winefish-1.3.3/0000700000047200004720000000000010414700277012330 5ustar kyanhkyanhwinefish-1.3.3/src/0000700000047200004720000000000010414700277013117 5ustar kyanhkyanhwinefish-1.3.3/src/preferences.h0000600000047200004720000000031210373411041015557 0ustar kyanhkyanh/* $Id: preferences.h 1830 2006-02-11 16:34:41Z kyanh $ */ void open_preferences_cb(GtkWidget *wid, gpointer data); void open_preferences_menu_cb(gpointer callback_data,guint action,GtkWidget *widget); winefish-1.3.3/src/Makefile.in0000600000047200004720000000457710366674705015217 0ustar kyanhkyanh# Winefish LaTeX Editor # Makefile.in - the Makefile template # Copyright (C) 2002 Olivier Sessink # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA top_srcdir = @top_srcdir@ top_builddir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ pkgdatadir = @pkgdatadir@ infodir = $(prefix)/info libdir = $(prefix)/lib/gnudl mandir = $(prefix)/man/man1 localedir = @localedir@ gnulocaledir = $(prefix)/share/locale aliaspath = $(localedir):. CC = @CC@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_PROGRAM = $(INSTALL) -s -m 755 DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \ -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" -DPKGDATADIR=\"$(pkgdatadir)\" @DEFS@ SRCS = \ about.c \ autox.c \ bf_lib.c \ bfspell.c \ bookmark.c \ brace_finder.c \ char_table.c \ document.c \ filebrowser.c \ fref.c \ func_grep.c \ gtk_easy.c \ gui.c \ highlight.c \ html.c \ html_diag.c \ image.c \ menu.c \ msg_queue.c \ outputbox.c \ outputbox_bf.c \ outputbox_filter.c \ outputbox_ka.c \ pixmap.c \ preferences.c \ project.c \ rcfile.c \ snooper.c \ snr2.c \ stringlist.c \ treetips.c \ undo_redo.c \ winefish.c \ wizards.c \ OBJS = $(SRCS:.c=.o) all: winefish winefish: $(SRCS) $(OBJS) $(CC) $(DEFS) -o winefish $(OBJS) $(LDFLAGS) $(LIBS) @echo "The winefish binary is succesfully created" .c.o: $(SRCS) $(CC) $(DEFS) $(CFLAGS) -c -o $@ $< $(OBJS): bluefish.h clean: rm -f $(OBJS) winefish patchclean: clean rm -f *.orig *.rej distclean: patchclean rm -f config.h Makefile *~ *.bak core install: all $(INSTALL_DIR) $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) ./winefish $(DESTDIR)$(bindir)/winefish uninstall: /bin/rm -f $(DESTDIR)$(bindir)/winefish winefish-1.3.3/src/pixmap.c0000600000047200004720000000303110373411041014550 0ustar kyanhkyanh/* $Id: pixmap.c 1830 2006-02-11 16:34:41Z kyanh $ */ #include #include #include "../inline_images/toolbar_icons.c" #include "../inline_images/general_icons.c" typedef struct { const guint id; const guint8 *data; } Tpixmap; typedef struct { const guint id; const gchar *stock_id; } Tstockpixmap; static Tpixmap tp[] = { {4, pixmap_close}, /* outputbox */ {101, pixmap_close_small} /* document.c, notebook */ }; static Tstockpixmap tsp[] = { {1000, GTK_STOCK_FIND}, {1001, GTK_STOCK_FIND_AND_REPLACE} }; GtkWidget *new_pixmap(gint type) { GtkWidget *widget; gint i; if (type < 1000) { GdkPixbuf *pixbuf; for (i=0;i<(sizeof(tp)/sizeof(Tpixmap));i++) { if (tp[i].id == type) { break; } } if (i >= sizeof(tp)/sizeof(Tpixmap)) { g_print("new_pixmap, requested unknown type %d\n", type); i = sizeof(tp)/sizeof(Tpixmap)-1; } pixbuf = gdk_pixbuf_new_from_inline(-1,tp[i].data,FALSE,NULL); widget = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); } else { for (i=0;i<(sizeof(tsp)/sizeof(Tstockpixmap));i++) { if (tsp[i].id == type) { break; } } if (i >= sizeof(tp)/sizeof(Tpixmap)) { g_print("new_pixmap, requested unknown type %d\n", type); i = sizeof(tp)/sizeof(Tpixmap)-1; } widget = gtk_image_new_from_stock(tsp[i].stock_id,GTK_ICON_SIZE_BUTTON); } return widget; } GList *default_icon_list() { GList *retlist = NULL; retlist = g_list_append(retlist, gdk_pixbuf_new_from_inline(-1,pixmap_winefish_icon1,FALSE,NULL)); return retlist; } winefish-1.3.3/src/autox.c0000600000047200004720000001417410373411041014424 0ustar kyanhkyanh/* $Id: autox.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor * * Autotext support * * Copyright (c) 2005 KyAnh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * NOTES * g_completion provides an completion only, *NOT* autotext * */ #include #include /* strtoul() */ #include /* strcmp() */ #include "bluefish.h" #include "autox.h" #include "rcfile.h" /* rcfile_parse_completion() */ #include "stringlist.h" /* count_array() */ #include "snooper.h" /* a share autotext array for all file types */ /* static GHashTable *autotext_hashtable = NULL; static GPtrArray *autotext_array= NULL; */ #ifdef DEBUG static void autotext_test(gchar *key, gchar *value, void *data) { g_print("autotext_test: %s => %s\n", key, value); } #endif static void autotext_remove_key_value(gpointer *key_or_value) { g_free(key_or_value); } void autotext_init(void) { GList *autotext_list = NULL; rcfile_parse_autotext(&autotext_list); main_v->props.autotext_hashtable = g_hash_table_new_full((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal, (GDestroyNotify)autotext_remove_key_value, (GDestroyNotify)autotext_remove_key_value); main_v->props.autotext_array = g_ptr_array_new(); GList *tmp2list = g_list_first(autotext_list); gint index=0; while (tmp2list) { gchar **strarr; strarr = (gchar **) tmp2list->data; if (count_array(strarr) == 3) { if (!g_hash_table_lookup(main_v->props.autotext_hashtable, strarr[0])) { if (strlen(strarr[1]) || strlen(strarr[2])) { gchar **tmp_array = g_malloc(3*sizeof(gchar *)); tmp_array[0] = g_strdup(strarr[1]); tmp_array[1] = g_strdup(strarr[2]); tmp_array[2] = NULL; g_ptr_array_add(main_v->props.autotext_array,tmp_array); g_hash_table_insert(main_v->props.autotext_hashtable, g_strdup(strarr[0]), g_strdup_printf("%d", index)); index++; } }/* else: replace the old by the new one */ } tmp2list = g_list_next(tmp2list); } /* we donot need autotext_list anymore */ /* this is taken from rcfile.c::free_configlist() -- this function is static */ { GList *tmplist = g_list_first(autotext_list); while(tmplist) { void *cli = tmplist->data; g_free(cli); tmplist = g_list_next(tmplist); } g_list_free(autotext_list); } #ifdef DEBUG g_hash_table_foreach(main_v->props.autotext_hashtable, (GHFunc)autotext_test, NULL); gchar **tmp = NULL; /* g_malloc(2*sizeof(gchar *)); */ for (index=0; index < main_v->props.autotext_array->len; index++) { tmp = g_ptr_array_index(main_v->props.autotext_array, index); g_print("autotext: element %d/%d: [%s,%s]\n", index, main_v->props.autotext_array->len, tmp[0], tmp[1]); } gchar *value; value = g_hash_table_lookup(main_v->props.autotext_hashtable, "\\abc"); if (value) { index = strtoul(value, NULL, 10); tmp = g_ptr_array_index(main_v->props.autotext_array, index); g_print("autotext: lookup: index=%d, (%s,%s)\n", index, tmp[0], tmp[1]); } g_free(value); #endif } gchar **autotext_done(gchar *lookup) { gchar *value = g_hash_table_lookup(main_v->props.autotext_hashtable, lookup); if (value) { gint index = strtoul(value, NULL, 10); gchar **tmp = g_ptr_array_index(main_v->props.autotext_array, index); return tmp; }else{ return NULL; } } void completion_init(void) { main_v->completion.show = COMPLETION_WINDOW_INIT; main_v->props.completion = g_completion_new(NULL); main_v->props.completion_s = g_completion_new(NULL); main_v->completion.cache = NULL; GList *tmplist = NULL, *tmplist_s = NULL; GList *tmp2list = NULL, *tmp2list_s = NULL; GList *wordslist = NULL, *wordslist_s = NULL; /* GList *search = NULL; */ rcfile_parse_completion(&wordslist, &wordslist_s); tmp2list = g_list_first(wordslist); GList *search = NULL; while (tmp2list) { gchar **strarr; strarr = (gchar **) tmp2list->data; /* TODO: remove this check for performance reason ?? */ if (count_array(strarr) == 2) { /* searching for duplicate entries may slow down Winefish ... but is there any way ? */ search = g_list_find_custom(tmplist, strarr[1],(GCompareFunc)strcmp); if (search == NULL) { tmplist = g_list_insert_sorted(tmplist, strarr[1], (GCompareFunc)strcmp); } #ifdef DEBUG else{ g_print("completion_init: duplicate entry: %s\n", strarr[1]); } #endif } tmp2list = g_list_next(tmp2list); } if (tmplist) { g_completion_add_items(main_v->props.completion, tmplist); g_list_free(tmplist); g_list_free(search); } tmp2list = g_list_first(wordslist); while(tmp2list) { void *cli = tmp2list->data; g_free(cli); tmp2list = g_list_next(tmp2list); } g_list_free(wordslist); /* session ****************************************************************************/ tmp2list_s = g_list_first(wordslist_s); GList *search2 = NULL; while (tmp2list_s) { gchar **strarr; strarr = (gchar **) tmp2list_s->data; if (count_array(strarr) == 2) { search2 = g_list_find_custom(main_v->props.completion->items, strarr[1], (GCompareFunc)strcmp); if ( !search2 ) { search2 = g_list_find_custom(tmplist_s, strarr[1],(GCompareFunc)strcmp); if (!search2) { tmplist_s = g_list_insert_sorted(tmplist_s, strarr[1], (GCompareFunc)strcmp); } } } tmp2list_s = g_list_next(tmp2list_s); } if (tmplist_s) { g_completion_add_items(main_v->props.completion_s, tmplist_s); g_list_free(tmplist_s); } tmp2list_s = g_list_first(wordslist_s); while(tmp2list_s) { void *cli = tmp2list_s->data; g_free(cli); tmp2list_s = g_list_next(tmp2list_s); } g_list_free(wordslist_s); } winefish-1.3.3/src/outputbox_filter.c0000600000047200004720000001774610377754204016731 0ustar kyanhkyanh/* $Id: outputbox_filter.c 2059 2006-02-25 04:09:40Z kyanh $ */ /* Winefish LaTeX Editor * * Copyright (c) 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* #define DEBUG */ #include #include #include "config.h" #include "bluefish.h" #include "document.h" #include "bf_lib.h" #include "outputbox.h" #include "outputbox_filter.h" #include "outputbox_cfg.h" #include "gtk_easy.h" /* flush_queue */ static regex_t on_input_line; static gboolean first_time = TRUE; void outputbox_filter_line( Toutputbox *ob, const gchar *source_orig ) { if (!source_orig || (strlen(source_orig) == 0) ) { return; } /* handle non UTF8 strings */ /*|| !g_utf8_validate(source, -1, NULL) */ if (first_time) { regcomp( &on_input_line, "lines? ([0-9]+)", REG_EXTENDED ); first_time = FALSE; } DEBUG_MSG("outputbox_filter_line: starting filter %s\n", source_orig); GtkTreeIter iter; /* gchar *tmp_src = NULL; */ gboolean scroll= FALSE; int nummatches; gchar *source; source = g_locale_to_utf8(source_orig, strlen(source_orig), NULL,NULL,NULL); /* fixed BUG#82 */ if (!source) { return; } if ( ob->def->show_all_output & OB_SHOW_ALL_OUTPUT ) { DEBUG_MSG("outputbox_filter: show_all_output =1. show line...\n"); /* tmp_src = g_markup_escape_text(source,-1); */ gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 2, source, -1 ); /* g_free(tmp_src); */ } else { #ifdef __KA_BACKEND__ nummatches = regexec( &ob->def->preg, source, NUM_MATCH, ob->def->pmatch, 0 ); if ( nummatches == 0 ) { /* we have a valid line */ gchar * filename, *line, *output; filename = line = output = NULL; gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); if ( ob->def->file_subpat >= 0 && ob->def->pmatch[ ob->def->file_subpat ].rm_so >= 0 ) { DEBUG_MSG( "outputbox_filter_line, filename from %d to %d\n", ob->def->pmatch[ ob->def->file_subpat ].rm_so , ob->def->pmatch[ ob->def->file_subpat ].rm_eo ); filename = g_strndup( &source[ ob->def->pmatch[ ob->def->file_subpat ].rm_so ], ob->def->pmatch[ ob->def->file_subpat ].rm_eo - ob->def->pmatch[ ob->def->file_subpat ].rm_so ); } if ( ob->def->line_subpat >= 0 && ob->def->pmatch[ ob->def->line_subpat ].rm_so >= 0 ) { DEBUG_MSG( "outputbox_filter_line, line from %d to %d\n", ob->def->pmatch[ ob->def->line_subpat ].rm_so , ob->def->pmatch[ ob->def->line_subpat ].rm_eo ); line = g_strndup( &source[ ob->def->pmatch[ ob->def->line_subpat ].rm_so ], ob->def->pmatch[ ob->def->line_subpat ].rm_eo - ob->def->pmatch[ ob->def->line_subpat ].rm_so ); } if ( ob->def->output_subpat >= 0 && ob->def->pmatch[ ob->def->output_subpat ].rm_so >= 0 ) { DEBUG_MSG( "outputbox_filter_line, output from %d to %d\n", ob->def->pmatch[ ob->def->output_subpat ].rm_so , ob->def->pmatch[ ob->def->output_subpat ].rm_eo ); output = g_strndup( &source[ ob->def->pmatch[ ob->def->output_subpat ].rm_so ], ob->def->pmatch[ ob->def->output_subpat ].rm_eo - ob->def->pmatch[ ob->def->output_subpat ].rm_so ); } #endif /* __KA_BACKEND__ */ #ifdef __BF_BACKEND__ int ovector[30]; nummatches = pcre_exec(ob->def->pcre_c, ob->def->pcre_s,source, strlen(source), 0,0, ovector, 30); if (nummatches > 0) { const char *filename,*line,*output; filename=line=output=NULL; gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); if (ob->def->file_subpat >= 0 && ovector[ob->def->file_subpat*2] >=0) { pcre_get_substring(source,ovector,nummatches,ob->def->file_subpat,&filename); } if (ob->def->line_subpat >= 0&& ovector[ob->def->line_subpat*2] >=0) { pcre_get_substring(source,ovector,nummatches,ob->def->line_subpat,&line); } if (ob->def->output_subpat >= 0&& ovector[ob->def->output_subpat*2] >=0) { pcre_get_substring(source,ovector,nummatches,ob->def->output_subpat,&output); } #endif /* __BF_BACKEND__ */ if ( filename ) { gchar * fullpath; /* create_full_path uses the current directory if no basedir is set */ /* TODO: better hanlder with full path :) */ gchar *basepath = g_path_get_basename(filename); gchar *tmpstr; /* dealing with cached */ if (!ob->basepath_cached || (strcmp(ob->basepath_cached, basepath) !=0 )) { ob->basepath_cached = g_strdup(basepath); ob->basepath_cached_color = !ob->basepath_cached_color; } /* display the basename */ tmpstr = g_markup_escape_text(basepath,-1); if (!ob->basepath_cached_color ) { tmpstr = g_strdup_printf("%s", tmpstr); } gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 0, tmpstr, -1 ); /* fullpath */ fullpath = create_full_path( filename, NULL ); DEBUG_MSG("outputbox_filter: fullpath %s\n", fullpath); gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 3, fullpath, -1 ); g_free( (gchar *)filename ); g_free( fullpath ); g_free( basepath ); g_free( tmpstr ); scroll=TRUE; } if ( line ) { gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 1, line, -1 ); g_free( (gchar *)line ); scroll=TRUE; } if ( output ) { /* tmp_src = g_markup_escape_text(output,-1); */ /* if (!ob->basepath_cached_color ) { tmp_src = g_strdup_printf("%s", tmp_src); }*/ gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 2, output, -1 ); g_free( (gchar *)output ); /* g_free(tmp_src); */ scroll=TRUE; } /* TODO: filter function */ } else if ( regexec( &on_input_line, source, NUM_MATCH, ob->def->pmatch, 0 ) == 0 ) { DEBUG_MSG( "outputbox_filter_line, line from %d to %d\n", ob->def->pmatch[ 1 ].rm_so , ob->def->pmatch[ 2 ].rm_eo ); gchar *line = NULL; line = g_strndup( &source[ ob->def->pmatch[ 1 ].rm_so ], ob->def->pmatch[ 1 ].rm_eo - ob->def->pmatch[ 1 ].rm_so ); if ( line ) { gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 1, line, -1 ); g_free( line ); DEBUG_MSG("outputbox_filter_line, line number = %s\n", line); /* gchar *tmp_src = g_markup_escape_text(source,-1); */ gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 2, source, -1 ); /*g_free(tmp_src);*/ scroll=TRUE; } } else if ( strstr( source, "LaTeX Error" ) || strstr( source, "Output written on") || strstr( source, "Warning") || strstr( source, "Overfull") ) { /* kyanh, 20050226, special filter for latex *.log file; this happens for e.g. when a Package not found (! LaTeX Error: .... ) */ DEBUG_MSG("outputbox_filter_line: extra filtered...\n"); /* tmp_src = g_markup_escape_text(source,-1); */ gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 2, source, -1 ); /*g_free(tmp_src);*/ scroll=TRUE; } } if (scroll) { DEBUG_MSG("outputbox_filter_line: scrolling...\n"); if ( iter.stamp == GTK_LIST_STORE(ob->lstore)->stamp ) { GtkTreePath *treepath = gtk_tree_model_get_path( GTK_TREE_MODEL( ob->lstore ), &iter ); gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW( ob->lview ), treepath, NULL, FALSE, 0, 0 ); gtk_tree_path_free( treepath ); } flush_queue(); } g_free(source); DEBUG_MSG("outputbox_filter_line: finished.\n"); } /* void outputbox_filter_file( Toutputbox *ob, const gchar *filename ) { } */ winefish-1.3.3/src/preferences.c0000600000047200004720000027375710413241361015604 0ustar kyanhkyanh/* $Id: preferences.c 2315 2006-03-31 14:55:45Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * preferences.c the preferences code * * Copyright (C) 2002-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* strtoul() */ #include /* strcmp() */ #include "bluefish.h" #include "stringlist.h" /* duplicate_arraylist*/ #include "bf_lib.h" /* list_switch_order() */ #include "gtk_easy.h" #include "document.h" #include "pixmap.h" #include "highlight.h" #include "filebrowser.h" #include "menu.h" #include "gui.h" #include "rcfile.h" /* kyanh, TODO: remove this */ enum { filebrowser_two_pane_view, filebrowser_unknown_icon, filebrowser_dir_icon, editor_font_string, /* editor font */ editor_tab_width, /* editor tabwidth */ editor_indent_wspaces, tab_font_string, /* notebook tabs font */ highlight_num_lines_count, /* number of lines to highlight in continous highlighting */ defaulthighlight, /* highlight documents by default */ transient_htdialogs, /* set html dialogs transient ro the main window */ restore_dimensions, left_panel_width, left_panel_left, main_window_h, /* main window height */ main_window_w, /* main window width */ max_recent_files, /* length of Open Recent list */ max_dir_history, /* length of directory history */ backup_file, /* wheather to use a backup file */ backup_filestring, /* the string to append to the backup file */ backup_abort_action, /* if the backup fails, continue 'save', 'abort' save, or 'ask' user */ backup_cleanuponclose, /* remove the backupfile after close ? */ allow_multi_instances, /* allow multiple instances of the same file */ modified_check_type, /* 0=no check, 1=by mtime and size, 2=by mtime, 3=by size, 4,5,...not implemented (md5sum?) */ num_undo_levels, /* number of undo levels per document */ clear_undo_on_save, /* clear all undo information on file save */ newfile_default_encoding,/* if you open a new file, what encoding will it use */ bookmarks_default_store, bookmarks_filename_mode, document_tabposition, leftpanel_tabposition, default_basedir, word_wrap, /* use wordwrap */ autoindent, /* autoindent code */ /* drop_at_drop_pos, *//* drop at drop position instead of cursor position */ cust_menu, /* entries in the custom menu */ #ifdef WITH_SPC /* spell checker options */ cfg_spc_cline , /* spell checker command line */ cfg_spc_lang , /* language */ spc_accept_compound , /* accept compound words ? */ spc_use_esc_chars , /* specify aditional characters that may be part of a word ? */ spc_esc_chars , /* which ones ? */ spc_use_pers_dict , /* use a personal dictionary */ spc_pers_dict , /* which one ? */ spc_use_input_encoding , /* use input encoding */ spc_input_encoding , /* wich one ? */ spc_output_html_chars , /* TODO: removed; output html chars ? (like á,)*/ #endif /* key conversion */ conv_ctrl_enter, /* convert control-enter key press */ ctrl_enter_text, /* inserted text */ conv_shift_enter, /* convert shift-enter key press */ shift_enter_text, /* inserted text */ conv_special_char, /* convert ctrl-'<','>','&' */ #ifdef WITH_MSG_QUEUE open_in_running_bluefish, /* open commandline documents in already running session*/ #endif /* WITH_MSG_QUEUE */ #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND templates_dir, /* directory for templates */ #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ #ifdef ENABLE_COLUMN_MARKER marker_i, /* column marker, the first one */ marker_ii, marker_iii, #endif /* ENABLE_COLUMN_MARKER */ property_num_max }; /* listts */ enum { browsers, external_commands, filetypes, filefilters, highlight_patterns, outputbox, autotext, /* kyanh, added,d 20050315 */ completion, lists_num_max }; typedef struct { GtkListStore *lstore; GtkWidget *lview; int insertloc; GList **thelist; } Tlistpref; typedef struct { GtkListStore *lstore; GtkWidget *lview; GtkWidget *entry[6];/* number of entries */ GtkWidget *popmenu; GtkWidget *check; GtkWidget *radio[9]; /* number of radio box */ gchar **curstrarr; const gchar *selected_filetype; } Thighlightpatterndialog; typedef struct { Tlistpref atd; gboolean refreshed; } Tautox; typedef struct { GtkWidget *prefs[property_num_max]; GList *lists[lists_num_max]; GtkWidget *win; GtkWidget *noteb; Tlistpref ftd; Tlistpref ffd; Thighlightpatterndialog hpd; Tlistpref bd; /* browsers */ Tlistpref ed; /* external */ Tlistpref od; /* output */ Tautox att; /* autotext */ Tautox atc; /* completion */ } Tprefdialog; typedef enum { string_none, string_file, string_font, string_color } Tprefstringtype; /* bluefish#20060120 */ void pref_click_column (GtkTreeViewColumn *treeviewcolumn, gpointer user_data) { GtkToggleButton *but = GTK_TOGGLE_BUTTON(user_data); GList *lst = gtk_tree_view_column_get_cell_renderers(treeviewcolumn); if ( gtk_toggle_button_get_active(but)) { gtk_toggle_button_set_active(but,FALSE); gtk_button_set_label(GTK_BUTTON(but),""); gtk_tree_view_column_set_sizing(treeviewcolumn,GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_fixed_width(treeviewcolumn,30); if (lst) { g_object_set(G_OBJECT(lst->data),"sensitive",FALSE,"mode",GTK_CELL_RENDERER_MODE_INERT,NULL); g_list_free(lst); } } else { gtk_toggle_button_set_active(but,TRUE); gtk_button_set_label(GTK_BUTTON(but),(gchar*)g_object_get_data(G_OBJECT(but),"_title_")); gtk_tree_view_column_set_sizing(treeviewcolumn,GTK_TREE_VIEW_COLUMN_AUTOSIZE); if (lst) { g_object_set(G_OBJECT(lst->data),"sensitive",TRUE,"mode",GTK_CELL_RENDERER_MODE_EDITABLE,NULL); g_list_free(lst); } } } /* type 0/1=text, 2=toggle */ /* sortable = TRUE: for autotext, completion */ /* or: use get_column to set 'sortable' manually */ /* static void pref_create_column(GtkTreeView *treeview, gint type, GCallback func, gpointer data, const gchar *title, gint num, gboolean sortable) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; if (type == 1 || type == 0) { renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", func, data); } else { renderer = gtk_cell_renderer_toggle_new(); g_object_set(G_OBJECT(renderer), "activatable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "toggled", func, data); } column = gtk_tree_view_column_new_with_attributes(title, renderer,(type ==1) ? "text" : "active" ,num,NULL); if (sortable) { gtk_tree_view_column_set_sort_column_id(column, num); } gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); } */ /* type 0/1=text, 2=toggle,3=radio, 4=non-editable combo */ static void pref_create_column(GtkTreeView *treeview, gint type, GCallback func, gpointer data, const gchar *title, gint num, gboolean sortable) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; GtkWidget *but; if (type == 1 || type == 0) { renderer = gtk_cell_renderer_text_new(); if (func) { g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", func, data); } } else #ifdef HAVE_ATLEAST_GTK_2_6 if (type == 2 || type == 3) #endif /* HAVE_ATLEAST_GTK_2_6 */ { renderer = gtk_cell_renderer_toggle_new(); if (type == 3) { gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(renderer),TRUE); } if (func) { g_object_set(G_OBJECT(renderer), "activatable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "toggled", func, data); } } #ifdef HAVE_ATLEAST_GTK_2_6 else /* if (type ==4) */ { renderer = gtk_cell_renderer_combo_new(); g_object_set(G_OBJECT(renderer), "has-entry", FALSE, NULL); /* should be done by the calling function: g_object_set(G_OBJECT(renderer), "model", model, NULL);*/ g_object_set(G_OBJECT(renderer), "text-column", 0, NULL); if (func) { g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", func, data); } } #endif /* HAVE_ATLEAST_GTK_2_6 */ column = gtk_tree_view_column_new_with_attributes(title, renderer,(type ==1) ? "text" : "active" ,num,NULL); if (sortable) { gtk_tree_view_column_set_sort_column_id(column, num); }else{ gtk_tree_view_column_set_clickable(GTK_TREE_VIEW_COLUMN(column),TRUE); but = gtk_check_button_new_with_label(title); g_object_set_data(G_OBJECT(but),"_title_",g_strdup(title)); gtk_widget_show(but); gtk_tree_view_column_set_widget(GTK_TREE_VIEW_COLUMN(column),but); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(but),TRUE); g_signal_connect(G_OBJECT(column), "clicked", G_CALLBACK(pref_click_column), but); } gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); } /* 3 entries must have len 3, but in reality it will be 4, because there is a NULL pointer appended */ static gchar **pref_create_empty_strarr(gint len) { gchar **strarr = g_malloc0((len+1)*sizeof(gchar *)); gint i; strarr[0] = g_strdup(_("Untitled")); for (i=1;iinsertloc = -1; select = gtk_tree_view_get_selection(GTK_TREE_VIEW(lp->lview)); if (gtk_tree_selection_get_selected (select,NULL,&iter)) { gchar **strarr; gtk_tree_model_get(GTK_TREE_MODEL(lp->lstore), &iter, pointercolumn, &strarr, -1); gtk_list_store_remove(GTK_LIST_STORE(lp->lstore),&iter); *lp->thelist = g_list_remove(*lp->thelist, strarr); g_strfreev(strarr); } } static void listpref_row_inserted(GtkTreeModel *treemodel,GtkTreePath *arg1,GtkTreeIter *arg2,Tlistpref *lp) { gint *indices = gtk_tree_path_get_indices(arg1); if (indices) { lp->insertloc = indices[0]; DEBUG_MSG("reorderable_row_inserted, insertloc=%d\n",lp->insertloc); } } static void listpref_row_deleted(GtkTreeModel *treemodel,GtkTreePath *arg1,Tlistpref *lp) { if (lp->insertloc > -1) { gint *indices = gtk_tree_path_get_indices(arg1); if (indices) { GList *lprepend, *ldelete; gint deleteloc = indices[0]; if (deleteloc > lp->insertloc) deleteloc--; DEBUG_MSG("reorderable_row_deleted, deleteloc=%d, insertloc=%d, listlen=%d\n",deleteloc,lp->insertloc,g_list_length(*lp->thelist)); *lp->thelist = g_list_first(*lp->thelist); lprepend = g_list_nth(*lp->thelist,lp->insertloc); ldelete = g_list_nth(*lp->thelist,deleteloc); if (ldelete && (ldelete != lprepend)) { gpointer data = ldelete->data; *lp->thelist = g_list_remove(*lp->thelist, data); if (lprepend == NULL) { DEBUG_MSG("lprepend=NULL, appending %s to the list\n",((gchar **)data)[0]); *lp->thelist = g_list_append(g_list_last(*lp->thelist), data); } else { DEBUG_MSG("lprepend %s, ldelete %s\n",((gchar **)lprepend->data)[0], ((gchar **)data)[0]); *lp->thelist = g_list_prepend(lprepend, data); } *lp->thelist = g_list_first(*lp->thelist); } else { DEBUG_MSG("listpref_row_deleted, ERROR: ldelete %p, lprepend %p\n", ldelete, lprepend); } } lp->insertloc = -1; } } static void font_dialog_response_lcb(GtkDialog *fsd,gint response,GtkWidget *entry) { DEBUG_MSG("font_dialog_response_lcb, response=%d\n", response); if (response == GTK_RESPONSE_OK) { gchar *fontname; fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fsd)); gtk_entry_set_text(GTK_ENTRY(entry), fontname); g_free(fontname); } gtk_widget_destroy(GTK_WIDGET(fsd)); } static void font_button_lcb(GtkWidget *wid, GtkWidget *entry) { GtkWidget *fsd; const gchar *fontname; fsd = gtk_font_selection_dialog_new(_("Select font")); fontname = gtk_entry_get_text(GTK_ENTRY(entry)); /* do NOT free, this is an internal pointer */ if (strlen(fontname)) { gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fsd), fontname); } g_signal_connect(GTK_OBJECT(fsd),"response",G_CALLBACK(font_dialog_response_lcb),entry); gtk_window_set_transient_for(GTK_WINDOW(GTK_DIALOG(fsd)), GTK_WINDOW(gtk_widget_get_toplevel(entry))); gtk_window_set_modal(GTK_WINDOW(GTK_DIALOG(fsd)), TRUE); gtk_window_set_destroy_with_parent(GTK_WINDOW(GTK_DIALOG(fsd)), TRUE); gtk_widget_show(fsd); } static GtkWidget *prefs_string(const gchar *title, const gchar *curval, GtkWidget *box, Tprefdialog *pd, Tprefstringtype prefstringtype) { GtkWidget *hbox, *return_widget; hbox = gtk_hbox_new(FALSE,3); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(title), FALSE, FALSE, 3); return_widget = boxed_entry_with_text(curval, 1023, hbox); if (prefstringtype == file) { gtk_box_pack_start(GTK_BOX(hbox), file_but_new(return_widget, 1, NULL), FALSE, FALSE, 3); } else if (prefstringtype == font) { GtkWidget *but = bf_gtkstock_button(GTK_STOCK_SELECT_FONT, G_CALLBACK(font_button_lcb), return_widget); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 3); } return return_widget; } static GtkWidget *prefs_combo(const gchar *title, const gchar *curval, GtkWidget *box, Tprefdialog *pd, GList *poplist, gboolean editable) { GtkWidget *return_widget; GtkWidget *hbox; hbox = gtk_hbox_new(FALSE,3); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(title), FALSE, FALSE, 3); return_widget = boxed_combo_with_popdown(curval, poplist, editable, hbox); return return_widget; } static GtkWidget *prefs_integer(const gchar *title, const gint curval, GtkWidget *box, Tprefdialog *pd, gfloat lower, gfloat upper) { GtkWidget *return_widget; GtkWidget *hbox; GtkObject *adjust; gfloat step_increment, page_increment; step_increment = (upper - lower)/1000; if (step_increment < 1) { step_increment = 1; } page_increment = (upper - lower)/20; if (page_increment < 10) { page_increment = 10; } hbox = gtk_hbox_new(FALSE,3); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 3); adjust = gtk_adjustment_new((1.0 * curval), lower, upper, step_increment ,page_increment , 0); return_widget = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 0.1, 0); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(title), FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(hbox), return_widget, TRUE, TRUE, 3); return return_widget; } /*************************/ /* GENERAL FUNCTIONS */ /*************************/ static void set_filetype_strarr_in_list(GtkTreeIter *iter, gchar **strarr, Tprefdialog *pd) { gint arrcount; arrcount = count_array(strarr); if (arrcount == 7) { gchar *escaped; escaped = escape_string(strarr[2],FALSE); gtk_list_store_set(GTK_LIST_STORE(pd->ftd.lstore), iter ,0,strarr[0],1,strarr[1],2,escaped,3,strarr[3] ,4,(strarr[4][0] != '0'),5,strarr[5],6,strarr[6] ,7,strarr,-1); g_free(escaped); } } static void filetype_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->ftd.lstore,7,type,path,newval,index); } static void filetype_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filetype_apply_change(pd, 1, path, newtext, 0); } static void filetype_1_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filetype_apply_change(pd, 1, path, newtext, 1); } static void filetype_2_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filetype_apply_change(pd, 1, path, newtext, 2); } static void filetype_3_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filetype_apply_change(pd, 1, path, newtext, 3); } static void filetype_4_toggled_lcb(GtkCellRendererToggle *cellrenderertoggle,gchar *path,Tprefdialog *pd) { gchar *val = g_strdup(cellrenderertoggle->active ? "0" : "1"); filetype_apply_change(pd, 2, path, val, 4); g_free(val); } static void filetype_5_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filetype_apply_change(pd, 1, path, newtext, 5); } static void filetype_6_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { if (strlen(newtext)==1 && newtext[0] >= '0' && newtext[0] <= '2') { filetype_apply_change(pd, 1, path, newtext, 6); } } static void add_new_filetype_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(7); gtk_list_store_append(GTK_LIST_STORE(pd->ftd.lstore), &iter); set_filetype_strarr_in_list(&iter, strarr,pd); pd->lists[filetypes] = g_list_append(pd->lists[filetypes], strarr); pd->ftd.insertloc = -1; } static void delete_filetype_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->ftd,7); } static void create_filetype_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *scrolwin; pd->lists[filetypes] = duplicate_arraylist(main_v->props.filetypes); pd->ftd.lstore = gtk_list_store_new (8,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER); pd->ftd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->ftd.lstore)); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_0_edited_lcb), pd, _("Label"), 0, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_1_edited_lcb), pd, _("Extensions"), 1, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_2_edited_lcb), pd, _("Update chars"), 2, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_3_edited_lcb), pd, _("Icon"), 3, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 2, G_CALLBACK(filetype_4_toggled_lcb), pd, _("Editable"), 4, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_5_edited_lcb), pd, _("Content regex"), 5, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ftd.lview), 1, G_CALLBACK(filetype_6_edited_lcb), pd, _("AutoCompletion"), 6, FALSE); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->ftd.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); /* select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->ftd.lview)); gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE); g_signal_connect(G_OBJECT(select), "changed",G_CALLBACK(filetype_selection_changed_cb),pd);*/ { GList *tmplist = g_list_first(pd->lists[filetypes]); while (tmplist) { gint arrcount; gchar **strarr = (gchar **)tmplist->data; arrcount = count_array(strarr); if (arrcount ==7) { GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(pd->ftd.lstore), &iter); set_filetype_strarr_in_list(&iter, strarr,pd); } tmplist = g_list_next(tmplist); } } gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->ftd.lview), TRUE); pd->ftd.thelist = &pd->lists[filetypes]; pd->ftd.insertloc = -1; g_signal_connect(G_OBJECT(pd->ftd.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->ftd); g_signal_connect(G_OBJECT(pd->ftd.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->ftd); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_filetype_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_filetype_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static void set_filefilter_strarr_in_list(GtkTreeIter *iter, gchar **strarr, Tprefdialog *pd) { gint arrcount; arrcount = count_array(strarr); if (arrcount==3) { gtk_list_store_set(GTK_LIST_STORE(pd->ffd.lstore), iter ,0,strarr[0],1,(strarr[1][0] != '0'),2,strarr[2],3,strarr,-1); } else { DEBUG_MSG("ERROR: set_filefilter_strarr_in_list, arraycount != 3 !!!!!!\n"); } } static void filefilter_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { DEBUG_MSG("filefilter_apply_change,lstore=%p,path=%s,newval=%s,index=%d\n",pd->ffd.lstore,path,newval,index); pref_apply_change(pd->ffd.lstore,3,type,path,newval,index); } static void filefilter_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filefilter_apply_change(pd, 1, path, newtext, 0); } static void filefilter_1_toggled_lcb(GtkCellRendererToggle *cellrenderertoggle,gchar *path,Tprefdialog *pd) { gchar *val = g_strdup(cellrenderertoggle->active ? "0" : "1"); filefilter_apply_change(pd, 2, path, val, 1); g_free(val); } static void filefilter_2_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { filefilter_apply_change(pd, 1, path, newtext, 2); } static void add_new_filefilter_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(3); gtk_list_store_append(GTK_LIST_STORE(pd->ffd.lstore), &iter); set_filefilter_strarr_in_list(&iter, strarr,pd); pd->lists[filefilters] = g_list_append(pd->lists[filefilters], strarr); pd->ffd.insertloc = -1; } static void delete_filefilter_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->ffd, 3); } static void create_filefilter_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *scrolwin; pd->lists[filefilters] = duplicate_arraylist(main_v->props.filefilters); pd->ffd.lstore = gtk_list_store_new (4,G_TYPE_STRING,G_TYPE_BOOLEAN,G_TYPE_STRING,G_TYPE_POINTER); pd->ffd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->ffd.lstore)); pref_create_column(GTK_TREE_VIEW(pd->ffd.lview), 1, G_CALLBACK(filefilter_0_edited_lcb), pd, _("Label"), 0, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ffd.lview), 2, G_CALLBACK(filefilter_1_toggled_lcb), pd, _("Inverse filter"), 1, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ffd.lview), 1, G_CALLBACK(filefilter_2_edited_lcb), pd, _("Filetypes in filter"), 2, FALSE); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->ffd.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); { GList *tmplist = g_list_first(pd->lists[filefilters]); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; if (count_array(strarr)==3) { GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(pd->ffd.lstore), &iter); set_filefilter_strarr_in_list(&iter, strarr,pd); } tmplist = g_list_next(tmplist); } } gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->ffd.lview), TRUE); pd->ffd.thelist = &pd->lists[filefilters]; pd->ffd.insertloc = -1; g_signal_connect(G_OBJECT(pd->ffd.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->ffd); g_signal_connect(G_OBJECT(pd->ffd.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->ffd); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_filefilter_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_filefilter_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static gchar **highlightpattern_create_strarr(Tprefdialog *pd) { gchar **strarr; strarr = g_malloc(12*sizeof(gchar *)); strarr[0] = g_strdup(pd->hpd.selected_filetype); strarr[1] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[0]),0,-1); DEBUG_MSG("highlightpattern_create_strarr for %s-%s at %p\n",strarr[0],strarr[1],strarr); if (GTK_TOGGLE_BUTTON(pd->hpd.check)->active){ strarr[2] = g_strdup("0"); } else { strarr[2] = g_strdup("1"); } strarr[3] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[1]),0,-1); strarr[4] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[2]),0,-1); if (GTK_TOGGLE_BUTTON(pd->hpd.radio[0])->active){ strarr[5] = g_strdup("1"); } else if (GTK_TOGGLE_BUTTON(pd->hpd.radio[1])->active) { strarr[5] = g_strdup("2"); } else { strarr[5] = g_strdup("3"); } strarr[6] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[3]),0,-1); strarr[7] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[4]),0,-1); strarr[8] = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[5]),0,-1); if (GTK_TOGGLE_BUTTON(pd->hpd.radio[3])->active){ strarr[9] = g_strdup("0"); } else if (GTK_TOGGLE_BUTTON(pd->hpd.radio[4])->active) { strarr[9] = g_strdup("1"); } else { strarr[9] = g_strdup("2"); } if (GTK_TOGGLE_BUTTON(pd->hpd.radio[6])->active){ strarr[10] = g_strdup("0"); } else if (GTK_TOGGLE_BUTTON(pd->hpd.radio[7])->active) { strarr[10] = g_strdup("1"); } else { strarr[10] = g_strdup("2"); } strarr[11] = NULL; DEBUG_MSG("highlightpattern_create_strarr, strarr at %p with count %d\n", strarr, count_array(strarr)); return strarr; } static void highlightpattern_apply_changes(Tprefdialog *pd) { DEBUG_MSG("highlightpattern_apply_changes, started\n"); if (pd->hpd.curstrarr) { GList *tmplist; tmplist = g_list_first(pd->lists[highlight_patterns]); while (tmplist) { if (tmplist->data == pd->hpd.curstrarr) { DEBUG_MSG("highlightpattern_apply_changes, curstrarr==tmplist->data==%p\n", tmplist->data); g_strfreev(tmplist->data); tmplist->data = highlightpattern_create_strarr(pd); pd->hpd.curstrarr = tmplist->data; DEBUG_MSG("highlightpattern_apply_changes, new strarr for %s-%s\n",pd->hpd.curstrarr[0],pd->hpd.curstrarr[1]); return; } tmplist = g_list_next(tmplist); } DEBUG_MSG("highlightpattern_apply_changes, nothing found for curstrarr %p?!?\n", pd->hpd.curstrarr); } DEBUG_MSG("highlightpattern_apply_changes, no curstrarr, nothing to apply\n"); } static void highlightpattern_fill_from_selected_filetype(Tprefdialog *pd) { DEBUG_MSG("highlightpattern_popmenu_activate, applied changes, about to clear liststore\n"); gtk_list_store_clear(GTK_LIST_STORE(pd->hpd.lstore)); if (pd->hpd.selected_filetype) { GList *tmplist; tmplist = g_list_first(pd->lists[highlight_patterns]); DEBUG_MSG("highlightpattern_popmenu_activate, about to fill for filetype %s (tmplist=%p)\n",pd->hpd.selected_filetype,tmplist); /* fill list model here */ while (tmplist) { gchar **strarr =(gchar **)tmplist->data; if (count_array(strarr) ==11 && strarr[0]) { DEBUG_MSG("found entry with filetype %s\n",strarr[0]); if (strcmp(strarr[0], pd->hpd.selected_filetype)==0) { GtkTreeIter iter; DEBUG_MSG("highlightpattern_popmenu_activate, appending pattern %s with filetype %s\n",strarr[1],strarr[0]); gtk_list_store_append(GTK_LIST_STORE(pd->hpd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->hpd.lstore), &iter, 0, strarr[1], -1); } } tmplist = g_list_next(tmplist); } } pd->hpd.curstrarr = NULL; gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[0]), ""); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[1]), ""); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[2]), ""); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[3]), ""); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[4]), ""); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[5]), ""); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.check), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[0]),TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[3]),TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[6]),TRUE); } static void highlightpattern_popmenu_activate(GtkMenuItem *menuitem,Tprefdialog *pd) { DEBUG_MSG("highlightpattern_popmenu_activate, pd=%p, menuitem=%p\n", pd, menuitem); highlightpattern_apply_changes(pd); pd->hpd.curstrarr = NULL; if (menuitem) { pd->hpd.selected_filetype = gtk_label_get_text(GTK_LABEL(GTK_BIN(menuitem)->child)); } highlightpattern_fill_from_selected_filetype(pd); } static void add_new_highlightpattern_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar *pattern = gtk_editable_get_chars(GTK_EDITABLE(pd->hpd.entry[0]),0,-1); if (pattern && pd->hpd.selected_filetype && strlen(pattern) && strlen(pd->hpd.selected_filetype)) { gchar **strarr = highlightpattern_create_strarr(pd); DEBUG_MSG("add_new_highlightpattern_lcb, appending strarr %p to list\n", strarr); pd->lists[highlight_patterns] = g_list_append(pd->lists[highlight_patterns], strarr); pd->hpd.curstrarr = NULL; { GtkTreeIter iter; GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->hpd.lview)); DEBUG_MSG("add_new_highlightpattern_lcb, appending to lview\n"); gtk_list_store_append(GTK_LIST_STORE(pd->hpd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->hpd.lstore), &iter, 0, strarr[1], -1); gtk_tree_selection_select_iter(selection,&iter); } /* gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[0]), "");*/ } else { g_free(pattern); } } static void highlightpattern_selection_changed_cb(GtkTreeSelection *selection, Tprefdialog *pd) { GtkTreeIter iter; GtkTreeModel *model; DEBUG_MSG("highlightpattern_selection_changed_cb, started\n"); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gchar *pattern; GList *tmplist = g_list_first(pd->lists[highlight_patterns]); /* GtkWidget *menuitem = gtk_menu_get_active(GTK_MENU( gtk_option_menu_get_menu(GTK_OPTION_MENU(pd->hpd.popmenu)) ));*/ gtk_tree_model_get(model, &iter, 0, &pattern, -1); DEBUG_MSG("highlightpattern_selection_changed_cb, selected=%s\n",pattern); highlightpattern_apply_changes(pd); pd->hpd.curstrarr = NULL; DEBUG_MSG("changed applied, searching for the data of the new selection\n"); while (tmplist) { gchar **strarr =(gchar **)tmplist->data; #ifdef DEBUG if (strarr == NULL){ DEBUG_MSG("strarr== NULL !!!!!!!!!!!!!!!\n"); } #endif if (strcmp(strarr[1], pattern)==0 && strcmp(strarr[0], pd->hpd.selected_filetype)==0) { DEBUG_MSG("highlightpattern_selection_changed_cb, found strarr=%p\n", strarr); DEBUG_MSG("0=%s, 1=%s, 2=%s, 3=%s, 4=%s\n",strarr[0],strarr[1],strarr[2],strarr[3],strarr[4]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.check), (strarr[2][0] == '0')); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[0]), strarr[1]); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[1]), strarr[3]); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[2]), strarr[4]); if (strarr[5][0] == '3') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[2]),TRUE); } else if (strarr[5][0] == '2') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[1]),TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[0]),TRUE); } gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[3]), strarr[6]); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[4]), strarr[7]); gtk_entry_set_text(GTK_ENTRY(pd->hpd.entry[5]), strarr[8]); if (strarr[9][0] == '2') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[5]),TRUE); } else if (strarr[9][0] == '1') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[4]),TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[3]),TRUE); } DEBUG_MSG("strarr[10]=%s, \n",strarr[10]); if (strarr[10][0] == '2') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[8]),TRUE); } else if (strarr[10][0] == '1') { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[7]),TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pd->hpd.radio[6]),TRUE); } pd->hpd.curstrarr = strarr; break; } tmplist = g_list_next(tmplist); } g_free(pattern); } else { DEBUG_MSG("no selection, returning..\n"); } } static void highlightpattern_type_toggled(GtkToggleButton *togglebutton,Tprefdialog *pd){ DEBUG_MSG("highlightpattern_type_toggled, started\n"); if (GTK_TOGGLE_BUTTON(pd->hpd.radio[0])->active) { gtk_widget_set_sensitive(pd->hpd.entry[2], TRUE); } else { gtk_widget_set_sensitive(pd->hpd.entry[2], FALSE); } DEBUG_MSG("highlightpattern_type_toggled, done\n"); } static void highlightpattern_up_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { GtkTreeIter iter; GtkTreeModel *model; gchar *pattern; GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->hpd.lview)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { GList *previous=NULL, *tmplist = g_list_first(pd->lists[highlight_patterns]); gtk_tree_model_get(model, &iter, 0, &pattern, -1); DEBUG_MSG("highlightpattern_up_clicked_lcb, selected=%s\n",pattern); while (tmplist) { gchar **strarr =(gchar **)tmplist->data; if (strcmp(strarr[0], pd->hpd.selected_filetype)==0) { DEBUG_MSG("highlightpattern_up_clicked_lcb, comparing %s+%s for filetype %s\n",strarr[1], pattern,pd->hpd.selected_filetype); if (strcmp(strarr[1], pattern)==0) { DEBUG_MSG("highlightpattern_up_clicked_lcb, found %s, previous=%p, tmplist=%p\n",strarr[1],previous,tmplist); if (previous) { DEBUG_MSG("highlightpattern_up_clicked_lcb, switch list order %s <-> %s\n",((gchar **)tmplist->data)[1], ((gchar **)previous->data)[1]); list_switch_order(tmplist, previous); highlightpattern_popmenu_activate(NULL, pd); } return; } previous = tmplist; } tmplist = g_list_next(tmplist); } } } static void highlightpattern_down_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { GtkTreeIter iter; GtkTreeModel *model; gchar *pattern; GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->hpd.lview)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { GList *tmplist = g_list_first(pd->lists[highlight_patterns]); gtk_tree_model_get(model, &iter, 0, &pattern, -1); while (tmplist) { gchar **strarr =(gchar **)tmplist->data; if (strcmp(strarr[1], pattern)==0 && strcmp(strarr[0], pd->hpd.selected_filetype)==0) { if (tmplist->next) { list_switch_order(tmplist, tmplist->next); highlightpattern_popmenu_activate(NULL, pd); return; } } tmplist = g_list_next(tmplist); } } } static void highlightpattern_delete_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { GtkTreeIter iter; GtkTreeModel *model; gchar *pattern; GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->hpd.lview)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { GList *tmplist = g_list_first(pd->lists[highlight_patterns]); gtk_tree_model_get(model, &iter, 0, &pattern, -1); while (tmplist) { gchar **strarr =(gchar **)tmplist->data; if (strcmp(strarr[1], pattern)==0 && strcmp(strarr[0], pd->hpd.selected_filetype)==0) { pd->hpd.curstrarr = NULL; pd->lists[highlight_patterns] = g_list_remove(pd->lists[highlight_patterns], strarr); g_strfreev(strarr); highlightpattern_popmenu_activate(NULL, pd); return; } tmplist = g_list_next(tmplist); } } } static void highlightpattern_gui_rebuild_filetype_popup(Tprefdialog *pd) { GList *tmplist; GtkWidget *menu, *menuitem; gtk_option_menu_remove_menu(GTK_OPTION_MENU(pd->hpd.popmenu)); menu = gtk_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(pd->hpd.popmenu), menu); gtk_widget_show(menu); tmplist = g_list_first(pd->lists[filetypes]); while (tmplist) { gchar **arr = (gchar **)tmplist->data; if (count_array(arr)>=3) { menuitem = gtk_menu_item_new_with_label(arr[0]); DEBUG_MSG("highlightpattern_gui_rebuild_filetype_popup, menuitem=%p for %s\n", menuitem, arr[0]); g_signal_connect(GTK_OBJECT(menuitem), "activate",G_CALLBACK(highlightpattern_popmenu_activate),pd); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_widget_show(menuitem); } tmplist = g_list_next(tmplist); } } static void highlightpattern_reset_clicked_lcb(GtkWidget *button, Tprefdialog *pd) { gchar *defaultfile = return_first_existing_filename(PKGDATADIR"highlighting.default", "data/highlighting.default", "../data/highlighting.default",NULL); if (defaultfile) { DEBUG_MSG("hightlighting file: %s\n", defaultfile); /* get current selected filetype && create array to compare to*/ gchar **compare = array_from_arglist(pd->hpd.selected_filetype, NULL); DEBUG_MSG("highlightpattern_reset_clicked_lcb, defaultfile=%s\n",defaultfile); /* delete filetype from arraylist */ pd->lists[highlight_patterns] = arraylist_delete_identical(pd->lists[highlight_patterns], compare, 1, TRUE); /* load filetype from default file */ pd->lists[highlight_patterns] = arraylist_append_identical_from_file(pd->lists[highlight_patterns], defaultfile, compare, 1, TRUE); g_strfreev(compare); /* re-load selected filetype in preferences gui */ DEBUG_MSG("highlightpattern_reset_clicked_lcb, about to rebuild gui\n"); highlightpattern_fill_from_selected_filetype(pd); g_free (defaultfile); } } static void create_highlightpattern_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *vbox3; pd->lists[highlight_patterns] = duplicate_arraylist(main_v->props.highlight_patterns); DEBUG_MSG("create_highlightpattern_gui, pd=%p, pd->lists[highlight_patterns]=%p\n", pd, pd->lists[highlight_patterns]); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(hbox),gtk_label_new(_("filetype")),FALSE, FALSE, 3); pd->hpd.popmenu = gtk_option_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(pd->hpd.popmenu), gtk_menu_new()); highlightpattern_gui_rebuild_filetype_popup(pd); gtk_box_pack_start(GTK_BOX(hbox),pd->hpd.popmenu,TRUE, TRUE, 3); but = gtk_button_new_with_label(_("Reset")); g_signal_connect(G_OBJECT(but), "clicked", G_CALLBACK(highlightpattern_reset_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but,FALSE, FALSE, 3); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 3); pd->hpd.entry[0] = boxed_full_entry(_("Pattern name"), NULL, 500, hbox); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_highlightpattern_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, TRUE, 3); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(highlightpattern_delete_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 1); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); pd->hpd.lstore = gtk_list_store_new (1, G_TYPE_STRING); pd->hpd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->hpd.lstore)); { GtkTreeViewColumn *column; GtkWidget *scrolwin; GtkTreeSelection *select; GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (_("Pattern"), renderer,"text", 0,NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(pd->hpd.lview), column); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->hpd.lview); gtk_box_pack_start(GTK_BOX(hbox), scrolwin, FALSE, TRUE, 2); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->hpd.lview)); g_signal_connect(G_OBJECT(select), "changed",G_CALLBACK(highlightpattern_selection_changed_cb),pd); } vbox3 = gtk_vbox_new(FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), vbox3, FALSE, FALSE, 2); /* pack up and down buttons here */ but = bf_gtkstock_button(GTK_STOCK_GO_UP, G_CALLBACK(highlightpattern_up_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(vbox3), but, FALSE, FALSE, 1); but = bf_gtkstock_button(GTK_STOCK_GO_DOWN, G_CALLBACK(highlightpattern_down_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(vbox3), but, FALSE, FALSE, 1); vbox3 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 2); pd->hpd.radio[0] = gtk_radio_button_new_with_label(NULL, _("Start pattern and end pattern")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[0], TRUE, TRUE, 0); pd->hpd.radio[1] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[0]), _("Only start pattern")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[1], TRUE, TRUE, 0); pd->hpd.radio[2] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[0]), _("Subpattern from parent")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[2], TRUE, TRUE, 0); g_signal_connect(G_OBJECT(pd->hpd.radio[0]), "toggled", G_CALLBACK(highlightpattern_type_toggled), pd); g_signal_connect(G_OBJECT(pd->hpd.radio[1]), "toggled", G_CALLBACK(highlightpattern_type_toggled), pd); g_signal_connect(G_OBJECT(pd->hpd.radio[2]), "toggled", G_CALLBACK(highlightpattern_type_toggled), pd); pd->hpd.entry[1] = boxed_full_entry(_("Start pattern"), NULL, 4000, vbox3); pd->hpd.entry[2] = boxed_full_entry(_("End pattern"), NULL, 4000, vbox3); pd->hpd.check = boxed_checkbut_with_value(_("Case sensitive matching"), FALSE, vbox3); pd->hpd.entry[3] = boxed_full_entry(_("Parentmatch"), NULL, 300, vbox3); pd->hpd.entry[4] = prefs_string(_("Foreground color"), "", vbox3, pd, string_color); pd->hpd.entry[5] = prefs_string(_("Background color"), "", vbox3, pd, string_color); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox, TRUE, TRUE, 0); vbox3 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 0); pd->hpd.radio[3] = gtk_radio_button_new_with_label(NULL, _("don't change weight")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[3], TRUE, TRUE, 0); pd->hpd.radio[4] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[3]), _("force non-bold weight")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[4], TRUE, TRUE, 0); pd->hpd.radio[5] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[3]), _("force bold weight")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[5], TRUE, TRUE, 0); vbox3 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 0); pd->hpd.radio[6] = gtk_radio_button_new_with_label(NULL, _("don't change style")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[6], TRUE, TRUE, 0); pd->hpd.radio[7] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[6]), _("force non-italic style")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[7], TRUE, TRUE, 0); pd->hpd.radio[8] = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pd->hpd.radio[6]), _("force italic style")); gtk_box_pack_start(GTK_BOX(vbox3),pd->hpd.radio[8], TRUE, TRUE, 0); } static void set_browser_strarr_in_list(GtkTreeIter *iter, gchar **strarr, Tprefdialog *pd) { gint arrcount = count_array(strarr); if (arrcount==2) { gtk_list_store_set(GTK_LIST_STORE(pd->bd.lstore), iter ,0,strarr[0],1,strarr[1],2,strarr,-1); } else { DEBUG_MSG("ERROR: set_browser_strarr_in_list, arraycount != 2 !!!!!!\n"); } } static void browser_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->bd.lstore,2,type,path,newval,index); } static void browser_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { browser_apply_change(pd, 1, path, newtext, 0); } static void browser_1_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { browser_apply_change(pd, 1, path, newtext, 1); } static void add_new_browser_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(2); gtk_list_store_append(GTK_LIST_STORE(pd->bd.lstore), &iter); set_browser_strarr_in_list(&iter, strarr,pd); pd->lists[browsers] = g_list_append(pd->lists[browsers], strarr); pd->bd.insertloc = -1; } static void delete_browser_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->bd, 2); } static void create_browsers_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *scrolwin; pd->lists[browsers] = duplicate_arraylist(main_v->props.browsers); pd->bd.lstore = gtk_list_store_new (3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER); pd->bd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->bd.lstore)); pref_create_column(GTK_TREE_VIEW(pd->bd.lview), 1, G_CALLBACK(browser_0_edited_lcb), pd, _("Label"), 0, FALSE); pref_create_column(GTK_TREE_VIEW(pd->bd.lview), 1, G_CALLBACK(browser_1_edited_lcb), pd, _("Command"), 1, FALSE); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->bd.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); { GList *tmplist = g_list_first(pd->lists[browsers]); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(pd->bd.lstore), &iter); set_browser_strarr_in_list(&iter, strarr,pd); tmplist = g_list_next(tmplist); } } gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->bd.lview), TRUE); pd->bd.thelist = &pd->lists[browsers]; pd->bd.insertloc = -1; g_signal_connect(G_OBJECT(pd->bd.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->bd); g_signal_connect(G_OBJECT(pd->bd.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->bd); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_browser_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_browser_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static void autotext_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->att.atd.lstore,3/*pointer index*/,type,path,newval,index); } static void completion_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->atc.atd.lstore,1/*pointer index*/,type,path,newval,index); } static void autotext_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { autotext_apply_change(pd, 1, path, newtext, 0); #ifdef SCROLL_TO_CELL_DOESNOT_WORK GtkTreePath* treepath = gtk_tree_path_new_from_string(path); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pd->att.atd.lview), treepath, NULL, FALSE, 0, 0); gtk_tree_path_free(treepath); #else GtkTreeViewColumn *column; GtkTreePath *treepath; gtk_tree_view_get_cursor(GTK_TREE_VIEW(pd->att.atd.lview), &treepath, &column); if (treepath) { gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pd->att.atd.lview), treepath, NULL, FALSE, 0, 0); /* i tried to jump to next cell (first string), but failed */ } /* we must free treepath, see GtkTreeView::GetCursor */ gtk_tree_path_free(treepath); #endif } static void completion_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { completion_apply_change(pd, 1, path, newtext, 0); GtkTreeViewColumn *column; GtkTreePath *treepath; gtk_tree_view_get_cursor(GTK_TREE_VIEW(pd->atc.atd.lview), &treepath, &column); if (treepath) { gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pd->atc.atd.lview), treepath, NULL, FALSE, 0, 0); } gtk_tree_path_free(treepath); } static void autotext_1_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { autotext_apply_change(pd, 1, path, newtext, 1); } static void autotext_2_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { autotext_apply_change(pd, 1, path, newtext, 2); } static gboolean autotext_remove_key_value(gchar *key, gchar *value, gpointer *data) { /* return TRUE: all key will be deleted */ return TRUE; } static void add_new_autotext_lcb(GtkWidget *wid, Tprefdialog *pd) { if (pd->att.refreshed) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(3); gtk_list_store_append(GTK_LIST_STORE(pd->att.atd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->att.atd.lstore), &iter, 0, strarr[0], 1 , strarr[1], 2, strarr[2], 3, strarr, -1); pd->lists[autotext] = g_list_append(pd->lists[autotext], strarr); pd->att.atd.insertloc = -1; GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->att.atd.lview),0); /* check whether the first column is clicked */ gboolean first_col_is_sorted = gtk_tree_view_column_get_sort_indicator(column); if (!first_col_is_sorted) { gtk_tree_view_column_clicked(column); } GtkTreePath *treepath = gtk_tree_model_get_path(GTK_TREE_MODEL(pd->att.atd.lstore), &iter); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pd->att.atd.lview), treepath, NULL, FALSE, 0, 0); gtk_widget_grab_focus(GTK_WIDGET(pd->att.atd.lview)); gtk_tree_view_set_cursor(GTK_TREE_VIEW(pd->att.atd.lview), treepath, column, TRUE); /* can*NOT*: gtk_tree_path_free(treepath); */ }else{ warning_dialog(pd->win, _("Warning:"), _("Please refresh the list before adding any item!\n\nBecause of peformance reason, Winefish doesnot load your autotext file automatically. You may do it manually by choosing 'Refresh' now. *Note* that this may take a quite long time.")); } } static void add_new_completion_lcb(GtkWidget *wid, Tprefdialog *pd) { if (pd->atc.refreshed) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(1); gtk_list_store_append(GTK_LIST_STORE(pd->atc.atd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->atc.atd.lstore), &iter, 0, strarr[0], 1, strarr, -1); pd->lists[completion] = g_list_append(pd->lists[completion], strarr); pd->atc.atd.insertloc = -1; GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->atc.atd.lview),0); /* check whether the first column is clicked */ /* gboolean first_col_is_sorted = gtk_tree_view_column_get_sort_indicator(column); if (!first_col_is_sorted) { gtk_tree_view_column_clicked(column); } */ GtkTreePath *treepath = gtk_tree_model_get_path(GTK_TREE_MODEL(pd->atc.atd.lstore), &iter); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pd->atc.atd.lview), treepath, NULL, FALSE, 0, 0); gtk_widget_grab_focus(GTK_WIDGET(pd->atc.atd.lview)); gtk_tree_view_set_cursor(GTK_TREE_VIEW(pd->atc.atd.lview), treepath, column, TRUE); /* can*NOT*: gtk_tree_path_free(treepath); */ }else{ warning_dialog(pd->win, _("Warning:"), _("Please refresh the list before adding any item!\n\nBecause of peformance reason, Winefish doesnot load your 'word-list' file automatically. You may do it manually by choosing 'Refresh' now. *Note* that this may take a quite long time.")); } } static void delete_autotext_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->att.atd, 3); } static void delete_completion_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->atc.atd, 1); } static void autotext_insert_def_key_value(gchar *key, gchar *value, Tprefdialog *pd) { GtkTreeIter iter; gint index = strtoul(value, NULL, 10); gchar **tmp; tmp = g_ptr_array_index(main_v->props.autotext_array, index); { gchar **strarr = g_malloc(4*sizeof(gchar *)); strarr[0] = g_strdup(key); strarr[1] = escape_string(tmp[0], TRUE); strarr[2] = escape_string(tmp[1], TRUE); strarr[3] = NULL; pd->lists[autotext] = g_list_append(pd->lists[autotext], strarr); gtk_list_store_append(GTK_LIST_STORE(pd->att.atd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->att.atd.lstore), &iter, 0, strarr[0], 1 , strarr[1], 2, strarr[2], 3, strarr, -1); } } static void completion_insert_global_words(Tprefdialog *pd) { GList *tmplist = g_list_first(main_v->props.completion->items); GtkTreeIter iter; while (tmplist) { gchar **strarr = g_malloc(2*sizeof(gchar *)); strarr[0] = escape_string((gchar*)tmplist->data, TRUE); strarr[1] = NULL; pd->lists[completion] = g_list_append(pd->lists[completion], strarr); gtk_list_store_append(GTK_LIST_STORE(pd->atc.atd.lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(pd->atc.atd.lstore), &iter, 0, strarr[0], 1, strarr, -1); tmplist = g_list_next(tmplist); } } static void refresh_autotext_lcb(GtkWidget *wid, Tprefdialog *pd) { pd->att.refreshed = TRUE; gtk_widget_set_sensitive(wid, FALSE); g_hash_table_foreach(main_v->props.autotext_hashtable,(GHFunc)autotext_insert_def_key_value, pd); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->att.atd.lview),0); gtk_tree_view_column_clicked(column); } static void refresh_completion_lcb(GtkWidget *wid, Tprefdialog *pd) { pd->atc.refreshed = TRUE; gtk_widget_set_sensitive(wid, FALSE); completion_insert_global_words(pd); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->atc.atd.lview),0); gtk_tree_view_column_clicked(column); } /* kyanh */ static void create_autotext_gui(Tprefdialog *pd, GtkWidget *vbox1) { pd->att.refreshed = FALSE; GtkWidget *hbox, *but, *scrolwin; pd->att.atd.lstore = gtk_list_store_new (4,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER); pd->att.atd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->att.atd.lstore)); pref_create_column(GTK_TREE_VIEW(pd->att.atd.lview), 1, G_CALLBACK(autotext_0_edited_lcb), pd, _("Definition"), 0, TRUE); pref_create_column(GTK_TREE_VIEW(pd->att.atd.lview), 1, G_CALLBACK(autotext_1_edited_lcb), pd, _("Before"), 1, TRUE); pref_create_column(GTK_TREE_VIEW(pd->att.atd.lview), 1, G_CALLBACK(autotext_2_edited_lcb), pd, _("After"), 2, TRUE); /* setting for new tree view */ gtk_tree_view_set_enable_search(GTK_TREE_VIEW(pd->att.atd.lview), TRUE); gtk_tree_view_set_search_column(GTK_TREE_VIEW(pd->att.atd.lview), 0); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->att.atd.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->att.atd.lview), TRUE); pd->att.atd.thelist = &pd->lists[autotext]; pd->att.atd.insertloc = -1; g_signal_connect(G_OBJECT(pd->att.atd.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->att.atd); g_signal_connect(G_OBJECT(pd->att.atd.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->att.atd); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); if (main_v->props.autotext_array->len >= 100) { /* too much definition make make winefish slow down */ but = bf_gtkstock_button(GTK_STOCK_REFRESH, G_CALLBACK(refresh_autotext_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); }else{ pd->att.refreshed = TRUE; g_hash_table_foreach(main_v->props.autotext_hashtable,(GHFunc)autotext_insert_def_key_value, pd); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->att.atd.lview),0); gtk_tree_view_column_clicked(column); } but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_autotext_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); { /*GtkTooltips *add_tips; add_tips = gtk_tooltips_new();*/ gtk_tooltips_set_tip(main_v->tooltips, but, _("Add new autotext definition.\nStart finding the old one by pressing CTRL+F."), NULL); } but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_autotext_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static void create_completion_gui(Tprefdialog *pd, GtkWidget *vbox1) { pd->atc.refreshed = FALSE; GtkWidget *hbox, *but, *scrolwin; pd->atc.atd.lstore = gtk_list_store_new (2,G_TYPE_STRING,G_TYPE_POINTER); pd->atc.atd.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->atc.atd.lstore)); pref_create_column(GTK_TREE_VIEW(pd->atc.atd.lview), 1, G_CALLBACK(completion_0_edited_lcb), pd, _("Command"), 0, TRUE); /* setting for new tree view */ gtk_tree_view_set_enable_search(GTK_TREE_VIEW(pd->atc.atd.lview), TRUE); gtk_tree_view_set_search_column(GTK_TREE_VIEW(pd->atc.atd.lview), 0); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->atc.atd.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->atc.atd.lview), TRUE); pd->atc.atd.thelist = &pd->lists[completion]; pd->atc.atd.insertloc = -1; g_signal_connect(G_OBJECT(pd->atc.atd.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->atc.atd); g_signal_connect(G_OBJECT(pd->atc.atd.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->atc.atd); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); if (g_list_length(main_v->props.completion->items) >= 100) { /* too much definition make make winefish slow down */ but = bf_gtkstock_button(GTK_STOCK_REFRESH, G_CALLBACK(refresh_completion_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); }else{ pd->atc.refreshed = TRUE; /* add */ completion_insert_global_words(pd); GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(pd->atc.atd.lview),0); gtk_tree_view_column_clicked(column); } but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_completion_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); { /* GtkTooltips *add_tips; add_tips = gtk_tooltips_new(); */ gtk_tooltips_set_tip(main_v->tooltips, but, _("Add new word which should be started by '\\'.\nStart finding the old one by pressing CTRL+F."), NULL); } but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_completion_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static void set_external_commands_strarr_in_list(GtkTreeIter *iter, gchar **strarr, Tprefdialog *pd) { gint arrcount = count_array(strarr); if (arrcount==2) { gtk_list_store_set(GTK_LIST_STORE(pd->ed.lstore), iter ,0,strarr[0],1,strarr[1],2,strarr,-1); } else { DEBUG_MSG("ERROR: set_external_command_strarr_in_list, arraycount != 2 !!!!!!\n"); } } static void external_commands_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->ed.lstore,2,type,path,newval,index); } static void external_commands_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { external_commands_apply_change(pd, 1, path, newtext, 0); } static void external_commands_1_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { external_commands_apply_change(pd, 1, path, newtext, 1); } static void add_new_external_commands_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(2); gtk_list_store_append(GTK_LIST_STORE(pd->ed.lstore), &iter); set_external_commands_strarr_in_list(&iter, strarr,pd); pd->lists[external_commands] = g_list_append(pd->lists[external_commands], strarr); pd->ed.insertloc = -1; } static void delete_external_commands_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->ed, 2); } static void create_externals_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *scrolwin; pd->lists[external_commands] = duplicate_arraylist(main_v->props.external_commands); pd->ed.lstore = gtk_list_store_new (3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER); pd->ed.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->ed.lstore)); pref_create_column(GTK_TREE_VIEW(pd->ed.lview), 1, G_CALLBACK(external_commands_0_edited_lcb), pd, _("Label"), 0, FALSE); pref_create_column(GTK_TREE_VIEW(pd->ed.lview), 1, G_CALLBACK(external_commands_1_edited_lcb), pd, _("Command"), 1, FALSE); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->ed.lview); gtk_widget_set_size_request(scrolwin, 120, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); { GList *tmplist = g_list_first(pd->lists[external_commands]); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(pd->ed.lstore), &iter); set_external_commands_strarr_in_list(&iter, strarr,pd); tmplist = g_list_next(tmplist); } } gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->ed.lview), TRUE); pd->ed.thelist = &pd->lists[external_commands]; pd->ed.insertloc = -1; g_signal_connect(G_OBJECT(pd->ed.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->ed); g_signal_connect(G_OBJECT(pd->ed.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->ed); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_external_commands_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_external_commands_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } static void set_outputbox_strarr_in_list(GtkTreeIter *iter, gchar **strarr, Tprefdialog *pd) { gint arrcount; arrcount = count_array(strarr); if (arrcount==7) { gtk_list_store_set(GTK_LIST_STORE(pd->od.lstore), iter ,0,strarr[0],1,strarr[1],2,strarr[2],3,strarr[3] ,4,strarr[4],5,strarr[5],6,strarr[6]/*(strarr[6][0] != '0')*/ ,7,strarr,-1); } } static void outputbox_apply_change(Tprefdialog *pd, gint type, gchar *path, gchar *newval, gint index) { pref_apply_change(pd->od.lstore,7,type,path,newval,index); } static void outputbox_0_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 0); } static void outputbox_1_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 1); } static void outputbox_2_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 2); } static void outputbox_3_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 3); } static void outputbox_4_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 4); } static void outputbox_5_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 5); } /* static void outputbox_6_toggled_lcb(GtkCellRendererToggle *cellrenderertoggle,gchar *path,Tprefdialog *pd) { gchar *val = g_strdup(cellrenderertoggle->active ? "0" : "1"); outputbox_apply_change(pd, 2, path, val, 6); g_free(val); } */ static void outputbox_6_edited_lcb(GtkCellRendererText *cellrenderertext,gchar *path,gchar *newtext,Tprefdialog *pd) { outputbox_apply_change(pd, 1, path, newtext, 6); } static void add_new_outputbox_lcb(GtkWidget *wid, Tprefdialog *pd) { gchar **strarr; GtkTreeIter iter; strarr = pref_create_empty_strarr(7); gtk_list_store_append(GTK_LIST_STORE(pd->od.lstore), &iter); set_outputbox_strarr_in_list(&iter, strarr,pd); pd->lists[outputbox] = g_list_append(pd->lists[outputbox], strarr); pd->od.insertloc = -1; } static void delete_outputbox_lcb(GtkWidget *wid, Tprefdialog *pd) { pref_delete_strarr(pd, &pd->od, 7); } static void create_outputbox_gui(Tprefdialog *pd, GtkWidget *vbox1) { GtkWidget *hbox, *but, *scrolwin; pd->lists[outputbox] = duplicate_arraylist(main_v->props.outputbox); pd->od.lstore = gtk_list_store_new (8,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING/*G_TYPE_BOOLEAN*/,G_TYPE_POINTER); pd->od.lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(pd->od.lstore)); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_0_edited_lcb), pd, _("Name"), 0, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_1_edited_lcb), pd, _("Pattern"), 1, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_2_edited_lcb), pd, _("File #"), 2, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_3_edited_lcb), pd, _("Line #"), 3, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_4_edited_lcb), pd, _("Output #"), 4, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_5_edited_lcb), pd, _("Command"), 5, FALSE); pref_create_column(GTK_TREE_VIEW(pd->od.lview), 1, G_CALLBACK(outputbox_6_edited_lcb), pd, _("Save,Show"), 6, FALSE); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), pd->od.lview); gtk_widget_set_size_request(scrolwin, 150, 190); gtk_box_pack_start(GTK_BOX(vbox1), scrolwin, TRUE, TRUE, 2); { GList *tmplist = g_list_first(pd->lists[outputbox]); while (tmplist) { gint arrcount; gchar **strarr = (gchar **)tmplist->data; arrcount = count_array(strarr); if (arrcount==7) { GtkTreeIter iter; gtk_list_store_append(GTK_LIST_STORE(pd->od.lstore), &iter); set_outputbox_strarr_in_list(&iter, strarr,pd); } tmplist = g_list_next(tmplist); } } gtk_tree_view_set_reorderable(GTK_TREE_VIEW(pd->od.lview), TRUE); pd->od.thelist = &pd->lists[outputbox]; pd->od.insertloc = -1; g_signal_connect(G_OBJECT(pd->od.lstore), "row-inserted", G_CALLBACK(listpref_row_inserted), &pd->od); g_signal_connect(G_OBJECT(pd->od.lstore), "row-deleted", G_CALLBACK(listpref_row_deleted), &pd->od); hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1),hbox, TRUE, TRUE, 2); but = bf_gtkstock_button(GTK_STOCK_ADD, G_CALLBACK(add_new_outputbox_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); but = bf_gtkstock_button(GTK_STOCK_DELETE, G_CALLBACK(delete_outputbox_lcb), pd); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 2); } /* kyanh, added, 20050221 */ static void create_outputbox_info_gui(Tprefdialog *pd, GtkWidget *vbox1) { gtk_box_pack_start(GTK_BOX(vbox1),gtk_label_new( _( "%D: basedir of project\n\ %B: basefile (without extension) of project\n\ %d: current directory\n\ %b: basename (without extension) of current file\n\ %f: current file (full path)\n\ %l: current line\n\ %%: percent sign\n\ \n\ If there isn't any project, or project mode is off, we have\n\ \t%D=%d, %B=%b\n\ \n\ Save,Show:\n\ \tneed save file: 1\n\ \tshow all output: 2\n\ \tboth of them: 1+2 =3\n\ \tnone of them: 0\ ")), TRUE, TRUE, 2); } /**************************************/ /* MAIN DIALOG FUNCTIONS */ /**************************************/ static void preferences_destroy_lcb(GtkWidget * widget, Tprefdialog *pd) { GtkTreeSelection *select; DEBUG_MSG("preferences_destroy_lcb, started\n"); /* FIX BUG#57, clear the list */ gtk_list_store_clear (GTK_LIST_STORE(pd->att.atd.lstore)); gtk_list_store_clear (GTK_LIST_STORE(pd->atc.atd.lstore)); free_arraylist(pd->lists[filetypes]); free_arraylist(pd->lists[filefilters]); free_arraylist(pd->lists[highlight_patterns]); free_arraylist(pd->lists[browsers]); free_arraylist(pd->lists[external_commands]); free_arraylist(pd->lists[autotext]); free_arraylist(pd->lists[completion]); pd->lists[filetypes] = NULL; pd->lists[filefilters] = NULL; pd->lists[highlight_patterns] = NULL; pd->lists[browsers] = NULL; pd->lists[autotext] = NULL; pd->lists[completion] = NULL; pd->lists[external_commands] = NULL; /* select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->ftd.lview)); g_signal_handlers_destroy(G_OBJECT(select));*/ DEBUG_MSG("preferences_destroy_lcb, destroying handlers for lstore %p\n",pd->ftd.lstore); g_signal_handlers_destroy(G_OBJECT(pd->ftd.lstore)); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->ffd.lview)); g_signal_handlers_destroy(G_OBJECT(select)); g_signal_handlers_destroy(G_OBJECT(pd->hpd.popmenu)); /* g_signal_handlers_destroy(G_OBJECT(GTK_COMBO(pd->bd.combo)->list));*/ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->bd.lview)); g_signal_handlers_destroy(G_OBJECT(select)); /* g_signal_handlers_destroy(G_OBJECT(GTK_COMBO(pd->ed.combo)->list));*/ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->ed.lview)); g_signal_handlers_destroy(G_OBJECT(select)); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->att.atd.lview)); g_signal_handlers_destroy(G_OBJECT(select)); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(pd->atc.atd.lview)); g_signal_handlers_destroy(G_OBJECT(select)); DEBUG_MSG("preferences_destroy_lcb, about to destroy the window\n"); window_destroy(pd->win); g_free(pd); } static void preferences_apply(Tprefdialog *pd) { string_apply(&main_v->props.editor_font_string, pd->prefs[editor_font_string]); integer_apply(&main_v->props.editor_tab_width, pd->prefs[editor_tab_width], FALSE); bitwise_apply(&main_v->props.view_bars, pd->prefs[editor_indent_wspaces], TRUE, MODE_INDENT_WITH_SPACES); bitwise_apply(&main_v->props.view_bars, pd->prefs[word_wrap], TRUE, MODE_WRAP); bitwise_apply(&main_v->props.view_bars, pd->prefs[defaulthighlight], TRUE, VIEW_COLORIZED); bitwise_apply(&main_v->props.view_bars, pd->prefs[allow_multi_instances], TRUE, MODE_ALLOW_MULTIPLE_INSTANCE); bitwise_apply(&main_v->props.view_bars, pd->prefs[backup_file], TRUE, MODE_CREATE_BACKUP_ON_SAVE); bitwise_apply(&main_v->props.view_bars, pd->prefs[backup_cleanuponclose], TRUE, MODE_REMOVE_BACKUP_ON_CLOSE); bitwise_apply(&main_v->props.view_bars, pd->prefs[clear_undo_on_save], TRUE, MODE_CLEAR_UNDO_HISTORY_ON_SAVE); bitwise_apply(&main_v->props.view_bars, pd->prefs[restore_dimensions], TRUE, MODE_RESTORE_DIMENSION); bitwise_apply(&main_v->props.view_bars, pd->prefs[transient_htdialogs], TRUE, MODE_MAKE_LATEX_TRANSIENT); bitwise_apply(&main_v->props.view_bars, pd->prefs[filebrowser_two_pane_view], TRUE, MODE_FILE_BROWSERS_TWO_VIEW); #ifdef WITH_MSG_QUEUE bitwise_apply(&main_v->props.view_bars, pd->prefs[open_in_running_bluefish], TRUE, MODE_REUSE_WINDOW); #endif /* integer_apply(&main_v->props.editor_indent_wspaces, pd->prefs[editor_indent_wspaces], TRUE); integer_apply(&main_v->props.word_wrap, pd->prefs[word_wrap], TRUE); integer_apply(&main_v->props.defaulthighlight, pd->prefs[defaulthighlight], TRUE); integer_apply(&main_v->props.allow_multi_instances, pd->prefs[allow_multi_instances], TRUE); #ifdef WITH_MSG_QUEUE integer_apply(&main_v->props.open_in_running_bluefish, pd->prefs[open_in_running_bluefish], TRUE); #endif */ integer_apply(&main_v->props.highlight_num_lines_count, pd->prefs[highlight_num_lines_count], FALSE); integer_apply(&main_v->props.bookmarks_default_store, pd->prefs[bookmarks_default_store], TRUE); main_v->props.bookmarks_filename_mode = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[bookmarks_filename_mode])); string_apply(&main_v->props.newfile_default_encoding, GTK_COMBO(pd->prefs[newfile_default_encoding])->entry); /* integer_apply(&main_v->props.backup_file, pd->prefs[backup_file], TRUE); */ string_apply(&main_v->props.backup_filestring, pd->prefs[backup_filestring]); main_v->props.backup_abort_action = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[backup_abort_action])); /* integer_apply(&main_v->props.backup_cleanuponclose, pd->prefs[backup_cleanuponclose], TRUE); */ integer_apply(&main_v->props.num_undo_levels, pd->prefs[num_undo_levels], FALSE); /* integer_apply(&main_v->props.clear_undo_on_save, pd->prefs[clear_undo_on_save], TRUE); */ main_v->props.modified_check_type = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[modified_check_type])); integer_apply(&main_v->props.max_recent_files, pd->prefs[max_recent_files], FALSE); /* integer_apply(&main_v->props.restore_dimensions, pd->prefs[restore_dimensions], TRUE); */ if (!(main_v->props.view_bars &MODE_RESTORE_DIMENSION) ) { integer_apply(&main_v->props.left_panel_width, pd->prefs[left_panel_width], FALSE); integer_apply(&main_v->globses.main_window_h, pd->prefs[main_window_h], FALSE); integer_apply(&main_v->globses.main_window_w, pd->prefs[main_window_w], FALSE); } string_apply(&main_v->props.tab_font_string, pd->prefs[tab_font_string]); main_v->props.document_tabposition = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[document_tabposition])); main_v->props.leftpanel_tabposition = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[leftpanel_tabposition])); main_v->props.left_panel_left = gtk_option_menu_get_history(GTK_OPTION_MENU(pd->prefs[left_panel_left])); /* integer_apply(&main_v->props.transient_htdialogs, pd->prefs[transient_htdialogs], TRUE); */ string_apply(&main_v->props.default_basedir, pd->prefs[default_basedir]); #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND string_apply(&main_v->props.templates_dir, pd->prefs[templates_dir]); #endif #endif #ifdef ENABLE_COLUMN_MARKER integer_apply(&main_v->props.marker_i, pd->prefs[marker_i], FALSE); integer_apply(&main_v->props.marker_ii, pd->prefs[marker_ii], FALSE); integer_apply(&main_v->props.marker_iii, pd->prefs[marker_iii], FALSE); #endif /* ENABLE_COLUMN_MARKER */ /* integer_apply(&main_v->props.filebrowser_two_pane_view, pd->prefs[filebrowser_two_pane_view], TRUE); */ string_apply(&main_v->props.filebrowser_unknown_icon, pd->prefs[filebrowser_unknown_icon]); string_apply(&main_v->props.filebrowser_dir_icon, pd->prefs[filebrowser_dir_icon]); /* kyanh, removed, 20050219 string_apply(&main_v->props.image_thumbnailstring, pd->prefs[image_thumbnailstring]); string_apply(&main_v->props.image_thumbnailtype, GTK_COMBO(pd->prefs[image_thumbnailtype])->entry); */ /*filetype_apply_changes(pd);*/ /*filefilter_apply_changes(pd);*/ highlightpattern_apply_changes(pd); /*browsers_apply_changes(pd);*/ /*externals_apply_changes(pd);*/ /*outputbox_apply_changes(pd);*/ free_arraylist(main_v->props.filetypes); main_v->props.filetypes = duplicate_arraylist(pd->lists[filetypes]); free_arraylist(main_v->props.filefilters); main_v->props.filefilters = duplicate_arraylist(pd->lists[filefilters]); free_arraylist(main_v->props.highlight_patterns); main_v->props.highlight_patterns = duplicate_arraylist(pd->lists[highlight_patterns]); free_arraylist(main_v->props.browsers); main_v->props.browsers = duplicate_arraylist(pd->lists[browsers]); free_arraylist(main_v->props.external_commands); main_v->props.external_commands = duplicate_arraylist(pd->lists[external_commands]); free_arraylist(main_v->props.outputbox); main_v->props.outputbox = duplicate_arraylist(pd->lists[outputbox]); /* autotext rebuild the list */ if (pd->att.refreshed) {/* we only update the list after user press REFRESH */ g_ptr_array_free(main_v->props.autotext_array, TRUE); main_v->props.autotext_array = g_ptr_array_new(); g_hash_table_foreach_remove(main_v->props.autotext_hashtable, (GHRFunc)autotext_remove_key_value, NULL); { GList *tmplist = g_list_first(pd->lists[autotext]); gint index=0; while (tmplist) { gchar **strarr = (gchar **)tmplist->data; if ((strarr[0][0] == '/') && !g_hash_table_lookup(main_v->props.autotext_hashtable, strarr[0])) { if (strlen(strarr[1]) || strlen(strarr[2])) { gchar **tmp_array = g_malloc(3*sizeof(gchar *)); tmp_array[0] = unescape_string(strarr[1], TRUE); tmp_array[1] = unescape_string(strarr[2], TRUE); tmp_array[2] = NULL; g_ptr_array_add(main_v->props.autotext_array,tmp_array); g_hash_table_insert(main_v->props.autotext_hashtable, g_strdup(strarr[0]), g_strdup_printf("%d", index)); index++; } } tmplist = g_list_next(tmplist); } } } /* autotext: DONE */ /* completion */ if (pd->atc.refreshed) { GList *tmplist = NULL; GList *search = NULL; tmplist = g_list_first(main_v->props.completion->items); while (tmplist) { g_free(tmplist->data); tmplist = g_list_next(tmplist); } g_completion_clear_items(main_v->props.completion); main_v->props.completion->items = NULL; tmplist = g_list_first(pd->lists[completion]); gchar *retstr = NULL; gchar **strarr = NULL; while (tmplist) { strarr = (gchar **)tmplist->data; retstr = unescape_string(strarr[0], TRUE); search = g_list_find(main_v->props.completion->items, retstr); if (search == NULL) { main_v->props.completion->items = g_list_append(main_v->props.completion->items, retstr); } tmplist = g_list_next(tmplist); } g_list_free(tmplist); { #ifdef DEBUG g_print("updating session word list\n"); #endif GList *retval2 = NULL; GList *tmp2list = NULL; tmp2list = g_list_first(main_v->props.completion_s->items); while (tmp2list) { #ifdef DEBUG g_print("found %s", (gchar*)tmp2list->data); #endif search = g_list_find_custom(main_v->props.completion->items,tmp2list->data, (GCompareFunc)strcmp); if (search==NULL) { retval2 = g_list_append(retval2, g_strdup((gchar*)tmp2list->data)); #ifdef DEBUG g_print("... added\n"); }else{ g_print("... skipped\n"); #endif } tmp2list = g_list_next(tmp2list); } g_list_free(tmp2list); GList *tmp3list = NULL; tmp3list = g_list_first(main_v->props.completion_s->items); while (tmp3list) { g_free(tmp3list->data); tmp3list = g_list_next(tmp3list); } g_completion_clear_items(main_v->props.completion_s); main_v->props.completion_s->items = retval2; } } /* completion: DONE */ /* apply the changes to highlighting patterns and filetypes to the running program */ filetype_highlighting_rebuild(TRUE); filebrowser_filters_rebuild(); all_documents_apply_settings(); { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { Tbfwin *bfwin = BFWIN(tmplist->data); DEBUG_MSG("preferences_ok_clicked_lcb, calling encoding_menu_rebuild\n"); encoding_menu_rebuild(bfwin); external_menu_rebuild(bfwin); /* browsers is also rebuild here! */ filetype_menu_rebuild(bfwin,NULL); DEBUG_MSG("preferences_ok_clicked_lcb, calling gui_apply_settings\n"); gui_apply_settings(bfwin); left_panel_rebuild(bfwin); DEBUG_MSG("preferences_ok_clicked_lcb, calling doc_force_activate\n"); doc_force_activate(bfwin->current_document); tmplist = g_list_next(tmplist); } } } static void preferences_cancel_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { preferences_destroy_lcb(NULL, pd); } static void preferences_apply_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { preferences_apply(pd); rcfile_save_all(); /* kyanh, 20050222, this is just a workaround if we donnot save the settings now, we may lost everything if winefish crashes for some reasons after then */ } static void preferences_ok_clicked_lcb(GtkWidget *wid, Tprefdialog *pd) { preferences_apply(pd); preferences_destroy_lcb(NULL, pd); } static void restore_dimensions_toggled_lcb(GtkToggleButton *togglebutton,Tprefdialog *pd) { gtk_widget_set_sensitive(pd->prefs[left_panel_width], !togglebutton->active); gtk_widget_set_sensitive(pd->prefs[main_window_h], !togglebutton->active); gtk_widget_set_sensitive(pd->prefs[main_window_w], !togglebutton->active); } static void create_backup_toggled_lcb(GtkToggleButton *togglebutton,Tprefdialog *pd) { gtk_widget_set_sensitive(pd->prefs[backup_filestring], togglebutton->active); gtk_widget_set_sensitive(pd->prefs[backup_abort_action], togglebutton->active); } static void preferences_dialog() { Tprefdialog *pd; GtkWidget *dvbox, *frame, *vbox1, *vbox2; gchar *notebooktabpositions[] = {N_("left"), N_("right"), N_("top"), N_("bottom"), NULL}; gchar *panellocations[] = {N_("right"), N_("left"), NULL}; gchar *modified_check_types[] = {N_("no check"), N_("check mtime and size"), N_("check mtime"), N_("check size"), NULL}; pd = g_new0(Tprefdialog,1); pd->win = window_full(_("Edit preferences"), GTK_WIN_POS_NONE, 0, G_CALLBACK(preferences_destroy_lcb), pd, TRUE); dvbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(pd->win), dvbox); pd->noteb = gtk_notebook_new(); /* gtk_notebook_set_homogeneous_tabs(GTK_NOTEBOOK(pd->noteb), TRUE); */ gtk_notebook_set_tab_pos(GTK_NOTEBOOK(pd->noteb), GTK_POS_LEFT); gtk_box_pack_start(GTK_BOX(dvbox), pd->noteb, TRUE, TRUE, 0); /* tab: editors */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Editor"),150,TRUE)); frame = gtk_frame_new(_("Editor options")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[editor_font_string] = prefs_string(_("Font"), main_v->props.editor_font_string, vbox2, pd, string_font); pd->prefs[editor_tab_width] = prefs_integer(_("Tab width"), main_v->props.editor_tab_width, vbox2, pd, 1, 50); pd->prefs[editor_indent_wspaces] = boxed_checkbut_with_value(_("Use spaces to indent, not tabs"), GET_BIT(main_v->props.view_bars, MODE_INDENT_WITH_SPACES), vbox2); pd->prefs[word_wrap] = boxed_checkbut_with_value(_("Word wrap default"), GET_BIT(main_v->props.view_bars,MODE_WRAP), vbox2); DEBUG_MSG("preferences_dialog, colormode = %d\n", GET_BIT(main_v->props.view_bars,VIEW_COLORIZED)); pd->prefs[defaulthighlight] = boxed_checkbut_with_value(_("Highlight syntax by default"), GET_BIT(main_v->props.view_bars,VIEW_COLORIZED), vbox2); pd->prefs[highlight_num_lines_count] = prefs_integer(_("Highlight # lines"), main_v->props.highlight_num_lines_count, vbox2, pd, 1, 8); frame = gtk_frame_new(_("Undo")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[num_undo_levels] = prefs_integer(_("Undo history size"), main_v->props.num_undo_levels, vbox2, pd, 50, 10000); pd->prefs[clear_undo_on_save] = boxed_checkbut_with_value(_("Clear undo history on save"), GET_BIT(main_v->props.view_bars,MODE_CLEAR_UNDO_HISTORY_ON_SAVE), vbox2); frame = gtk_frame_new(_("Bookmark options")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[bookmarks_default_store] = boxed_checkbut_with_value(_("Make permanent by default"), main_v->props.bookmarks_default_store, vbox2); { gchar *actions[] = {N_("full path"), N_("path from basedir"), N_("filename"), NULL}; pd->prefs[bookmarks_filename_mode] = boxed_optionmenu_with_value(_("Bookmarks filename display"), main_v->props.bookmarks_filename_mode, vbox2, actions); } /* tab: Files */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Files"),152,TRUE)); frame = gtk_frame_new(_("Encoding")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); { GList *tmplist, *poplist = g_list_append(NULL, ""); tmplist = g_list_first(main_v->props.encodings); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; poplist = g_list_append(poplist, strarr[1]); tmplist = g_list_next(tmplist); } pd->prefs[newfile_default_encoding] = prefs_combo(_("Default character set"),main_v->props.newfile_default_encoding, vbox2, pd, poplist, TRUE); g_list_free(poplist); } /* kyanh, removed, 10050219 pd->prefs[auto_set_encoding_meta] = boxed_checkbut_with_value(_("Auto set encoding tag on change"), main_v->props.auto_set_encoding_meta, vbox2); */ frame = gtk_frame_new(_("Backup")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[backup_file] = boxed_checkbut_with_value(_("Create backup on save"), GET_BIT(main_v->props.view_bars, MODE_CREATE_BACKUP_ON_SAVE), vbox2); pd->prefs[backup_filestring] = prefs_string(_("Backup file suffix"), main_v->props.backup_filestring, vbox2, pd, string_none); { gchar *failureactions[] = {N_("save"), N_("abort"), N_("ask"), NULL}; pd->prefs[backup_abort_action] = boxed_optionmenu_with_value(_("Action on backup failure"), main_v->props.backup_abort_action, vbox2, failureactions); } pd->prefs[backup_cleanuponclose] = boxed_checkbut_with_value(_("Remove backupfile on close"), GET_BIT(main_v->props.view_bars, MODE_REMOVE_BACKUP_ON_CLOSE), vbox2); create_backup_toggled_lcb(GTK_TOGGLE_BUTTON(pd->prefs[backup_file]), pd); g_signal_connect(G_OBJECT(pd->prefs[backup_file]), "toggled", G_CALLBACK(create_backup_toggled_lcb), pd); frame = gtk_frame_new(_("Misc")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[allow_multi_instances] = boxed_checkbut_with_value(_("Allow multi instances of a file"), GET_BIT(main_v->props.view_bars, MODE_ALLOW_MULTIPLE_INSTANCE), vbox2); #ifdef WITH_MSG_QUEUE pd->prefs[open_in_running_bluefish] = boxed_checkbut_with_value(_("Open files in already running winefish window"),GET_BIT(main_v->props.view_bars,MODE_REUSE_WINDOW), vbox2); #endif /* WITH_MSG_QUEUE */ pd->prefs[modified_check_type] = boxed_optionmenu_with_value(_("File modified on disk check "), main_v->props.modified_check_type, vbox2, modified_check_types); pd->prefs[max_recent_files] = prefs_integer(_("Number of files in 'Open recent'"), main_v->props.max_recent_files, vbox2, pd, 3, 100); frame = gtk_frame_new(_("File browser")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[default_basedir] = prefs_string(_("Default basedir"), main_v->props.default_basedir, vbox2, pd, string_none); pd->prefs[filebrowser_two_pane_view] = boxed_checkbut_with_value(_("Use separate file and directory view"), GET_BIT(main_v->props.view_bars, MODE_FILE_BROWSERS_TWO_VIEW), vbox2); pd->prefs[filebrowser_unknown_icon] = prefs_string(_("Unknown icon"), main_v->props.filebrowser_unknown_icon, vbox2, pd, string_file); pd->prefs[filebrowser_dir_icon] = prefs_string(_("Directory icon"), main_v->props.filebrowser_dir_icon, vbox2, pd, string_file); /* tab: user interface */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("User interface"), 156,TRUE)); frame = gtk_frame_new(_("Dimensions")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[restore_dimensions] = boxed_checkbut_with_value(_("Restore last used dimensions"), GET_BIT(main_v->props.view_bars, MODE_RESTORE_DIMENSION), vbox2); pd->prefs[left_panel_width] = prefs_integer(_("Initial sidebar width"), main_v->props.left_panel_width, vbox2, pd, 1, 4000); pd->prefs[main_window_h] = prefs_integer(_("Initial window height"), main_v->globses.main_window_h, vbox2, pd, 1, 4000); pd->prefs[main_window_w] = prefs_integer(_("Initial window width"), main_v->globses.main_window_w, vbox2, pd, 1, 4000); restore_dimensions_toggled_lcb(GTK_TOGGLE_BUTTON(pd->prefs[restore_dimensions]), pd); g_signal_connect(G_OBJECT(pd->prefs[restore_dimensions]), "toggled", G_CALLBACK(restore_dimensions_toggled_lcb), pd); frame = gtk_frame_new(_("General")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[transient_htdialogs] = boxed_checkbut_with_value(_("Make LaTeX dialogs transient"), GET_BIT(main_v->props.view_bars, MODE_MAKE_LATEX_TRANSIENT), vbox2); pd->prefs[tab_font_string] = prefs_string(_("Notebook tab font (leave empty for gtk default)"), main_v->props.tab_font_string, vbox2, pd, string_font); pd->prefs[document_tabposition] = boxed_optionmenu_with_value(_("Document notebook tab position"), main_v->props.document_tabposition, vbox2, notebooktabpositions); pd->prefs[leftpanel_tabposition] = boxed_optionmenu_with_value(_("Sidebar notebook tab position"), main_v->props.leftpanel_tabposition, vbox2, notebooktabpositions); pd->prefs[left_panel_left] = boxed_optionmenu_with_value(_("Sidebar location"), main_v->props.left_panel_left, vbox2, panellocations); /* tab: Filtetypes */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Filetypes"), 153,TRUE)); frame = gtk_frame_new(_("Filetypes")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_filetype_gui(pd, vbox2); frame = gtk_frame_new(_("Filefilters")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_filefilter_gui(pd, vbox2); /* tab: Hilight */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Highlighting"), 158,TRUE)); frame = gtk_frame_new(_("Patterns")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_highlightpattern_gui(pd, vbox2); /* tab: Viewers, Filters */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Viewers, Filters"), 151,TRUE)); frame = gtk_frame_new(_("Viewers")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_browsers_gui(pd, vbox2); frame = gtk_frame_new(_("Utilities and Filters")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_externals_gui(pd, vbox2); frame = gtk_frame_new(_("Information")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); gtk_box_pack_start(GTK_BOX(vbox2),gtk_label_new( _("%f: current filename\n\ %i: input (filters)\n\ %o: output filename (filters)\n\ %%: percent sign\ ")), TRUE, TRUE, 2); /* tab: TeXbox */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("TeXbox"), 157,TRUE)); frame = gtk_frame_new(_("TeXbox")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_outputbox_gui(pd, vbox2); /* kyanh, added, 20050221 */ frame = gtk_frame_new(_("Information")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_outputbox_info_gui(pd, vbox2); /* tab: AutoX */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("AutoX"), 151,TRUE)); frame = gtk_frame_new(_("Autotext")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_autotext_gui(pd, vbox2); frame = gtk_frame_new(_("Word List (for Autocompletion)")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); create_completion_gui(pd, vbox2); /* tab: misc */ vbox1 = gtk_vbox_new(FALSE, 5); gtk_notebook_append_page(GTK_NOTEBOOK(pd->noteb), vbox1, hbox_with_pix_and_text(_("Miscellaneous"), 151,TRUE)); #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND frame = gtk_frame_new(_("Templates Directory")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[templates_dir] = prefs_string(NULL, main_v->props.templates_dir, vbox2, pd, string_none); #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ #ifdef ENABLE_COLUMN_MARKER frame = gtk_frame_new(_("Column Markers")); gtk_box_pack_start(GTK_BOX(vbox1), frame, FALSE, FALSE, 5); vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), vbox2); pd->prefs[marker_i] = prefs_integer(_("Marker 1"), main_v->props.marker_i, vbox2, pd, 0, 100); pd->prefs[marker_ii] = prefs_integer(_("Marker 2"), main_v->props.marker_ii, vbox2, pd, 0, 100); pd->prefs[marker_iii] = prefs_integer(_("Marker 3"), main_v->props.marker_iii, vbox2, pd, 0, 100); #endif /* ENABLE_COLUMN_MARKER */ /* end tab: misc. TODO: move to static function ;) */ /* end, create buttons for dialog now */ { GtkWidget *ahbox, *but; ahbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(ahbox), 12); gtk_box_pack_start(GTK_BOX(dvbox), ahbox, FALSE, FALSE, 0); but = bf_gtkstock_button(GTK_STOCK_APPLY, G_CALLBACK(preferences_apply_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(ahbox), but, TRUE, TRUE, 0); but = bf_stock_cancel_button(G_CALLBACK(preferences_cancel_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(ahbox), but, TRUE, TRUE, 0); but = bf_stock_ok_button(G_CALLBACK(preferences_ok_clicked_lcb), pd); gtk_box_pack_start(GTK_BOX(ahbox), but, TRUE, TRUE, 0); gtk_window_set_default(GTK_WINDOW(pd->win), but); } gtk_widget_show_all(pd->win); } void open_preferences_cb(GtkWidget *wid, gpointer data) { preferences_dialog(); } void open_preferences_menu_cb(gpointer callback_data,guint action,GtkWidget *widget) { preferences_dialog(); } winefish-1.3.3/src/pixmap.h0000600000047200004720000000043110373411041014556 0ustar kyanhkyanh/* $Id: pixmap.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* * Modified for Winefish (C) Ky Anh */ GtkWidget *new_pixmap(gint type); GList *default_icon_list(void); extern const guint8 pixmap_winefish_icon1[]; extern const guint8 pixmap_comment[]; /* END OF FILE */ winefish-1.3.3/src/autox.h0000600000047200004720000000234210373411041014423 0ustar kyanhkyanh/* $Id: autox.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * bluefish.h - global prototypes * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __AUTOCOMPLETION_H_ #define __AUTOCOMPLETION_H_ void autotext_init(void); void completion_init(void); gchar **autotext_done(gchar *lookup); /* void completion_addword(gchar *word); */ #endif /* __AUTOCOMPLETION_H_ */ winefish-1.3.3/src/outputbox_filter.h0000600000047200004720000000061410366105730016710 0ustar kyanhkyanh/* $Id: outputbox_filter.h 1663 2006-01-26 08:44:08Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish) * Copyright (C) 2006 kyanh */ #ifndef __OUTPUTBOX_FILTER_H_ #define __OUTPUTBOX_FILTER_H_ void outputbox_filter_line( Toutputbox *ob, const gchar *source ); /* void outputbox_filter_file( Toutputbox *ob, const gchar *filename ); */ #endif /* __OUTPUTBOX_FILTER_H_ */ winefish-1.3.3/src/outputbox.c0000600000047200004720000005475610411777430015361 0ustar kyanhkyanh/* $Id: outputbox.c 2246 2006-03-27 15:04:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * outputbox.c the output box * * Copyright (C) 2002 Olivier Sessink * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include "outputbox_cfg.h" #include #include /* strlen() */ #ifdef HAVE_VTE_TERMINAL #include /* vte */ #endif /* HAVE_VTE_TERMINAL */ #include "bluefish.h" #include "bf_lib.h" #include "document.h" #include "gtk_easy.h" #include "stringlist.h" #include "pixmap.h" #include "outputbox.h" /* myself */ #include "gui.h" /* statusbar_message */ #ifdef __KA_BACKEND__ #include #include /* kill() */ #include /* open() */ #include /* kyanh, open() */ /* kyanh, 20050301, Thanks to M. Garoche <...@easyconnect.fr> Move from to */ #include /* wait(), waitid() */ #include #include #include "outputbox_ka.h" /* backend by ka */ #endif /* __KA_BACKEND__ */ #ifdef __BF_BACKEND__ #include "outputbox_bf.h" #endif /* __BF_BACKEND__ */ #include "document.h" /* doc_file_to_textbox */ static void ob_lview_current_cursor_open_file(GtkTreePath *path, Toutputbox *ob, gboolean clone_file) { GtkTreePath *treepath; if (path) { treepath = path; }else{ gtk_tree_view_get_cursor(GTK_TREE_VIEW(ob->lview), &treepath, NULL); } if (treepath) { gchar *filepath, *line; gint lineval; GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL( ob->lstore ), &iter, treepath); gtk_tree_model_get( GTK_TREE_MODEL( ob->lstore ), &iter, 3, &filepath, 1, &line, -1 ); gtk_tree_model_get( GTK_TREE_MODEL( ob->lstore ), &iter, 3, &filepath, -1 ); DEBUG_MSG( "ob_lview_current_cursor_open_file, file=%s, line=%s\n", filepath, line ); if ( filepath && strlen( filepath ) ) { if (clone_file) { Tdocument * doc; if (doc_is_empty_non_modified_and_nameless( ob->bfwin->current_document )) { doc = ob->bfwin->current_document ; }else{ doc = doc_new( ob->bfwin, FALSE ); switch_to_document_by_pointer( ob->bfwin, doc ); } doc_file_to_textbox( doc, filepath , FALSE, FALSE ); doc_set_modified(doc, TRUE); doc_activate( doc ); }else{ doc_new_with_file( ob->bfwin, filepath, FALSE, FALSE ); } } if ( line && strlen( line /* linepath, BUG#74 */) ) { lineval = atoi( line ); flush_queue(); doc_select_line( ob->bfwin->current_document, lineval, TRUE ); } /* clone_file: Control + Click doesnot select the row ==> we need select it manually !*/ if (clone_file) { gtk_tree_view_set_cursor(GTK_TREE_VIEW(ob->lview), treepath, NULL, FALSE); } gtk_widget_grab_focus( ob->bfwin->current_document->view ); g_free( line ); g_free(filepath); if (!path) gtk_tree_path_free(treepath); } } /* static void ob_lview_row_activated_lcb( GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, Toutputbox *ob ) { ob_lview_current_cursor_open_file(path,ob); } */ /* TODO: hide only this page */ static void outputbox_close_lcb( GtkWidget *widget, Toutputbox *ob ) { setup_toggle_item_from_widget( ob->bfwin->menubar, N_( "/View/View Outputbox" ), FALSE ); gtk_widget_hide( ob->bfwin->ob_hbox ); } /* kyanh */ static void ob_lview_copy_line_lcb (GtkWidget *widget, Toutputbox *ob ) { GtkTreePath *treepath; gtk_tree_view_get_cursor(GTK_TREE_VIEW(ob->lview), &treepath, NULL); if (treepath) { GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL( ob->lstore ), &iter, treepath); gchar *message; gtk_tree_model_get( GTK_TREE_MODEL( ob->lstore ), &iter, 2, &message, -1 ); DEBUG_MSG("ob_lview_copy_line_lcb: message = '%s'\n",message); gtk_clipboard_set_text (gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), message, -1); g_free(message); gtk_tree_path_free(treepath); } } #ifdef OB_POPUP_DYNAMIC_MENU_WITH_LCB static void ob_lview_current_cursor_open_file_lcb (GtkWidget *widget, Toutputbox *ob ) { ob_lview_current_cursor_open_file(NULL,ob, FALSE); } #endif /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ /* kyanh */ static GtkWidget *ob_lview_create_popup_menu (Toutputbox *ob) { DEBUG_MSG("ob_lview_create_popup_menu: fetching value = %d\n", ob->OB_FETCHING); if (ob->OB_FETCHING != OB_IS_READY) { DEBUG_MSG("ob_lview_create_popup_menu: return without creating any menu\n"); return NULL; } GtkWidget *menu; GtkWidget *menu_item; menu = gtk_menu_new (); menu_item = gtk_menu_item_new_with_label(_("hide this box")); g_signal_connect( menu_item, "activate", G_CALLBACK( outputbox_close_lcb ), ob ); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( gtk_menu_item_new() ) ); menu_item = gtk_menu_item_new_with_label(_("copy this line")); g_signal_connect( menu_item, "activate", G_CALLBACK( ob_lview_copy_line_lcb ), ob ); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); GtkTreePath *treepath; gtk_tree_view_get_cursor(GTK_TREE_VIEW(ob->lview), &treepath, NULL); if (treepath) { menu_item = NULL; GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL( ob->lstore ), &iter, treepath); gchar *filepath=NULL; gchar *tmpstr=NULL; #ifdef OB_POPUP_DYNAMIC_MENU_WITH_LCB gchar *linenumber=NULL; #endif /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ gtk_tree_model_get( GTK_TREE_MODEL( ob->lstore ), &iter, 3, &filepath, -1 ); #ifdef OB_POPUP_DYNAMIC_MENU_WITH_LCB gtk_tree_model_get( GTK_TREE_MODEL( ob->lstore ), &iter, 1, &linenumber, -1 ); if (filepath && strlen(filepath)) { if (linenumber && strlen(linenumber)) { tmpstr = g_strdup_printf(_("goto line %s, file = %s"), linenumber, filepath); }else{ tmpstr = g_strdup_printf(_("goto file = %s"), filepath); } }else{ if (linenumber && strlen(linenumber)) { tmpstr = g_strdup_printf(_("goto line %s, current file"), linenumber); } } #else /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ if (filepath && strlen(filepath)) { tmpstr = g_strdup_printf(_("file: %s"), filepath); } #endif /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ if (tmpstr) { menu_item = gtk_menu_item_new_with_label(tmpstr); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); #ifdef OB_POPUP_DYNAMIC_MENU_WITH_LCB g_signal_connect( menu_item, "activate", G_CALLBACK( ob_lview_current_cursor_open_file_lcb ), ob ); #endif /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ DEBUG_MSG("ob_lview_create_popup_menu: dynamic menu item = %s\n", tmpstr); } g_free(tmpstr); g_free(filepath); #ifdef OB_POPUP_DYNAMIC_MENU_WITH_LCB g_free(linenumber); #endif /* OB_POPUP_DYNAMIC_MENU_WITH_LCB */ gtk_tree_path_free(treepath); } /* gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( gtk_menu_item_new() ) ); */ menu_item = gtk_menu_item_new_with_label(_("noop")); gtk_widget_show (menu_item); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_widget_show_all(menu); return menu; } static gboolean ob_lview_button_release_lcb( GtkWidget *widget, GdkEventButton *bevent, Toutputbox *ob ) { DEBUG_MSG("ob_view_button_release_lcb: event = %d\n", bevent->button); if (bevent->button == 3) { GtkWidget * menu = ob_lview_create_popup_menu(ob); if (menu) { gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } /* could we need to free menu ? */ }else if(bevent->button ==1) { ob_lview_current_cursor_open_file(NULL,ob, bevent -> state & GDK_CONTROL_MASK); } return FALSE; } /* kyanh, added, 20050227 Send some specific message to outputbox. Please DONOT use for general purpose :! @markup: should be: b, i, u */ void outputbox_message( Toutputbox *ob, const char *string, gint markup ) { DEBUG_MSG("outputbox_message: %s\n", string); GtkTreeIter iter; gtk_list_store_append( GTK_LIST_STORE( ob->lstore ), &iter ); gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 2, string, -1 ); if (markup) { gchar *tmpstr=g_strdup(""); if (markup & OB_MESSAGE_BLUE ) { tmpstr = g_strdup_printf("*****"); }else if (markup & OB_MESSAGE_RED) { tmpstr = g_strdup_printf("*****"); }else { tmpstr = g_strdup_printf("*****"); } #ifdef BOLD_ITALIC_TAKE_NO_EFFECTS if (markup & OB_MESSAGE_BOLD) { tmpstr = g_strdup_printf("%s", tmpstr); } if (markup & OB_MESSAGE_ITALIC) { tmpstr = g_strdup_printf("%s", tmpstr); } #endif /* BOLD_ITALIC_TAKE_NO_EFFECTS */ gtk_list_store_set( GTK_LIST_STORE( ob->lstore ), &iter, 0, tmpstr, -1 ); g_free(tmpstr); } /* TODO: Scroll as an Optional */ /* The Outputbox may *NOT* be shown before scrolling :) */ /* kyanh, added, 20050301 */ GtkTreePath *treepath = gtk_tree_model_get_path( GTK_TREE_MODEL( ob->lstore ), &iter ); gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW( ob->lview ), treepath, NULL, FALSE /* skip align */, 0, 0 ); gtk_tree_path_free( treepath ); flush_queue(); } #ifdef __KA_BACKEND__ /* when this function is call, the function continue_execute may be running :) */ static void clean_up_child_process (gint signal_number) { /* Clean up the child process. */ gint status; DEBUG_MSG("clean_up_child_process: starting...\n"); /* waitpid(-1,&status,WNOHANG); */ wait(&status); /* Store its exit status in a global variable. */ child_exit_status = status; DEBUG_MSG("clean_up_child_process: finished.\n"); } #endif /* __KA_BACKEND__ */ static void ob_notebook_switch_page_lcb(GtkNotebook *notebook, GtkNotebookPage *page, gint page_num, Tbfwin *bfwin) { Toutputbox *ob; ob = outputbox_get_box(bfwin, page_num); DEBUG_MSG("ob_notebook_switch_page_lcb: select page %d, %p\n", page_num, ob); if (ob && (ob->OB_FETCHING < OB_IS_READY)) { DEBUG_MSG("ob_notebook_switch_page_lcb: Stop TRUE, ob_fetching = %d\n", ob->OB_FETCHING); outputbox_set_status(ob, TRUE, TRUE); }else{ #ifdef DEBUG if(ob) { DEBUG_MSG("ob_notebook_switch_page_lcb: Stop FALSE, ob_fetching = %d\n", ob->OB_FETCHING); } #endif outputbox_set_status(ob, FALSE, TRUE); } } /* prepare frontent for outputbox */ static void outputbox_init_frontend(Tbfwin *bfwin) { #ifdef __KA_BACKEND__ /* Handle SIGCHLD by calling clean_up_child_process. */ struct sigaction sigchld_action; memset (&sigchld_action, 0, sizeof (sigchld_action)); sigchld_action.sa_handler = &clean_up_child_process; sigaction (SIGCHLD, &sigchld_action, NULL); #endif /* __KA_BACKEND__ */ DEBUG_MSG("outputbox_init_frontend: entering...\n"); /* create the hbox for ob */ bfwin->ob_hbox = gtk_hbox_new( FALSE, 0 ); gtk_paned_add2( GTK_PANED( bfwin->vpane ), bfwin->ob_hbox ); gtk_paned_set_position( GTK_PANED( bfwin->vpane ), ( gint ) ( bfwin->vpane->allocation.height * 0.7 ) ); /* notebook for ob */ bfwin->ob_notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(bfwin->ob_notebook), TRUE); gtk_notebook_set_show_border(GTK_NOTEBOOK(bfwin->ob_notebook), FALSE); gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(bfwin->ob_notebook), 0); /*deprecated*/ gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(bfwin->ob_notebook), 0); /*deprecated*/ gtk_notebook_set_tab_pos(GTK_NOTEBOOK(bfwin->ob_notebook),GTK_POS_LEFT); gtk_box_pack_start(GTK_BOX(bfwin->ob_hbox), bfwin->ob_notebook, TRUE, TRUE, 0); DEBUG_MSG("outputbox_init_frontend: added notebook %p\n", bfwin->ob_notebook); g_signal_connect(G_OBJECT(bfwin->ob_notebook),"switch-page",G_CALLBACK(ob_notebook_switch_page_lcb), bfwin); setup_toggle_item_from_widget( bfwin->menubar, N_( "/View/View Outputbox" ), TRUE ); } /* gboolean ob_lview_move_cursor_lcb(GtkTreeView *treeview,GtkMovementStep arg1,gint arg2,gpointer user_data) { DEBUG_MSG("ob_lview_move_cursor_lcb: hello.......................................................\n"); return TRUE; } */ #ifdef HAVE_VTE_TERMINAL GtkWidget *otuputbox_new_terminal_box ( Tbfwin *bfwin ) { if (!bfwin->ob_hbox) { outputbox_init_frontend(bfwin); } GtkWidget *terminal = vte_terminal_new (); /* scrolling */ GtkWidget *scrolwin = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolwin ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); /* vte terminal */ vte_terminal_fork_command (VTE_TERMINAL (terminal), "/bin/bash", NULL, NULL, g_get_home_dir (), FALSE, FALSE, FALSE); vte_terminal_set_font_from_string (VTE_TERMINAL (terminal), "Monospace 11"); vte_terminal_set_scroll_on_output (VTE_TERMINAL (terminal), FALSE); vte_terminal_set_scroll_on_keystroke (VTE_TERMINAL (terminal), TRUE); vte_terminal_set_mouse_autohide (VTE_TERMINAL (terminal), TRUE); gtk_container_add( GTK_CONTAINER( scrolwin ), terminal); GtkWidget *label = gtk_label_new(_("term")); gtk_notebook_append_page(GTK_NOTEBOOK(bfwin->ob_notebook), scrolwin, label); return terminal; } #endif /* HAVE_VTE_TERMINAL */ static Toutputbox *outputbox_new_box( Tbfwin *bfwin, const gchar *title ) { if (!bfwin->ob_hbox) { outputbox_init_frontend(bfwin); } /* create the backend */ GtkTreeViewColumn * column; GtkWidget *scrolwin; GtkCellRenderer *renderer; #ifdef OB_WITH_IMAGE GtkWidget *vbox2, *but, *image; #endif /* OB_WITH_IMAGE */ Toutputbox *ob; ob = g_new0( Toutputbox, 1 ); DEBUG_MSG( "init_output_box, created %p\n", ob ); ob->OB_FETCHING = OB_IS_READY; ob->bfwin = bfwin; ob->def = NULL; #ifdef __KA_BACKEND__ ob->pid=0; #endif /* LVIEW settings */ /* basename, linenumber, message, filename (hidden) */ ob->lstore = gtk_list_store_new ( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); ob->lview = gtk_tree_view_new_with_model( GTK_TREE_MODEL( ob->lstore ) ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW (ob->lview) , FALSE ); g_object_unref( ob->lstore ); /* the view widget now holds the only reference, if the view is destroyed, the model will be destroyed */ renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ( NULL, renderer, "markup", 0, NULL ); gtk_tree_view_append_column ( GTK_TREE_VIEW( ob->lview ), column ); column = gtk_tree_view_column_new_with_attributes ( NULL, renderer, "text", 1, NULL ); gtk_tree_view_append_column ( GTK_TREE_VIEW( ob->lview ), column ); column = gtk_tree_view_column_new_with_attributes ( NULL, renderer, "text", 2, NULL ); gtk_tree_view_append_column ( GTK_TREE_VIEW( ob->lview ), column ); /* g_signal_connect( G_OBJECT( ob->lview ), "row-activated", G_CALLBACK( ob_lview_row_activated_lcb ), ob ); */ g_signal_connect( G_OBJECT( ob->lview ), "button-release-event", G_CALLBACK( ob_lview_button_release_lcb ), ob ); /* g_signal_connect( G_OBJECT( ob->lview ), "move-cursor", G_CALLBACK( ob_lview_move_cursor_lcb ), ob ); */ /* end LVIEW settings */ #ifdef OB_WITH_IMAGE /* but button for closing ... */ vbox2 = gtk_vbox_new( FALSE, 0 ); but = gtk_button_new(); image = new_pixmap( 4 ); gtk_widget_show( image ); gtk_container_add( GTK_CONTAINER( but ), image ); gtk_container_set_border_width( GTK_CONTAINER( but ), 0 ); gtk_widget_set_size_request( but, 16, 16 ); g_signal_connect( G_OBJECT( but ), "clicked", G_CALLBACK( outputbox_close_clicked_lcb ), ob ); gtk_box_pack_start( GTK_BOX( ob->hbox ), vbox2, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), but, FALSE, FALSE, 0 ); #endif /* OB_WITH_IMAGE */ /* scrolling */ scrolwin = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolwin ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_container_add( GTK_CONTAINER( scrolwin ), ob->lview ); gtk_widget_set_size_request( scrolwin, 150, 150 ); /* TODO: autosize */ GtkWidget *label = gtk_label_new(title); ob->page_number = gtk_notebook_append_page(GTK_NOTEBOOK(ob->bfwin->ob_notebook), scrolwin, label); /* need eventboxgtk_tooltips_set_tip( main_v->tooltips, label, "asdfasdfasfsaf", NULL ); */ DEBUG_MSG("outputbox_new_box: added page %p\n", scrolwin); return ob; } void outputbox(Tbfwin *bfwin, gpointer *ob, const gchar *title, gchar *pattern, gint file_subpat, gint line_subpat, gint output_subpat, gchar *command, gint show_all_output ) { DEBUG_MSG("outputbox: starting...\n"); if ( *ob ) { setup_toggle_item_from_widget(bfwin->menubar, N_("/View/View Outputbox"), TRUE); /* fix BUG[200503]#25 */ /* GtkWidget *label = gtk_label_new(title); gtk_notebook_set_tab_label(label); */ } else { *ob = outputbox_new_box(bfwin,title); } gtk_widget_show_all( bfwin->ob_hbox ); gtk_notebook_set_current_page(GTK_NOTEBOOK(bfwin->ob_notebook), OUTPUTBOX(*ob)->page_number); if ( OUTPUTBOX(*ob)->OB_FETCHING < OB_IS_READY ) { /* stop older output box */ DEBUG_MSG("outputbox: current OB_FETCHING=%d < %d\n", OUTPUTBOX(*ob)->OB_FETCHING,OB_IS_READY); outputbox_message( *ob, _("tool is running. press Escape to stop it first."), OB_MESSAGE_RED ); flush_queue(); return; } gtk_list_store_clear( GTK_LIST_STORE( OUTPUTBOX(*ob)->lstore ) ); flush_queue(); if (!command) { /* TODO: check for valid command */ outputbox_message(*ob, _("empty command"), OB_MESSAGE_RED); return; } { gchar *format_str; if ( bfwin->project && ( bfwin->project->view_bars & MODE_PROJECT ) ) { format_str = g_strdup_printf(_("%s # project mode: ON"), command ); } else { format_str = g_strdup_printf(_("%s # project mode: OFF"), command); } outputbox_message( *ob, format_str, OB_MESSAGE_DEFAULTL ); g_free( format_str ); flush_queue(); } if (show_all_output & OB_NEED_SAVE_FILE) { file_save_cb( NULL, bfwin ); if ( !bfwin->current_document->filename ) { outputbox_message(*ob, _("file wasnot saved. tool canceled"), OB_MESSAGE_RED); flush_queue(); return; } } OUTPUTBOX(*ob)->basepath_cached = NULL; OUTPUTBOX(*ob)->basepath_cached_color = FALSE; OUTPUTBOX(*ob)->OB_FETCHING = OB_GO_FETCHING; OUTPUTBOX(*ob)->def = g_new0( Toutput_def, 1 ); OUTPUTBOX(*ob)->def->pattern = g_strdup( pattern ); OUTPUTBOX(*ob)->def->file_subpat = file_subpat; OUTPUTBOX(*ob)->def->line_subpat = line_subpat; OUTPUTBOX(*ob)->def->output_subpat = output_subpat; OUTPUTBOX(*ob)->def->show_all_output = show_all_output; OUTPUTBOX(*ob)->def->command = g_strdup( command ); DEBUG_MSG("outputbox: starting command: %s\n", command); #ifdef __BF_BACKEND__ const char *errptr; gint erroffset; OUTPUTBOX(*ob)->def->pcre_c = pcre_compile(OUTPUTBOX(*ob)->def->pattern, PCRE_UTF8,&errptr,&erroffset,NULL); if (OUTPUTBOX(*ob)->def->pcre_c == NULL) { { gchar *tmpstr; tmpstr = g_strdup_printf(_("failed to compile pattern %s"), OUTPUTBOX(*ob)->def->pattern); outputbox_message(*ob, tmpstr, OB_MESSAGE_RED); g_free(tmpstr); } /* free ob stuff */ OUTPUTBOX(*ob)->basepath_cached_color = FALSE; g_free( OUTPUTBOX(*ob)->basepath_cached ); g_free( OUTPUTBOX(*ob)->def->pattern ); pcre_free(OUTPUTBOX(*ob)->def->pcre_c); pcre_free(OUTPUTBOX(*ob)->def->pcre_s); g_free( OUTPUTBOX(*ob)->def->command ); g_free( OUTPUTBOX(*ob)->def ); OUTPUTBOX(*ob)->OB_FETCHING = OB_IS_READY; return; } OUTPUTBOX(*ob)->def->pcre_s = pcre_study(OUTPUTBOX(*ob)->def->pcre_c, 0,&errptr); #endif /* __BF_BACKEND__ */ #ifdef __KA_BACKEND__ regcomp( &OUTPUTBOX(*ob)->def->preg, OUTPUTBOX(*ob)->def->pattern, REG_EXTENDED ); #endif /* __BF_BACKEND__ */ #ifdef __KA_BACKEND__ /* kyanh */ OUTPUTBOX(*ob)->retfile = NULL; OUTPUTBOX(*ob)->io_channel = NULL; OUTPUTBOX(*ob)->pollID = 0; OUTPUTBOX(*ob)->pid = 0; #endif /* __KA_BACKEND__ */ run_command(*ob); if (OUTPUTBOX(*ob)->OB_FETCHING == OB_ERROR) { OUTPUTBOX(*ob)->OB_FETCHING = OB_IS_READY; } /* gtk_widget_show_all(ob->hbox); */ DEBUG_MSG("outputbox: finished\n"); } /* this function call from gui.c (when program exist) and from menu (toggle). for that, the `ob' may be NULL; */ void outputbox_stop(Toutputbox *ob) { if (!ob) { return; } DEBUG_MSG("outputbox_stop: starting...\n"); /* menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), FALSE); */ /* flush_queue(); */ if (ob->OB_FETCHING == OB_GO_FETCHING || ob->OB_FETCHING == OB_IS_FETCHING) { #ifdef __KA_BACKEND__ if (ob->pid) { #endif /* __KA_BACKEND__ */ #if __BF_BACKEND__ if (ob->handle->child_pid) {/* TODO: why check for ob? */ #endif /* __BF_BACKEND__ */ ob->OB_FETCHING = OB_STOP_REQUEST; outputbox_message(ob, _("stop request. stopping tool..."), OB_MESSAGE_RED); #ifdef __KA_BACKEND__ finish_execute(ob); #endif /* __KA_BACKEND__ */ } } DEBUG_MSG("outputbox_stop: fisnised.\n"); } Toutputbox *outputbox_get_box (Tbfwin *bfwin, guint page) { Toutputbox *ob; ob = OUTPUTBOX(bfwin->outputbox); if (ob && (ob->page_number == page)) { return ob; #ifdef EXTERNAL_FIND #ifdef EXTERNAL_GREP }else { ob = OUTPUTBOX(bfwin->grepbox); if (ob && (ob->page_number == page)) { return ob; }else{ ob = OUTPUTBOX(bfwin->templatebox); if (ob && (ob->page_number == page)) { return ob; } } #endif /* EXTERNAL_GREP */ #endif /* EXTERNAL_FIND */ } return NULL; } void outputbox_set_status(Toutputbox *ob, gboolean status, gboolean force) { if (!ob) { return ;} gint cur_page; cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(ob->bfwin->ob_notebook)); if (force) { menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), status); }else{/* force FALSE ==> call by outputbox backend, for e.g., outputbox_bf.c::finish_excute() */ if (ob->page_number == cur_page) { menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), status); } GtkWidget *tab_label, *child_widget; child_widget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(ob->bfwin->ob_notebook), ob->page_number); tab_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(ob->bfwin->ob_notebook), child_widget); GdkColor colorred = {0,0,0,65535}; GdkColor colorblack = {0,0,0,0}; if ( status ) { DEBUG_MSG("outputbox_set_status: red color\n"); gtk_widget_modify_fg( tab_label, GTK_STATE_NORMAL, &colorred ); gtk_widget_modify_fg( tab_label, GTK_STATE_PRELIGHT, &colorred ); gtk_widget_modify_fg( tab_label, GTK_STATE_ACTIVE, &colorred ); } else { DEBUG_MSG("outputbox_set_status: normal status\n"); gtk_widget_modify_fg( tab_label, GTK_STATE_NORMAL, &colorblack ); gtk_widget_modify_fg( tab_label, GTK_STATE_PRELIGHT, &colorblack ); gtk_widget_modify_fg( tab_label, GTK_STATE_ACTIVE, &colorblack ); } } } winefish-1.3.3/src/outputbox.h0000600000047200004720000000620010377754204015350 0ustar kyanhkyanh/* $Id: outputbox.h 2059 2006-02-25 04:09:40Z kyanh $ */ /* void outputbox_init(Tbfwin *bfwin,GtkWidget *vbox); */ #ifndef __OUTPUTBOX_H_ #define __OUTPUTBOX_H_ #include "outputbox_cfg.h" /* in order to HIDE/SHOW the output box, we must export Toutputbox, so that gui.c can regcornizes this type... */ #define NUM_MATCH 30 /* Status of executing a tool 0: continue fetching data from channel; 1: fetching; return [ do nothing ] in continue_execute 2: 'stop' signal from user; 3: stopped; 4: ready to start; */ enum { OB_GO_FETCHING = 1 << 0, /* 0 */ OB_IS_FETCHING = 1 << 1, OB_STOP_REQUEST = 1 << 2, /* 2 */ OB_IS_STOPPED = 1 << 3, OB_ERROR = 1<< 4, OB_IS_READY = 1 << 5/* highest value */ }; enum { OB_NEED_SAVE_FILE = 1<<0, /* need save file */ OB_SHOW_ALL_OUTPUT = 1<<1 /* show all output */ }; enum { OB_MESSAGE_BOLD=1<<0, OB_MESSAGE_ITALIC=1<<1, OB_MESSAGE_RED=1<<2, OB_MESSAGE_BLUE=1<<3, OB_MESSAGE_DEFAULTL=1<<4 }; typedef struct { gchar *command; gchar *pattern; gint file_subpat; gint line_subpat; gint output_subpat; gint show_all_output; regmatch_t pmatch[ NUM_MATCH ]; #ifdef __KA_BACKEND__ regex_t preg; #endif /* __KA_BACKEND__ */ #ifdef __BF_BACKEND__ pcre *pcre_c; pcre_extra *pcre_s; #endif /* __BF_BACKEND__ */ } Toutput_def; #ifdef __BF_BACKEND__ typedef struct { gint refcount; /* Tbfwin *bfwin; */ /* const gchar *formatstring; */ gchar *commandstring; gchar *securedir; /* if we need any local temporary files for input or output we'll use fifo's */ gchar *fifo_in; gchar *fifo_out; gchar *tmp_in; gchar *tmp_out; gchar *inplace; gboolean pipe_in; gboolean pipe_out; gboolean include_stderr; GIOChannel* channel_in; gchar *buffer_out; gchar *buffer_out_position; GIOChannel* channel_out; GIOFunc channel_out_lcb; gpointer channel_out_data; GPid child_pid; gpointer data; gpointer ob; /* kyanh, added, 20060124 */ } Texternalp; #define EXTERNALP(var) ((Texternalp *)(var)) #endif typedef struct { gint OB_FETCHING; GtkListStore *lstore; GtkWidget *lview; /* ~> GtkTreeView */ /* GtkWidget *hbox; *//* handle => add close button */ gint page_number; Toutput_def *def; Tbfwin *bfwin; gchar *basepath_cached; gint basepath_cached_color; #ifdef __KA_BACKEND__ /* kyanh, added, 20050220 */ guint pollID; gchar *retfile; gint pid; /* kyanh, added, 20050226, pid of command */ GIOChannel *io_channel; #endif #ifdef __BF_BACKEND__ Texternalp *handle; #endif } Toutputbox; #define OUTPUTBOX(var) ((Toutputbox *)(var)) void outputbox( /*ob frontend */ Tbfwin *bfwin, gpointer *ob, const gchar *title, /* output */ gchar *pattern, gint file_subpat, gint line_subpat, gint output_subpat, gchar *command, gint show_all_output ); void outputbox_stop (Toutputbox *ob); void outputbox_message( Toutputbox *ob, const char *string, gint markup ); #ifdef HAVE_VTE_TERMINAL GtkWidget * otuputbox_new_terminal_box ( Tbfwin *bfwin ); #endif /* HAVE_VTE_TERMINAL */ /* Toutputbox *outputbox_new_box( Tbfwin *bfwin, const gchar *title ); */ Toutputbox *outputbox_get_box( Tbfwin *bfwin, guint page); void outputbox_set_status( Toutputbox *ob, gboolean status, gboolean force); #endif /* __OUTPUTBOX_H_ */ winefish-1.3.3/src/image.c0000600000047200004720000002430410373411041014342 0ustar kyanhkyanh/* $Id: image.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* * Modified for Winefish (C) 2005 Ky Anh */ #include #include /*#define DEBUG*/ #include "bluefish.h" #include "html_diag.h" #include "document.h" #include "gtk_easy.h" #include "bf_lib.h" #include "stringlist.h" typedef struct { Thtml_diag *dg; GtkWidget *frame; GdkPixbuf *pb; GtkWidget *im; /* and some options for the thumbnails */ /* kyanh, removed, 20050219 gboolean is_thumbnail; */ GtkAdjustment *adjustment; /* no-widget object */ /* kyanh, removed, 20050225, guint adj_changed_id; */ } Timage_diag; void image_diag_destroy_cb(GtkWidget * widget, Timage_diag *imdg) { html_diag_destroy_cb(widget,imdg->dg); /* destroy the dialog */ if (imdg->pb) { g_object_unref(imdg->pb); /* destroy the image (PixBuf Object) */ } g_free(imdg); } static void image_insert_dialogok_lcb(GtkWidget * widget, Timage_diag *imdg) { gchar *finalstring,*scale,*caption,*label; finalstring = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[3]), 0, -1); if (strlen(finalstring) ==0) { DEBUG_MSG("image_insert_dialogok_lcb: empty relative path; use the absolute one.\n"); finalstring = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[0]), 0, -1); } label = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[1]), 0, -1); caption = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[2]), 0, -1); if (strlen(label) && (strcmp(label,"fig:") != 0) ) { label = g_strconcat("\n\\label{",label,"}",NULL); } else { /* remove label=fig: */ label = g_strdup(""); } if (strcmp(caption,"")!=0) { caption = g_strconcat("\n\\caption{",caption,"}",NULL); } scale = g_strdup_printf("scale=%.2f",imdg->adjustment->value); /* fix BUG#27 */ finalstring = g_strconcat("\\begin{figure}[htb]\n\\begin{center}\n\\ifpdf\n\t\\includegraphics[",scale,"]{",finalstring,"}\n\\else\n%\t\\includegraphics[",scale,"]{",finalstring,"}\n\\fi",caption,label,"\n\\end{center}\n\\end{figure}",NULL); g_free(scale); g_free(label); g_free(caption); doc_insert_two_strings(imdg->dg->doc, finalstring, NULL); g_free(finalstring); image_diag_destroy_cb(NULL, imdg); } void image_diag_cancel_clicked_cb(GtkWidget *widget, gpointer data) { image_diag_destroy_cb(NULL, data); } static void image_filename_changed(GtkWidget * widget, Timage_diag *imdg) { /* kyanh, add checking G_FILE_TEST_EXISTS, 20050225 if file doesnot exist (for e.g., when user enters some stupid char in text box), although gdk_pixbuf_new_from_file() return NULL (NO ERROR:), we still receive some GLib-GObject-CRITICAL ERROR when the progam exits. Here we can user the ERRORS CODE returned by gdk_pixbuf_new_from_file (FILE ERROR or PIX_ERROR) */ /* if (g_file_test(gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[0]), 0, -1),G_FILE_TEST_EXISTS)) { */ gint pb_width, pd_height, toobig; GdkPixbuf *tmp_pb; DEBUG_MSG("image_filename_changed() started. GTK_IS_WIDGET(imdg->im) == %d\n", GTK_IS_WIDGET(imdg->im)); if (imdg->pb) { g_object_unref(imdg->pb); } imdg->pb = gdk_pixbuf_new_from_file(gtk_entry_get_text(GTK_ENTRY(imdg->dg->entry[0])), NULL); if (!imdg->pb) { return; } toobig = 1; pb_width = gdk_pixbuf_get_width(imdg->pb); if ((pb_width / 250) > toobig) { toobig = pb_width / 250; } pd_height = gdk_pixbuf_get_height(imdg->pb); if ((pd_height / 300) > toobig) { toobig = pd_height / 300; } tmp_pb = gdk_pixbuf_scale_simple(imdg->pb, (pb_width / toobig), (pd_height / toobig), /* kyanh, removed, 20020220, main_v->props.image_thumbnail_refresh_quality ? */ GDK_INTERP_BILINEAR /* :GDK_INTERP_NEAREST */); if (GTK_IS_WIDGET(imdg->im)) { DEBUG_MSG("imdg->im == %p\n", imdg->im); DEBUG_MSG("gtk_widget_destroy() %p\n", imdg->im); gtk_widget_destroy(imdg->im); } imdg->im = gtk_image_new_from_pixbuf(tmp_pb); g_object_unref(tmp_pb); gtk_container_add(GTK_CONTAINER(imdg->frame), imdg->im); /* Update Relative Path */ gchar *relpath; relpath = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[0]),0,-1); if (imdg->dg->bfwin->project) { relpath = create_relative_link_to(imdg->dg->bfwin->project->basedir,relpath); } else { relpath = create_relative_link_to(imdg->dg->doc->filename,relpath); } if (!relpath) { relpath = gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[0]),0,-1); } DEBUG_MSG("relpath: %s\n",relpath); gtk_entry_set_text(GTK_ENTRY(imdg->dg->entry[3]),relpath); g_free(relpath); /* Show the widget */ gtk_widget_show(imdg->im); DEBUG_MSG("imdg->im == %p\n", imdg->im); DEBUG_MSG("image_filename_changed() finished. GTK_IS_WIDGET(imdg->im) == %d\n", GTK_IS_WIDGET(imdg->im)); } static void image_adjust_changed(GtkAdjustment * adj, Timage_diag *imdg) { /* if (g_file_test(gtk_editable_get_chars(GTK_EDITABLE(imdg->dg->entry[0]), 0, -1),G_FILE_TEST_EXISTS)) { */ GdkPixbuf *tmp_pb; gint tn_width, tn_height; DEBUG_MSG("image_adjust_changed started. GTK_IS_WIDGET(imdg->im) == %d\n", GTK_IS_WIDGET(imdg->im)); if (!imdg->pb) { image_filename_changed(NULL, imdg); return; } tn_width = imdg->adjustment->value * gdk_pixbuf_get_width(imdg->pb); tn_height = imdg->adjustment->value * gdk_pixbuf_get_height(imdg->pb); tmp_pb = gdk_pixbuf_scale_simple(imdg->pb, tn_width, tn_height, /* kyanh, removed, 20020220, main_v->props.image_thumbnail_refresh_quality ? */ GDK_INTERP_BILINEAR /*: GDK_INTERP_NEAREST */); if (GTK_IS_WIDGET(imdg->im)) { DEBUG_MSG("imdg->im == %p\n", imdg->im); DEBUG_MSG("gtk_widget_destroy() %p\n", imdg->im); gtk_widget_destroy(imdg->im); } imdg->im = gtk_image_new_from_pixbuf(tmp_pb); g_object_unref(tmp_pb); gtk_container_add(GTK_CONTAINER(imdg->frame), imdg->im); gtk_widget_show(imdg->im); DEBUG_MSG("image_adjust_changed finished. GTK_IS_WIDGET(imdg->im) == %d\n", GTK_IS_WIDGET(imdg->im)); } void image_insert_dialog_backend(gchar *filename,Tbfwin *bfwin, Ttagpopup *data,/* kyanh, tobe removed */gboolean is_thumbnail) { gchar *tagvalues[6]; gchar *custom = NULL; Timage_diag *imdg; GtkWidget *dgtable; imdg = g_new(Timage_diag, 1); imdg->pb = NULL; imdg->im = NULL; /* kyanh, removed, 20050219 imdg->is_thumbnail = is_thumbnail; */ imdg->dg = html_diag_new(bfwin,_("Insert image")); { /* kyanh, because it is 'static', the value can pass through ...? */ static gchar *tagitems[] = {"src","label","caption","scale","relsrc", NULL }; fill_dialogvalues(tagitems, tagvalues, &custom, (Ttagpopup *) data, imdg->dg); } imdg->frame = gtk_frame_new(_("Preview")); /* gtk_widget_set_usize(imdg->frame, -1, 50);*/ gtk_box_pack_start(GTK_BOX(imdg->dg->vbox), imdg->frame, TRUE, TRUE, 0); /* SCALING */ GtkWidget *scale; imdg->adjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.5/*init*/, 0.0001/*min*/, 1.1/*max*/, 0.001/*small step*/, 0.1/*bigstep*/, 0.1/*pagesize*/)); scale = gtk_hscale_new(imdg->adjustment); /* kyanh, removed unused variable, 20050225 imdg->adj_changed_id = */ g_signal_connect(G_OBJECT(imdg->adjustment), "value_changed", G_CALLBACK(image_adjust_changed), imdg); gtk_scale_set_digits(GTK_SCALE(scale), 3); gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_DISCONTINUOUS); gtk_box_pack_start(GTK_BOX(imdg->dg->vbox), scale, FALSE, FALSE, 0); dgtable = html_diag_table_in_vbox(imdg->dg, 5, 9); /* rows, cols */ if (filename) { imdg->dg->entry[0] = entry_with_text(filename, 1024); DEBUG_MSG("image_insert: from filebrowser.\n"); } else { imdg->dg->entry[0] = entry_with_text(tagvalues[0], 1024); } bf_mnemonic_label_tad_with_alignment(_("_Image location:"), imdg->dg->entry[0], 0, 0.5, dgtable, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(dgtable), imdg->dg->entry[0], 1, 7, 0, 1); gtk_table_attach_defaults(GTK_TABLE(dgtable), file_but_new(imdg->dg->entry[0], 1, bfwin), 7, 9, 0, 1); g_signal_connect(G_OBJECT(imdg->dg->entry[0]), "changed", G_CALLBACK(image_filename_changed), imdg); imdg->dg->entry[3] = entry_with_text(tagvalues[4], 1024); bf_mnemonic_label_tad_with_alignment(_("Relative Path:"), imdg->dg->entry[3], 0, 0.5, dgtable, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(dgtable), imdg->dg->entry[3], 1, 7, 1, 2); imdg->dg->entry[1] = entry_with_text(tagvalues[1], 1024); bf_mnemonic_label_tad_with_alignment(_("Label:"), imdg->dg->entry[1], 0, 0.5, dgtable, 0, 1, 2, 3); gtk_table_attach_defaults(GTK_TABLE(dgtable), imdg->dg->entry[1], 1, 7, 2, 3); gtk_entry_set_text(GTK_ENTRY(imdg->dg->entry[1]),"fig:"); imdg->dg->entry[2] = entry_with_text(tagvalues[2], 1024); bf_mnemonic_label_tad_with_alignment(_("Caption:"), imdg->dg->entry[2], 0, 0.5, dgtable, 0, 1, 3, 4); gtk_table_attach_defaults(GTK_TABLE(dgtable), imdg->dg->entry[2], 1, 7, 3, 4); if (filename/* kyanh, removed, 20050226, || tagvalues[0] */) { /* BUG[200502]#8 */ g_signal_emit_by_name(G_OBJECT(imdg->dg->entry[0]), "changed"/*, imdg*/); } { /* the function image_diag_finish() */ /* add CANCEL and OK buttons */ GtkWidget *hbox; hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), gtk_hseparator_new(), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(imdg->dg->vbox), hbox, FALSE, FALSE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); imdg->dg->obut = bf_stock_ok_button(G_CALLBACK(image_insert_dialogok_lcb), imdg); imdg->dg->cbut = bf_stock_cancel_button(G_CALLBACK(image_diag_cancel_clicked_cb), imdg); gtk_box_pack_start(GTK_BOX(hbox),imdg->dg->cbut , FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox),imdg->dg->obut , FALSE, FALSE, 0); gtk_window_set_default(GTK_WINDOW(imdg->dg->dialog), imdg->dg->obut); gtk_box_pack_start(GTK_BOX(imdg->dg->vbox), hbox, FALSE, FALSE, 0); gtk_widget_show_all(GTK_WIDGET(imdg->dg->dialog)); } /* TODO: removed */ if (custom) { g_free(custom); } } /* two instances of image_insert_dialog_backend */ void image_insert_dialog(Tbfwin *bfwin, Ttagpopup *data) { image_insert_dialog_backend(NULL, bfwin, data, FALSE); } void image_insert_from_filename(Tbfwin *bfwin, gchar *filename) { image_insert_dialog_backend(filename,bfwin, NULL, FALSE); } winefish-1.3.3/src/fref.c0000600000047200004720000022107510372322023014206 0ustar kyanhkyanh/* $Id: fref.c 1774 2006-02-08 07:56:03Z kyanh $ */ /* * fref.c - function reference file * Modified for Winefish (C) 2005 Ky Anh * * * indent --line-length 100 --k-and-r-style --tab-size 4 -bbo --ignore-newlines */ #include #include #include /* #define DEBUG */ #include "bluefish.h" #include "fref.h" #include "rcfile.h" /* array_from_arglist() */ #include "stringlist.h" #include "document.h" #include "bf_lib.h" #include "gtk_easy.h" #include "char_table.h" #include "treetips.h" enum { FREF_ACTION_INSERT, FREF_ACTION_DIALOG, FREF_ACTION_INFO }; enum { FREF_IT_DESC, FREF_IT_ATTRS, FREF_IT_NOTES }; enum { STR_COLUMN, PTR_COLUMN, FILE_COLUMN, N_COLUMNS }; #define FR_TYPE_TAG 1 #define FR_TYPE_FUNCTION 2 #define FR_TYPE_CLASS 3 #define FR_TYPE_GROUP 4 #define MAX_NEST_LEVEL 20 typedef struct { gpointer data; Tbfwin *bfwin; } Tcallbackdata; typedef struct { gchar *name; gchar *title; gchar *description; gchar *def_value; gboolean required; gboolean has_list; gchar *values; GtkWidget *dlg_item; } FRAttrInfo; typedef struct { gchar *name; gchar *title; gchar *description; gchar *def_value; gchar *type; gboolean required; gboolean has_list; gchar *values; GtkWidget *dlg_item; } FRParamInfo; typedef struct { gchar type; gchar *name; gchar *description; gchar *tip; gchar *return_type; /* if function */ gchar *return_description; /* if function */ GList *attributes; GList *params; GList *methods; gchar *info_text; gchar *info_title; gchar *dialog_text; gchar *dialog_title; gchar *insert_text; } FRInfo; typedef struct { FRInfo *act_info; FRInfo *act_grp; FRAttrInfo *act_attr; FRParamInfo *act_param; GtkWidget *tree; GtkTreeStore *store; GtkTreeIter grp_parent[MAX_NEST_LEVEL]; gint nest_level; GtkTreeIter parent; gint state; gint pstate; gint vstate; GHashTable *dict; } FRParseAux; #define FR_LOADER_STATE_NONE 1 #define FR_LOADER_STATE_TAG 2 #define FR_LOADER_STATE_FUNC 3 #define FR_LOADER_STATE_CLASS 4 #define FR_LOADER_STATE_ATTR 5 #define FR_LOADER_STATE_PARAM 6 #define FR_LOADER_STATE_TIP 7 #define FR_LOADER_STATE_DESCR 8 #define FR_LOADER_STATE_INFO 9 #define FR_LOADER_STATE_DIALOG 10 #define FR_LOADER_STATE_INSERT 11 #define FR_LOADER_STATE_VALLIST 12 #define FR_LOADER_STATE_RETURN 13 #define FR_LOADER_STATE_GROUPDESC 14 #define FR_INFO_TITLE 1 #define FR_INFO_DESC 2 #define FR_INFO_ATTRS 3 #define FR_INFO_NOTES 4 #define FR_COL_1 "#4B6983" #define FR_COL_2 "#7590AE" #define FR_COL_3 "#666666" #define FR_COL_4 "#FFFFFF" GtkWidget *fref_prepare_dialog(Tbfwin * bfwin, FRInfo * entry); typedef struct { GtkWidget *tree; GtkTooltips *argtips; GtkWidget *infocheck; GtkWidget *infoview; GtkWidget *infoscroll; Tbfwin *bfwin; TreeTips *tips; } Tfref_gui; #define FREFGUI(var) ((Tfref_gui *)(var)) typedef struct { GtkTreeStore *store; GHashTable *refcount; /* Opened reference count */ } Tfref_data; #define FREFDATA(var) ((Tfref_data *)(var)) typedef struct { gchar *name; gchar *description; } Tfref_name_data; #ifdef DEBUG static void free_with_print(gpointer ptr) { DEBUG_MSG("free_wp: free'ing %p\n", ptr); g_free(ptr); } #endif void fref_free_info(FRInfo * info) { FRAttrInfo *tmpa; FRParamInfo *tmpp; GList *lst; DEBUG_MSG("fref_free_info, freeing info->name=%s\n", info->name); g_free(info->name); g_free(info->description); g_free(info->tip); g_free(info->return_type); g_free(info->return_description); g_free(info->info_text); g_free(info->info_title); g_free(info->dialog_text); g_free(info->dialog_title); g_free(info->insert_text); if (info->attributes) { lst = g_list_first(info->attributes); while (lst) { tmpa = (FRAttrInfo *) lst->data; g_free(tmpa->name); g_free(tmpa->title); g_free(tmpa->description); g_free(tmpa->def_value); g_free(tmpa->values); g_free(tmpa); lst = g_list_next(lst); } g_list_free(info->attributes); } /* attributes */ if (info->params) { lst = g_list_first(info->params); while (lst) { tmpp = (FRParamInfo *) lst->data; g_free(tmpp->name); g_free(tmpp->title); g_free(tmpp->description); g_free(tmpp->def_value); g_free(tmpp->type); g_free(tmpp->values); g_free(tmpp); lst = g_list_next(lst); } g_list_free(info->params); } /* params */ /* methods */ g_free(info); } void fref_name_loader_start_element(GMarkupParseContext * context, const gchar * element_name, const gchar ** attribute_names, const gchar ** attribute_values, gpointer user_data, GError ** error) { GHashTable *attrs; int i; Tfref_name_data *data; gchar *tmps; if (user_data == NULL) return; data = (Tfref_name_data *) user_data; attrs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); i = 0; while (attribute_names[i] != NULL) { g_hash_table_insert(attrs, (gpointer) g_strdup(attribute_names[i]), (gpointer) g_strdup(attribute_values[i])); i++; } if (strcmp(element_name, "ref") == 0) { tmps = g_hash_table_lookup(attrs, "name"); if (tmps != NULL) data->name = g_strdup(tmps); tmps = g_hash_table_lookup(attrs, "description"); if (tmps != NULL) data->description = g_strdup(tmps); } g_hash_table_destroy(attrs); } void fref_loader_start_element(GMarkupParseContext * context, const gchar * element_name, const gchar ** attribute_names, const gchar ** attribute_values, gpointer user_data, GError ** error) { FRParseAux *aux; FRInfo *info; FRAttrInfo *tmpa; FRParamInfo *tmpp; GHashTable *attrs; int i; gpointer pomstr; GtkTreeIter iter; GtkTreeRowReference *rref; GtkTreePath *path = NULL; gchar *string = NULL; if (user_data == NULL) return; aux = (FRParseAux *) user_data; attrs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); i = 0; while (attribute_names[i] != NULL) { g_hash_table_insert(attrs, (gpointer) g_strdup(attribute_names[i]), (gpointer) g_strdup(attribute_values[i])); i++; } switch (aux->state) { case FR_LOADER_STATE_NONE: if (strcmp(element_name, "group") == 0) { if (aux->nest_level < MAX_NEST_LEVEL) { info = g_new0(FRInfo, 1); info->type = FR_TYPE_GROUP; info->name = g_strdup(g_hash_table_lookup(attrs, "name")); gtk_tree_store_append(aux->store, &iter, &aux->parent); string = g_strdup(g_hash_table_lookup(attrs, "name")); gtk_tree_store_set(aux->store, &iter, STR_COLUMN, string, FILE_COLUMN, NULL, PTR_COLUMN, info, -1); g_free (string); aux->grp_parent[aux->nest_level] = aux->parent; aux->parent = iter; } else g_warning("Maximum nesting level reached!"); (aux->nest_level)++; } else if (strcmp(element_name, "description") == 0) { /* group description */ FRInfo *tmpinfo; gtk_tree_model_get(GTK_TREE_MODEL(aux->store), &aux->parent, PTR_COLUMN, &tmpinfo, -1); if (tmpinfo != NULL) { aux->pstate = FR_LOADER_STATE_NONE; aux->state = FR_LOADER_STATE_GROUPDESC; } } else if (strcmp(element_name, "tag") == 0) { aux->state = FR_LOADER_STATE_TAG; aux->pstate = FR_LOADER_STATE_NONE; info = g_new0(FRInfo, 1); info->type = FR_TYPE_TAG; info->name = g_strdup(g_hash_table_lookup(attrs, "name")); gtk_tree_store_append(aux->store, &iter, &aux->parent); gtk_tree_store_set(aux->store, &iter, STR_COLUMN, info->name, PTR_COLUMN, info, FILE_COLUMN, NULL, -1); aux->act_info = info; path = gtk_tree_model_get_path(GTK_TREE_MODEL(aux->store), &iter); rref = gtk_tree_row_reference_new(GTK_TREE_MODEL(aux->store), path); g_hash_table_insert(aux->dict, g_strdup(info->name), rref); } else if (strcmp(element_name, "function") == 0) { aux->state = FR_LOADER_STATE_FUNC; aux->pstate = FR_LOADER_STATE_NONE; info = g_new0(FRInfo, 1); info->type = FR_TYPE_FUNCTION; info->name = g_strdup(g_hash_table_lookup(attrs, "name")); gtk_tree_store_append(aux->store, &iter, &aux->parent); gtk_tree_store_set(aux->store, &iter, STR_COLUMN, info->name, PTR_COLUMN, info, -1); aux->act_info = info; path = gtk_tree_model_get_path(GTK_TREE_MODEL(aux->store), &iter); rref = gtk_tree_row_reference_new(GTK_TREE_MODEL(aux->store), path); g_hash_table_insert(aux->dict, g_strdup(info->name), rref); } else if (strcmp(element_name, "class") == 0) { aux->state = FR_LOADER_STATE_CLASS; aux->pstate = FR_LOADER_STATE_NONE; info = g_new0(FRInfo, 1); info->type = FR_TYPE_CLASS; info->name = g_strdup(g_hash_table_lookup(attrs, "name")); gtk_tree_store_append(aux->store, &iter, &aux->parent); gtk_tree_store_set(aux->store, &iter, STR_COLUMN, info->name, PTR_COLUMN, info, -1); aux->act_info = info; path = gtk_tree_model_get_path(GTK_TREE_MODEL(aux->store), &iter); rref = gtk_tree_row_reference_new(GTK_TREE_MODEL(aux->store), path); g_hash_table_insert(aux->dict, g_strdup(info->name), rref); } else if (strcmp(element_name, "ref") == 0) { } else g_warning("FREF Config Error: Unknown element %s", element_name); break; /* state NONE */ case FR_LOADER_STATE_TAG: if (strcmp(element_name, "description") == 0) { aux->state = FR_LOADER_STATE_DESCR; aux->pstate = FR_LOADER_STATE_TAG; } else if (strcmp(element_name, "tip") == 0) { aux->state = FR_LOADER_STATE_TIP; aux->pstate = FR_LOADER_STATE_TAG; } else if (strcmp(element_name, "attribute") == 0) { aux->state = FR_LOADER_STATE_ATTR; aux->pstate = FR_LOADER_STATE_TAG; tmpa = g_new0(FRAttrInfo, 1); tmpa->name = g_strdup(g_hash_table_lookup(attrs, "name")); tmpa->title = g_strdup(g_hash_table_lookup(attrs, "title")); pomstr = g_hash_table_lookup(attrs, "required"); if (pomstr != NULL && (g_strcasecmp(pomstr, "y") == 0 || g_strcasecmp(pomstr, "1") == 0)) tmpa->required = TRUE; else tmpa->required = FALSE; pomstr = g_hash_table_lookup(attrs, "vallist"); if (pomstr != NULL && (g_strcasecmp(pomstr, "y") == 0 || g_strcasecmp(pomstr, "1") == 0)) tmpa->has_list = TRUE; else tmpa->has_list = FALSE; tmpa->def_value = g_strdup(g_hash_table_lookup(attrs, "default")); aux->act_attr = tmpa; aux->act_info->attributes = g_list_append(aux->act_info->attributes, tmpa); } else if (strcmp(element_name, "dialog") == 0) { aux->state = FR_LOADER_STATE_DIALOG; aux->pstate = FR_LOADER_STATE_TAG; aux->act_info->dialog_title = g_strdup(g_hash_table_lookup(attrs, "title")); } else if (strcmp(element_name, "info") == 0) { aux->state = FR_LOADER_STATE_INFO; aux->pstate = FR_LOADER_STATE_TAG; aux->act_info->info_title = g_strdup(g_hash_table_lookup(attrs, "title")); } else if (strcmp(element_name, "insert") == 0) { aux->state = FR_LOADER_STATE_INSERT; aux->pstate = FR_LOADER_STATE_TAG; } else g_warning("FREF Config Error: Unknown tag (%s)", element_name); break; /* state TAG */ case FR_LOADER_STATE_FUNC: if (strcmp(element_name, "description") == 0) { aux->state = FR_LOADER_STATE_DESCR; aux->pstate = FR_LOADER_STATE_FUNC; } else if (strcmp(element_name, "tip") == 0) { aux->state = FR_LOADER_STATE_TIP; aux->pstate = FR_LOADER_STATE_FUNC; } else if (strcmp(element_name, "param") == 0) { aux->state = FR_LOADER_STATE_PARAM; aux->pstate = FR_LOADER_STATE_FUNC; tmpp = g_new0(FRParamInfo, 1); tmpp->name = g_strdup(g_hash_table_lookup(attrs, "name")); tmpp->title = g_strdup(g_hash_table_lookup(attrs, "title")); pomstr = g_hash_table_lookup(attrs, "required"); if (pomstr != NULL && (g_strcasecmp(pomstr, "y") == 0 || g_strcasecmp(pomstr, "1") == 0)) tmpp->required = TRUE; else tmpp->required = FALSE; pomstr = g_hash_table_lookup(attrs, "vallist"); if (pomstr != NULL && (g_strcasecmp(pomstr, "y") == 0 || g_strcasecmp(pomstr, "1") == 0)) tmpp->has_list = TRUE; else tmpp->has_list = FALSE; tmpp->def_value = g_strdup(g_hash_table_lookup(attrs, "default")); tmpp->type = g_strdup(g_hash_table_lookup(attrs, "type")); aux->act_param = tmpp; aux->act_info->params = g_list_append(aux->act_info->params, tmpp); } else if (strcmp(element_name, "return") == 0) { aux->state = FR_LOADER_STATE_RETURN; aux->pstate = FR_LOADER_STATE_FUNC; aux->act_info->return_type = g_strdup(g_hash_table_lookup(attrs, "type")); } else if (strcmp(element_name, "dialog") == 0) { aux->state = FR_LOADER_STATE_DIALOG; aux->pstate = FR_LOADER_STATE_FUNC; aux->act_info->dialog_title = g_strdup(g_hash_table_lookup(attrs, "title")); } else if (strcmp(element_name, "info") == 0) { aux->state = FR_LOADER_STATE_INFO; aux->pstate = FR_LOADER_STATE_FUNC; aux->act_info->info_title = g_strdup(g_hash_table_lookup(attrs, "title")); } else if (strcmp(element_name, "insert") == 0) { aux->state = FR_LOADER_STATE_INSERT; aux->pstate = FR_LOADER_STATE_FUNC; } else g_warning("FREF Config Error: Unknown tag (%s)", element_name); break; /* state FUNC */ case FR_LOADER_STATE_ATTR: if (strcmp(element_name, "vallist") == 0) { aux->state = FR_LOADER_STATE_VALLIST; aux->vstate = FR_LOADER_STATE_ATTR; } else g_warning("FREF Config Error: Unknown tag (%s)", element_name); break; /* state ATTR */ case FR_LOADER_STATE_PARAM: if (strcmp(element_name, "vallist") == 0) { aux->state = FR_LOADER_STATE_VALLIST; aux->vstate = FR_LOADER_STATE_PARAM; } else g_warning("FREF Config Error: Unknown tag (%s)", element_name); break; /* state PARAM */ } /* switch */ if (path) gtk_tree_path_free (path); g_hash_table_destroy(attrs); } void fref_loader_end_element(GMarkupParseContext * context, const gchar * element_name, gpointer user_data, GError ** error) { FRParseAux *aux; if (user_data == NULL) return; aux = (FRParseAux *) user_data; switch (aux->state) { case FR_LOADER_STATE_TAG: if (strcmp(element_name, "tag") == 0) { aux->act_info = NULL; aux->pstate = FR_LOADER_STATE_NONE; } break; /* tag */ case FR_LOADER_STATE_FUNC: if (strcmp(element_name, "function") == 0) { aux->act_info = NULL; aux->pstate = FR_LOADER_STATE_NONE; } break; /* function */ case FR_LOADER_STATE_ATTR: if (strcmp(element_name, "attribute") == 0) { aux->act_attr = NULL; aux->pstate = FR_LOADER_STATE_TAG; } break; /* attribute */ case FR_LOADER_STATE_PARAM: if (strcmp(element_name, "param") == 0) { aux->act_param = NULL; aux->pstate = FR_LOADER_STATE_FUNC; } break; /* param */ } /* switch */ if (aux->state != FR_LOADER_STATE_VALLIST) aux->state = aux->pstate; else aux->state = aux->vstate; if (strcmp(element_name, "group") == 0) { if (aux->nest_level > 0) { (aux->nest_level)--; if (aux->nest_level < MAX_NEST_LEVEL) aux->parent = aux->grp_parent[aux->nest_level]; } } } void fref_loader_text(GMarkupParseContext * context, const gchar * _text, gsize _text_len, gpointer user_data, GError ** error) { FRParseAux *aux; gchar *text; gint text_len; FRInfo *tmpinfo; if (user_data == NULL && _text == NULL) return; /* remove white spaces from the begining and the end */ text = g_strdup(_text); text = g_strstrip(text); text_len = strlen(text); aux = (FRParseAux *) user_data; switch (aux->state) { case FR_LOADER_STATE_DESCR: aux->act_info->description = g_strndup(text, text_len); break; case FR_LOADER_STATE_TIP: aux->act_info->tip = g_strndup(text, text_len); break; case FR_LOADER_STATE_ATTR: aux->act_attr->description = g_strndup(text, text_len); break; case FR_LOADER_STATE_PARAM: aux->act_param->description = g_strndup(text, text_len); break; case FR_LOADER_STATE_RETURN: aux->act_info->return_description = g_strndup(text, text_len); break; case FR_LOADER_STATE_VALLIST: if (aux->vstate == FR_LOADER_STATE_ATTR) aux->act_attr->values = g_strndup(text, text_len); else if (aux->vstate == FR_LOADER_STATE_PARAM) aux->act_param->values = g_strndup(text, text_len); else g_warning("FREF Config Error: cannot assign vallist"); break; case FR_LOADER_STATE_DIALOG: aux->act_info->dialog_text = g_strndup(text, text_len); break; case FR_LOADER_STATE_INFO: aux->act_info->info_text = g_strndup(text, text_len); break; case FR_LOADER_STATE_INSERT: aux->act_info->insert_text = g_strndup(text, text_len); break; case FR_LOADER_STATE_GROUPDESC: gtk_tree_model_get(GTK_TREE_MODEL(aux->store), &aux->parent, PTR_COLUMN, &tmpinfo, -1); if (tmpinfo != NULL) { /* BUG?? this appears as if it is freed in fref_free_info() * but a small memory leak is shown when opening the HTML ref */ tmpinfo->description = g_strndup(text, text_len); } break; } /* switch */ g_free(text); } void fref_loader_error(GMarkupParseContext * context, GError * error, gpointer user_data) { if (error != NULL) g_warning("FREF Config Error: %s", error->message); else g_warning("FREF Config Error: Unknown Error"); } /* CONFIG FILE PARSER */ static GMarkupParser FRParser = { fref_loader_start_element, fref_loader_end_element, fref_loader_text, NULL, fref_loader_error }; /* AUXILIARY FILE PARSER */ static GMarkupParser FRNameParser = { fref_name_loader_start_element, NULL, NULL, NULL, fref_loader_error }; gchar *fref_xml_get_refname(gchar * filename) { GMarkupParseContext *ctx; gchar *config; gsize len; Tfref_name_data *aux = NULL; gchar *tmps; if (filename == NULL) return NULL; aux = g_new0(Tfref_name_data, 1); ctx = g_markup_parse_context_new(&FRNameParser, (GMarkupParseFlags) 0, (gpointer) aux, NULL); if (ctx == NULL) { g_free(aux); return NULL; } if (!g_file_get_contents(filename, &config, &len, NULL)) { g_markup_parse_context_free(ctx); g_free(aux); return NULL; } if (!g_markup_parse_context_parse(ctx, config, len, NULL)) { g_markup_parse_context_free(ctx); g_free(aux); g_free(config); return NULL; } g_markup_parse_context_free(ctx); tmps = aux->name; g_free(aux->description); g_free(aux); g_free(config); return tmps; } void fref_loader_load_ref_xml(gchar * filename, GtkWidget * tree, GtkTreeStore * store, GtkTreeIter * parent, GHashTable * dict) { GMarkupParseContext *ctx; gchar *config; gsize len; FRParseAux *aux; if (filename == NULL) return; aux = g_new0(FRParseAux, 1); aux->tree = tree; aux->store = store; aux->state = FR_LOADER_STATE_NONE; aux->parent = *parent; aux->nest_level = 0; aux->dict = dict; ctx = g_markup_parse_context_new(&FRParser, (GMarkupParseFlags) 0, (gpointer) aux, NULL); if (ctx == NULL) return; if (!g_file_get_contents(filename, &config, &len, NULL)) { g_markup_parse_context_free(ctx); g_free(aux); return; } if (!g_markup_parse_context_parse(ctx, config, len, NULL)) { g_markup_parse_context_free(ctx); g_free(aux); g_free(config); return; } g_markup_parse_context_free(ctx); if (aux->act_info) fref_free_info(aux->act_info); if (aux->act_attr) { g_free(aux->act_attr->name); g_free(aux->act_attr->title); g_free(aux->act_attr->description); g_free(aux->act_attr->def_value); g_free(aux->act_attr->values); g_free(aux->act_attr); } if (aux->act_param) { g_free(aux->act_param->name); g_free(aux->act_param->title); g_free(aux->act_param->description); g_free(aux->act_param->def_value); g_free(aux->act_param->type); g_free(aux->act_param->values); g_free(aux->act_param); } g_free(aux); g_free(config); } void fref_loader_unload_ref(GtkTreeStore * store, GtkTreeIter * position) { GtkTreeIter iter; GtkTreePath *path; path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), position); DEBUG_MSG("fref_loader_unload_ref, called for path %s\n", gtk_tree_path_to_string(path)); while (gtk_tree_model_iter_children(GTK_TREE_MODEL(store), &iter, position)) { FRInfo *entry; gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, PTR_COLUMN, &entry, -1); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter)) { fref_loader_unload_ref(store, &iter); /* have not to free entry name, because this is a pointer to info field */ } /* this is very crappy... on my OpenBSD box gtk_tree_store_remove() has a different prototype, and it does *not* return a boolean, but just void, that means we can't use it to step trough the tree... */ gtk_tree_store_remove(store, &iter); if (entry != NULL) { fref_free_info(entry); } } /* while */ iter = *position; if (gtk_tree_path_get_depth(path) > 1) { gchar *name; DEBUG_MSG("fref_loader_unload_ref, path depth > 0\n"); /*gtk_tree_model_get_iter(GTK_TREE_MODEL(store),&iter,path); */ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, STR_COLUMN, &name, -1); if (name) { /* have to free name column for group */ DEBUG_MSG("fref_loader_unload_ref, free'ing %s\n", name); g_free(name); /* freeing item name */ } } else { /* freeing search dictionary */ GHashTable *dict; DEBUG_MSG("fref_loader_unload_ref, path depth == 0, this is the top node\n"); /*gtk_tree_model_get_iter(GTK_TREE_MODEL(store),&iter,path); */ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, PTR_COLUMN, &dict, -1); if (dict) { DEBUG_MSG("fref_loader_unload_ref, destroying search hashtable %p\n", dict); g_hash_table_destroy(dict); gtk_tree_store_set(store, &iter, PTR_COLUMN, NULL, -1); } } gtk_tree_path_free(path); DEBUG_MSG("fref_loader_unload, done\n"); } void fref_loader_unload_all(GtkWidget * tree, GtkTreeStore * store) { GtkTreeIter iter; gint *cnt = NULL; gpointer *aux; gboolean do_unload = FALSE; DEBUG_MSG("fref_loader_unload_all, started for tree=%p, store=%p\n", tree, store); while (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0)) { GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); if (gtk_tree_path_get_depth(path) == 1) { gchar *cat; gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, STR_COLUMN, &cat, -1); DEBUG_MSG("fref_loader_unload_all, cat=%s\n", cat); aux = g_hash_table_lookup(FREFDATA(main_v->frefdata)->refcount, cat); if (cat) g_free (cat); if (aux != NULL) { cnt = (gint *) aux; *cnt = (*cnt) - 1; if (*cnt <= 0) do_unload = TRUE; else do_unload = FALSE; DEBUG_MSG("fref_loader_unload_all, cnt=%d, do_unload=%d\n", *cnt, do_unload); } else do_unload = FALSE; } else do_unload = FALSE; if (do_unload) { gchar *file, *name; DEBUG_MSG("fref_loader_unload_all, calling fref_loader_unload_ref\n"); fref_loader_unload_ref(store, &iter); gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, STR_COLUMN, &name, FILE_COLUMN, &file, -1); if (file) { DEBUG_MSG("fref_loader_unload_all, freeing %s\n", file); g_free(file); } if (name) { DEBUG_MSG("fref_loader_unload_all, freeing %s\n", name); g_free(name); } gtk_tree_store_remove(store, &iter); } /* do_unload */ if (path) gtk_tree_path_free (path); } /* while */ /* gtk_tree_store_clear(store); */ } /* END OF CONFIG PARSER */ /* GUI */ static void fill_toplevels(Tfref_data * fdata, gboolean empty_first) { GList *reflist; gint *cnt; if (empty_first) { gtk_tree_store_clear(fdata->store); } /* prepare first nodes - read from configuration data */ reflist = g_list_first(main_v->props.reference_files); while (reflist) { gchar **tmparray = reflist->data; if (count_array(tmparray) == 2) { if (file_exists_and_readable(tmparray[1])) { GtkTreeIter iter; GtkTreeIter iter2; gtk_tree_store_append(fdata->store, &iter, NULL); gtk_tree_store_set(fdata->store, &iter, STR_COLUMN, tmparray[0], PTR_COLUMN, NULL, FILE_COLUMN, tmparray[1], -1); cnt = g_new0(gint, 1); *cnt = 0; g_hash_table_replace(fdata->refcount, g_strdup(tmparray[0]), cnt); /* dummy node for er display */ gtk_tree_store_append(fdata->store, &iter2, &iter); } } reflist = g_list_next(reflist); } } void fref_cleanup(Tbfwin * bfwin) { DEBUG_MSG("fref_cleanup, started for bfwin=%p, refcount at %p\n", bfwin, FREFDATA(main_v->frefdata)->refcount); fref_loader_unload_all(FREFGUI(bfwin->fref)->tree, FREFDATA(main_v->frefdata)->store); /* g_hash_table_destroy(FREFDATA(main_v->frefdata)->refcount); */ /* Ok I'll not free search dictionary too ... O.S. */ FREFGUI(bfwin->fref)->tree = NULL; FREFGUI(bfwin->fref)->argtips = NULL; tree_tips_destroy(FREFGUI(bfwin->fref)->tips); g_free (bfwin->fref); bfwin->fref = NULL; } /* fref_init is ONCE called by bluefish.c to init the fref_data structure */ void fref_init() { Tfref_data *fdata = g_new(Tfref_data, 1); fdata->store = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING); fdata->refcount = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); fill_toplevels(fdata, FALSE); DEBUG_MSG("fref_init, refcount at %p\n", fdata->refcount); main_v->frefdata = fdata; } /*------------ PREPARE INFO -----------------------*/ gchar *fref_prepare_info(FRInfo * entry, gint infotype, gboolean use_colors) { gchar *ret, *tofree; GList *lst; FRAttrInfo *tmpa; FRParamInfo *tmpp; ret = g_strdup(""); switch (entry->type) { case FR_TYPE_GROUP: switch (infotype) { case FR_INFO_DESC: if (entry->description != NULL) { gchar *escaped = xml_escape(entry->description); tofree = ret; if (use_colors) { ret = g_strconcat(ret, " ", escaped, "", NULL); } else { ret = g_strconcat(ret, " ", escaped, "", NULL); } g_free(tofree); g_free(escaped); } break; } break; case FR_TYPE_TAG: switch (infotype) { case FR_INFO_TITLE: tofree = ret; if (use_colors) ret = g_strconcat(ret, " TAG: ", entry->name, "", NULL); else ret = g_strconcat(ret, " TAG: ", entry->name, "", NULL); g_free(tofree); break; case FR_INFO_DESC: if (entry->description != NULL) { gchar *escaped = xml_escape(entry->description); tofree = ret; if (use_colors) ret = g_strconcat(ret, " ", escaped, "", NULL); else ret = g_strconcat(ret, " ", escaped, "", NULL); g_free(tofree); g_free(escaped); } break; case FR_INFO_NOTES: if (entry->info_text != NULL) { gchar *escaped = xml_escape(entry->info_text); tofree = ret; if (use_colors) ret = g_strconcat(ret, "NOTES: \n", escaped, "", NULL); else ret = g_strconcat(ret, "NOTES: \n", escaped, "", NULL); g_free(tofree); g_free(escaped); } break; case FR_INFO_ATTRS: lst = g_list_first(entry->attributes); while (lst) { gchar *escaped1, *escaped2; tmpa = (FRAttrInfo *) lst->data; tofree = ret; escaped1 = xml_escape(tmpa->name); escaped2 = xml_escape(tmpa->description); if (use_colors) ret = g_strconcat(ret, " ", escaped1, " - ", escaped2, "\n", NULL); else ret = g_strconcat(ret, " ", escaped1, " - ", escaped2, "\n", NULL); g_free(escaped1); g_free(escaped2); g_free(tofree); lst = g_list_next(lst); } break; } /* switch infotype */ break; /* TAG */ case FR_TYPE_FUNCTION: switch (infotype) { case FR_INFO_TITLE: tofree = ret; if (use_colors) ret = g_strconcat(ret, " FUNCTION: ", entry->name, "", NULL); else ret = g_strconcat(ret, " FUNCTION: ", entry->name, "", NULL); g_free(tofree); break; case FR_INFO_DESC: if (entry->description != NULL) { gchar *escaped = xml_escape(entry->description); tofree = ret; if (use_colors) ret = g_strconcat(ret, " ", escaped, "\n", NULL); else ret = g_strconcat(ret, " ", escaped, "\n", NULL); g_free(tofree); g_free(escaped); } if (entry->return_type != NULL) { tofree = ret; if (use_colors) ret = g_strconcat(ret, " RETURNS: ", entry->return_type, "\n", NULL); else ret = g_strconcat(ret, " RETURNS: ", entry->return_type, "\n", NULL); g_free(tofree); } if (entry->return_description != NULL) { tofree = ret; if (use_colors) ret = g_strconcat(ret, " ", entry->return_description, "\n", NULL); else ret = g_strconcat(ret, " ", entry->return_description, "\n", NULL); g_free(tofree); } break; case FR_INFO_NOTES: if (entry->info_text != NULL) { gchar *escaped = xml_escape(entry->info_text); tofree = ret; if (use_colors) ret = g_strconcat(ret, "NOTES: \n", escaped, "", NULL); else ret = g_strconcat(ret, "NOTES: \n", escaped, "", NULL); g_free(tofree); g_free(escaped); } break; case FR_INFO_ATTRS: lst = g_list_first(entry->params); while (lst) { tmpp = (FRParamInfo *) lst->data; tofree = ret; if (tmpp->description != NULL && tmpp->type != NULL) { gchar *escaped1, *escaped2, *escaped3; escaped1 = xml_escape(tmpp->name); escaped2 = xml_escape(tmpp->type); escaped3 = xml_escape(tmpp->description); if (use_colors) ret = g_strconcat(ret, " ", escaped1, "(", escaped2, ") - ", escaped3, "\n", NULL); else ret = g_strconcat(ret, " ", escaped1, "(", escaped2, ") - ", escaped3, "\n", NULL); g_free(escaped1); g_free(escaped2); g_free(escaped3); } else if (tmpp->type != NULL) { gchar *escaped1, *escaped2; escaped1 = xml_escape(tmpp->name); escaped2 = xml_escape(tmpp->type); ret = g_strconcat(ret, " ", escaped1, "(", escaped2, ")\n", NULL); g_free(escaped1); g_free(escaped2); } else { gchar *escaped1; escaped1 = xml_escape(tmpp->name); ret = g_strconcat(ret, " ", escaped1, "\n", NULL); g_free(escaped1); } g_free(tofree); lst = g_list_next(lst); } break; } /* switch infotype */ break; } return ret; } /*------------ SHOW INFO -----------------------*/ static void info_window_close_lcb(GtkWidget * widget, gpointer data) { gtk_widget_destroy(data); } gchar *fref_prepare_text(FRInfo * entry, GtkWidget * dialog) { /* Here attribute/param names have to be replaced by values from dialog */ gchar *p, *prev, *stringdup, *tofree; gchar *tmp, *dest, *tmp3 = NULL; GList *lst; gint d1, d2; FRAttrInfo *tmpa; FRParamInfo *tmpp; const gchar *converted = NULL, *tmp2 = NULL; dest = g_strdup(""); stringdup = g_strdup(entry->dialog_text); prev = stringdup; p = strchr(prev, '%'); while (p) { tmp = dest; *p = '\0'; p++; if (*p == '%') { converted = "%"; } else { switch (entry->type) { case FR_TYPE_TAG: d1 = g_ascii_digit_value(*p); if (d1 != -1) { d2 = g_ascii_digit_value(*(p + 1)); if (d2 != -1) d1 = d1 * 10 + d2; lst = g_list_nth(entry->attributes, d1); if (lst != NULL) { tmpa = (FRAttrInfo *) lst->data; if (tmpa->dlg_item) { if (GTK_IS_COMBO(tmpa->dlg_item)) converted = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(tmpa->dlg_item)->entry)); else converted = gtk_entry_get_text(GTK_ENTRY(tmpa->dlg_item)); } else converted = ""; } else converted = ""; } else if (*p == '_') { /* non empty attributes */ lst = g_list_first(entry->attributes); tmp3 = g_strdup(""); while (lst != NULL) { tmpa = (FRAttrInfo *) lst->data; if (tmpa->dlg_item) { if (GTK_IS_COMBO(tmpa->dlg_item)) tmp2 = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(tmpa->dlg_item)->entry)); else tmp2 = gtk_entry_get_text(GTK_ENTRY(tmpa->dlg_item)); if (strcmp(tmp2, "") != 0) { tofree = tmp3; tmp3 = g_strconcat(tmp3, " ", tmpa->name, "=\"", tmp2, "\"", NULL); g_free(tofree); } } lst = g_list_next(lst); } /* while */ converted = tmp3; } else if (*p == '~') { /* non empty attributes and required */ lst = g_list_first(entry->attributes); tmp3 = g_strdup(""); while (lst != NULL) { tmpa = (FRAttrInfo *) lst->data; if (tmpa->dlg_item) { if (GTK_IS_COMBO(tmpa->dlg_item)) tmp2 = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(tmpa->dlg_item)->entry)); else tmp2 = gtk_entry_get_text(GTK_ENTRY(tmpa->dlg_item)); if (strcmp(tmp2, "") != 0 || tmpa->required) { tofree = tmp3; tmp3 = g_strconcat(tmp3, " ", tmpa->name, "=\"", tmp2, "\"", NULL); g_free(tofree); } } lst = g_list_next(lst); } /* while */ converted = tmp3; } /* required and non-empty */ break; case FR_TYPE_FUNCTION: d1 = g_ascii_digit_value(*p); if (d1 != -1) { d2 = g_ascii_digit_value(*(p + 1)); if (d2 != -1) d1 = d1 * 10 + d2; lst = g_list_nth(entry->params, d1); if (lst != NULL) { tmpp = (FRParamInfo *) lst->data; if (tmpp->dlg_item) { if (GTK_IS_COMBO(tmpp->dlg_item)) converted = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(tmpp->dlg_item)->entry)); else converted = gtk_entry_get_text(GTK_ENTRY(tmpp->dlg_item)); } else converted = ""; } else converted = ""; } break; } /* switch */ } dest = g_strconcat(dest, prev, converted, NULL); g_free(tmp); /* here I free the dest (tmp=dest) */ g_free(tmp3); prev = ++p; p = strchr(p, '%'); } tmp = dest; dest = g_strconcat(dest, prev, NULL); g_free(tmp); g_free(stringdup); return dest; } GList *fref_string_to_list(gchar * string, gchar * delimiter) { GList *lst; gchar **arr; gint i; lst = NULL; arr = g_strsplit(string, delimiter, 0); i = 0; while (arr[i] != NULL) { lst = g_list_append(lst, arr[i]); i++; } return lst; } /* CALLBACKS */ static GtkWidget *togglemenuitem(GSList * group, gchar * name, gboolean selected, GCallback toggledfunc, gpointer toggleddata) { GtkWidget *retval; retval = gtk_radio_menu_item_new_with_label(group, name); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(retval), selected); g_signal_connect(GTK_OBJECT(retval), "toggled", toggledfunc, toggleddata); DEBUG_MSG("togglemenuitem, created %p and set to %d\n", retval, selected); return retval; } static void fref_ldblclck_changed(GtkWidget * widget, gpointer data) { if (GTK_CHECK_MENU_ITEM(widget)->active) { DEBUG_MSG("fref_ldblclck_changed, set to %d\n", GPOINTER_TO_INT(data)); main_v->globses.fref_ldoubleclick_action = GPOINTER_TO_INT(data); } } static void fref_infotype_changed(GtkWidget * widget, gpointer data) { if (GTK_CHECK_MENU_ITEM(widget)->active) { DEBUG_MSG("fref_infotype_changed, set to %d\n", GPOINTER_TO_INT(data)); main_v->globses.fref_info_type = GPOINTER_TO_INT(data); } } static FRInfo *get_current_entry(Tbfwin * bfwin) { GtkTreePath *path; GtkTreeViewColumn *col; gtk_tree_view_get_cursor(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), &path, &col); if (path != NULL) { FRInfo *retval = NULL; GValue *val; GtkTreeIter iter; gtk_tree_model_get_iter(gtk_tree_view_get_model(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree)), &iter, path); gtk_tree_path_free(path); val = g_new0(GValue, 1); gtk_tree_model_get_value(gtk_tree_view_get_model(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree)), &iter, 1, val); if (G_IS_VALUE(val) && g_value_fits_pointer(val)) { retval = (FRInfo *) g_value_peek_pointer(val); } g_value_unset(val); g_free(val); return retval; } return NULL; } gboolean frefcb_info_keypress(GtkWidget * widget, GdkEventKey * event, Tcallbackdata * cd) { if (event->keyval == GDK_Escape && cd->data != NULL) { gtk_widget_destroy(GTK_WIDGET(cd->data)); g_free(cd); return FALSE; } return TRUE; } static void frefcb_info_close(GtkButton * button, Tcallbackdata * cd) { if (cd->data != NULL) { gtk_widget_destroy(GTK_WIDGET(cd->data)); } g_free(cd); } static void frefcb_row_expanded(GtkTreeView * treeview, GtkTreeIter * arg1, GtkTreePath * arg2, gpointer user_data) { GValue *val; GtkTreeIter iter; gchar *cat; gint *cnt = NULL; gpointer *aux; gboolean do_load = FALSE; GHashTable *dict; if (gtk_tree_path_get_depth(arg2) == 1) { val = g_new0(GValue, 1); gtk_tree_model_get_value(GTK_TREE_MODEL(user_data), arg1, 0, val); cat = (gchar *) (g_value_peek_pointer(val)); aux = g_hash_table_lookup(FREFDATA(main_v->frefdata)->refcount, cat); if (aux != NULL) { cnt = (gint *) aux; *cnt = (*cnt) + 1; if (*cnt == 1) do_load = TRUE; else do_load = FALSE; } else do_load = FALSE; g_value_unset (val); g_free (val); } else do_load = FALSE; if (do_load) { val = g_new0(GValue, 1); gtk_tree_model_get_value(GTK_TREE_MODEL(user_data), arg1, 2, val); dict = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) gtk_tree_row_reference_free); DEBUG_MSG("frefcb_row_expanded, search hash_table at %p\n", dict); gtk_tree_store_set(GTK_TREE_STORE(user_data), arg1, PTR_COLUMN, dict, -1); if (G_IS_VALUE(val) && g_value_peek_pointer(val) != NULL) { fref_loader_load_ref_xml((gchar *) g_value_peek_pointer(val), GTK_WIDGET(treeview), GTK_TREE_STORE(user_data), arg1, dict); } /* remove dummy */ if (g_value_peek_pointer(val) != NULL && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(user_data), &iter, arg1, 0)) { gtk_tree_store_remove(GTK_TREE_STORE(user_data), &iter); } g_value_unset (val); g_free (val); } } static void frefcb_info_dialog(GtkButton * button, Tcallbackdata * cd) { FRInfo *entry; GtkWidget *dialog; gchar *pomstr; gint resp; Tbfwin *bfwin = cd->bfwin; if (cd->data != NULL) { gtk_widget_destroy(GTK_WIDGET(cd->data)); g_free(cd); } entry = get_current_entry(bfwin); if (entry == NULL) return; dialog = fref_prepare_dialog(bfwin, entry); if (dialog) { resp = gtk_dialog_run(GTK_DIALOG(dialog)); if (resp == GTK_RESPONSE_OK) { pomstr = fref_prepare_text(entry, dialog); gtk_widget_destroy(dialog); doc_insert_two_strings(bfwin->current_document, pomstr, NULL); g_free(pomstr); } else gtk_widget_destroy(dialog); } } static void frefcb_info_insert(GtkButton * button, Tcallbackdata * cd) { FRInfo *entry; Tbfwin *bfwin = cd->bfwin; if (cd->data != NULL) { gtk_widget_destroy(GTK_WIDGET(cd->data)); g_free(cd); } entry = get_current_entry(bfwin); if (entry == NULL || entry->insert_text == NULL) return; doc_insert_two_strings(bfwin->current_document, entry->insert_text, NULL); } void fref_show_info(Tbfwin * bfwin, FRInfo * entry, gboolean modal, GtkWidget * parent) { GtkWidget *label_t, *frame, *scroll, *view, *btn1, *btn2, *btn3, *vbox, *hbox, *fourbox, *label_d, *label_a, *label_n, *ev_t, *ev_d, *ev_a, *ev_n; GtkWidget *info_window; Tcallbackdata *cd; GdkColor col1, col2, col4; cd = g_new(Tcallbackdata, 1); gdk_color_parse(FR_COL_1, &col1); gdk_color_parse(FR_COL_2, &col2); gdk_color_parse(FR_COL_4, &col4); label_t = gtk_label_new(fref_prepare_info(entry, FR_INFO_TITLE, TRUE)); label_d = gtk_label_new(fref_prepare_info(entry, FR_INFO_DESC, TRUE)); label_a = gtk_label_new(fref_prepare_info(entry, FR_INFO_ATTRS, TRUE)); label_n = gtk_label_new(fref_prepare_info(entry, FR_INFO_NOTES, TRUE)); gtk_label_set_use_markup(GTK_LABEL(label_t), TRUE); gtk_label_set_use_markup(GTK_LABEL(label_d), TRUE); gtk_label_set_use_markup(GTK_LABEL(label_a), TRUE); gtk_label_set_use_markup(GTK_LABEL(label_n), TRUE); gtk_misc_set_alignment(GTK_MISC(label_t), 0.0, 0.0); gtk_misc_set_padding(GTK_MISC(label_t), 5, 5); gtk_label_set_line_wrap(GTK_LABEL(label_t), TRUE); gtk_misc_set_alignment(GTK_MISC(label_d), 0.0, 0.0); gtk_misc_set_padding(GTK_MISC(label_d), 5, 5); gtk_label_set_line_wrap(GTK_LABEL(label_d), TRUE); gtk_misc_set_alignment(GTK_MISC(label_a), 0.0, 0.0); gtk_misc_set_padding(GTK_MISC(label_a), 5, 5); gtk_label_set_line_wrap(GTK_LABEL(label_a), TRUE); gtk_misc_set_alignment(GTK_MISC(label_n), 0.0, 0.0); gtk_misc_set_padding(GTK_MISC(label_n), 5, 5); gtk_label_set_line_wrap(GTK_LABEL(label_n), TRUE); ev_t = gtk_event_box_new(); gtk_widget_modify_bg(GTK_WIDGET(ev_t), GTK_STATE_NORMAL, &col1); gtk_container_add(GTK_CONTAINER(ev_t), label_t); ev_d = gtk_event_box_new(); gtk_widget_modify_bg(GTK_WIDGET(ev_d), GTK_STATE_NORMAL, &col2); gtk_container_add(GTK_CONTAINER(ev_d), label_d); ev_a = gtk_event_box_new(); gtk_widget_modify_bg(GTK_WIDGET(ev_a), GTK_STATE_NORMAL, &col4); gtk_container_add(GTK_CONTAINER(ev_a), label_a); ev_n = gtk_event_box_new(); gtk_widget_modify_bg(GTK_WIDGET(ev_n), GTK_STATE_NORMAL, &col1); gtk_container_add(GTK_CONTAINER(ev_n), label_n); scroll = gtk_scrolled_window_new(NULL, NULL); btn2 = NULL; btn3 = NULL; gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); view = gtk_viewport_new(GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 1024, 1, 100, 200)), GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 768, 1, 100, 200))); info_window = window_full2(_("Info"), GTK_WIN_POS_NONE, 0, G_CALLBACK(info_window_close_lcb) , NULL, TRUE, FALSE); if (modal) { gtk_window_set_modal(GTK_WINDOW(info_window), TRUE); } fourbox = gtk_vbox_new(FALSE, 0); frame = gtk_frame_new(NULL); hbox = gtk_hbox_new(TRUE, 5); gtk_container_add(GTK_CONTAINER(view), GTK_WIDGET(fourbox)); gtk_box_pack_start(GTK_BOX(fourbox), ev_t, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(fourbox), ev_d, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(fourbox), ev_a, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(fourbox), ev_n, TRUE, TRUE, 0); btn1 = gtk_button_new_with_label(_("Close")); gtk_box_pack_start(GTK_BOX(hbox), btn1, TRUE, TRUE, 5); if (!modal) { btn2 = gtk_button_new_with_label(_("Dialog")); btn3 = gtk_button_new_with_label(_("Insert")); gtk_box_pack_start(GTK_BOX(hbox), btn2, TRUE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), btn3, TRUE, TRUE, 5); } gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(view)); gtk_container_add(GTK_CONTAINER(info_window), GTK_WIDGET(frame)); vbox = gtk_vbox_new(FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(vbox)); gtk_container_set_border_width(GTK_CONTAINER(frame), 0); gtk_frame_set_label_widget(GTK_FRAME(frame), NULL); gtk_widget_set_size_request(info_window, 400, 300); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN); cd->data = info_window; cd->bfwin = bfwin; g_signal_connect(G_OBJECT(info_window), "key-press-event", G_CALLBACK(frefcb_info_keypress), cd); g_signal_connect(G_OBJECT(btn1), "clicked", G_CALLBACK(frefcb_info_close), cd); if (!modal) { g_signal_connect(G_OBJECT(btn2), "clicked", G_CALLBACK(frefcb_info_dialog), cd); g_signal_connect(G_OBJECT(btn3), "clicked", G_CALLBACK(frefcb_info_insert), cd); } gtk_widget_show_all(info_window); } void frefcb_info_show(GtkButton * button, Tbfwin * bfwin) { FRInfo *entry; entry = get_current_entry(bfwin); if (entry == NULL) return; fref_show_info(bfwin, entry, TRUE, gtk_widget_get_toplevel(GTK_WIDGET(button))); } GtkWidget *fref_prepare_dialog(Tbfwin * bfwin, FRInfo * entry) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *table; GtkWidget *label; GtkWidget *input; GtkWidget *combo; GtkWidget *dialog_action_area; GtkWidget *cancelbutton; GtkWidget *okbutton; GtkWidget *infobutton; GtkWidget *scroll; GtkRequisition req, req2; FRAttrInfo *attr = NULL; FRParamInfo *par = NULL; GList *list = NULL; gint itnum, w, h; DEBUG_MSG("fref_prepare_dialog, started\n"); dialog = gtk_dialog_new(); if (entry->dialog_title != NULL) gtk_window_set_title(GTK_WINDOW(dialog), entry->dialog_title); vbox = GTK_DIALOG(dialog)->vbox; scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show(scroll); gtk_widget_show(vbox); switch (entry->type) { case FR_TYPE_TAG: list = entry->attributes; break; case FR_TYPE_FUNCTION: list = entry->params; break; case FR_TYPE_CLASS: list = NULL; break; } if (list == NULL) { gtk_widget_destroy(dialog); DEBUG_MSG("fref_prepare_dialog, list==NULL, aborting..\n"); return NULL; } table = gtk_table_new(g_list_length(list), 2, FALSE); gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), table); switch (entry->type) { case FR_TYPE_TAG: { list = g_list_first(list); attr = (FRAttrInfo *) g_list_nth_data(list, 0); itnum = 0; while (itnum < g_list_length(list)) { if (attr->title != NULL) { label = gtk_label_new(""); if (attr->required) { gchar *tofree = g_strconcat("", attr->title, "", NULL); gtk_label_set_markup(GTK_LABEL(label), tofree); g_free(tofree); } else { gtk_label_set_text(GTK_LABEL(label), attr->title); } } else { label = gtk_label_new(""); if (attr->required) { gchar *tofree = g_strconcat("", attr->name, "", NULL); gtk_label_set_markup(GTK_LABEL(label), tofree); g_free(tofree); } else { gtk_label_set_text(GTK_LABEL(label), attr->name); } } gtk_widget_show(label); gtk_table_attach(GTK_TABLE(table), label, 0, 1, itnum, itnum + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 5, 6); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); if (attr->has_list) { combo = gtk_combo_new(); gtk_widget_show(combo); gtk_table_attach(GTK_TABLE(table), combo, 1, 2, itnum, itnum + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 5, 5); /* gtk_combo_set_value_in_list(GTK_COMBO(combo), TRUE, TRUE); */ gtk_combo_set_popdown_strings(GTK_COMBO(combo), fref_string_to_list(attr->values, ",")); if (attr->def_value != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), attr->def_value); attr->dlg_item = combo; gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, GTK_COMBO(combo)->entry, attr->description, ""); } else { input = gtk_entry_new(); if (attr->def_value != NULL) gtk_entry_set_text(GTK_ENTRY(input), attr->def_value); gtk_widget_show(input); gtk_table_attach(GTK_TABLE(table), input, 1, 2, itnum, itnum + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 5, 5); attr->dlg_item = input; gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, input, attr->description, ""); } itnum++; attr = (FRAttrInfo *) g_list_nth_data(list, itnum); } }; break; case FR_TYPE_FUNCTION: { list = g_list_first(list); par = (FRParamInfo *) g_list_nth_data(list, 0); itnum = 0; while (itnum < g_list_length(list)) { if (par->title != NULL) { label = gtk_label_new(""); if (par->required) { gchar *tofree = NULL; if (par->type != NULL) tofree = g_strconcat("", par->title, " (", par->type, ") ", "", NULL); else tofree = g_strconcat("", par->title, " ", NULL); gtk_label_set_markup(GTK_LABEL(label), tofree); g_free(tofree); } else { gchar *tofree = NULL; if (par->type != NULL) tofree = g_strconcat(par->title, " (", par->type, ") ", NULL); else tofree = g_strconcat(par->title, " ", NULL); gtk_label_set_text(GTK_LABEL(label), tofree); g_free(tofree); } } else { label = gtk_label_new(""); if (par->required) { gchar *tofree = NULL; if (par->type != NULL) tofree = g_strconcat("", par->name, " (", par->type, ") ", "", NULL); else tofree = g_strconcat("", par->name, " ", NULL); gtk_label_set_markup(GTK_LABEL(label), tofree); g_free(tofree); } else { gchar *tofree = NULL; if (par->type != NULL) tofree = g_strconcat(par->name, " (", par->type, ") ", NULL); else tofree = g_strconcat(par->name, " ", NULL); gtk_label_set_text(GTK_LABEL(label), tofree); g_free(tofree); } } gtk_widget_show(label); gtk_table_attach(GTK_TABLE(table), label, 0, 1, itnum, itnum + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 5, 6); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); if (par->has_list) { combo = gtk_combo_new(); gtk_widget_show(combo); gtk_table_attach(GTK_TABLE(table), combo, 1, 2, itnum, itnum + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 5, 5); /*gtk_combo_set_value_in_list(GTK_COMBO(combo), TRUE,TRUE); */ gtk_combo_set_popdown_strings(GTK_COMBO(combo), fref_string_to_list(par->values, ",")); if (par->def_value != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), par->def_value); par->dlg_item = combo; gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, GTK_COMBO(combo)->entry, par->description, ""); } else { input = gtk_entry_new(); if (par->def_value != NULL) gtk_entry_set_text(GTK_ENTRY(input), par->def_value); gtk_widget_show(input); gtk_table_attach(GTK_TABLE(table), input, 1, 2, itnum, itnum + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 5, 5); par->dlg_item = input; if (par->description != NULL) gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, input, par->description, ""); } itnum++; par = (FRParamInfo *) g_list_nth_data(list, itnum); } }; break; } /* switch */ dialog_action_area = GTK_DIALOG(dialog)->action_area; gtk_widget_show(dialog_action_area); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area), GTK_BUTTONBOX_END); infobutton = gtk_button_new_with_label(_("Info")); gtk_widget_show(infobutton); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), infobutton, FALSE, FALSE, 2); g_signal_connect(G_OBJECT(infobutton), "clicked", G_CALLBACK(frefcb_info_show), bfwin); cancelbutton = gtk_button_new_from_stock("gtk-cancel"); gtk_widget_show(cancelbutton); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), cancelbutton, GTK_RESPONSE_CANCEL); okbutton = gtk_button_new_from_stock("gtk-ok"); gtk_widget_show(okbutton); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), okbutton, GTK_RESPONSE_OK); gtk_tooltips_enable(FREFGUI(bfwin->fref)->argtips); gtk_widget_show(table); gtk_window_get_size(GTK_WINDOW(dialog), &w, &h); gtk_widget_size_request(table, &req); gtk_widget_size_request(dialog_action_area, &req2); gtk_window_resize(GTK_WINDOW(dialog), req.width + 10, MIN(400, req.height + req2.height + 20)); return dialog; } static void fref_popup_menu_dialog(GtkWidget * widget, Tcallbackdata * cd) { GtkWidget *dialog; gint resp; gchar *pomstr; FRInfo *entry = cd->data; Tbfwin *bfwin = cd->bfwin; g_free(cd); DEBUG_MSG("starting dialog\n"); dialog = fref_prepare_dialog(bfwin, entry); if (dialog) { resp = gtk_dialog_run(GTK_DIALOG(dialog)); if (resp == GTK_RESPONSE_OK) { pomstr = fref_prepare_text(entry, dialog); gtk_widget_destroy(dialog); doc_insert_two_strings(bfwin->current_document, pomstr, NULL); g_free(pomstr); } else gtk_widget_destroy(dialog); } } static void fref_popup_menu_insert(GtkWidget * widget, Tcallbackdata * cd) { FRInfo *entry = cd->data; Tbfwin *bfwin = cd->bfwin; g_free(cd); doc_insert_two_strings(bfwin->current_document, entry->insert_text, NULL); } static void fref_popup_menu_info(GtkWidget * widget, Tcallbackdata * cd) { FRInfo *entry = cd->data; Tbfwin *bfwin = cd->bfwin; g_free(cd); fref_show_info(bfwin, entry, FALSE, NULL); } static void fref_popup_menu_rescan_lcb(GtkWidget * widget, gpointer user_data) { gchar *userdir = g_strconcat(g_get_home_dir(), "/.winefish/", NULL); DEBUG_MSG("fref_popup_menu_rescan_lcb, started\n"); fref_rescan_dir(PKGDATADIR); fref_rescan_dir(userdir); g_free(userdir); DEBUG_MSG("about to refill toplevels\n"); fill_toplevels(FREFDATA(main_v->frefdata), TRUE); } static GtkWidget *fref_popup_menu(Tbfwin * bfwin, FRInfo * entry) { GtkWidget *menu, *menu_item; DEBUG_MSG("fref_popup_menu, started\n"); menu = gtk_menu_new(); if (entry) { Tcallbackdata *cd = g_new(Tcallbackdata, 1); cd->bfwin = bfwin; cd->data = entry; menu_item = gtk_menu_item_new_with_label(_("Dialog")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(fref_popup_menu_dialog), cd); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Insert")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(fref_popup_menu_insert), cd); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Info")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(fref_popup_menu_info), cd); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_menu_item_new(); gtk_menu_append(GTK_MENU(menu), menu_item); } menu_item = gtk_menu_item_new_with_label(_("Options")); gtk_menu_append(GTK_MENU(menu), menu_item); { GtkWidget *optionsmenu, *ldblclckmenu, *infowinmenu; GSList *group = NULL; GSList *group2 = NULL; optionsmenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), optionsmenu); menu_item = gtk_menu_item_new_with_label(_("Rescan reference files")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(fref_popup_menu_rescan_lcb), NULL); gtk_menu_append(GTK_MENU(optionsmenu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Left doubleclick action")); gtk_menu_append(GTK_MENU(optionsmenu), menu_item); ldblclckmenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), ldblclckmenu); menu_item = togglemenuitem(NULL, _("Insert"), (main_v->globses.fref_ldoubleclick_action == FREF_ACTION_INSERT), G_CALLBACK(fref_ldblclck_changed), GINT_TO_POINTER(FREF_ACTION_INSERT)); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item)); gtk_menu_append(GTK_MENU(ldblclckmenu), menu_item); menu_item = togglemenuitem(group, _("Dialog"), (main_v->globses.fref_ldoubleclick_action == FREF_ACTION_DIALOG), G_CALLBACK(fref_ldblclck_changed), GINT_TO_POINTER(FREF_ACTION_DIALOG)); gtk_menu_append(GTK_MENU(ldblclckmenu), menu_item); menu_item = togglemenuitem(group, _("Info"), (main_v->globses.fref_ldoubleclick_action == FREF_ACTION_INFO), G_CALLBACK(fref_ldblclck_changed), GINT_TO_POINTER(FREF_ACTION_INFO)); gtk_menu_append(GTK_MENU(ldblclckmenu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Info type")); gtk_menu_append(GTK_MENU(optionsmenu), menu_item); infowinmenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), infowinmenu); menu_item = togglemenuitem(NULL, _("Description"), (main_v->globses.fref_info_type == FREF_IT_DESC), G_CALLBACK(fref_infotype_changed), GINT_TO_POINTER(FREF_IT_DESC)); group2 = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item)); gtk_menu_append(GTK_MENU(infowinmenu), menu_item); menu_item = togglemenuitem(group2, _("Attributes/Parameters"), (main_v->globses.fref_info_type == FREF_IT_ATTRS), G_CALLBACK(fref_infotype_changed), GINT_TO_POINTER(FREF_IT_ATTRS)); gtk_menu_append(GTK_MENU(infowinmenu), menu_item); menu_item = togglemenuitem(group2, _("Notes"), (main_v->globses.fref_info_type == FREF_IT_NOTES), G_CALLBACK(fref_infotype_changed), GINT_TO_POINTER(FREF_IT_NOTES)); gtk_menu_append(GTK_MENU(infowinmenu), menu_item); } gtk_widget_show_all(menu); g_signal_connect_after(G_OBJECT(menu), "destroy", G_CALLBACK(destroy_disposable_menu_cb), menu); return menu; } static gboolean frefcb_event_keypress(GtkWidget * widget, GdkEventKey * event, Tbfwin * bfwin) { FRInfo *entry; entry = get_current_entry(bfwin); if (entry != NULL) { if (g_strcasecmp(gdk_keyval_name(event->keyval), "F1") == 0) { fref_show_info(bfwin, entry, FALSE, NULL); return TRUE; } } return FALSE; } static gboolean reference_file_known(gchar * path) { GList *tmplist = g_list_first(main_v->props.reference_files); while (tmplist) { gchar **arr = tmplist->data; if (count_array(arr) == 2 && strcmp(arr[1], path) == 0) { return TRUE; } tmplist = g_list_next(tmplist); } return FALSE; } void fref_rescan_dir(const gchar * dir) { const gchar *filename; GError *error = NULL; gchar *tofree; GPatternSpec *ps = g_pattern_spec_new("funcref_*.xml"); GDir *gd = g_dir_open(dir, 0, &error); filename = g_dir_read_name(gd); while (filename) { if (g_pattern_match(ps, strlen(filename), filename, NULL)) { gchar *path = g_strconcat(dir, filename, NULL); DEBUG_MSG("filename %s has a match!\n", filename); if (!reference_file_known(path)) { tofree = fref_xml_get_refname(path); main_v->props.reference_files = g_list_append(main_v->props.reference_files, array_from_arglist(g_strdup(tofree), path, NULL)); g_free(tofree); } g_free(path); } filename = g_dir_read_name(gd); } g_dir_close(gd); g_pattern_spec_free(ps); } typedef struct { Tbfwin *bfwin; gchar *cat; } Tfref_cleanup; static guint fref_idle_cleanup(Tfref_cleanup * data) { GtkTreeIter iter; gboolean cont = TRUE; DEBUG_MSG("fref_idle_cleanup, started for data=%s\n", data->cat); gtk_tree_model_get_iter_first(GTK_TREE_MODEL(FREFDATA(main_v->frefdata)->store), &iter); while (cont) { gchar *str = NULL; gtk_tree_model_get(GTK_TREE_MODEL(FREFDATA(main_v->frefdata)->store), &iter, STR_COLUMN, &str, -1); DEBUG_MSG("fref_idle_cleanup, comparing %s,%s\n", str, data->cat); if (strcmp(str, data->cat) == 0) { DEBUG_MSG("fref_idle_cleanup, found!\n"); fref_loader_unload_ref(GTK_TREE_STORE(FREFDATA(main_v->frefdata)->store), &iter); break; } g_free (str); cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(FREFDATA(main_v->frefdata)->store), &iter); } { GtkTreeIter newiter; gtk_tree_store_append(GTK_TREE_STORE(FREFDATA(main_v->frefdata)->store), &newiter, &iter); } g_free (data->cat); g_free (data); return FALSE; /* do not call again */ } static void frefcb_row_collapsed(GtkTreeView * treeview, GtkTreeIter * arg1, GtkTreePath * arg2, Tbfwin * bfwin) { gint *cnt = NULL; gpointer *aux; gboolean do_unload = FALSE; GtkTreeModel *treemodel = GTK_TREE_MODEL(FREFDATA(main_v->frefdata)->store); if (gtk_tree_path_get_depth(arg2) == 1) { gchar *cat; gtk_tree_model_get(treemodel, arg1, STR_COLUMN, &cat, -1); DEBUG_MSG("frefcb_row_collapsed, lookup for the refcount of %s\n", cat); aux = g_hash_table_lookup(FREFDATA(main_v->frefdata)->refcount, cat); if (aux != NULL) { cnt = (gint *) aux; DEBUG_MSG("frefcb_row_collapsed, refcount=%d, about to decrease\n", *cnt); *cnt = (*cnt) - 1; if (*cnt == 0) { Tfref_cleanup *data = g_new(Tfref_cleanup, 1); do_unload = TRUE; data->cat = cat; data->bfwin = bfwin; gtk_timeout_add(250, (GtkFunction) fref_idle_cleanup, data); } } else do_unload = FALSE; } else do_unload = FALSE; /* if (do_unload) { DEBUG_MSG("frefcb_row_collapsed, do_unload=%d, unloading!\n",do_unload); val = g_new0(GValue, 1); gtk_tree_model_get_value(GTK_TREE_MODEL(treemodel), arg1, 2, val); if (G_IS_VALUE(val) && g_value_peek_pointer(val)!=NULL) { DEBUG_MSG("frefcb_row_collapsed, calling fref_loader_unload_ref\n"); fref_loader_unload_ref(GTK_TREE_STORE(treemodel),arg1); / * dummy node for expander display * / DEBUG_MSG("frefcb_row_collapsed, appending dummy node\n"); gtk_tree_store_append(GTK_TREE_STORE(treemodel), &iter, arg1); } g_free(val); }*/ } static void frefcb_full_info(GtkButton * button, Tbfwin * bfwin) { FRInfo *entry; entry = get_current_entry(bfwin); if (entry == NULL) return; fref_show_info(bfwin, entry, FALSE, NULL); } static void frefcb_search(GtkButton * button, Tbfwin * bfwin) { GtkTreePath *path; GtkTreeViewColumn *col; GtkWidget *dlg, *entry; GValue *val; GtkTreeIter iter; GHashTable *dict; gint result; gchar *stf = NULL; gtk_tree_view_get_cursor(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), &path, &col); if (path != NULL) { while (gtk_tree_path_get_depth(path) > 1 && gtk_tree_path_up(path)); gtk_tree_model_get_iter(gtk_tree_view_get_model(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree)), &iter, path); gtk_tree_path_free(path); val = g_new0(GValue, 1); /* first column of reference title holds dictionary */ gtk_tree_model_get_value(gtk_tree_view_get_model(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree)), &iter, 1, val); if (G_IS_VALUE(val) && g_value_fits_pointer(val)) { dict = (GHashTable *) g_value_peek_pointer(val); if (dict != NULL) { gpointer ret = NULL; dlg = gtk_dialog_new_with_buttons(_("Reference search"), NULL, GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_ACCEPT); entry = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), entry, TRUE, TRUE, 0); gtk_widget_show(entry); result = gtk_dialog_run(GTK_DIALOG(dlg)); if (result == GTK_RESPONSE_ACCEPT) { stf = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); ret = g_hash_table_lookup(dict, stf); g_free(stf); if (!ret) error_dialog(bfwin->main_window, _("Reference search"), _("Reference not found")); } gtk_widget_destroy(dlg); if (ret != NULL) { GtkTreePath *path2 = gtk_tree_row_reference_get_path(ret); #ifndef HAVE_ATLEAST_GTK_2_2 gtktreepath_expand_to_root(FREFGUI(bfwin->fref)->tree, path2); #else gtk_tree_view_expand_to_path(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), path2); #endif gtk_tree_view_set_cursor(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), path2, gtk_tree_view_get_column(GTK_TREE_VIEW (FREFGUI(bfwin->fref)->tree), 0), FALSE); } } else error_dialog(bfwin->main_window, _("Error"), _ ("Perhaps you didn't load a reference, or you did not select a reference to search in.")); } g_value_unset(val); g_free(val); } } static gboolean frefcb_event_mouseclick(GtkWidget * widget, GdkEventButton * event, Tbfwin * bfwin) { FRInfo *entry; if (widget != FREFGUI(bfwin->fref)->tree) return FALSE; entry = get_current_entry(bfwin); if (entry == NULL) { if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { gtk_menu_popup(GTK_MENU(fref_popup_menu(bfwin, NULL)), NULL, NULL, NULL, NULL, event->button, event->time); return TRUE; } else return FALSE; } if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { /* right mouse click */ gtk_menu_popup(GTK_MENU(fref_popup_menu(bfwin, entry)), NULL, NULL, NULL, NULL, event->button, event->time); } else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { /* double click */ Tcallbackdata *cd = g_new(Tcallbackdata, 1); cd->data = entry; cd->bfwin = bfwin; switch (main_v->globses.fref_ldoubleclick_action) { case FREF_ACTION_INSERT: fref_popup_menu_insert(NULL, cd); break; case FREF_ACTION_DIALOG: fref_popup_menu_dialog(NULL, cd); break; case FREF_ACTION_INFO: fref_popup_menu_info(NULL, cd); break; default: g_print("weird, fref_doubleclick_action=%d\n", main_v->globses.fref_ldoubleclick_action); main_v->globses.fref_ldoubleclick_action = FREF_ACTION_DIALOG; break; } } return FALSE; /* we have handled the event, but the treeview freezes if you return TRUE, so we return FALSE */ } static void frefcb_cursor_changed(GtkTreeView * treeview, Tbfwin * bfwin) { FRInfo *entry; gchar *info = NULL, *tmpinfo = NULL; GdkRectangle rect; entry = get_current_entry(bfwin); if (entry == NULL) return; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FREFGUI(bfwin->fref)->infocheck))) { if (entry->description != NULL) { switch (main_v->globses.fref_info_type) { case FREF_IT_DESC: tmpinfo = fref_prepare_info(entry, FR_INFO_DESC, FALSE); info = g_strconcat("Description:\n", tmpinfo, NULL); break; case FREF_IT_ATTRS: tmpinfo = fref_prepare_info(entry, FR_INFO_ATTRS, FALSE); switch (entry->type) { case FR_TYPE_TAG: info = g_strconcat("Attributes:\n", tmpinfo, NULL); break; case FR_TYPE_FUNCTION: info = g_strconcat("Parameters:\n", tmpinfo, NULL); break; } break; case FREF_IT_NOTES: info = fref_prepare_info(entry, FR_INFO_NOTES, FALSE); break; default: info = g_strdup("Unknown fref_info_type"); } /* switch */ gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), &rect); gtk_widget_set_size_request(FREFGUI(bfwin->fref)->infoview, rect.width, -1); gtk_label_set_markup(GTK_LABEL(FREFGUI(bfwin->fref)->infoview), info); if (tmpinfo) g_free (tmpinfo); g_free(info); } else gtk_label_set_text(GTK_LABEL(FREFGUI(bfwin->fref)->infoview), ""); } } static void frefcb_infocheck_toggled(GtkToggleButton * togglebutton, Tbfwin * bfwin) { if (gtk_toggle_button_get_active(togglebutton)) gtk_widget_show(FREFGUI(bfwin->fref)->infoscroll); else gtk_widget_hide(FREFGUI(bfwin->fref)->infoscroll); } gchar *fref_tip(gconstpointer win, gconstpointer tree, gint x, gint y) { gchar *str = NULL, *tofree = NULL; GList *lst; FRAttrInfo *tmpa; FRParamInfo *tmpp; FRInfo *info = NULL; GtkTreePath *path; if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree), x, y, &path, NULL, NULL, NULL)) return NULL; if (path != NULL) { GValue *val; GtkTreeIter iter; gtk_tree_model_get_iter(gtk_tree_view_get_model(GTK_TREE_VIEW(tree)), &iter, path); gtk_tree_path_free(path); val = g_new0(GValue, 1); gtk_tree_model_get_value(gtk_tree_view_get_model(GTK_TREE_VIEW(tree)), &iter, 1, val); if (G_IS_VALUE(val) && g_value_fits_pointer(val)) { info = (FRInfo *) (g_value_peek_pointer(val)); } g_value_unset(val); g_free(val); } if (!info) return NULL; switch (info->type) { case FR_TYPE_TAG: str = g_strdup_printf("%s: ", info->name); lst = g_list_first(info->attributes); while (lst) { tmpa = (FRAttrInfo *) lst->data; tofree = str; str = g_strconcat(str, "", tmpa->name, " ", NULL); g_free(tofree); lst = g_list_next(lst); } break; case FR_TYPE_FUNCTION: if (info->return_type != NULL) str = g_strdup_printf("%s %s( ", info->return_type, info->name); else str = g_strdup_printf("%s( ", info->name); lst = g_list_first(info->params); while (lst) { tmpp = (FRParamInfo *) lst->data; tofree = str; if (tmpp->type != NULL) str = g_strconcat(str, "", tmpp->type, " ", tmpp->name, "", NULL); else str = g_strconcat(str, "", tmpp->name, "", NULL); g_free(tofree); lst = g_list_next(lst); if (lst) { tofree = str; str = g_strconcat(str, ",", NULL); g_free(tofree); } } tofree = str; str = g_strconcat(str, " )", NULL); g_free(tofree); break; } return str; } GtkWidget *fref_gui(Tbfwin * bfwin) { GtkWidget *scroll, *box, *pane, *box2, *btn1, *btn2, *btn3; GtkCellRenderer *cell; GtkTreeViewColumn *column; Tfref_data *fdata = FREFDATA(main_v->frefdata); GtkTreeIter it; bfwin->fref = g_new0(Tfref_gui, 1); pane = gtk_vpaned_new(); box = gtk_vbox_new(FALSE, 1); box2 = gtk_hbox_new(FALSE, 1); scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); FREFGUI(bfwin->fref)->infoscroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(FREFGUI(bfwin->fref)->infoscroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); FREFGUI(bfwin->fref)->tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(fdata->store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), FALSE); /*gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (FREFGUI(bfwin->fref)->tree), TRUE);*/ cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("", cell, "text", STR_COLUMN, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), column); gtk_container_add(GTK_CONTAINER(scroll), FREFGUI(bfwin->fref)->tree); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), FALSE); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->tree), "row-collapsed", G_CALLBACK(frefcb_row_collapsed), bfwin); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->tree), "row-expanded", G_CALLBACK(frefcb_row_expanded), fdata->store); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->tree), "button-press-event", G_CALLBACK(frefcb_event_mouseclick), bfwin); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->tree), "key-press-event", G_CALLBACK(frefcb_event_keypress), bfwin); gtk_widget_show(FREFGUI(bfwin->fref)->tree); gtk_widget_show(scroll); /* BUG??: don't we have a global tooltips object somewhere ? FREFGUI(bfwin->fref)->argtips = gtk_tooltips_new();*/ FREFGUI(bfwin->fref)->argtips = main_v->tooltips; FREFGUI(bfwin->fref)->tips = tree_tips_new_full(bfwin, GTK_TREE_VIEW(FREFGUI(bfwin->fref)->tree), fref_tip); tree_tips_set_hide_interval(FREFGUI(bfwin->fref)->tips, 5000); FREFGUI(bfwin->fref)->infoview = gtk_label_new(NULL); gtk_label_set_line_wrap(GTK_LABEL(FREFGUI(bfwin->fref)->infoview), TRUE); gtk_label_set_use_markup(GTK_LABEL(FREFGUI(bfwin->fref)->infoview), TRUE); gtk_misc_set_alignment(GTK_MISC(FREFGUI(bfwin->fref)->infoview), 0.0, 0.0); gtk_misc_set_padding(GTK_MISC(FREFGUI(bfwin->fref)->infoview), 5, 5); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->tree), "cursor-changed", G_CALLBACK(frefcb_cursor_changed), bfwin); FREFGUI(bfwin->fref)->infocheck = gtk_check_button_new_with_label(_("info")); gtk_widget_show(FREFGUI(bfwin->fref)->infocheck); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FREFGUI(bfwin->fref)->infocheck), TRUE); g_signal_connect(G_OBJECT(FREFGUI(bfwin->fref)->infocheck), "toggled", G_CALLBACK(frefcb_infocheck_toggled), bfwin); { /* BUG??: is this ever freed ??? */ Tcallbackdata *cd = g_new(Tcallbackdata, 1); cd->data = NULL; cd->bfwin = bfwin; btn1 = bf_allbuttons_backend(_("d"), FALSE, 0, G_CALLBACK(frefcb_info_dialog), cd); } btn2 = bf_allbuttons_backend(_("i"), FALSE, 0, G_CALLBACK(frefcb_full_info), bfwin); btn3 = bf_allbuttons_backend(_("s"), FALSE, 0, G_CALLBACK(frefcb_search), bfwin); gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, btn1, _("dialog"), ""); gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, btn2, _("info"), ""); gtk_tooltips_set_tip(FREFGUI(bfwin->fref)->argtips, btn3, _("search"), ""); gtk_box_pack_start(GTK_BOX(box2), FREFGUI(bfwin->fref)->infocheck, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box2), btn3, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box2), btn2, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box2), btn1, FALSE, TRUE, 0); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(FREFGUI(bfwin->fref)->infoscroll), FREFGUI(bfwin->fref)->infoview); gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), box2, FALSE, TRUE, 0); gtk_paned_pack1(GTK_PANED(pane), box, TRUE, FALSE); gtk_paned_pack2(GTK_PANED(pane), FREFGUI(bfwin->fref)->infoscroll, TRUE, TRUE); gtk_widget_show_all(pane); if (!gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(fdata->store), &it, NULL, 0)) fill_toplevels(fdata, FALSE); return pane; } winefish-1.3.3/src/char_table.c0000600000047200004720000001172010373411041015342 0ustar kyanhkyanh/* $Id: char_table.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * char_table.h - character convertion prototypes * * Complete rewrite for UTF8 Copyright (C) 2002 Olivier Sessink * some ideas from original version Copyright (C) 2000 Pablo De Napoli * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include #include "char_table.h" #include "bluefish.h" typedef struct { gunichar id; char *entity; } Tchar_entity; Tchar_entity ascii_charset[] = { {34, """} , {38, "&"} , {60, "<"} , {62, ">"} , {0, NULL} }; /* Do not modify this table * for convert_unichar_to_htmlstring to work properly */ Tchar_entity iso8859_1_charset[] = { {160, " "} , {161, "¡"} , {162, "¢"} , {163, "£"} , {164, "¤"} , {165, "¥"} , {166, "¦"} , {167, "§"} , {168, "¨"} , {169, "©"} , {170, "ª"} , {171, "«"} , {172, "¬"} , {173, "­"} , {174, "®"} , {175, "¯"} , {176, "°"} , {177, "±"} , {178, "²"} , {179, "³"} , {180, "´"} , {181, "µ"} , {182, "¶"} , {183, "·"} , {184, "¸"} , {185, "¹"} , {186, "º"} , {187, "»"} , {188, "¼"} , {189, "½"} , {190, "¾"} , {191, "¿"} , {192, "À"} , {193, "Á"} , {194, "Â"} , {195, "Ã"} , {196, "Ä"} , {197, "Å"} , {198, "Æ"} , {199, "Ç"} , {200, "È"} , {201, "É"} , {202, "Ê"} , {203, "Ë"} , {204, "Ì"} , {205, "Í"} , {206, "Î"} , {207, "Ï"} , {208, "Ð"} , {209, "Ñ"} , {210, "Ò"} , {211, "Ó"} , {212, "Ô"} , {213, "Õ"} , {214, "Ö"} , {215, "×"} , {216, "Ø"} , {217, "Ù"} , {218, "Ú"} , {219, "Û"} , {220, "Ü"} , {221, "Ý"} , {222, "Þ"} , {223, "ß"} , {224, "à"} , {225, "á"} , {226, "â"} , {227, "ã"} , {228, "ä"} , {229, "å"} , {230, "æ"} , {231, "ç"} , {232, "è"} , {233, "é"} , {234, "ê"} , {235, "ë"} , {236, "ì"} , {237, "í"} , {238, "î"} , {239, "ï"} , {240, "ð"} , {241, "ñ"} , {242, "ò"} , {243, "ó"} , {244, "ô"} , {245, "õ"} , {246, "ö"} , {247, "÷"} , {248, "ø"} , {249, "ù"} , {250, "ú"} , {251, "û"} , {252, "ü"} , {253, "ý"} , {254, "þ"} , {255, "ÿ"} , {0, NULL} }; static void convert_unichar_to_htmlstring(gunichar unichar, gchar *deststring, gboolean ascii, gboolean iso) { if (ascii) { gint j=0; while (ascii_charset[j].id != 0) { if (ascii_charset[j].id == unichar) { deststring[0]='\0'; strncat(deststring, ascii_charset[j].entity, 8); return; } j++; } } if (iso) { if (unichar >= 160 && unichar < 256) { deststring[0]='\0'; strncat(deststring, iso8859_1_charset[unichar - 160].entity, 8); return; } } { gint len= g_unichar_to_utf8(unichar, deststring); deststring[len] = '\0'; } } /* utf8string MUST BE VALIDATED UTF8 otherwise this function is broken!! so text from the TextBuffer is OK to use */ gchar *convert_string_utf8_to_html(const gchar *utf8string, gboolean ascii, gboolean iso) { if (!utf8string || utf8string[0] == '\0' || (!ascii && !iso)) { return g_strdup(utf8string); } else { /* optimize for speed, not for memory usage because that is very temporary */ gchar *converted_string = g_malloc0(8 * strlen(utf8string)*sizeof(gchar)); const gchar *srcp = utf8string; gunichar unichar = g_utf8_get_char(srcp); DEBUG_MSG("convert_string_utf8_to_html, utf8string='%s'\n", utf8string); while (unichar) { gchar converted[9]; convert_unichar_to_htmlstring(unichar, converted, ascii, iso); converted_string = strncat(converted_string, converted, 8); srcp = g_utf8_next_char(srcp); unichar = g_utf8_get_char (srcp); } DEBUG_MSG("convert_string_utf8_to_html, converted string='%s'\n", converted_string); return converted_string; } } winefish-1.3.3/src/wizards.c0000600000047200004720000005445610372321767014774 0ustar kyanhkyanh/* $Id: wizards.c 1773 2006-02-08 07:55:35Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * wizards.c - much magic is contained within * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include /* strtod() */ #include #include "bluefish.h" #include "wizards.h" /* myself */ #include "gtk_easy.h" /* spinbutwithvalue and stuff*/ #include "bf_lib.h" /* bf_str_repeat() */ #include "html_diag.h" #include "document.h" /* doc_insert_two_strings() */ #include "pixmap.h" /* new_pixmap() */ #include "stringlist.h" enum { TABLE_DEFAULT, /* table */ TABLE_ARRAY, TABLE_MATRIX #ifdef HAVE_CONTEXT , TABLE_CONTEXT_NATURAL #endif }; enum { LIST_ITEM_A = 1 << 0, /* itemize, enumerate: plain \item */ LIST_ITEM_B = 1 << 1, /* \item[] */ LIST_PARAM_A = 1 << 2, /* dinglist, dingautolist: one mandatory parameter {} */ LIST_PARAM_B = 1 << 3 /* enhanced enumerate: one mandatory paramter [] */ }; /** * repeat a string sometimes, added some details * @param str item string * @param number_of number of repeating * @param offset start fromoffset * @param show_all show detail for every items * @param comment comment added before details * @return repeating of str */ static gchar *bf_str_repeat_with_count(const gchar * str, gint number_of, gint offset, gboolean show_all, const gchar* comment) { if (!show_all && (number_of <=5) ) { return bf_str_repeat(str, number_of); } gchar *retstr = g_strdup(""); gchar *tmpstr=NULL; gint groups_index=1; gint index = 1; gint step = 5-4*show_all; while (index <= number_of) { if ( show_all || (index+offset) %5 == 0) { tmpstr = g_strdup_printf("%%%% %s %d\n",comment, groups_index * step); retstr = g_strconcat(retstr, tmpstr, str, NULL); groups_index++; }else{ retstr = g_strconcat(retstr, str, NULL); } index++; } g_free(tmpstr); return retstr; } static void table_wizard_ok_lcb(GtkWidget * widget, Thtml_diag *dg) { gint rows, cols, type; gchar *rowdata=NULL, *tablerow=NULL, *format=NULL, *env = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[1])->entry), 0, -1), /* env = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(dg->combo[1])->entry)); */ *tablecontent=g_strdup(""), *align=g_strdup(""), *vsep=g_strdup(""); /* gtk forces the value of one if nothing is entered */ rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[1])); cols = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[2])); #ifdef HAVE_CONTEXT if (strncmp(env,"context",7) ==0 ) { DEBUG_MSG("creat_table: type = context natural table\n"); type = TABLE_CONTEXT_NATURAL; } else #endif if (g_str_has_suffix(env,"matrix")) {/* matrix */ DEBUG_MSG("create table: type = matrix\n"); type = TABLE_MATRIX; }else{ gchar *tmpstr = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[2])->entry), 0, -1); align = g_strndup(tmpstr, 1); /* center ->, left -> l, right -> r */ g_free(tmpstr); if (g_str_has_suffix(env,"array")) {/* is array */ type = TABLE_ARRAY; DEBUG_MSG("create table: type = array\n"); }else{/* tabular, longtable */ type = TABLE_DEFAULT; DEBUG_MSG("create table: type = tabular or longtable\n"); vsep = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[3])->entry), 0, -1); if (/* !g_ascii_strcasecmp */strstr(vsep,"none")) {/* g_ascii_strcasecmp() return 0 if matched */ DEBUG_MSG("create table: column format = none\n"); vsep = g_strdup(""); } } } gchar *tmpstr = NULL; gint row_index = 1 ; while (row_index <= rows) { /* number of & = number of cols - 1 */ #ifdef HAVE_CONTEXT if (type == TABLE_CONTEXT_NATURAL) { rowdata = bf_str_repeat("\t\\bTD\n\t\\eTD\n", cols); }else #endif if (cols >1) { tmpstr = g_strdup_printf(_("row %d col"), row_index); rowdata = bf_str_repeat_with_count("&\n", cols-1, 1, FALSE, tmpstr ); }else{ rowdata = g_strdup(""); } rowdata = g_strconcat("\n",rowdata,NULL); /* kyanh, TODONE: disable hline for ARRAY */ if ((type == TABLE_DEFAULT) && GTK_TOGGLE_BUTTON(dg->check[1])->active) { tablerow = g_strconcat(rowdata, "\\\\\\hline\n", NULL); } #ifdef HAVE_CONTEXT else if (type == TABLE_CONTEXT_NATURAL ){ tablerow = g_strconcat("\\bTR\n", rowdata, "\\eTR\n", NULL); } #endif else{ tablerow = g_strconcat(rowdata, "\\\\\n", NULL); } tmpstr = g_strdup_printf(_("%%%% row %d\n"), row_index); tablecontent = g_strconcat(tablecontent, tmpstr, tablerow,NULL); row_index ++; } g_free(rowdata); g_free(tmpstr); if ((type == TABLE_DEFAULT) && GTK_TOGGLE_BUTTON(dg->check[1])->active) { tablecontent = g_strconcat("\\hline\n",tablecontent,NULL); /* add head=\hline */ }else{ #ifdef HAVE_CONTEXT if (type != TABLE_CONTEXT_NATURAL ) { #endif /* kyanh, TODONE: remove \\ from the last row if no \hline was added */ tablecontent = g_strndup(tablecontent,strlen(tablecontent)-3); /* remove last \\ */ #ifdef HAVE_CONTEXT } #endif } g_free(tablerow); if (type == TABLE_DEFAULT) { /* BUG#5869#bilco */ /* better? use vsep = g_strdup("") (above) */ format = g_strconcat(vsep,align,NULL); /* |c, */ format = bf_str_repeat(format,cols); format = g_strconcat("{",format,vsep,"}",NULL); } else if (type == TABLE_ARRAY) { format = bf_str_repeat(align,cols); format = g_strconcat("{",format,"}",NULL); }else{/* context included :) */ format = g_strdup(""); } g_free(align); g_free(vsep); DEBUG_MSG("create table: full columns format = %s\n", format); gchar *before_str, *after_str; #ifdef HAVE_CONTEXT if (type == TABLE_CONTEXT_NATURAL) { before_str = g_strdup("\\starttable\n"); }else{ #endif before_str = g_strconcat("\\begin{",env,"}",format,"\n", NULL); #ifdef HAVE_CONTEXT } #endif g_free(format); #ifdef HAVE_CONTEXT if (type == TABLE_CONTEXT_NATURAL) { after_str = g_strconcat(tablecontent, "\\stoptable", NULL); }else{ #endif after_str = g_strconcat(tablecontent, "\\end{",env,"}", NULL); #ifdef HAVE_CONTEXT } #endif g_free(env); g_free(tablecontent); doc_insert_two_strings(dg->bfwin->current_document, before_str, after_str); g_free(before_str); g_free(after_str); html_diag_destroy_cb(NULL, dg); } /* kyanh, 20050212, added */ void table_type_changed_cb(GtkWidget* widget, Thtml_diag *dg) { const gchar *tmpstr = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(dg->combo[1])->entry)); if ( g_str_has_suffix(tmpstr, "matrix") #ifdef HAVE_CONTEXT || (strncmp (tmpstr, "context", 7) == 0) #endif ) { gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[2]), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[3]), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(dg->check[1]), FALSE); } else if (/* NOT g_*/ strncmp(tmpstr,"array",5)==0 ) { gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[2]), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[3]), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(dg->check[1]), FALSE); }else{ gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[2]), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[3]), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(dg->check[1]), TRUE); } } void tablewizard_dialog(Tbfwin *bfwin) { GtkWidget *dgtable; Thtml_diag *dg; dg = html_diag_new(bfwin,_("Table Wizard")); dgtable = gtk_table_new(4, 5, 0); gtk_table_set_row_spacings(GTK_TABLE(dgtable), 6); gtk_table_set_col_spacings(GTK_TABLE(dgtable), 12); gtk_box_pack_start(GTK_BOX(dg->vbox), dgtable, FALSE, FALSE, 0); dg->spin[1] = spinbut_with_value("1", 1, 100, 1.0, 5.0); bf_mnemonic_label_tad_with_alignment(_("Number of _rows:"), dg->spin[1], 0, 0.5, dgtable, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[1], 1, 2, 0, 1); dg->spin[2] = spinbut_with_value("1", 1, 100, 1.0, 5.0); bf_mnemonic_label_tad_with_alignment(_("Number of colu_mns:"), dg->spin[2], 0, 0.5, dgtable, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[2], 1, 2, 1, 2); dg->check[1] = gtk_check_button_new(); bf_mnemonic_label_tad_with_alignment(_("Add Horizontal Rules:"), dg->check[1], 0, 0.5, dgtable, 0, 1, 2, 3); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[1], 1, 2, 2, 3); GList *dtd_cblist = NULL; #ifdef HAVE_CONTEXT dtd_cblist = g_list_append(dtd_cblist, "context"); #endif dtd_cblist = g_list_append(dtd_cblist, "tabular"); dtd_cblist = g_list_append(dtd_cblist, "longtable"); dtd_cblist = g_list_append(dtd_cblist, "array"); dtd_cblist = g_list_append(dtd_cblist, "matrix"); dtd_cblist = g_list_append(dtd_cblist, "bmatrix"); dtd_cblist = g_list_append(dtd_cblist, "vmatrix"); dtd_cblist = g_list_append(dtd_cblist, "Vmatrix"); dtd_cblist = g_list_append(dtd_cblist, "pmatrix"); #ifdef HAVE_CONTEXT dg->combo[1] = combo_with_popdown("context", dtd_cblist, 0); /* kyanh, default env = context */ #else dg->combo[1] = combo_with_popdown("tabular", dtd_cblist, 0); /* kyanh, default env = tabular */ #endif bf_mnemonic_label_tad_with_alignment(_("Type (Environment):"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 4, 5); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[1], 1, 2, 4, 5); g_signal_connect(G_OBJECT(GTK_ENTRY(GTK_COMBO(dg->combo[1])->entry)), "changed", G_CALLBACK(table_type_changed_cb), dg); dtd_cblist = NULL; dtd_cblist = g_list_append(dtd_cblist, "center"); dtd_cblist = g_list_append(dtd_cblist, "left"); dtd_cblist = g_list_append(dtd_cblist, "right"); dg->combo[2] = combo_with_popdown("center", dtd_cblist, 0); bf_mnemonic_label_tad_with_alignment(_("Columns Alignmen:"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 5, 6); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[2], 1, 2, 5, 6); g_signal_connect(G_OBJECT(GTK_ENTRY(GTK_COMBO(dg->combo[2])->entry)), "changed", G_CALLBACK(table_type_changed_cb), dg); dtd_cblist = NULL; /* TODO: save history */ dtd_cblist = g_list_append(dtd_cblist, "none"); dtd_cblist = g_list_append(dtd_cblist, "|"); dtd_cblist = g_list_append(dtd_cblist, "||"); dtd_cblist = g_list_append(dtd_cblist, "@{}"); /* TODO: @{text} */ dg->combo[3] = combo_with_popdown("|", dtd_cblist, 1); g_list_free(dtd_cblist); bf_mnemonic_label_tad_with_alignment(_("Vertical Rules:"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 6, 7); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[3], 1, 2, 6, 7); g_signal_connect(G_OBJECT(GTK_ENTRY(GTK_COMBO(dg->combo[3])->entry)), "changed", G_CALLBACK(table_type_changed_cb), dg); #ifdef HAVE_CONTEXT gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[2]), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(dg->combo[3]), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(dg->check[1]), FALSE); #endif html_diag_finish(dg, G_CALLBACK(table_wizard_ok_lcb)); } static gchar *extract_time_string(char *original_string) { static gchar *return_string; gchar *start_ptr; gchar *end_ptr; gint string_size; return_string = g_malloc0(32); start_ptr = strchr(original_string, '('); start_ptr++; end_ptr = strchr(original_string, ')'); string_size = end_ptr - start_ptr; strncat(return_string, start_ptr, string_size); return return_string; } /************************************************************************/ /* time insert struct */ typedef struct { GtkWidget *check[6]; GtkWidget *label[6]; GtkWidget *dialog; Tbfwin *bfwin; } TimeInsert; static void insert_time_destroy_lcb(GtkWidget * widget, TimeInsert * data) { DEBUG_MSG("insert_time_destroy_lcb, data=%p\n", data); window_destroy(data->dialog); g_free(data); } static void insert_time_callback(GtkWidget * widget, TimeInsert * timeinsert) { gchar *temp_string; gchar *insert_string; gchar *final_string; gint count; insert_string = g_malloc0(32); final_string = g_malloc0(255); for (count = 1; count < 6; count++) { if (GTK_TOGGLE_BUTTON(timeinsert->check[count])->active) { gtk_label_get(GTK_LABEL(timeinsert->label[count]), &temp_string); insert_string = extract_time_string(temp_string); strncat(final_string, insert_string, 31); strncat(final_string, " ", 31); } DEBUG_MSG("insert_time_callback, count=%d\n", count); } DEBUG_MSG("insert_time_callback, final_string=%s\n", final_string); doc_insert_two_strings(timeinsert->bfwin->current_document, final_string, ""); DEBUG_MSG("insert_time_callback, text inserted\n"); g_free(insert_string); g_free(final_string); insert_time_destroy_lcb(NULL, timeinsert); DEBUG_MSG("insert_time_callback, finished\n"); } /************************************************************************/ static void insert_time_cancel(GtkWidget * widget, TimeInsert * data) { DEBUG_MSG("insert_time_cancel, data=%p\n", data); insert_time_destroy_lcb(widget, data); } /************************************************************************/ void insert_time_dialog(Tbfwin *bfwin) { gint month, year, count; time_t time_var; gchar *temp = NULL; struct tm *time_struct; TimeInsert *timeinsert; GtkWidget *ok_b, *cancel_b, *vbox, *hbox; timeinsert = g_malloc(sizeof(TimeInsert)); timeinsert->bfwin = bfwin; time_var = time(NULL); time_struct = localtime(&time_var); DEBUG_MSG("insert_time_cb, timeinsert=%p\n", timeinsert); timeinsert->dialog = window_full(_("Insert Time"), GTK_WIN_POS_MOUSE , 12, G_CALLBACK(insert_time_destroy_lcb), timeinsert, TRUE); vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(timeinsert->dialog), vbox); for (count = 1; count < 6; count++) { switch (count) { case 1: temp = g_strdup_printf(_(" _Time (%i:%i:%i)"), time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec); break; case 2: switch (time_struct->tm_wday) { case 0: temp = g_strdup(_(" Day of the _week (Sunday)")); break; case 1: temp = g_strdup(_(" Day of the _week (Monday)")); break; case 2: temp = g_strdup(_(" Day of the _week (Tuesday)")); break; case 3: temp = g_strdup(_(" Day of the _week (Wednesday)")); break; case 4: temp = g_strdup(_(" Day of the _week (Thursday)")); break; case 5: temp = g_strdup(_(" Day of the _week (Friday)")); break; case 6: temp = g_strdup(_(" Day of the _week (Saturday)")); break; default: g_message(_("You appear to have a non existant day!\n")); temp = g_strdup(" ** Error ** see stdout"); } /* end of switch day of week */ break; case 3: month = time_struct->tm_mon + 1; year = time_struct->tm_year; year = 1900 + year; temp = g_strdup_printf(_(" _Date (%i/%i/%i)"), time_struct->tm_mday, month, year); break; case 4: temp = g_strdup_printf(_(" _Unix Time (%i)"), (int) time_var); break; case 5: temp = g_strdup_printf(_(" Unix Date _String (%s"), ctime(&time_var)); /* Replace \n on ')' */ temp[strlen(temp) - 1] = ')'; break; default: break; } /* end of switch count */ timeinsert->check[count] = gtk_check_button_new(); timeinsert->label[count] = gtk_label_new_with_mnemonic(temp); gtk_label_set_mnemonic_widget(GTK_LABEL(timeinsert->label[count]), timeinsert->check[count]); g_free(temp); gtk_container_add(GTK_CONTAINER(timeinsert->check[count]), GTK_WIDGET(timeinsert->label[count])); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(timeinsert->check[count]), TRUE, TRUE, 0); } /* end of for loop */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), gtk_hseparator_new(), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 10); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); ok_b = bf_stock_ok_button(GTK_SIGNAL_FUNC(insert_time_callback), (gpointer) timeinsert); gtk_window_set_default(GTK_WINDOW(timeinsert->dialog), ok_b); cancel_b = bf_stock_cancel_button(GTK_SIGNAL_FUNC(insert_time_cancel), (gpointer) timeinsert); gtk_box_pack_start(GTK_BOX(hbox), cancel_b, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), ok_b, TRUE, TRUE, 0); gtk_widget_show_all(timeinsert->dialog); } /* QUICK START */ static void quickstart_ok_lcb(GtkWidget *widget, Thtml_diag *dg) { gchar *finalstring, *class; class = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[1])->entry), 0, -1); finalstring = g_strconcat(class, "\n\\usepackage{ifpdf}\n\ \\usepackage[colorlinks,bookmarksopen]{hyperref}\n" /* \\usepackage[left=25mm,right=20mm,top=25mm,bottom=25mm]{geometry}", */ ,"\\begin{document}\n", NULL); g_free(class); /* kyanh, 20050225, i don't know why. after inserting two strings, the iter START/END change. */ /*gchar *tmpstr = g_strdup("\n\n\\end{document}\n");*/ doc_insert_two_strings(dg->doc, finalstring, "\n\\end{document}\n"); g_free(finalstring); /*g_free(tmpstr);*/ /* if ( dg->doc->highlightstate ) { dg->doc->need_highlighting = TRUE; doc_highlight_full( dg->doc ); } */ html_diag_destroy_cb(NULL, dg); } void quickstart_dialog(Tbfwin *bfwin, Ttagpopup *data) { GtkWidget *dgtable; Thtml_diag *dg; dg = html_diag_new(bfwin,_("Quick Start")); #ifdef HAVE_VNTEX dgtable = html_diag_table_in_vbox(dg, 4, 4); /* rows, cols */ #else dgtable = html_diag_table_in_vbox(dg, 2, 4); /* rows, cols */ #endif /* Document classes */ /* TODO: save users' modification */ GList *dtd_cblist = NULL; dtd_cblist = add_to_stringlist(dtd_cblist, "\\documentclass[12pt, oneside, a4paper]{article}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\documentclass[12pt, oneside, a4paper]{report}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\documentclass[12pt, oneside, a4paper]{book}"); dg->combo[1] = combo_with_popdown("\\documentclass[12pt, oneside, a4paper]{article}", dtd_cblist, 1); gtk_widget_set_size_request(dg->combo[1], 425, -1); bf_mnemonic_label_tad_with_alignment(_("Document _Class:"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[1], 1, 4, 0, 1); #ifdef HAVE_VNTEX /* Vietnam package */ dtd_cblist = NULL; dtd_cblist = add_to_stringlist(dtd_cblist, "none"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[utf8x]{vietnam}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[utf8]{vietnam}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[viscii]{vietnam}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[tcvn]{vietnam}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[vps]{vietnam}"); dtd_cblist = add_to_stringlist(dtd_cblist, "\\usepackage[mviscii]{vietnam}"); dg->combo[2] = combo_with_popdown("\\usepackage[utf8x]{vietnam}", dtd_cblist, 1); gtk_widget_set_size_request(dg->combo[2], 425, -1); g_list_free(dtd_cblist); bf_mnemonic_label_tad_with_alignment(_("_VnTeX Support:"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[2], 1, 4, 1, 2); #endif /* TODO: add additional packages: geometry, amsmath */ /* finish */ html_diag_finish(dg, G_CALLBACK(quickstart_ok_lcb)); } /* QUICK LIST */ /* result > extra > items > result1 */ static void quicklistok_lcb(GtkWidget * widget, Thtml_diag *dg) { gint rows,type; gchar *env, *result, *result1, *extra, *anitem, *anitem_n; rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[1])); env = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[1])->entry), 0, -1); if (g_str_has_prefix(env,"enhance")) { env = g_strdup("enumerate"); type = LIST_PARAM_B; anitem = g_strdup("\\item"); anitem_n = g_strdup("\\item\n"); }else if (g_str_has_prefix(env,"ding")) { type = LIST_PARAM_A; anitem = g_strdup("\\item"); anitem_n = g_strdup("\\item\n"); }else if (strncmp(env,"description", 11) ==0) { type = LIST_ITEM_B; anitem = g_strdup("\\item[]"); /* not very good */ anitem_n = g_strdup("\\item[]\n"); }else{ type = LIST_ITEM_A; anitem = g_strdup("\\item"); anitem_n = g_strdup("\\item\n"); } if (rows ==0 ) { anitem = g_strdup(""); anitem_n = g_strdup(""); } result1 = g_strdup(""); switch (type) { case LIST_PARAM_A: result = g_strconcat("\\begin{",env,"}{",NULL); extra = g_strdup("}\n"); if (rows) { result1 = bf_str_repeat_with_count(anitem_n,rows,0,FALSE,_("item")); } break; case LIST_PARAM_B: result = g_strconcat("\\begin{",env,"}[",NULL); extra = g_strdup("]\n"); if (rows) { result1 = bf_str_repeat_with_count(anitem_n,rows,0,FALSE,_("item")); } break; default: result = g_strconcat("\\begin{",env,"}\n",anitem,NULL); if (rows>1) { result1 = bf_str_repeat_with_count(anitem_n, rows-1, 1,FALSE,_("item")); } extra = g_strdup("\n"); break; }; result1 = g_strconcat(extra, result1, "\\end{",env,"}",NULL); doc_insert_two_strings(dg->doc, result, result1); g_free(result); g_free(result1); g_free(env); g_free(extra); html_diag_destroy_cb(widget, dg); } void quicklist_dialog(Tbfwin *bfwin, Ttagpopup *data) { Thtml_diag *dg; GtkWidget *dgtable; dg = html_diag_new(bfwin,_("Quick List")); dgtable = html_diag_table_in_vbox(dg, 2, 10); /* kyanh, default value: a list should contain at leat 2 items */ dg->spin[1] = spinbut_with_value("2", 0, 500, 1.0, 5.0); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(dg->spin[1]), 1); bf_mnemonic_label_tad_with_alignment(_("_Rows:"), dg->spin[1], 0, 0.5, dgtable, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[1], 1, 2, 0, 1); GList *dtd_cblist = NULL; dtd_cblist = g_list_append(dtd_cblist, "itemize"); dtd_cblist = g_list_append(dtd_cblist, "description"); dtd_cblist = g_list_append(dtd_cblist, "enumerate"); dtd_cblist = g_list_append(dtd_cblist, "enhanced enumerate"); dtd_cblist = g_list_append(dtd_cblist, "dinglist"); dtd_cblist = g_list_append(dtd_cblist, "dingautolist"); dg->combo[1] = combo_with_popdown("itemize", dtd_cblist, 0); bf_mnemonic_label_tad_with_alignment(_("Type (_Environment):"), dg->combo[1], 0, 0.5, dgtable, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[1], 1, 2, 1, 2); g_list_free(dtd_cblist); html_diag_finish(dg, G_CALLBACK(quicklistok_lcb)); } winefish-1.3.3/src/config_spec.h0000600000047200004720000000420610412071173015545 0ustar kyanhkyanh#ifndef __CONFIG_SPEC_H_ #define __CONFIG_SPEC_H_ /*********************** winefish *********************** * * outputbox * these lines alter `rcfile.c::rc_parse_main()' * *********************** winefish ***********************/ #define OB_LaTeX "latex -file-line-error-style -src-specials '%B'" #define OB_PDFLaTeX "pdflatex -file-line-error-style -src-specials '%B'" #define OB_DVIPS "dvips -o '%B.ps' '%B.dvi'" #define OB_DVIPDFM "dvipdfm -o '%B.pdf' '%B.dvi'" #define OB_ViewLog "cat '%B.log'" #define OB_SoftClean "rm -fv '%B.log' '%B.aux' '%B.toc'" #define OB_DVI_Viewer "xdvi -editor \"winefish -n0 -l%%l '%%f'\" -sourceposition '%l%b.tex' '%B.dvi' &" #define OB_PDF_Viewer "xpdf '%B.pdf' &" #define OB_EPS_Viewer "gv '%B.ps' &" #define OB_Dos2Unix "cat '%f' | dos2unix > '%o'" #define OB_Tidy "cat '%f' | tidy -utf8 -q >'%o' 2>/dev/null" /*********************** winefish *********************** * * below things you may modify... * *********************** winefish ***********************/ /* maximum depth for `find' function */ #define FUNC_GREP_RECURSIVE_MAX_DEPTH "-maxdepth 50" /* maximum length of latex command (\foobar) */ #define COMMAND_MAX_LENGTH 20 /* maximum length of autotext command (/foobar) */ #define AUTOTEXT_MAX_LENGTH 20 /* delimiters for recognization of latex commands */ #define DELIMITERS " `1234567890-=~!@#$%^&*()_+[]{};':\",./<>?\\|" /*********************** winefish *********************** * The maximum of lines for `brace_finder' when it starts job *AUTOMATICALLY*. * Each times `brace_finder' enters a new line, the value of `line-index' will be * increased. If `line-index' reaches BRACE_FINDER_MAX_LINES, * it returns BR_RET_NOT_FOUND (see brace_finder.c::brace_finder()) * * too big value will slowdown winefish. * the best value is the maximum of lines in the visible area... *********************** winefish ***********************/ #define BRACE_FINDER_MAX_LINES 30 /* 30*80 */ #define BRACE_FINDER_MAX_CHARS 2400 /*********************** winefish ***********************/ /* #undef BACKUP_RC_FILE_ON_SAVE */ /*********************** winefish ***********************/ #endif /* __CONFIG_SPEC_H_ */ winefish-1.3.3/src/char_table.h0000600000047200004720000000233310373411041015347 0ustar kyanhkyanh/* $Id: char_table.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * char_table.h - character convertion functions and data structures * * Copyright (C) 2002-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ gchar *convert_string_utf8_to_html(const gchar *utf8string, gboolean ascii, gboolean iso); #define xml_escape(var) convert_string_utf8_to_html(var, TRUE, FALSE); #define html_escape(var) convert_string_utf8_to_html(var, TRUE, FALSE); winefish-1.3.3/src/snooper.c0000600000047200004720000001465010373241726014763 0ustar kyanhkyanh/* $Id: snooper.c 1813 2006-02-11 01:54:30Z kyanh $ */ /* Winefish LaTeX Editor * * Completion support * * Copyright (c) 2005 KyAnh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include "bluefish.h" #include "snooper.h" /* #define SHOW_SNOOPER */ /* UniKey stuff: this function will be call twice, once when key is pressed, once when key is released; snooper works well without turning on InputMethod (UniKey). It's hard to imagine. THIS IS A BUG of UniKey: I tried with other input methods and got not problems. *Note* that UniKey runs after snooper :) -- we can see this by #define SHOW_SNOOPER 1 */ #define ALL_CONTROL_MASK ( GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK | GDK_MOD4_MASK | GDK_MOD5_MASK) static gint completion_snooper (GtkWidget *widget, GdkEventKey *kevent, gpointer data) { gint retval = FALSE; #ifdef SHOW_SNOOPER if ( kevent->type == GDK_KEY_PRESS ) { g_print("\nsnooper: press\n"); }else{ g_print("snooper: release\n"); } g_print("snooper: entering popup.show = %d\n", main_v->completion.show); guint32 character; character = gdk_keyval_to_unicode( kevent->keyval ); g_print( "snooper: now: keyval=%d (or %X), character=%d, string=%s, state=%d, hw_keycode=%d\n", kevent->keyval, kevent->keyval, character, kevent->string, kevent->state, kevent->hardware_keycode ); if (((GdkEventKey*)main_v->last_kevent)) { character = gdk_keyval_to_unicode( ((GdkEventKey*)((GdkEventKey*)main_v->last_kevent))->keyval ); g_print( "snooper: previous: keyval=%d (or %X), character=%d, string=%s, state=%d, hw_keycode=%d\n", ((GdkEventKey*)main_v->last_kevent)->keyval, ((GdkEventKey*)main_v->last_kevent)->keyval, character, ((GdkEventKey*)main_v->last_kevent)->string, ((GdkEventKey*)main_v->last_kevent)->state, ((GdkEventKey*)main_v->last_kevent)->hardware_keycode ); }else{ g_print("snooper: previos: undefined\n"); } #endif /* SHOW_SNOOPER */ if (main_v->completion.show == COMPLETION_AUTO_CALL) { } else if ( (kevent->keyval == GDK_Escape) && (main_v->completion.show == COMPLETION_WINDOW_SHOW) ) { #ifdef SHOW_SNOOPER g_print("snooper: Escape key captured.\n"); #endif /* SHOW_SNOOPER */ gtk_widget_hide( GTK_WIDGET( main_v->completion.window )); main_v->completion.show = COMPLETION_WINDOW_HIDE; retval = TRUE; } else if ( (kevent->keyval == GDK_Delete) && (main_v->completion.show == COMPLETION_WINDOW_SHOW) ) { if (kevent->type == GDK_KEY_PRESS ) { main_v->completion.show = COMPLETION_DELETE; }else{ retval = TRUE; } /* release-event will be ignored */ } else if ( ( kevent->state & GDK_CONTROL_MASK ) && ( kevent->keyval == GDK_space ) ) { /* the popup is shown only key is press */ if ( (main_v->completion.show < COMPLETION_WINDOW_SHOW) && (kevent->type == GDK_KEY_PRESS ) ) { #ifdef SHOW_SNOOPER g_print("snooper: popup to be shown\n"); #endif main_v->completion.show = COMPLETION_FIRST_CALL; /* to be shown */ if ( kevent->type == GDK_KEY_RELEASE ) { retval = TRUE; /* ignore the release key */ #ifdef SHOW_SNOOPER }else{ g_print("snooper: CTRL + Space will be passed\n"); #endif } } else { /* press | release */ #ifdef SHOW_SNOOPER g_print("snooper: popup is active\n"); #endif retval = TRUE; } } else if ( (main_v->completion.show > COMPLETION_WINDOW_HIDE) && ((kevent->keyval == GDK_Return || kevent->keyval == GDK_Up || kevent->keyval == GDK_Down || kevent->keyval == GDK_Page_Up || kevent->keyval == GDK_Page_Down))) { if ( kevent->keyval == GDK_Return ) { main_v->completion.show = COMPLETION_WINDOW_ACCEPT; if ( kevent->type == GDK_KEY_PRESS ) { retval= TRUE; } } else { if ( kevent->type == GDK_KEY_RELEASE ) { retval = TRUE; }else if ( kevent->keyval == GDK_Up) { main_v->completion.show = COMPLETION_WINDOW_UP; } else if ( kevent->keyval == GDK_Down ) { main_v->completion.show = COMPLETION_WINDOW_DOWN; } else if ( kevent->keyval == GDK_Page_Down ) { main_v->completion.show = COMPLETION_WINDOW_PAGE_DOWN; } else if ( kevent->keyval == GDK_Page_Up ) { main_v->completion.show = COMPLETION_WINDOW_PAGE_UP; } } } else { #ifdef SHOW_SNOOPER g_print("snooper: -- auto call -- or nothing\n"); #endif if ( (main_v->completion.show == COMPLETION_WINDOW_SHOW ) && ( kevent->state & ALL_CONTROL_MASK) ) { /* only SHIFT mask available here; this happens when user press SHIFT to get a Uppercase letters, for example. */ /* BUG#5990, for belgian keyboard: must press ALT+{, ALT+} to get {, }*/ if ( (kevent->keyval != GDK_braceleft) && (kevent->keyval != GDK_braceright) ) { #ifdef SHOW_SNOOPER g_print("snooper: popup is showing. 'non-null-state' event will be canceled\n"); #endif retval = TRUE; } } else if (kevent->type == GDK_KEY_RELEASE) { /* auto show the form. TODO: Should be a main's properties */ if ((kevent->state == 0) && (((GdkEventKey*)main_v->last_kevent)->state==0)&& ( (((GdkEventKey*)main_v->last_kevent)->keyval == GDK_braceleft) || ( (GDK_a <= ((GdkEventKey*)main_v->last_kevent)->keyval) && (GDK_z >= ((GdkEventKey*)main_v->last_kevent)->keyval)) || ((GDK_A <= ((GdkEventKey*)main_v->last_kevent)->keyval) && (GDK_Z >= ((GdkEventKey*)main_v->last_kevent)->keyval))) ) { #ifdef SHOW_SNOOPER g_print("snooper: previous: normal key. auto start completion...\n"); #endif main_v->completion.show = COMPLETION_AUTO_CALL; } } } if (kevent->type == GDK_KEY_PRESS) { #ifdef SHOW_SNOOPER g_print("snooper: cache now keyval and hardware_keycode\n"); #endif *((GdkEventKey*)main_v->last_kevent) = *kevent; } return retval; } void snooper_install() { /* install a snooper for doc->view */ main_v->snooper = gtk_key_snooper_install( (GtkKeySnoopFunc) completion_snooper, NULL); main_v->last_kevent = gdk_event_new(GDK_KEY_PRESS);/* requires GLIB 2.2*/ } winefish-1.3.3/src/image.h0000600000047200004720000000050710373411041014346 0ustar kyanhkyanh/* $Id: image.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* * Modified for Winefish (C) 2005 Ky Anh */ #ifndef __IMAGE_H_ #define __IMAGE_H_ #include "html_diag.h" void image_insert_dialog(Tbfwin *bfwin, Ttagpopup *data); void image_insert_from_filename(Tbfwin *bfwin, gchar *filename); #endif /* __IMAGE_H_ */ winefish-1.3.3/src/fref.h0000600000047200004720000000462510373411041014213 0ustar kyanhkyanh/* $Id: fref.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* ---------------------------------------------------------- */ /* -------------- XML FILE FORMAT --------------------------- */ /* ---------------------------------------------------------- */ /* Group description Function description Text shown in a tooltip or hints Values if vallist==1 Parameter description Return value description Text inserted after executing dialog, use params as %0,%1,%2 etc. %_ means "insert only these attributes which are not empty and not default values" Text inserted after activating this action Text shown in the info The TABLE element contains all other elements that specify caption, rows, content, and formatting. Tag tooltip This attribute specifies the width (in pixels only) of the frame around a table (see the Note below for more information about this attribute). Text inserted after executing dialog, use params as %0,%1,%2 etc. Text inserted after activating this action Text shown in the info */ #ifndef __FREF_H__ #define __FREF_H__ GtkWidget *fref_gui(Tbfwin *bfwin); /* used in gui.c */ void fref_init(void); /* only used once */ void fref_cleanup(Tbfwin *bfwin); void fref_rescan_dir(const gchar *dir); /* used by rcfile.c */ #endif /* __FREF_H__ */ winefish-1.3.3/src/wizards.h0000600000047200004720000000246410373411041014753 0ustar kyanhkyanh/* $Id: wizards.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * wizards.h - wizard callback prototypes * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __WIZARDS_H_ #define __WIZARDS_H_ #include "html_diag.h" /* Ttagpopup */ void tablewizard_dialog(Tbfwin *bfwin); void insert_time_dialog(Tbfwin *bfwin); void quickstart_dialog(Tbfwin *bfwin, Ttagpopup *data); void quicklist_dialog(Tbfwin *bfwin, Ttagpopup *data); #endif /* __WIZARDS_H_ */ winefish-1.3.3/src/stringlist.c0000600000047200004720000005710010375113637015476 0ustar kyanhkyanh/* $Id: stringlist.c 1936 2006-02-16 15:17:51Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * stringlist.c - functions that deal with stringlists * * Copyright (C) 1999-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*#define DEBUG*/ /* * This module deals with the GUI dialog used in bluefish to manage * GLists in which each element is composed of several strings, * like the lists of syntax highlighting, external filters, external commands, * and lately doctypes. For example, the list of doctypes contains a string * for the DOCTYPE and a string for the FILENAME of that doctype. * * When the stringlist is edited, the old one is deleted and a new one is created, * so the order can be different from the original. */ #include #include #include /* strspn() */ #include /* strcasecmp() */ #include "bluefish.h" #include "bf_lib.h" /*#include "coloursel.h" color_but_new() */ #include "stringlist.h" #include "gtk_easy.h" #define STRING_MAX_SIZE 4096 #define MAX_ARRAY_LENGTH 20 /************************************************************************/ /************************************************************************/ #ifdef USE_ESTRL_DIALOG /* kyanh, removed, 200550228 */ #endif /* USE_ESTRL_DIALOG */ /************************************************************************/ #ifdef DEBUG void debug_array(gchar **array) { gint count=0; gchar **tmpchar=array; if (!tmpchar) { DEBUG_MSG("debug_array, no array!?!?\n"); } while (*tmpchar != NULL) { count++; DEBUG_MSG("debug_array, tmpchar(%p), count=%d, contains(%p) %s\n", tmpchar, count, *tmpchar, *tmpchar); tmpchar++; } } #endif /** * count_array: * @array: #gchar** with the NULL terminated array to count * * counts the number of entries in a NULL terminated array * * Return value: #gint with number of entries */ gint count_array(gchar **array) { gint count=0; gchar **tmpchar=array; if (!tmpchar) { DEBUG_MSG("count_array, no array!?!?\n"); return 0; } while (*tmpchar != NULL) { count++; tmpchar++; } return count; } /** * array_to_string: * @array: #gchar** with NULL terminated array * @delimiter: #gchar with the delimiter character * * Converts a NULL terminated array to a string with a delimiter * between the entries, and some characters backslash escaped * like \t, \n, \\ and the delimiter. In Bluefish the : is the most * used delimiter * * Return value: #gchar* newly allocated string */ gchar *array_to_string(gchar **array) { if (array) { gchar **tmp, *escaped1, *finalstring; gint newsize=1; DEBUG_MSG("array_to_string, started\n"); finalstring = g_malloc0(newsize); tmp = array; while(*tmp) { DEBUG_MSG("array_to_string, *tmp = %s\n", *tmp); escaped1 = escape_string(*tmp, TRUE); newsize += strlen(escaped1)+1; finalstring = g_realloc(finalstring, newsize); strcat(finalstring, escaped1); finalstring[newsize-2] = ':'; finalstring[newsize-1] = '\0'; g_free(escaped1); tmp++; } DEBUG_MSG("array_to_string, finalstring = %s\n", finalstring); return finalstring; } else { #ifdef DEBUG DEBUG_MSG("array_to_string, array=NULL !!!\n"); exit(135); #else return g_strdup(""); #endif } } #define ARRAYBLOCKSIZE 6 #define BUFBLOCKSIZE 60 /** * string_to_array: * @string: #gchar* with the string to convert * @delimiter: #gchar with the delimiter character * * breaks the string apart into a NULL terminated array * using the delimiter character. \t, \\ and \n are also unescaped * to their original characters * * Return value: #gchar** newly allocated NULL terminated array */ /* * kyanh: use `:' as separator. */ gchar **string_to_array(gchar *string) { gchar **array; gchar *tmpchar, *tmpchar2; gchar *newstring; gint count=0; gint newstringsize; gint arraycount=0, arraysize; newstringsize = BUFBLOCKSIZE; newstring = g_malloc(newstringsize * sizeof(char)); arraysize = ARRAYBLOCKSIZE; array = g_malloc(arraysize * sizeof(char *)); DEBUG_MSG("string_to_array, started, array=%p\n", array); tmpchar = string; while (*tmpchar != '\0') { DEBUG_MSG("string_to_array, count=%d, newstring(%p)\n", count, newstring); if (*tmpchar == '\\') { tmpchar2 = tmpchar+1; switch (*tmpchar2) { case '\0': newstring[count] = '\\'; break; case '\\': newstring[count] = '\\'; tmpchar++; break; case 'n': newstring[count] = '\n'; tmpchar++; break; case 't': newstring[count] = '\t'; tmpchar++; break; case ':': newstring[count] = ':'; tmpchar++; break; default: DEBUG_MSG("string_to_array, weird, an unescaped backslash ?\n"); newstring[count] = '\\'; break; } } else if (*tmpchar == ':') { newstring[count] = '\0'; /* end of the current newstring */ DEBUG_MSG("string_to_array, newstring(%p)=%s\n", newstring, newstring); array[arraycount] = g_strdup(newstring); DEBUG_MSG("string_to_array, found delimiter, arraycount=%d, result(%p)=%s\n",arraycount, array[arraycount], array[arraycount]); arraycount++; if (arraycount == arraysize-2) { /* we need 1 spare entry in the array */ arraysize += ARRAYBLOCKSIZE; /* and arraysize starts at 1, arraycount at 0 */ DEBUG_MSG("string_to_array, arraycount=%d, about to increase arraysize to %d, sizeof(array(%p))=%d\n", arraycount, arraysize, array, sizeof(&array)); array = g_realloc(array, arraysize * sizeof(char *)); DEBUG_MSG("string_to_array, arraysize=%d, array(%p), sizeof(array)=%d\n", arraysize, array, sizeof(&array)); } count = -1; } else { newstring[count] = *tmpchar; } tmpchar++; count++; if (count == newstringsize-2) { newstringsize += BUFBLOCKSIZE; DEBUG_MSG("string_to_array, about to increase newstring(%p) to %d bytes\n", newstring, newstringsize); newstring = g_realloc(newstring, newstringsize * sizeof(char)); DEBUG_MSG("string_to_array, newstringsize=%d, sizeof(newstring(%p))=%d\n", newstringsize, newstring, sizeof(newstring)); } } if (count > 0) { newstring[count] = '\0'; array[arraycount] = g_strdup(newstring); DEBUG_MSG("string_to_array, last array entry, arraycount=%d, result(%p)=%s\n",arraycount, array[arraycount],array[arraycount]); } else { array[arraycount] = NULL; } array[arraycount+1] = NULL; /* since we have 1 spare entry in the array this is safe to do*/ DEBUG_MSG("string_to_array, returning %p\n", array); g_free(newstring); return array; } /** * array_from_arglist: * @...: #gchar* with the first string, NULL terminated * * builds a NULL terminated array from the argumentlist to this function * * Return value: #gchar** with the array */ gchar **array_from_arglist(const gchar *string1, ...) { gint numargs=1; va_list args; gchar *s; gchar **retval, **index; va_start (args, string1); s = va_arg (args, gchar*); while (s) { numargs++; s = va_arg (args, gchar*); } va_end (args); DEBUG_MSG("array_from_arglist, numargs=%d\n", numargs); index = retval = g_new(gchar *, numargs + 1); *index = g_strdup(string1); va_start (args, string1); s = va_arg (args, gchar*); while (s) { index++; *index = g_strdup(s); s = va_arg (args, gchar*); } va_end (args); index++; *index = NULL; return retval; } /** * array_from_arglist: * @allocate_strings: #gboolean if the strings should be newly allocated * @...: #gchar* with the first string, NULL terminated * * builds a GList with strings (a stringlist), copied by reference or by content * * Return value: GList * */ GList *list_from_arglist(gboolean allocate_strings, ...) { GList *retval=NULL; va_list args; gchar *s; va_start(args, allocate_strings); s = va_arg(args, gchar*); while (s) { retval = g_list_append(retval, s); s = va_arg (args, gchar*); } va_end (args); return retval; } GList *duplicate_stringlist(GList *list, gint dup_data) { GList *retlist=NULL; if (list) { GList *tmplist; tmplist = g_list_first(list); while (tmplist) { if (tmplist->data) { gchar *data; if (dup_data) { data = g_strdup((gchar *)tmplist->data); } else { data = (gchar *)tmplist->data; } retlist = g_list_append(retlist, data); } tmplist = g_list_next(tmplist); } } return retlist; } gint free_stringlist(GList * which_list) { GList *tmplist; DEBUG_MSG("free_stringlist, started\n"); tmplist = g_list_first(which_list); while (tmplist != NULL) { DEBUG_MSG("free_stringlist, tmplist->data(%p)\n", tmplist->data); g_free(tmplist->data); tmplist = g_list_next(tmplist); } DEBUG_MSG("free_stringlist, strings free-ed, about to free list itself\n"); g_list_free(which_list); which_list = NULL; return 1; } gint free_arraylist(GList * which_list) { GList *tmplist; #ifdef DEBUGGING gchar **tmpchar; #endif DEBUG_MSG("free_arraylist, started\n"); tmplist = g_list_first(which_list); while (tmplist != NULL) { #ifdef DEBUGGING DEBUG_MSG("free_arraylist, starting list %p with data %p\n", tmplist, tmplist->data); tmpchar = (gchar **)tmplist->data; while (*tmpchar) { DEBUG_MSG("free_arraylist, freeing %p\n", *tmpchar); DEBUG_MSG("free_arraylist, containing %s\n", *tmpchar); g_free(*tmpchar); tmpchar++; } DEBUG_MSG("free_arraylist, content freed\n"); g_free((gchar **)tmplist->data); DEBUG_MSG("free_arraylist, array freed\n"); #else g_strfreev((gchar **)tmplist->data); #endif tmplist = g_list_next(tmplist); } g_list_free(which_list); which_list = NULL; return 1; } gchar **duplicate_stringarray(gchar **array) { gchar **newchar; gint i; newchar = g_malloc0((count_array(array)+1)*sizeof(gchar *)); for (i=0; array[i] != NULL ; i++) { newchar[i] = g_strdup(array[i]); } return newchar; } GList *duplicate_arraylist(GList *arraylist) { GList *tmplist; GList *newlist=NULL; tmplist = g_list_first(arraylist); while (tmplist != NULL) { newlist = g_list_append(newlist, duplicate_stringarray((gchar **)tmplist->data)); tmplist = g_list_next(tmplist); } return newlist; } /***************************************************************************** * gets a stringlist from a file */ GList *get_list(const gchar * filename, GList * which_list, gboolean is_arraylist) { DEBUG_MSG("get_stringlist, started with filename=%s\n", filename); if (filename == NULL) { return NULL; } if (file_exists_and_readable(filename)) { FILE *fd; gchar *tmpbuf; DEBUG_MSG("get_stringlist, opening %s\n", filename); fd = fopen(filename, "r"); if (fd == NULL) { return NULL; } tmpbuf = g_malloc(STRING_MAX_SIZE); while (fgets(tmpbuf, STRING_MAX_SIZE, fd) != NULL) { gchar *tempstr; tmpbuf = trunc_on_char(tmpbuf, '\n'); tempstr = g_strdup(tmpbuf); if (is_arraylist) { gchar **temparr = string_to_array(tempstr); which_list = g_list_append(which_list, temparr); g_free(tempstr); } else { DEBUG_MSG("get_list, adding string \"%s\" to the stringlist=%p\n", tempstr, which_list); which_list = g_list_append(which_list, tempstr); } } fclose(fd); g_free(tmpbuf); } return which_list; } #ifdef __GNUC__ __inline__ #endif GList *get_stringlist(const gchar * filename, GList * which_list) { return get_list(filename,which_list,FALSE); } /** * put_stringlist_limited: * @filename: #gchar* with the filename to store the list * @which_list: #GList* with the list to store * @maxentries: #gint only the LAST maxentries of the list will be stored * * stores the LAST maxentries entries of list which_list in file filename * if maxentries is 0 all entries will be stored * * Return value: #gboolean TRUE on success, FALSE on failure */ gboolean put_stringlist_limited(gchar * filename, GList * which_list, gint maxentries) { FILE *fd; GList *tmplist; DEBUG_MSG("put_stringlist_limited, started with filename=%s\n", filename); #ifdef BACKUP_RC_FILE_ON_SAVE if ( (main_v->props.viewbars && MODE_CREATE_BACKUP_ON_SAVE) && strlen(main_v->props.backup_filestring) ) { gchar *backupfilename = g_strconcat(filename, main_v->props.backup_filestring,NULL); file_copy(filename, backupfilename); g_free(backupfilename); } #endif /* BACKUP_RC_FILE_ON_SAVE */ DEBUG_MSG("put_stringlist_limited, opening %s for saving list(%p)\n", filename, which_list); fd = fopen(filename, "w"); if (fd == NULL) { return FALSE; } if (maxentries > 0) { gint count; count = g_list_length(which_list) - maxentries; tmplist = g_list_nth(which_list, (count<0) ? 0 : count); } else { tmplist = g_list_first(which_list); } while (tmplist) { gchar *tmpstr = g_strndup((char *) tmplist->data, STRING_MAX_SIZE - 1); DEBUG_MSG("put_stringlist_limited, tmplist(%p), adding string(%p)=%s (strlen=%d)the file\n", tmplist, tmpstr, tmpstr, strlen(tmpstr)); fputs(tmpstr, fd); g_free(tmpstr); fputs("\n", fd); tmplist = g_list_next(tmplist); } fclose(fd); DEBUG_MSG("put_stringlist_limited, finished, filedescriptor closed\n"); return TRUE; } gboolean put_stringlist(gchar * filename, GList * which_list) { return put_stringlist_limited(filename,which_list, -1); } GList *remove_from_stringlist(GList *which_list, const gchar * string) { if (string && strlen(string) ) { GList *tmplist = g_list_first(which_list); while (tmplist) { if (strcmp((gchar *) tmplist->data, string) == 0) { DEBUG_MSG("remove_from_stringlist, removing '%s' (%p)\n", (gchar *)tmplist->data, tmplist->data); g_free(tmplist->data); return g_list_remove(which_list, tmplist->data); } tmplist = g_list_next(tmplist); } } return which_list; } static void unlink_before(GList *tmplist) { GList *prev = tmplist->prev; if (prev) { prev->next = NULL; } tmplist->prev = NULL; } GList *limit_stringlist(GList *which_list, gint num_entries, gboolean keep_end) { GList *retlist, *freelist; if (keep_end) { gint len; freelist = g_list_first(which_list); len = g_list_length(freelist); if (len <= num_entries) return which_list; retlist = g_list_nth(freelist, len - num_entries); unlink_before(retlist); } else { retlist = g_list_first(which_list); freelist = g_list_nth(retlist, num_entries); if (freelist) unlink_before(freelist); } if (freelist) free_stringlist(freelist); return retlist; } /** * add_to_history_stringlist: * @which_list: #GList* the list to add to * @string: #const gchar* with the string to add * @recent_on_top: #gboolean, TRUE if the most recent entry is the one on top * @move_if_exists: #gboolean, if TRUE do move existing entries to the most recent part * * adds string to the stringlist which_list * * if string exists in this list already and move_if_exists is TRUE, * it will be moved to the most recent part of the list (which is the * end or the beginning based on the value of recent_on_top * * Return value: GList* with the modified list */ GList *add_to_history_stringlist(GList *which_list, const gchar *string, gboolean recent_on_top, gboolean move_if_exists) { if (string && strlen(string) ) { GList *tmplist = g_list_first(which_list); while (tmplist) { if (strcmp((gchar *) tmplist->data, string) == 0) { /* move this entry to the end */ if (move_if_exists) { DEBUG_MSG("add_to_history_stringlist, entry %s exists, moving!\n", string); which_list = g_list_remove_link(which_list, tmplist); if (recent_on_top) { return g_list_concat(tmplist, which_list); } else { return g_list_concat(which_list, tmplist); } } else { return which_list; } } tmplist = g_list_next(tmplist); } /* if we arrive here the string was not yet in the list */ DEBUG_MSG("add_to_history_stringlist, adding new entry %s\n",string); if (recent_on_top) { which_list = g_list_prepend(which_list, g_strdup(string)); } else { which_list = g_list_append(which_list, g_strdup(string)); } } return which_list; } /** * add_to_stringlist: * @which_list: a #GList * to add to * @string: a #const gchar * item you want to add to the list * * this function will check if a string with same content exists already * and if not it will add it to the list, it returns the new list pointer * * Return value: the new GList * **/ GList *add_to_stringlist(GList * which_list, const gchar * string) { if (string && strlen(string) ) { GList *tmplist = g_list_first(which_list); while (tmplist) { if (strcmp((gchar *) tmplist->data, string) == 0) { DEBUG_MSG("add_to_stringlist, strings are the same, don't add!!\n"); return which_list; } tmplist = g_list_next(tmplist); } /* if we arrive here the string was not yet in the list */ which_list = g_list_append(which_list, g_strdup(string)); } return which_list; } /** * stringlist_to_string: * @stringlist: a #GList * to convert * @delimiter: a #const gchar * item with the delimiter * * this function will convert a stringlist (GList that contains * only \0 terminated gchar* elements) to a string, putting the * delimiter inbetween all elements; * * Return value: the gchar * **/ gchar *stringlist_to_string(GList *stringlist, gchar *delimiter) { gchar *string, *tmp; GList *tmplist; string = g_strdup(""); tmp = string; tmplist = g_list_first(stringlist); while (tmplist) { string = g_strconcat(tmp, (gchar *) tmplist->data, delimiter, NULL); g_free(tmp); tmp = string; tmplist = g_list_next(tmplist); } return string; } /** * array_n_strings_identical: * @array1: #gchar** * @array2: #gchar** * @case_sensitive: #gboolean * @testlevel: #gint * * tests the first testlevel strings in the arrays if they are identical * returns the first strcmp() value that is not 0, or 0 if all * strings up to testlevel are identical. * * if BOTH array end before testlevel is reached, 0 is returned * if ONE array ends before the other, -1 or 1 is returned * * Return value: #gint */ gint array_n_strings_identical(gchar **array1, gchar **array2, gboolean case_sensitive, gint testlevel) { gint i=0, res=0; while (idata; if (array_n_strings_identical(compare, tmparr, case_sensitive, testlevel)==0) { DEBUG_MSG("arraylist_delete_identical, %s and %s are identical, will delete %p from list\n",tmparr[0],compare[0], tmplist); thelist = g_list_delete_link(thelist, tmplist); DEBUG_MSG("arraylist_delete_identical, free array %p (%s)\n",tmparr,tmparr[0]); g_strfreev(tmparr); } tmplist = nextlist; } return thelist; } /** * arraylist_append_identical_from_list: * @thelist: #GList* * @source: #GList* * @compare: #gchar** * @testlevel: #gint * @case_sensitive: #gboolean * * compares every array in 'source' with 'compare', and if it is identical up to 'testlevel', it will * add the array to 'thelist' * * Return value: the new arraylist */ GList *arraylist_append_identical_from_list(GList *thelist, GList *source, gchar **compare, gint testlevel, gboolean case_sensitive) { GList *tmplist = g_list_first(source); while (tmplist) { gchar **tmparr = tmplist->data; if (array_n_strings_identical(compare, tmparr, case_sensitive, testlevel)==0) { thelist = g_list_append(thelist, duplicate_stringarray(tmparr)); } tmplist = g_list_next(tmplist); } return thelist; } /** * arraylist_append_identical_from_file: * @thelist: #GList* * @sourcefilename: #const gchar* * @compare: #gchar** * @testlevel: #gint * @case_sensitive: #gboolean * * compares every array read from 'sourcefilename' with 'compare', and if it is identical up to 'testlevel', it will * add the array to 'thelist' * * Return value: the new arraylist */ GList *arraylist_append_identical_from_file(GList *thelist, const gchar *sourcefilename, gchar **compare, gint testlevel, gboolean case_sensitive) { GList *sourcelist = get_list(sourcefilename,NULL,TRUE); thelist = arraylist_append_identical_from_list(thelist, sourcelist, compare, testlevel, case_sensitive); free_arraylist(sourcelist); return thelist; } /** * arraylist_value_exists: * @arraylist: #GList* * @value: #gchar** * @testlevel: #gint * @case_sensitive: #gboolean whether the test should be case sensitive * * tests for the occurence of an array with identical content as value * in arraylist. It will only test the first testlevel strings in the array * so if you want the test to check for a 100% identical array that number * should be high (9999 or so) * * Return value: #gboolean */ gboolean arraylist_value_exists(GList *arraylist, gchar **value, gint testlevel, gboolean case_sensitive) { GList *tmplist = g_list_first(arraylist); while (tmplist) { gchar **tmparr = tmplist->data; if (array_n_strings_identical(value, tmparr, case_sensitive, testlevel)==0) { return TRUE; } tmplist = g_list_next(tmplist); } return FALSE; } /** * arraylist_load_new_identifiers_from_list: * @mylist: #GList* * @fromlist: #GList* * @uniquelevel: #gint * * compares every entry in fromlist * with all entries in list mylist. Comparision is done uniquelevel deep * by function arraylist_value_exists() * those arrays that do _not_ match are appended to mylist which is returned * at the end of the function * * Return value: #GList* */ GList *arraylist_load_new_identifiers_from_list(GList *mylist, GList *deflist, gint uniquelevel) { GList *tmplist = g_list_first(deflist); while (tmplist) { gchar **tmparr = tmplist->data; if (count_array(tmparr) >= uniquelevel) { if (!arraylist_value_exists(mylist, tmparr, uniquelevel, TRUE)) { DEBUG_MSG("arraylist_load_new_identifiers, adding %s to thelist\n",tmparr[0]); mylist = g_list_append(mylist, duplicate_stringarray(tmparr)); } } tmplist = g_list_next(tmplist); } return mylist; } /** * arraylist_load_new_identifiers_from_file: * @mylist: #GList* * @fromfilename: #gchar* * @uniquelevel: #gint * * loads an arraylist from fromfilename and compares every entry * with all entries in list mylist. Comparision is done uniquelevel deep * by function arraylist_value_exists() * those arrays that do _not_ match are appended to mylist which is returned * at the end of the function * * Return value: #GList* */ GList *arraylist_load_new_identifiers_from_file(GList *mylist, const gchar *fromfilename, gint uniquelevel) { GList *deflist = get_list(fromfilename,NULL,TRUE); mylist = arraylist_load_new_identifiers_from_list(mylist, deflist, uniquelevel); free_arraylist(deflist); return mylist; } winefish-1.3.3/src/snooper.h0000600000047200004720000000313410366105356014763 0ustar kyanhkyanh/* $Id: snooper.h 1658 2006-01-26 08:40:14Z kyanh $ */ /* Winefish LaTeX Editor * * Completion support * * Copyright (c) 2005 KyAnh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SNOOPER_H_ #define __SNOOPER_H_ enum { COMPLETION_WINDOW_INIT = 1 << 0, /* require `intitalize' the window */ COMPLETION_WINDOW_HIDE = 1 << 1, /* hide window */ COMPLETION_WINDOW_SHOW = 1 << 2, /* show winow */ COMPLETION_WINDOW_UP = 1 << 3, /* select one item up */ COMPLETION_WINDOW_PAGE_UP = 1 << 4, /* select many items up */ COMPLETION_WINDOW_DOWN = 1 << 5, /* select one item down */ COMPLETION_WINDOW_PAGE_DOWN = 1 << 6, /* select many items down */ COMPLETION_WINDOW_ACCEPT= 1 << 7, /* accept one item */ COMPLETION_DELETE = 1 << 8 , /* delete an item */ COMPLETION_FIRST_CALL = 1 << 9, /* first press CTRL+Space in the period */ COMPLETION_AUTO_CALL = 1<< 10 /* auto call */ }; void snooper_install(void); #endif winefish-1.3.3/src/treetips.c0000600000047200004720000001523710373411041015124 0ustar kyanhkyanh/* $Id: treetips.c 1830 2006-02-11 16:34:41Z kyanh $ */ #include "treetips.h" static gint tree_tips_paint(TreeTips *tips) { if (!tips->window) return FALSE; if (!GTK_WIDGET_VISIBLE(tips->window)) return FALSE; gtk_paint_flat_box (tips->window->style, tips->window->window, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN, NULL, tips->window, "treetip", 0, 0, -1, -1); gtk_paint_shadow (tips->window->style, tips->window->window, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN, NULL, tips->window, "treetip", 0, 0, -1, -1); return FALSE; } void tree_tips_hide(TreeTips *tips) { if (tips && tips->window) { gtk_widget_hide_all(tips->window); } if (tips->hide_tout) g_source_remove (tips->hide_tout); } gboolean tree_tips_hide_cb(GtkWidget *widget,GdkEventFocus *event,gpointer user_data) { tree_tips_hide(user_data); return FALSE; } void tree_tips_show(TreeTips *tips) { GtkWidget *label; gint x,y; gchar *pstr; if (!tips) return; if (!tips->enabled) return; if (tips->window) return; pstr = ((* tips->func)(tips->bfwin,tips->tree, tips->posx,tips->posy)); if (pstr) { tips->window = gtk_window_new (GTK_WINDOW_POPUP); gtk_widget_set_app_paintable (tips->window, TRUE); gtk_window_set_resizable (GTK_WINDOW(tips->window), FALSE); gtk_widget_set_name (tips->window, "tree-tooltips"); gtk_container_set_border_width (GTK_CONTAINER (tips->window), 4); g_signal_connect_swapped(GTK_WINDOW(tips->window),"expose-event",G_CALLBACK(tree_tips_paint),tips); label = gtk_label_new (NULL); gtk_label_set_markup(GTK_LABEL(label),pstr); gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); gtk_container_add (GTK_CONTAINER (tips->window), GTK_WIDGET (label)); gtk_window_set_position (GTK_WINDOW(tips->window), GTK_WIN_POS_MOUSE); gdk_window_get_pointer (NULL, &x, &y, NULL); gtk_window_move (GTK_WINDOW(tips->window), x + 8, y + 16); gtk_widget_show_all(tips->window); g_free(pstr); tips->hide_tout = g_timeout_add (tips->hide_interval, (GSourceFunc) tree_tips_hide, tips); } } gboolean tree_tips_mouse_enter(GtkWidget *widget, GdkEvent *event, gpointer user_data) { TreeTips *tips = TREE_TIPS(user_data); if ( event->type != GDK_ENTER_NOTIFY ) return FALSE; if (!tips->enabled) return FALSE; if ( ((GdkEventCrossing *) event)->x == tips->posx && ((GdkEventCrossing *) event)->y == tips->posy ) return FALSE; if (tips->window) { gtk_widget_destroy(tips->window); tips->window = NULL; g_source_remove (tips->hide_tout); } tips->tip_outside = FALSE; return FALSE; } gboolean tree_tips_mouse_leave(GtkWidget *widget, GdkEvent *event, gpointer user_data) { TreeTips *tips = TREE_TIPS(user_data); if ( event->type != GDK_LEAVE_NOTIFY ) return FALSE; if (!tips->enabled) return FALSE; if ( ((GdkEventCrossing *) event)->x == tips->posx && ((GdkEventCrossing *) event)->y == tips->posy ) return FALSE; if (tips->window) { gtk_widget_destroy(tips->window); tips->window = NULL; g_source_remove (tips->hide_tout); } if (tips->tip_on) { if (tips->show_tout) g_source_remove (tips->show_tout); tips->tip_on = FALSE; } tips->tip_outside = TRUE; return FALSE; } gboolean tree_tips_mouse_motion(GtkWidget *widget, GdkEvent *event, gpointer user_data) { TreeTips *tips = TREE_TIPS(user_data); if (!tips->enabled) return FALSE; if (tips->window) { gtk_widget_destroy(tips->window); tips->window = NULL; if (tips->hide_tout) g_source_remove (tips->hide_tout); } if (event->type == GDK_MOTION_NOTIFY && tips->tip_outside == FALSE) { tips->posx = ((GdkEventMotion *) event)->x; tips->posy = ((GdkEventMotion *) event)->y; if (tips->tip_on) { g_source_remove (tips->show_tout); tips->tip_on = FALSE; } tips->show_tout = g_timeout_add (tips->show_interval, (GSourceFunc) tree_tips_show, tips); tips->tip_on = TRUE; } return FALSE; } TreeTips *tree_tips_new(Tbfwin *win) { TreeTips *tips = g_new0(TreeTips,1); tips->bfwin = win; tips->window = NULL; tips->tree = NULL; tips->func = NULL; tips->posx=tips->posy=0; tips->tip_on = FALSE; tips->tip_outside = TRUE; tips->show_interval = 500; tips->hide_interval = 1500; tips->enabled = TRUE; tips->show_tout=0; tips->hide_tout=0; return tips; } TreeTips *tree_tips_new_full(Tbfwin *win,GtkTreeView *tree,TreeTipsCFunc function) { TreeTips *tips = g_new0(TreeTips,1); tips->bfwin = win; tips->window = NULL; tips->tree = tree; tips->func = function; tips->posx=tips->posy=0; tips->tip_on = FALSE; tips->tip_outside = TRUE; tips->enabled = TRUE; if (tree) { g_signal_connect(G_OBJECT(tree),"motion-notify-event",G_CALLBACK(tree_tips_mouse_motion),tips); g_signal_connect(G_OBJECT(tree),"enter-notify-event",G_CALLBACK(tree_tips_mouse_enter),tips); g_signal_connect(G_OBJECT(tree),"leave-notify-event",G_CALLBACK(tree_tips_mouse_leave),tips); g_signal_connect(G_OBJECT(tree),"focus-out-event",G_CALLBACK(tree_tips_hide_cb),tips); } tips->show_interval = 500; tips->hide_interval = 1500; tips->show_tout=0; tips->hide_tout=0; return tips; } void tree_tips_set_show_interval(TreeTips *tips,gint interv) { if (tips) tips->show_interval = interv; } void tree_tips_set_hide_interval(TreeTips *tips,gint interv) { if (tips) tips->hide_interval = interv; } void tree_tips_set_content_function(TreeTips *tips,TreeTipsCFunc func) { if (tips) tips->func = func; } void tree_tips_set_tree(TreeTips *tips,GtkTreeView *tree) { if (tips) { tips->tree = tree; if (tree) { g_signal_connect(G_OBJECT(tree),"motion-notify-event",G_CALLBACK(tree_tips_mouse_motion),tips->window); g_signal_connect(G_OBJECT(tree),"enter-notify-event",G_CALLBACK(tree_tips_mouse_enter),tips->window); g_signal_connect(G_OBJECT(tree),"leave-notify-event",G_CALLBACK(tree_tips_mouse_leave),tips->window); g_signal_connect(G_OBJECT(tree),"focus-out-event",G_CALLBACK(tree_tips_hide),tips); } } } void tree_tips_destroy(TreeTips *tips) { tips->tree = NULL; if (tips->window) { gtk_widget_destroy(tips->window); tips->window = NULL; } g_free(tips); } void tree_tips_set_enabled(TreeTips *tips,gboolean en) { if (!tips) return; tips->enabled = en; } winefish-1.3.3/src/treetips.h0000600000047200004720000000214310373411041015121 0ustar kyanhkyanh/* $Id: treetips.h 1830 2006-02-11 16:34:41Z kyanh $ */ #ifndef TREETIPS_H #define TREETIPS_H #include #include "bluefish.h" /* function to create treetip content Note: there is no 'static' content in treetips, you should provide a function */ typedef gchar* (*TreeTipsCFunc) (gconstpointer bfwin, gconstpointer tree, gint x, gint y); typedef struct { GtkTreeView *tree; Tbfwin *bfwin; GtkWidget *window; gint posx,posy; gint show_tout,hide_tout; gboolean tip_on,tip_outside,enabled; TreeTipsCFunc func; gint show_interval,hide_interval; } TreeTips; #define TREE_TIPS(var) ((TreeTips *)(var)) TreeTips *tree_tips_new(Tbfwin *win); TreeTips *tree_tips_new_full(Tbfwin *win,GtkTreeView *tree,TreeTipsCFunc function); void tree_tips_set_show_interval(TreeTips *tips,gint interv); void tree_tips_set_hide_interval(TreeTips *tips,gint interv); void tree_tips_set_content_function(TreeTips *tips,TreeTipsCFunc func); void tree_tips_set_tree(TreeTips *tips,GtkTreeView *tree); void tree_tips_destroy(TreeTips *tips); void tree_tips_set_enabled(TreeTips *tips,gboolean en); #endif /* TREETIPS_H */ winefish-1.3.3/src/menu.c0000600000047200004720000027240710375350210014237 0ustar kyanhkyanh/* $Id: menu.c 1984 2006-02-17 13:32:56Z kyanh $ */ /* Copyright (C) 1998-2000 Olivier Sessink, Chris Mazuc and Roland Steinbach * Copyright (C) 2000-2002 Olivier Sessink and Roland Steinbach * Copyright (C) 2002-2004 Olivier Sessink * Modified for Winefish (C) 2005-2006 kyanh * * this file has * content-type: UTF8 * and it is important you keep it UTF-8 !!! * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include /* atoi */ #include /* strchr() */ #include /* #define DEBUG*/ #include "bluefish.h" #include "bfspell.h" #include "bookmark.h" #include "pixmap.h" #include "document.h" /* file_open etc. */ #include "highlight.h" /* doc_highlight_full */ #include "menu.h" /* my own .h file */ #include "undo_redo.h" /* undo_cb() redo_cb() etc. */ #include "snr2.h" /* search_cb, replace_cb */ #include "gui.h" /* go_to_line_win_cb, status_bar_message() */ #include "stringlist.h" /* free_stringlist() */ #include "bf_lib.h" /* append_string_to_file() */ #include "gtk_easy.h" /* window_full, bf_stock_ok_button */ #include "preferences.h" /* open_preferences_menu_cb */ #include "html.h" #include "wizards.h" #include "image.h" #include "rcfile.h" /* rcfile_save_configfile_menu_cb */ #include "project.h" #include "about.h" #include "outputbox.h" /* outputbox_stop() */ #include "func_grep.h" /* grepbox functions */ #include "brace_finder.h" /* The callback for an ItemFactory entry can take two forms. If callback_action is zero, it is of the following form: void callback(void) otherwise it is of the form: void callback( gpointer callback_data,guint callback_action, GtkWidget *widget) callback_data is a pointer to an arbitrary piece of data and is set during the call to gtk_item_factory_create_items(). we want to pass the Tbfwin* so we should never use a callback_action of zero */ static void menu_file_operations_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { switch(callback_action) { case 1: file_new_cb(NULL,bfwin); break; case 2: file_open_cb(NULL,bfwin); break; #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND case 3: file_open_advanced_cb(bfwin, TRUE/*open_files*/); break; #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ case 4: doc_reload(bfwin->current_document); break; case 5: file_save_cb(NULL, bfwin); break; case 6: file_save_as_cb(NULL, bfwin); break; case 7: file_move_to_cb(NULL, bfwin); break; case 8: file_save_all_cb(NULL, bfwin); break; case 9: file_close_cb(NULL, bfwin); break; case 10: edit_cut_cb(NULL, bfwin); break; case 11: edit_copy_cb(NULL, bfwin); break; case 12: edit_paste_cb(NULL, bfwin); break; case 13: edit_select_all_cb(NULL, bfwin); break; case 14: search_cb(NULL, bfwin); break; case 16: search_again_cb(NULL, bfwin); break; case 17: replace_cb(NULL, bfwin); break; case 19: replace_again_cb(NULL, bfwin); break; case 20: undo_cb(NULL, bfwin); break; case 21: redo_cb(NULL, bfwin); break; case 22: undo_all_cb(NULL, bfwin); break; case 23: redo_all_cb(NULL, bfwin); break; case 24: file_close_all_cb(NULL,bfwin); break; case 26: file_open_from_selection(bfwin); break; case 27: search_from_selection(bfwin); break; #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND case 28: file_open_advanced_cb(bfwin, FALSE/*donot open files*/); break; case 29: template_rescan_cb(bfwin); break; #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ default: DEBUG_MSG("menu_file_operations_cb, unknown action, abort!\n"); exit(123); } } static void menu_html_dialogs_lcb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { switch (callback_action) { case 0: quicklist_dialog(bfwin,NULL); break; case 1: image_insert_dialog(bfwin,NULL); break; case 2: tablewizard_dialog(bfwin); break; case 3: quickstart_dialog(bfwin,NULL); break; case 4: insert_time_dialog(bfwin); break; default: DEBUG_MSG("menu_file_operations_cb, unknown action, abort!\n"); exit(123); } } #ifdef HAVE_LIBASPELL static void spell_check_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { spell_check_cb(NULL, bfwin); } #endif /* HAVE_LIBASPELL */ static void menu_bmark_operations_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { switch(callback_action) { case 1: bmark_add(bfwin); break; /* case 2: bmark_add_perm(bfwin); break;*/ default: DEBUG_MSG("Bmark action no. %d\n",callback_action); } } static void toggle_doc_property(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { switch(callback_action) { case 1: bfwin->current_document->view_bars = SET_BIT( bfwin->current_document->view_bars, MODE_WRAP, GTK_CHECK_MENU_ITEM(widget)->active); doc_set_wrap(bfwin->current_document); break; case 2: /* save view_line_numbers for session only */ DEBUG_MSG("old mask value: %d/%d\n", main_v->session->view_bars, GET_BIT(main_v->session->view_bars,VIEW_LINE_NUMBER)); bfwin->current_document->view_bars = SET_BIT(bfwin->current_document->view_bars , VIEW_LINE_NUMBER, GTK_CHECK_MENU_ITEM(widget)->active); document_set_line_numbers(bfwin->current_document, GET_BIT(bfwin->current_document->view_bars , VIEW_LINE_NUMBER)); main_v->session->view_bars = SET_BIT(main_v->session->view_bars, VIEW_LINE_NUMBER, GET_BIT(bfwin->current_document->view_bars,VIEW_LINE_NUMBER)); DEBUG_MSG("new mask value: %d/%d\n", main_v->session->view_bars, GET_BIT(main_v->session->view_bars , VIEW_LINE_NUMBER)); break; case 3: bfwin->current_document->view_bars = SET_BIT(bfwin->current_document->view_bars , MODE_AUTO_COMPLETE, GTK_CHECK_MENU_ITEM(widget)->active); break; case 4: main_v->props.view_bars = SET_BIT(main_v->props.view_bars, MODE_AUTO_INDENT, GTK_CHECK_MENU_ITEM(widget)->active); break; case 5: if (bfwin->project) { bfwin->project->view_bars = SET_BIT(bfwin->project->view_bars, MODE_PROJECT, GTK_CHECK_MENU_ITEM(widget)->active); if (bfwin->project->view_bars & MODE_PROJECT) { statusbar_message(bfwin, _("project mode: ON"), 2000); }else{ statusbar_message(bfwin, _("project mode: OFF"), 2000); } } break; case 6: /* BUG#71 */ { if (bfwin->ob_hbox) { gint cur_page; cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(bfwin->ob_notebook)); Toutputbox *ob; ob = outputbox_get_box(bfwin,cur_page); outputbox_stop(ob); } } break; } } static void brace_finder_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { guint16 retval; retval = brace_finder(bfwin->current_document->buffer, bfwin->current_document->brace_finder, BR_MOVE_IF_FOUND | callback_action, 0); if (retval & (BR_RET_MOVED_LEFT | BR_RET_MOVED_RIGHT) ) { GtkTextMark *mark; mark = gtk_text_buffer_get_insert( bfwin->current_document->buffer ); gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( bfwin->current_document->view ), mark ); }else if ( retval & BR_RET_NOT_FOUND) { statusbar_message(bfwin, _("brace_finder: matching not found"), 1000); }else if (retval & BR_RET_IN_COMMENT) { statusbar_message(bfwin, _("brace_finder: inside a commented line"), 1000); }else if (retval & BR_RET_IN_SELECTION) { statusbar_message(bfwin, _("brace_finder: inside the selection"), 1000); } /* else if (retval & BR_RET_WRONG_OPERATION) { statusbar_message(bfwin, _("brace_finder: wrong operation or brace escaped"), 1000); } */ } /* extern const guint8 []; */ static GtkItemFactoryEntry menu_items[] = { /* Files */ {N_("/_File"), NULL, NULL, 0, ""}, {N_("/File/tearoff1"), NULL, NULL, 0, ""}, {N_("/File/_New"), "n", menu_file_operations_cb, 1, ""}, {N_("/File/New _Window"), NULL, gui_window_menu_cb, 1, ""}, {N_("/File/_Open..."), "o", menu_file_operations_cb, 2, ""}, {N_("/File/Open Recen_t"), NULL, NULL, 0, ""}, {N_("/File/Open Recent/tearoff1"), NULL, NULL, 0, ""}, #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND {N_("/File/Open Ad_vanced..."), NULL, menu_file_operations_cb, 3, ""}, #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ {N_("/File/Open _from selection"), NULL, menu_file_operations_cb, 26, ""}, {N_("/File/sep1"), NULL, NULL, 0, ""}, {N_("/File/_Save"), "s", menu_file_operations_cb, 5, ""}, {N_("/File/Save _As..."), NULL, menu_file_operations_cb, 6, ""}, {N_("/File/Sav_e All"), NULL, menu_file_operations_cb, 8, ""}, {N_("/File/_Revert to Saved"), NULL, menu_file_operations_cb, 4, ""}, {N_("/File/sep2"), NULL, NULL, 0, ""}, {N_("/File/_Insert..."), NULL, file_insert_menucb, 1, ""}, {N_("/File/Rena_me..."), "F2", menu_file_operations_cb, 7, ""}, {N_("/File/sep3"), NULL, NULL, 0, ""}, {N_("/File/_Close"), "w", menu_file_operations_cb, 9, ""}, {N_("/File/Close A_ll"), NULL, menu_file_operations_cb, 24, ""}, {N_("/File/Close Win_dow"), NULL, gui_window_menu_cb, 2, ""}, {N_("/File/sep4"), NULL, NULL, 0, ""}, /* {N_("/File/_Quit"), "Q", bluefish_exit_request, 0, ""}, */ {N_("/File/_Quit"), "q", bluefish_exit_request, 0, ""}, /* EDIT */ {N_("/_Edit"), NULL, NULL, 0, ""}, {N_("/Edit/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Edit/_Undo"), "z", menu_file_operations_cb, 20, ""}, {N_("/Edit/_Redo"), "z", menu_file_operations_cb, 21, ""}, {N_("/Edit/Undo All"), NULL, menu_file_operations_cb, 22, ""}, {N_("/Edit/Redo All"), NULL, menu_file_operations_cb, 23, ""}, {N_("/Edit/sep1"), NULL, NULL, 0, ""}, {N_("/Edit/Selection"), NULL, NULL, 0, ""}, {N_("/Edit/Selection/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Edit/Selection/Cu_t"), "x", menu_file_operations_cb, 10, ""}, {N_("/Edit/Selection/_Copy"), "c", menu_file_operations_cb, 11, ""}, {N_("/Edit/Selection/_Paste"), "v", menu_file_operations_cb, 12, ""}, {N_("/Edit/Selection/sep2"), NULL, NULL, 0, ""}, {N_("/Edit/Selection/Select _All"), NULL, menu_file_operations_cb, 13, ""}, {N_("/Edit/Find, Replace"), NULL, NULL, 0, ""}, {N_("/Edit/Find, Replace/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Edit/Find, Replace/Brace Finder (Forward)"), NULL, brace_finder_cb, BR_FIND_FORWARD, ""}, {N_("/Edit/Find, Replace/Brace Finder (Backward)"), NULL, brace_finder_cb, BR_FIND_BACKWARD, ""}, {N_("/Edit/Find, Replace/sep0"), NULL, NULL, 0, ""}, {N_("/Edit/Find, Replace/_Find..."), "f", menu_file_operations_cb, 14, ""}, {N_("/Edit/Find, Replace/Find A_gain"), "g", menu_file_operations_cb, 16, ""}, {N_("/Edit/Find, Replace/Find from selection"), NULL, menu_file_operations_cb, 27, ""}, #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND {N_("/Edit/Find, Replace/Find from Files"), "f", menu_file_operations_cb, 28, ""}, {N_("/Edit/Find, Replace/Templates"), "f", menu_file_operations_cb, 29, ""}, #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ {N_("/Edit/Find, Replace/sep1"), NULL, NULL, 0, ""}, {N_("/Edit/Find, Replace/R_eplace..."), "h", menu_file_operations_cb, 17, ""}, {N_("/Edit/Find, Replace/Replace Agai_n"), "h", menu_file_operations_cb, 19, ""}, {N_("/Edit/Find, Replace/sep2"), NULL, NULL, 0, ""}, /* ulitilities */ {N_("/Edit/Find, Replace/To _Uppercase"), NULL, doc_convert_asciichars_in_selection, 1, ""}, {N_("/Edit/Find, Replace/To _Lowercase"), NULL, doc_convert_asciichars_in_selection, 2, ""}, {N_("/Edit/Find, Replace/sep3"), NULL, NULL, 0, ""}, {N_("/Edit/Find, Replace/ASCII to HTML entities"), NULL, doc_convert_asciichars_in_selection, 4, ""}, {N_("/Edit/Find, Replace/ISO8859 to HTML entities"), NULL, doc_convert_asciichars_in_selection, 8, ""}, {N_("/Edit/Find, Replace/ASCII & ISO8859 to HTML entities"), NULL, doc_convert_asciichars_in_selection, 12, ""}, /* others */ {N_("/Edit/sep4"), NULL, NULL, 0, ""}, {N_("/Edit/Sh_ift Right"), NULL, menu_indent_cb, 2, ""}, {N_("/Edit/S_hift Left"), NULL, menu_indent_cb, 1, ""}, {N_("/Edit/_Comment"), NULL, menu_comment_cb, 0, ""}, {N_("/Edit/_UnComment"), NULL, menu_comment_cb, 1, ""}, {N_("/Edit/_Hard Shift Left"), NULL, menu_shift_cb, 1, ""}, {N_("/Edit/Delete Current Line"), "k", menu_del_line_cb, 1, ""}, {N_("/Edit/sep5"), NULL, NULL, 0, ""}, {N_("/Edit/Add _Bookmark"), "d", menu_bmark_operations_cb, 1, ""}, {N_("/_Insert"), NULL, NULL, 0, ""}, {N_("/Insert/Tearoff1"), NULL, NULL, 0, ""}, /* INSERT MENU */ {N_("/Insert/T_ools"), NULL, NULL, 0, ""}, {N_("/Insert/Tools/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Tools/Simple document (code)"), NULL, menu_html_dialogs_lcb, 3, ""}, {N_("/Insert/Tools/Figure"), "I", menu_html_dialogs_lcb, 1, ""}, {N_("/Insert/Tools/Time, Date"), NULL, menu_html_dialogs_lcb, 4, ""}, {N_("/Insert/Tools/Source Separator"), NULL, general_html_menu_cb, 105, ""}, /* table, array, list */ {N_("/Insert/_Table, List"), NULL, NULL, 0, ""}, {N_("/Insert/Table, List/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Table, List/_List"), "L", menu_html_dialogs_lcb, 0, ""}, {N_("/Insert/Table, List/_Table, Array"), "T", menu_html_dialogs_lcb, 2, ""}, /* Section, SubSection */ {N_("/Insert/_Headings"), NULL, NULL, 0, ""}, {N_("/Insert/Headings/Tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Headings/_part"), "0", general_html_menu_cb, 18, ""}, {N_("/Insert/Headings/_chapter"), "1", general_html_menu_cb, 19, ""}, {N_("/Insert/Headings/_section"), "2", general_html_menu_cb, 20, ""}, {N_("/Insert/Headings/s_ubsection"), "3", general_html_menu_cb, 21, ""}, {N_("/Insert/Headings/su_bsubsection"), "4", general_html_menu_cb, 22, ""}, {N_("/Insert/Headings/sep1"), NULL, NULL, 0, ""}, {N_("/Insert/Headings/parag_raph"), "5", general_html_menu_cb, 23, ""}, {N_("/Insert/Headings/subparag_raph"), "6", general_html_menu_cb, 100, ""}, {N_("/Insert/Headings/sep2"), NULL, NULL, 0, ""}, {N_("/Insert/Headings/_part*"), "0", general_html_menu_cb, 112, ""}, {N_("/Insert/Headings/_chapter*"), "1", general_html_menu_cb, 113, ""}, {N_("/Insert/Headings/_section*"), "2", general_html_menu_cb, 114, ""}, {N_("/Insert/Headings/s_ubsection*"), "3", general_html_menu_cb, 115, ""}, {N_("/Insert/Headings/su_bsubsection*"), "4", general_html_menu_cb, 116, ""}, /* Environments */ {N_("/Insert/_Environments"), NULL, NULL, 0, ""}, {N_("/Insert/Environments/tearoff1"), NULL, NULL, 0, ""}, /* stuff */ {N_("/Insert/Environments/flush_left"), NULL, general_html_menu_cb, 50, ""}, {N_("/Insert/Environments/flush_right"), NULL, general_html_menu_cb, 51, ""}, {N_("/Insert/Environments/_centering"), NULL, general_html_menu_cb, 10, ""}, {N_("/Insert/Environments/sep2"), NULL, NULL, 0, ""}, {N_("/Insert/Environments/_verbatim"), "v", general_html_menu_cb, 13, ""}, {N_("/Insert/Environments/verbati_m*"), "v", general_html_menu_cb, 52, ""}, {N_("/Insert/Environments/ver_se"), NULL, general_html_menu_cb, 48, ""}, {N_("/Insert/Environments/_quotation"), NULL, general_html_menu_cb, 49, ""}, /* Short Quotation, Sloppy Paragraph */ /* AMSLaTeX Equations Environments */ {N_("/Insert/AMS equations"), NULL, NULL, 0, ""}, {N_("/Insert/AMS equations/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/AMS equations/split"), "S", general_html_menu_cb, 15, ""}, {N_("/Insert/AMS equations/cases"), "C", general_html_menu_cb, 16, ""}, {N_("/Insert/AMS equations/sep1"), NULL, NULL, 0, ""}, /* -ED Version */ {N_("/Insert/AMS equations/aligned"), "D", general_html_menu_cb, 25, ""}, {N_("/Insert/AMS equations/gathered"), "R", general_html_menu_cb, 26, ""}, {N_("/Insert/AMS equations/sep2"), NULL, NULL, 0, ""}, /* NoStar version */ {N_("/Insert/AMS equations/equation"), "E", general_html_menu_cb, 27, ""}, {N_("/Insert/AMS equations/align"), "A", general_html_menu_cb, 31, ""}, {N_("/Insert/AMS equations/subequations"), "U", general_html_menu_cb, 28, ""}, {N_("/Insert/AMS equations/gather"), "G", general_html_menu_cb, 29, ""}, {N_("/Insert/AMS equations/multline"), "M", general_html_menu_cb, 30, ""}, /* {N_("/Insert/AMS equations/FlAlign"), "L", general_html_menu_cb, 32, ""}, */ {N_("/Insert/AMS equations/alignat"), "N", general_html_menu_cb, 37, ""}, {N_("/Insert/AMS equations/sep3"), NULL, NULL, 0, ""}, /* star version */ {N_("/Insert/AMS equations/equation*"), "E", general_html_menu_cb, 38, ""}, {N_("/Insert/AMS equations/align*"), "A", general_html_menu_cb, 41, ""}, {N_("/Insert/AMS equations/gather*"), "G", general_html_menu_cb, 39, ""}, {N_("/Insert/AMS equations/multline*"), "M", general_html_menu_cb,40, ""}, /* {N_("/Insert/AMS equations/FlAlign"), "L", general_html_menu_cb, 42, ""}, */ {N_("/Insert/AMS equations/alignat*"), "N", general_html_menu_cb,43, ""}, /* TODO: abstract */ {N_("/Insert/_Font style"), NULL, NULL, 0, ""}, /* FONT SIZES*/ #ifdef HAVE_FULL_MENU {N_("/Insert/Font/Sizes"), NULL, NULL, 0, ""}, {N_("/Insert/Font/Sizes/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Font/Sizes/{\\\\tiny }"), NULL, general_html_menu_cb, 4, ""}, {N_("/Insert/Font/Sizes/{\\\\scriptsize }"), NULL, general_html_menu_cb, 5, ""}, {N_("/Insert/Font/Sizes/{\\\\footnotesize }"), NULL, general_html_menu_cb, 6, ""}, {N_("/Insert/Font/Sizes/{\\\\small }"), NULL, general_html_menu_cb, 7, ""}, {N_("/Insert/Font/Sizes/{\\\\normalsize }"), NULL, general_html_menu_cb,8, ""}, {N_("/Insert/Font/Sizes/{\\\\large }"), NULL, general_html_menu_cb, 9, ""}, {N_("/Insert/Font/Sizes/{\\\\Large }"), NULL, general_html_menu_cb, 11, ""}, {N_("/Insert/Font/Sizes/{\\\\huge }"), NULL, general_html_menu_cb, 12, ""}, {N_("/Insert/Font/Sizes/{\\\\Huge }"), NULL, general_html_menu_cb, 14, ""}, #endif /* HAVE_FULL_MENU */ /* FONT STYLES */ /* {N_("/Insert/Font/Styles"), NULL, NULL, 0, ""}, */ {N_("/Insert/Font style/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Font style/\\\\emph - _emphasized"), "e", general_html_menu_cb, 17, ""}, {N_("/Insert/Font style/\\\\underline - _underlined"), "u", general_html_menu_cb, 3, ""}, {N_("/Insert/Font style/\\\\textit - _italic"), "i", general_html_menu_cb, 2, ""}, {N_("/Insert/Font style/\\\\textsl - _slanted"), "s", general_html_menu_cb, 108, ""}, {N_("/Insert/Font style/\\\\textbf - _boldface"), "b", general_html_menu_cb, 1, "",}, {N_("/Insert/Font style/\\\\texttt - _typewriter"), "t", general_html_menu_cb, 110, ""}, {N_("/Insert/Font style/\\\\textsc - small_caps"), "c", general_html_menu_cb, 111, ""}, /* Math Font Style*/ #ifdef HAVE_FULL_MENU {N_("/Insert/Font/Maths"), NULL, NULL, 0, ""}, {N_("/Insert/Font/Maths/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Font/Maths/\\\\mathrm - Roman"), NULL, general_html_menu_cb, 117, ""}, {N_("/Insert/Font/Maths/\\\\mathit - Italic"), NULL, general_html_menu_cb, 118, ""}, {N_("/Insert/Font/Maths/\\\\mathbf - Boldface"), NULL, general_html_menu_cb, 119, ""}, {N_("/Insert/Font/Maths/\\\\mathsf - Sans serif"), NULL, general_html_menu_cb, 120, ""}, {N_("/Insert/Font/Maths/\\\\mathtt - Typewriter"), NULL, general_html_menu_cb, 121, ""}, {N_("/Insert/Font/Maths/sep1"), NULL, NULL, 0, ""}, {N_("/Insert/Font/Maths/\\\\mathcal - Caligraphic"), NULL, general_html_menu_cb, 122, ""}, {N_("/Insert/Font/Maths/\\\\mathbb - Blackboard"), NULL, general_html_menu_cb, 123, ""}, {N_("/Insert/Font/Maths/\\\\mathfrak - Fraktur"), NULL, general_html_menu_cb, 124, ""}, #endif /* HAVE_FULL_MENU */ /* TABLE */ /* TODO: table of contents/figures/tables Bibliography, glossary, index */ /* {N_("/Insert/_Table - Array"), NULL, NULL, 0, ""}, {N_("/Insert/Table - Array/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Table - Array/Table - Array _Wizard..."), "T", menu_html_dialogs_lcb, 2, ""}, {N_("/Insert/Table - Array/Tabular"), NULL, general_html_menu_cb, 24, ""}, {N_("/Insert/Table - Array/Longtable"), NULL, general_html_menu_cb, 102, ""}, */ /* TODO: \upshape (Vertical)*/ /* Math Spacing Command */ /* {N_("/Insert/_Math Spaces"), NULL, NULL, 0, ""}, {N_("/Insert/Math Spaces/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/Math Spaces/\\\\, or \\\\thinspace - Thin Spce"), NULL, general_html_menu_cb, 125, ""}, {N_("/Insert/Math Spaces/\\\\: or \\\\medspace - Medium Space"), NULL, general_html_menu_cb, 126, ""}, {N_("/Insert/Math Spaces/\\\\; or \\\\thicksapce - Thick Space"), NULL, general_html_menu_cb, 127, ""}, {N_("/Insert/Math Spaces/\\\\quad - Quad"), NULL, general_html_menu_cb, 128, ""}, {N_("/Insert/Math Spaces/\\\\quadquad - Double Quad"), NULL, general_html_menu_cb, 129, ""}, {N_("/Insert/Math Spaces/sep1"), NULL, NULL, 0, ""}, {N_("/Insert/Math Spaces/\\\\! or \\\\negthinspace - Negative Thin Space"), NULL, general_html_menu_cb, 130, ""}, {N_("/Insert/Math Spaces/\\\\negmedspace - Negative Medium Space"), NULL, general_html_menu_cb, 131, ""}, {N_("/Insert/Math Spaces/\\\\negthickspace - Negative Thick Space"), NULL, general_html_menu_cb, 132, ""}, */ /* Lists */ /* {N_("/Insert/_List"), NULL, NULL, 0, ""}, {N_("/Insert/List/tearoff1"), NULL, NULL, 0, ""}, {N_("/Insert/List/Quick List"), "L", menu_html_dialogs_lcb, 0, ""}, {N_("/Insert/List/sep1"), NULL, NULL, 0, ""}, {N_("/Insert/List/Itemize"), NULL, general_html_menu_cb, 33, ""}, {N_("/Insert/List/Description"), NULL, general_html_menu_cb, 103, ""}, {N_("/Insert/List/Enumerate"), NULL, general_html_menu_cb, 34, ""}, {N_("/Insert/List/Enhanced Enumerate"), NULL, general_html_menu_cb, 104, ""}, {N_("/Insert/List/sep2"), NULL, NULL, 0, ""}, {N_("/Insert/List/List Ite_m"), NULL, general_html_menu_cb, 35, ""}, {N_("/Insert/List/List Item with Option"), NULL, general_html_menu_cb, 36, ""}, */ /* DOCUMENT */ {N_("/_Document"), NULL, NULL, 0, ""}, {N_("/Document/tearoff1"), NULL, NULL, 0, ""}, {N_("/Document/_Increase Tabsize"), NULL, gui_change_tabsize, 1, ""}, {N_("/Document/_Decrease Tabsize"), NULL, gui_change_tabsize, 0, ""}, {N_("/Document/_Auto Indent"), NULL, toggle_doc_property, 4, ""}, {N_("/Document/sep1"), NULL, NULL, 0, ""}, {N_("/Document/Auto_Completion"), NULL, toggle_doc_property, 3, ""}, {N_("/Document/_Wrap"), NULL, toggle_doc_property, 1, ""}, {N_("/Document/_Line Numbers"), NULL, toggle_doc_property, 2, ""}, {N_("/Document/sep2"), NULL, NULL, 0, ""}, {N_("/Document/_Highlight Syntax"), NULL, doc_toggle_highlighting_cb, 1, ""}, {N_("/Document/_Update Highlighting"), NULL, doc_update_highlighting, 0, ""}, {N_("/Document/sep3"), NULL, NULL, 0, ""}, {N_("/Document/Document Ty_pe"), NULL, NULL, 0, ""}, {N_("/Document/Document Type/tearoff1"), NULL, NULL, 0, ""}, {N_("/Document/Character _Encoding"), NULL, NULL, 0, ""}, {N_("/Document/Character Encoding/tearoff1"), NULL, NULL, 0, ""}, {N_("/Document/sep4"), NULL, NULL, 0, ""}, #ifdef HAVE_LIBASPELL {N_("/Document/Check _Spelling..."), NULL, spell_check_menu_cb, 0, "", GTK_STOCK_SPELL_CHECK}, #endif /* HAVE_LIBASPELL */ {N_("/Document/_Floating window"), NULL, file_floatingview_menu_cb, 1, ""}, {N_("/Document/Word _Count"), NULL, word_count_cb, 1, ""}, /* kyanh, 20020220, in order to obtain a nice position in the MENU BAR, we should create the External menu here. Otherwise, External MENU is built in the end of game, and will appear after HELP MENU */ {N_("/E_xternal"), NULL, NULL, 0, ""}, {N_("/External/tearoff1"), NULL, NULL, 0, ""}, {N_("/External/Stop..."), NULL , toggle_doc_property , 6, ""}, {N_("/External/_Project mode"), NULL , toggle_doc_property , 5, ""}, /* Project relatives */ {N_("/_Project"), NULL, NULL, 0, ""}, {N_("/Project/tearoff1"), NULL, NULL, 0, ""}, {N_("/Project/_New"), NULL, project_menu_cb, 6, ""}, {N_("/Project/_Open"), NULL, project_menu_cb, 1, ""}, {N_("/Project/Open R_ecent"), NULL, NULL, 0, ""}, {N_("/Project/Open Recent/tearoff1"), NULL, NULL, 0, ""}, {N_("/Project/sep1"), NULL, NULL, 0, ""}, {N_("/Project/_Save"), NULL, project_menu_cb, 2, ""}, {N_("/Project/Save _as..."), NULL, project_menu_cb, 3, ""}, {N_("/Project/Save & _close"), NULL, project_menu_cb, 4, ""}, {N_("/Project/sep2"), NULL, NULL, 0, ""}, {N_("/Project/Project options..."), NULL, project_menu_cb, 5, ""}, /* GO */ {N_("/_Go"), NULL, NULL, 0, ""}, {N_("/Go/tearoff1"), NULL, NULL, 0, ""}, {N_("/Go/_Previous document"), NULL, gui_notebook_switch, 1, ""}, {N_("/Go/_Next document"), NULL, gui_notebook_switch, 2, ""}, {N_("/Go/sep1"), NULL, NULL, 0, ""}, {N_("/Go/_First document"), NULL, gui_notebook_switch, 3, ""}, {N_("/Go/L_ast document"), NULL, gui_notebook_switch, 4, ""}, {N_("/Go/sep1"), NULL, NULL, 0, ""}, {N_("/Go/Goto _Line"), NULL, go_to_line_win_cb, 1, ""}, {N_("/Go/Goto _Selection"), NULL, go_to_line_from_selection_cb, 1, ""}, /* View */ {N_("/_View"), NULL, NULL, 0, ""}, {N_("/View/tearoff1"), NULL, NULL, 0, ""}, /* {N_("/View/View _Main Toolbar"), NULL, gui_toggle_hidewidget_cb, 1, ""}, */ {N_("/View/View _Custom Menu"), NULL, gui_toggle_hidewidget_cb, 3, ""}, {N_("/View/View _Sidebar"), "Escape", gui_toggle_hidewidget_cb, 4, ""}, {N_("/View/View _Outputbox"), "Escape", gui_toggle_hidewidget_cb, 5, ""}, #ifdef HAVE_VTE_TERMINAL {N_("/View/View _Terminal"), NULL, gui_toggle_hidewidget_cb, 6, ""}, #endif /* HAVE_VTE_TERMINAL */ {N_("/_?"), NULL, NULL, 0, ""}, {N_("/?/_About..."), NULL, about_dialog_create, 0, ""}, {N_("/?/sep1"), NULL, NULL, 0, ""}, {N_("/?/_Save Settings"), NULL, rcfile_save_configfile_menu_cb, 0, ""}, {N_("/?/Save Shortcut _Keys"), NULL, rcfile_save_configfile_menu_cb, 3, ""}, {N_("/?/_Preferences"), NULL, open_preferences_menu_cb, 0, ""/*, GTK_STOCK_PREFERENCES*/}, }; #ifdef ENABLE_NLS gchar *menu_translate(const gchar * path, gpointer data) { gchar *retval; retval = gettext(path); return retval; } #endif /************************************************/ /* generic functions for dynamic created menu's */ /************************************************/ typedef struct { Tbfwin *bfwin; GtkWidget *menuitem; gpointer data; gulong signal_id; } Tbfw_dynmenu; #define BFW_DYNMENU(var) ((Tbfw_dynmenu *)(var)) static Tbfw_dynmenu *find_bfw_dynmenu_by_data_in_list(GList *thelist, gpointer data) { GList *tmplist = g_list_first(thelist); while (tmplist) { if (BFW_DYNMENU(tmplist->data)->data == data) return BFW_DYNMENU(tmplist->data); tmplist = g_list_next(tmplist); } return NULL; } static GtkWidget *remove_menuitem_in_list_by_label(const gchar *labelstring, GList **menuitemlist) { GList *tmplist; gpointer tmp; tmplist = g_list_first(*menuitemlist); while (tmplist) { DEBUG_MSG("remove_recent_entry, tmplist=%p, data=%p\n", tmplist, tmplist->data); DEBUG_MSG("remove_recent_entry, tmplist->data=%s\n",GTK_LABEL(GTK_BIN(tmplist->data)->child)->label); if(!strcmp(GTK_LABEL(GTK_BIN(tmplist->data)->child)->label, labelstring)) { tmp = tmplist->data; *menuitemlist = g_list_remove(*menuitemlist, tmplist->data); DEBUG_MSG("remove_recent_entry, returning %p\n", tmp); return tmp; } tmplist = g_list_next(tmplist); } return NULL; } /* the result of this function can be added to the menuitem-list */ static GtkWidget *create_dynamic_menuitem(Tbfwin *bfwin, gchar *menubasepath, const gchar *label, GCallback callback, gpointer data, gint menu_insert_offset) { GtkWidget *tmp, *menu; GtkItemFactory *factory; /* add it to bfwin->menubar */ factory = gtk_item_factory_from_widget(bfwin->menubar); menu = gtk_item_factory_get_widget(factory, menubasepath); DEBUG_MSG("create_dynamic_menuitem, menubar=%p, menu=%p basepath=%s, label=%s\n", bfwin->menubar, menu, menubasepath,label); if (menu != NULL) { tmp = gtk_menu_item_new_with_label(label); g_signal_connect(G_OBJECT(tmp), "activate",callback, data); gtk_widget_show(tmp); if (menu_insert_offset == -1) { gtk_menu_shell_append(GTK_MENU_SHELL(menu),tmp); } else { gtk_menu_shell_insert(GTK_MENU_SHELL(menu),tmp,menu_insert_offset); } return tmp; } else { DEBUG_MSG("create_dynamic_menuitem, NO MENU FOR BASEPATH %s\n", menubasepath); return NULL; } } static void create_parent_and_tearoff(gchar *menupath, GtkItemFactory *ifactory) { char *basepath; GtkWidget *widg=NULL; GtkItemFactoryEntry entry; basepath = g_strndup(menupath, (strlen(menupath) - strlen(strrchr(menupath, '/')))); DEBUG_MSG("create_parent_and_tearoff, basepath=%s for menupath=%s\n", basepath, menupath); widg = gtk_item_factory_get_widget(ifactory, basepath); if (!widg) { DEBUG_MSG("create_parent_and_tearoff, no widget found for %s, will create it\n", basepath); create_parent_and_tearoff(basepath, ifactory); entry.path = g_strconcat(basepath, "/tearoff1", NULL); entry.accelerator = NULL; entry.callback = NULL; entry.callback_action = 0; entry.item_type = ""; gtk_item_factory_create_item(ifactory, &entry, NULL, 2); g_free(entry.path); } g_free(basepath); } static void menu_current_document_type_change(GtkMenuItem *menuitem,Tbfw_dynmenu *bdm) { DEBUG_MSG("menu_current_document_type_change, started for hlset %p\n", bdm->data); if (GTK_CHECK_MENU_ITEM(menuitem)->active) { if (doc_set_filetype(bdm->bfwin->current_document, bdm->data)) { doc_highlight_full(bdm->bfwin->current_document); } else { menu_current_document_set_toggle_wo_activate(bdm->bfwin,bdm->bfwin->current_document->hl, NULL); } } doc_set_statusbar_editmode_encoding(bdm->bfwin->current_document); DEBUG_MSG("menu_current_document_type_change, finished\n"); } void filetype_menus_empty() { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { Tbfwin *bfwin = BFWIN(tmplist->data); GList *tmplist2 = g_list_first(bfwin->menu_filetypes); while (tmplist2) { Tbfw_dynmenu *bdm = BFW_DYNMENU(tmplist2->data); g_signal_handler_disconnect(bdm->menuitem,bdm->signal_id); gtk_widget_destroy(bdm->menuitem); g_free(bdm); tmplist2 = g_list_next(tmplist2); } tmplist = g_list_next(tmplist); } } void filetype_menu_rebuild(Tbfwin *bfwin,GtkItemFactory *item_factory) { GSList *group=NULL; GtkWidget *parent_menu; GList *tmplist = g_list_last(main_v->filetypelist); if (!item_factory) { item_factory = gtk_item_factory_from_widget(bfwin->menubar); } DEBUG_MSG("filetype_menu_rebuild, adding filetypes in menu\n"); bfwin->menu_filetypes = NULL; parent_menu = gtk_item_factory_get_widget(item_factory, N_("/Document/Document Type")); while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; if (filetype->editable) { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->data = filetype; bdm->bfwin = bfwin; bdm->menuitem = gtk_radio_menu_item_new_with_label(group, filetype->type); bdm->signal_id = g_signal_connect(G_OBJECT(bdm->menuitem), "activate",G_CALLBACK(menu_current_document_type_change), (gpointer) bdm); gtk_widget_show(bdm->menuitem); gtk_menu_insert(GTK_MENU(parent_menu), bdm->menuitem, 1); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(bdm->menuitem)); bfwin->menu_filetypes = g_list_append(bfwin->menu_filetypes, bdm); } tmplist = g_list_previous(tmplist); } } /* * menu factory crap, thanks to the gtk tutorial for this * both the 1.0 and the 1.2 code is directly from the tutorial */ void menu_create_main(Tbfwin *bfwin, GtkWidget *vbox) { GtkItemFactory *item_factory; GtkAccelGroup *accel_group; gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); accel_group = gtk_accel_group_new(); item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "", accel_group); #ifdef ENABLE_NLS gtk_item_factory_set_translate_func(item_factory, menu_translate, "", NULL); #endif gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, bfwin); gtk_window_add_accel_group(GTK_WINDOW(bfwin->main_window), accel_group); bfwin->menubar = gtk_item_factory_get_widget(item_factory, ""); gtk_box_pack_start(GTK_BOX(vbox), bfwin->menubar, FALSE, TRUE, 0); gtk_accel_map_add_entry("/Edit/Shift Right", GDK_period, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Edit/Shift Left", GDK_comma, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Edit/Comment", GDK_percent, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Edit/UnComment", GDK_percent, GDK_MOD1_MASK); gtk_accel_map_add_entry("/Edit/Hard Shift Left", GDK_less, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Edit/Find, Replace/Brace Finder (Forward)", GDK_bracketright, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Edit/Find, Replace/Brace Finder (Backward)", GDK_bracketleft, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Insert/Tools/Source Separator", GDK_equal, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Document/Update Highlighting", GDK_space, GDK_MOD1_MASK); gtk_accel_map_add_entry("/Go/Previous document", GDK_Page_Up, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Go/Next document", GDK_Page_Down, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Go/First document", GDK_Page_Up, GDK_SHIFT_MASK | GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Go/Last document", GDK_Page_Down, GDK_SHIFT_MASK | GDK_CONTROL_MASK); gtk_accel_map_add_entry("/External/Project mode", GDK_Escape, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/Go/Goto Line", GDK_slash, GDK_CONTROL_MASK); gtk_accel_map_add_entry("/External/Stop...", GDK_Escape, 0); /* gtk_accel_map_add_entry("/View/View Outputbox", GDK_Escape, GDK_SHIFT_MASK); */ gtk_widget_show(bfwin->menubar); /* setup_toggle_item(item_factory, N_("/View/View Main Toolbar"), main_v->session->view_bars & VIEW_MAIN_TOOLBAR); */ /* setup_toggle_item(item_factory, N_("/View/View LaTeX Toolbar"), main_v->session->view_bars & VIEW_LATEX_TOOLBAR); */ setup_toggle_item(item_factory, N_("/View/View Custom Menu"), main_v->session->view_bars & VIEW_CUSTOM_MENU); setup_toggle_item(item_factory, N_("/View/View Sidebar"), main_v->session->view_bars & VIEW_LEFT_PANEL); setup_toggle_item(item_factory, N_("/Document/Auto Indent"), main_v->props.view_bars & MODE_AUTO_INDENT); setup_toggle_item(item_factory, N_("/External/Project mode"), 1); set_project_menu_widgets(bfwin, FALSE); menuitem_set_sensitive(bfwin->menubar, N_("/External/Stop..."), FALSE); filetype_menu_rebuild(bfwin, item_factory); } /*************************************************************/ /* Output Box handling */ /*************************************************************/ static GtkWidget *dynamic_menu_append_spacing(Tbfwin *bfwin, gchar *basepath) { GtkItemFactory *factory; GtkWidget *menu, *menuitem; factory = gtk_item_factory_from_widget(bfwin->menubar); menu = gtk_item_factory_get_widget(factory, basepath); menuitem = gtk_menu_item_new(); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu),menuitem); return menuitem; } static void menu_outputbox_lcb(GtkMenuItem *menuitem,Tbfw_dynmenu *bdm) { gchar **arr = (gchar **)bdm->data; /* gint save_show; SET_BIT(save_show, OB_NEED_SAVE_FILE, TRUE); SET_BIT(save_show, OB_SHOW_ALL_OUTPUT, (arr[6][0]=='1')); g_print("menu_outputbox_lcb: save/show = %d\n", save_show); */ outputbox(bdm->bfwin,&bdm->bfwin->outputbox, _("output"), arr[1], atoi(arr[2]), atoi(arr[3]), atoi(arr[4]), arr[5],atoi(arr[6])); } /*******************************************************************/ /* Open Recent menu handling */ /*******************************************************************/ /* the only required header */ static GtkWidget *create_recent_entry(Tbfwin *bfwin, const gchar *filename, gboolean is_project, gboolean check_for_duplicates); /*******************************************************************/ static GtkWidget *remove_recent_entry(Tbfwin *bfwin, const gchar *filename, gboolean is_project) { GList *tmplist; GList **worklist; gpointer tmp; worklist = (is_project) ? &bfwin->menu_recent_projects : &bfwin->menu_recent_files; if(strcmp(filename, "last") ==0) { tmplist = g_list_first(*worklist); if (tmplist) { tmp = tmplist->data; DEBUG_MSG("remove_recent_entry, remove last entry\n"); *worklist = g_list_remove(*worklist, tmplist->data); return tmp; } else { DEBUG_MSG("remove_recent_entry, worklist contained no items, returning NULL\n"); return NULL; } } else { return remove_menuitem_in_list_by_label(filename, worklist); } } static void open_recent_project_cb(GtkWidget *widget, Tbfwin *bfwin) { gchar *filename = GTK_LABEL(GTK_BIN(widget)->child)->label; DEBUG_MSG("open_recent_project_cb, started, filename is %s\n", filename); project_open_from_file(bfwin, filename, -1); add_to_recent_list(bfwin,filename, 0, TRUE); } /* open_recent_file * This function should be called when a menu from the Open Recent list * has been selected. */ static void open_recent_file_cb(GtkWidget *widget, Tbfwin *bfwin) { gboolean success; gchar *filename = GTK_LABEL(GTK_BIN(widget)->child)->label; DEBUG_MSG("open_recent_file_cb, started, filename is %s\n", filename); statusbar_message(bfwin,_("loading file(s)..."),2000); flush_queue(); success = (doc_new_with_file(bfwin,filename, FALSE, FALSE) != NULL); if (!success) { gchar *message = g_strconcat(_("The filename was:\n"), filename, NULL); warning_dialog(bfwin->main_window,_("Could not open file\n"), message); g_free(message); return; } DEBUG_MSG("open_recent_file_cb, document %s opened\n", filename); add_to_recent_list(bfwin,filename, 0, FALSE); } /* create_recent_entry * This function builds the gtkitemfactoryentry and inserts it at the * bfwin->menubar. Furthermore, it returns a pointer to it, so that * this pointer can be added in the main_v->recent_files list */ static GtkWidget *create_recent_entry(Tbfwin *bfwin, const gchar *filename, gboolean is_project, gboolean check_for_duplicates) { GtkWidget *tmp; if (check_for_duplicates) { tmp = remove_recent_entry(bfwin,filename,is_project); if (tmp) { gtk_widget_hide(tmp); gtk_widget_destroy(tmp); } } if (is_project) { return create_dynamic_menuitem(bfwin,N_("/Project/Open Recent") , filename, G_CALLBACK(open_recent_project_cb), bfwin , 1); } else { return create_dynamic_menuitem(bfwin,N_("/File/Open Recent") , filename, G_CALLBACK(open_recent_file_cb), bfwin , 1); } } GList *recent_menu_from_list(Tbfwin *bfwin, GList *startat, gboolean is_project) { GList *retlist=NULL, *tmplist=startat; while (tmplist) { DEBUG_MSG("recent_menu_init, adding recent project %s\n",(gchar *)tmplist->data); retlist = g_list_append(retlist, create_recent_entry(bfwin,tmplist->data,is_project,FALSE)); tmplist = g_list_next(tmplist); } return retlist; } /* recent_menu_init() * Gets the list of documents from .winefish/recentlist and inserts * it at the File-->Open Recent menu. If the file doesn't exist (probably * because this is the first time Bluefish is running) then a menu * item telling that no recent files exist will appear */ void recent_menu_init(Tbfwin *bfwin) { /* recent_menu_from_file(bfwin, "/.winefish/recentlist", FALSE); recent_menu_from_file(bfwin, "/.winefish/recentprojects", TRUE);*/ recent_menu_from_list(bfwin, bfwin->session->recent_files, FALSE); recent_menu_from_list(bfwin, main_v->globses.recent_projects, TRUE); } /* when a project is opened, the recent menu should show the recent files from that project */ void recent_menu_init_project(Tbfwin *bfwin) { gint num; GList *tmplist = g_list_first(bfwin->menu_recent_files); while (tmplist) { gtk_widget_destroy(tmplist->data); tmplist = g_list_next(tmplist); } num = g_list_length(bfwin->session->recent_files) - main_v->props.max_recent_files; bfwin->menu_recent_files = recent_menu_from_list(bfwin, g_list_nth(bfwin->session->recent_files, (num > 0)?num:0), FALSE); } /* Add_to_recent_list * This should be called when a new file is opened, i.e. from * file_open_cb, it adds a new entry which also appears in the * menu bar, and (if nessecary) deletes the last entry */ void add_to_recent_list(Tbfwin *bfwin,gchar *filename, gint closed_file, gboolean is_project) { DEBUG_MSG("add_to_recent_list, started for %s\n", filename); if (closed_file) { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { Tbfwin *curbfwin = BFWIN(tmplist->data); if (!curbfwin->project || curbfwin == bfwin || is_project) { GtkWidget *tmp; GList **worklist; worklist = (is_project) ? &curbfwin->menu_recent_projects : &curbfwin->menu_recent_files; /* First of all, create the entry and insert it at the list*/ *worklist = g_list_append(*worklist,create_recent_entry(curbfwin,filename,is_project,TRUE)); DEBUG_MSG("add_to_recent_list, inserted item in menu\n"); if(g_list_length(*worklist) > main_v->props.max_recent_files) { tmp = remove_recent_entry(bfwin,"last",is_project); if (tmp) { DEBUG_MSG("add_to_recent_list, list too long, entry %s to be deleted\n", GTK_LABEL(GTK_BIN(tmp)->child)->label); gtk_widget_hide(tmp); gtk_widget_destroy(tmp); } } } tmplist = g_list_next(tmplist); } } if (is_project) { main_v->globses.recent_projects = add_to_history_stringlist(main_v->globses.recent_projects, filename, FALSE, TRUE); } else { bfwin->session->recent_files = add_to_history_stringlist(bfwin->session->recent_files, filename, FALSE, TRUE); } } /*****************/ /* Windows !! */ /*****************/ static void remove_all_window_entries_in_window(Tbfwin *menubfwin) { GList *tmplist = g_list_first(menubfwin->menu_windows); DEBUG_MSG("removing all window entries in menubfwin %p\n",menubfwin); while (tmplist) { Tbfw_dynmenu *bdm = BFW_DYNMENU(tmplist->data); /*g_signal_handler_disconnect(bdm->menuitem,bdm->signal_id);*/ DEBUG_MSG("remove_all_window_entries_in_window, destroy menuitem=%p\n",bdm->menuitem); gtk_widget_destroy(bdm->menuitem); g_free(bdm); tmplist = g_list_next(tmplist); } g_list_free(menubfwin->menu_windows); menubfwin->menu_windows = NULL; } static void remove_window_entry_from_window(Tbfwin *menubfwin, Tbfwin *tobfwin) { Tbfw_dynmenu *bdm = find_bfw_dynmenu_by_data_in_list(menubfwin->menu_windows, tobfwin); DEBUG_MSG("remove_window_entry_from_window, menuwin=%p, found bdm=%p\n",menubfwin,bdm); if (bdm) { /*g_signal_handler_disconnect(bdm->menuitem,bdm->signal_id);*/ DEBUG_MSG("remove_window_entry_from_window, destroy menuitem=%p\n",bdm->menuitem); gtk_widget_destroy(bdm->menuitem); menubfwin->menu_windows = g_list_remove(menubfwin->menu_windows,bdm); g_free(bdm); } } static void rename_window_entry_from_window(Tbfwin *menubfwin, Tbfwin *tobfwin, gchar *newtitle) { Tbfw_dynmenu *bdm = find_bfw_dynmenu_by_data_in_list(menubfwin->menu_windows, tobfwin); DEBUG_MSG("rename_window_entry_from_window, menubfwin=%p, found bdm=%p\n",menubfwin,bdm); if (bdm) { GtkWidget *label = gtk_bin_get_child(GTK_BIN(bdm->menuitem)); DEBUG_MSG("rename_window_entry_from_window, setting label to have title %s\n",newtitle); gtk_label_set_text(GTK_LABEL(label), newtitle); } } static void menu_window_lcb(GtkWidget *widget, Tbfw_dynmenu *bdm) { gtk_window_present(GTK_WINDOW(BFWIN(bdm->data)->main_window)); } static void add_window_entry(Tbfwin *menubfwin, Tbfwin *tobfwin) { const gchar *winname; Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->bfwin = menubfwin; bdm->data = tobfwin; winname = gtk_window_get_title(GTK_WINDOW(tobfwin->main_window)); DEBUG_MSG("add_window_entry, menubfwin=%p, bdm=%p with title %s\n",menubfwin,bdm,winname); bdm->menuitem = create_dynamic_menuitem(menubfwin,_("/Windows"),winname,G_CALLBACK(menu_window_lcb),(gpointer)bdm,-1); DEBUG_MSG("add_window_entry, menuitem=%p\n",bdm->menuitem); menubfwin->menu_windows = g_list_append(menubfwin->menu_windows, bdm); } void add_window_entry_to_all_windows(Tbfwin *tobfwin) { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { if (tmplist->data != tobfwin) { add_window_entry(BFWIN(tmplist->data), tobfwin); } tmplist = g_list_next(tmplist); } } void add_allwindows_entries_to_window(Tbfwin *menubfwin) { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { if (tmplist->data != menubfwin) { add_window_entry(menubfwin, BFWIN(tmplist->data)); } tmplist = g_list_next(tmplist); } } void remove_window_entry_from_all_windows(Tbfwin *tobfwin) { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { remove_window_entry_from_window(BFWIN(tmplist->data), tobfwin); tmplist = g_list_next(tmplist); } remove_all_window_entries_in_window(tobfwin); } void rename_window_entry_in_all_windows(Tbfwin *tobfwin, gchar *newtitle) { GList *tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { rename_window_entry_from_window(BFWIN(tmplist->data), tobfwin, newtitle); tmplist = g_list_next(tmplist); } } /*****************/ /* Browsers!! */ /*****************/ static void view_in_browser(Tbfwin *bfwin, gchar *browser) { if (bfwin->current_document->filename) { gchar *command; command = convert_command(bfwin, browser); DEBUG_MSG("view_in_browser, should start command [%s] now\n", command); system(command); g_free(command); /*CANNOT BE FREED*/ } else { warning_dialog(bfwin->main_window,_("Could not view file in browser, the file does not yet have a name\n"), NULL); } } /* kyanh, removed, 20050309 void browser_toolbar_cb(GtkWidget *widget, Tbfwin *bfwin) { GList *tmplist = g_list_first(main_v->props.browsers); if (tmplist && tmplist->data) { gchar **arr = tmplist->data; DEBUG_MSG("first browser in main_v->props.browsers(%p) is %s with command %s\n", main_v->props.browsers, arr[0], arr[1]); view_in_browser(bfwin,arr[1]); } } */ static void browser_lcb(GtkWidget *widget, Tbfw_dynmenu *bdm) { gchar **arr = (gchar **)bdm->data; if (!bdm->bfwin->current_document->filename || bdm->bfwin->current_document->modified) { file_save_cb(NULL, bdm->bfwin); } view_in_browser(bdm->bfwin,arr[1]); } static void external_command_lcb(GtkWidget *widget, Tbfw_dynmenu *bdm) { gchar *secure_tempname = NULL, *secure_tempname2 = NULL; gboolean need_o, need_f, need_i, need_p; gchar **arr = (gchar **)bdm->data; /* now check if * %f - we need a filename * %o - output filename that we need to read after the command has finished (filter) * %i - input filename for the filter */ need_o = (strstr(arr[1], "%o") != NULL); /* output file name */ need_f = (strstr(arr[1], "%f") != NULL); /* basefile name */ need_i = (strstr(arr[1], "%i") != NULL); /* input name */ need_p = (strstr(arr[1], "%%") != NULL); gint num_needs = need_o + need_f + need_i + need_p; if (need_f) { file_save_cb(NULL, bdm->bfwin); if (!bdm->bfwin->current_document->filename) { return; } /* kyanh, change to working directory */ /* change_dir(bdm->bfwin->current_document->filename); */ if (bdm->bfwin->current_document->filename[0] == '/'){ /* for local files we chdir() to their directory */ gchar *tmpstring = g_path_get_dirname(bdm->bfwin->current_document->filename); chdir(tmpstring); g_free(tmpstring); } } if (num_needs) { gchar *command; Tconvert_table *table, *tmpt; table = tmpt = g_new(Tconvert_table, num_needs +1); if (need_p) { tmpt->my_int = '%'; tmpt->my_char = g_strdup("%"); tmpt++; } if (need_f) { DEBUG_MSG("adding 's' to table\n"); tmpt->my_int = 'f'; tmpt->my_char = g_strdup(bdm->bfwin->current_document->filename); tmpt++; } if (need_o) { secure_tempname = create_secure_dir_return_filename(); DEBUG_MSG("adding 'f' to table\n"); tmpt->my_int = 'o'; tmpt->my_char = g_strdup(secure_tempname); tmpt++; } if (need_i) { gchar *buffer; GtkTextIter itstart, itend; gtk_text_buffer_get_bounds(bdm->bfwin->current_document->buffer,&itstart,&itend); secure_tempname2 = create_secure_dir_return_filename(); DEBUG_MSG("adding 'i' to table\n"); tmpt->my_int = 'i'; tmpt->my_char = g_strdup(secure_tempname2); tmpt++; /* now we also save the current filename (or in the future the selection) to this file */ buffer = gtk_text_buffer_get_text(bdm->bfwin->current_document->buffer,&itstart,&itend,FALSE); buffer_to_file(BFWIN(bdm->bfwin), buffer, secure_tempname2); g_free(buffer); } #ifdef OLD_IMPLEMENT if (need_p) { tmpt->my_int = 'p'; tmpt->my_char = g_strdup("%"); tmpt++; } #endif /* OLD_IMPLEMENT */ tmpt->my_char = NULL; command = replace_string_printflike(arr[1], table); free_convert_table(table); system(command); /* TODO: THE SYSTEM MAY HALTED */ g_free(command); /* filting */ if (need_o) { gint end; gchar *buf = NULL; gboolean suc6; /* empty textbox and fill from file secure_tempname */ end = doc_get_max_offset(bdm->bfwin->current_document); suc6 = g_file_get_contents(secure_tempname, &buf, NULL, NULL); if (suc6 && buf) { if (strlen(buf)) { doc_replace_text(bdm->bfwin->current_document, buf, 0, end); } g_free(buf); } } if (secure_tempname) { remove_secure_dir_and_filename(secure_tempname); } if (secure_tempname2) { remove_secure_dir_and_filename(secure_tempname2); } } else { DEBUG_MSG("external_command_lcb, about to start %s\n", arr[1]); system(arr[1]); /* TODO: THE SYSTEM MAY HALTED */ } } /** * external_menu_rebuild: * @bfwin: #Tbfwin* * * rebuild the browsers, external commands and outputbox menu's * * Return value: void */ void external_menu_rebuild(Tbfwin *bfwin) { static gint KEYS_LaTeX[] = {GDK_F1,GDK_F2,GDK_F3,GDK_F4,GDK_F5,GDK_F6,GDK_F7,GDK_F8,GDK_F9,GDK_F10,GDK_F11,GDK_F12}; GList *tmplist; gint hotkey; /* first cleanup all menu's */ tmplist = g_list_first(bfwin->menu_external); while (tmplist) { Tbfw_dynmenu *bdm = (Tbfw_dynmenu *)tmplist->data; DEBUG_MSG("external_menu_rebuild,destroying,bfwin=%p,bdm=%p,menuitem=%p\n",bfwin,bdm,bdm->menuitem); gtk_widget_destroy(bdm->menuitem); g_free(bdm); tmplist = g_list_next(tmplist); } g_list_free(bfwin->menu_external); bfwin->menu_external = NULL; tmplist = g_list_first(bfwin->menu_outputbox); while (tmplist) { gtk_widget_destroy(BFW_DYNMENU(tmplist->data)->menuitem); g_free(BFW_DYNMENU(tmplist->data)); tmplist = g_list_next(tmplist); } g_list_free(bfwin->menu_outputbox); bfwin->menu_outputbox = NULL; /* the *LaTeX* */ Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->menuitem = dynamic_menu_append_spacing(bfwin,N_("/External")); bfwin->menu_outputbox = g_list_append(bfwin->menu_outputbox, bdm); tmplist = g_list_first(main_v->props.outputbox); hotkey =0; while (tmplist) { gchar **arr = tmplist->data; /* outputbox(gchar *pattern, gint file_subpat, gint line_subpat, gint output_subpat, gchar *command, gboolean show_all_output) * arr[0] = name * arr[1] = pattern * arr[2] = file subpattern * arr[3] = line subpattern * arr[4] = output subpattern * arr[5] = command * arr[6] = show_all_output */ if (count_array(arr)==7) { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); gchar *tmp1; tmp1 = N_("/External"); bdm->data = arr; bdm->bfwin = bfwin; bdm->menuitem = create_dynamic_menuitem(bfwin,tmp1,arr[0],G_CALLBACK(menu_outputbox_lcb),(gpointer)bdm,-1); bfwin->menu_outputbox = g_list_append(bfwin->menu_outputbox,bdm); if (hotkey < sizeof(KEYS_LaTeX)) { tmp1 = g_strconcat("",tmp1,"/",arr[0],NULL); gtk_accel_map_change_entry(tmp1, KEYS_LaTeX[hotkey], 0, TRUE); } hotkey++; } tmplist = g_list_next(tmplist); } /* Viewers */ { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->menuitem = dynamic_menu_append_spacing(bfwin,N_("/External")); bfwin->menu_external = g_list_append(bfwin->menu_external,bdm); } tmplist = g_list_first(main_v->props.browsers); hotkey = 0; while (tmplist) { gchar **arr = tmplist->data; /* arr[0] = name * arr[1] = command */ if (count_array(arr)==2) { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); gchar *tmp1; tmp1 = N_("/External"); bdm->bfwin = bfwin; bdm->data = arr; DEBUG_MSG("external_menu_rebuild,Adding browser %s with command %s to the menu at %s\n", arr[0], arr[1], tmp1); bdm->menuitem = create_dynamic_menuitem(bfwin,tmp1,arr[0],G_CALLBACK(browser_lcb),bdm,-1); DEBUG_MSG("external_menu_rebuild,creating,bfwin=%p,bdm=%p,menuitem=%p\n",bfwin,bdm,bdm->menuitem); bfwin->menu_external = g_list_append(bfwin->menu_external, bdm); if (hotkey < sizeof(KEYS_LaTeX)) { tmp1 = g_strconcat("",tmp1,"/",arr[0],NULL); gtk_accel_map_change_entry(tmp1, KEYS_LaTeX[hotkey], GDK_CONTROL_MASK, TRUE); } hotkey++; } #ifdef DEBUG else { DEBUG_MSG("need count=2 for browser menu! %p has count %d\n", arr, count_array(arr)); } #endif tmplist = g_list_next(tmplist); } { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->menuitem = dynamic_menu_append_spacing(bfwin,N_("/External")); bfwin->menu_external = g_list_append(bfwin->menu_external,bdm); } /* Filters */ tmplist = g_list_first(main_v->props.external_commands); while (tmplist) { gchar **arr = tmplist->data; /* arr[0] = name * arr[1] = command */ if (count_array(arr)==2) { gchar *tmp1; Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); tmp1 = N_("/External"); bdm->bfwin = bfwin; bdm->data = arr; bdm->menuitem = create_dynamic_menuitem(bfwin,tmp1,arr[0],G_CALLBACK(external_command_lcb),bdm,-1); bfwin->menu_external = g_list_append(bfwin->menu_external, bdm); } tmplist = g_list_next(tmplist); } /* g_free(KEYS_LaTeX); BUG#5689 */ } static void menu_current_document_encoding_change(GtkMenuItem *menuitem,Tbfw_dynmenu *bdm) { if (GTK_CHECK_MENU_ITEM(menuitem)->active) { gchar *encoding = (gchar *)bdm->data; Tbfwin *bfwin = bdm->bfwin; if (encoding && (!bfwin->current_document->encoding || strcmp(encoding,bfwin->current_document->encoding)!=0)) { if (bfwin->current_document->encoding) { g_free(bfwin->current_document->encoding); } bfwin->current_document->encoding = g_strdup(encoding); /* kyanh, removed, 20050220 if (main_v->props.auto_set_encoding_meta) { update_encoding_meta_in_file(bfwin->current_document, bfwin->current_document->encoding); }*/ doc_set_statusbar_editmode_encoding(bfwin->current_document); DEBUG_MSG("menu_current_document_encoding_change, set to %s\n", encoding); } } } void encoding_menu_rebuild(Tbfwin *bfwin) { GSList *group=NULL; GtkWidget *parent_menu; GList *tmplist; tmplist = g_list_first(bfwin->menu_encodings); while (tmplist) { Tbfw_dynmenu *bdm = tmplist->data; gtk_widget_destroy(GTK_WIDGET(bdm->menuitem)); g_free(bdm); tmplist = g_list_next(tmplist); } g_list_free(bfwin->menu_encodings); bfwin->menu_encodings = NULL; tmplist = g_list_last(main_v->props.encodings); parent_menu = gtk_item_factory_get_widget(gtk_item_factory_from_widget(bfwin->menubar), N_("/Document/Character Encoding")); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; if (count_array(strarr)==2) { Tbfw_dynmenu *bdm = g_new(Tbfw_dynmenu,1); bdm->menuitem = gtk_radio_menu_item_new_with_label(group, strarr[0]); bdm->data = strarr[1]; bdm->bfwin = bfwin; g_signal_connect(G_OBJECT(bdm->menuitem), "activate",G_CALLBACK(menu_current_document_encoding_change), (gpointer) bdm); gtk_widget_show(bdm->menuitem); gtk_menu_insert(GTK_MENU(parent_menu), bdm->menuitem, 1); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(bdm->menuitem)); bfwin->menu_encodings = g_list_append(bfwin->menu_encodings, bdm); } tmplist = g_list_previous(tmplist); } } void menu_current_document_set_toggle_wo_activate(Tbfwin *bfwin, Tfiletype *filetype, gchar *encoding) { Tbfw_dynmenu *bdm = find_bfw_dynmenu_by_data_in_list(bfwin->menu_filetypes, filetype); if (bdm && filetype && bdm->menuitem && !GTK_CHECK_MENU_ITEM(bdm->menuitem)->active) { DEBUG_MSG("setting widget from hlset %p active\n", bfwin->current_document->hl); g_signal_handler_disconnect(G_OBJECT(bdm->menuitem),bdm->signal_id); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(bdm->menuitem), TRUE); bdm->signal_id = g_signal_connect(G_OBJECT(bdm->menuitem), "activate",G_CALLBACK(menu_current_document_type_change), (gpointer) bdm); } #ifdef DEBUG else { DEBUG_MSG("widget from filetype %p is already active, or filetype does not have a widget!!\n", bfwin->current_document->hl); } #endif if (encoding) { GList *tmplist; tmplist = g_list_first(main_v->props.encodings); while (tmplist) { gchar **tmparr = (gchar **)tmplist->data; if (strcmp(tmparr[1], encoding)==0) { Tbfw_dynmenu *bdm = find_bfw_dynmenu_by_data_in_list(bfwin->menu_encodings, tmparr[1]); if (bdm) { g_signal_handlers_block_matched(G_OBJECT(bdm->menuitem), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, menu_current_document_encoding_change, NULL); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(bdm->menuitem),TRUE); g_signal_handlers_unblock_matched(G_OBJECT(bdm->menuitem), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, menu_current_document_encoding_change, NULL); } break; } tmplist = g_list_next(tmplist); } } } /***************/ /* custom menu */ /***************/ #define MAX_TEXT_ENTRY 10 typedef struct { GtkWidget *dialog; GtkWidget *textentry[MAX_TEXT_ENTRY]; gint type; gchar **array; Tbfwin *bfwin; } Tcust_con_struc; typedef struct { GtkItemFactoryEntry entry; gint type; gchar **array; Tbfwin *bfwin; } Tcmenu_entry; /* instead of having one list where both insert and replace types have their place, I changed that to 2 arraylists: main_v->props.cmenu_insert main_v->props.cmenu_replace ** for insert ** array[0] = title / menupath array[1] = formatstring before, containing %0, %1... that should be replaced by the values from the dialog array[2] = formatstring after array[3] = number of variables from the dialog array[4..] = the description of those variables ** for replace ** array[0] = title / menupath array[1] = search pattern, containing %0 etc. array[2] = replace pattern, containing %0 etc. array[3] = replace where: 0 = from beginning 1 = from cursor 2 = selection (selection required) 3 = all open documents 4 = ask array[4] = replace type: 0 = normal 1 = regular expression array[5] = case sensitivity: 0 = no 1 = yes array[6] = number of variables from the dialog array[7..] = the description of those variables */ static void cust_con_struc_dialog_destroy_lcb(GtkWidget *widget, Tcust_con_struc *ccs) { window_destroy(ccs->dialog); g_free(ccs); } static void cust_con_struc_dialog_cancel_lcb(GtkWidget *widget, gpointer data) { cust_con_struc_dialog_destroy_lcb(NULL, data); } static void cust_con_struc_dialog_ok_lcb(GtkWidget *widget, Tcust_con_struc *ccs) { Tconvert_table *table, *tmpt; gint num_vars, i; DEBUG_MSG("cust_con_struc_dialog_ok_lcb, ccs at %p\n", ccs); DEBUG_MSG("cust_con_struc_dialog_ok_lcb, array at %p, &array[0]=%p\n", ccs->array, &ccs->array[0]); DEBUG_MSG("cust_con_struc_dialog_ok_lcb, array[0] at %p, *array=%p\n", ccs->array[0], *ccs->array); if (ccs->type == 0) { gchar *before=NULL, *after=NULL; num_vars = atoi(ccs->array[3]); DEBUG_MSG("cust_con_struc_dialog_ok_lcb, num_vars=%d, ccs->array[3]=%s\n", num_vars, ccs->array[3]); table = tmpt = g_new(Tconvert_table, num_vars+2); tmpt->my_int = '%'; tmpt->my_char = g_strdup("%"); tmpt++; for (i=0; imy_int = 48 + i; tmpt->my_char = gtk_editable_get_chars(GTK_EDITABLE(ccs->textentry[i]), 0, -1); tmpt++; } DEBUG_MSG("cust_con_struc_dialog_ok_lcb, setting tmpt(%p) to NULL\n", tmpt); tmpt->my_char = NULL; if (strlen(ccs->array[1])) { DEBUG_MSG("cust_con_struc_dialog_ok_lcb, ccs->array[1]=%s\n",ccs->array[1] ); before = replace_string_printflike(ccs->array[1], table); } if (strlen(ccs->array[2])) { after = replace_string_printflike(ccs->array[2], table); } doc_insert_two_strings(ccs->bfwin->current_document, before, after); tmpt = table; while (tmpt->my_char) { DEBUG_MSG("cust_con_struc_dialog_ok_lcb, tmpt=%p, about to free(%p) %s\n", tmpt, tmpt->my_char, tmpt->my_char); g_free(tmpt->my_char); tmpt++; } g_free(table); if (before) { g_free(before); } if (after) { g_free(after); } } else { gchar *search=NULL, *replace=NULL; num_vars = atoi(ccs->array[6]); table = tmpt = g_new(Tconvert_table, num_vars+1); for (i=0; imy_int = 48 + i; tmpt->my_char = gtk_editable_get_chars(GTK_EDITABLE(ccs->textentry[i]), 0, -1); tmpt++; } tmpt->my_char = NULL; if (strlen(ccs->array[1])) { DEBUG_MSG("cust_con_struc_dialog_ok_lcb, ccs->array[1]=%s\n",ccs->array[1] ); search = replace_string_printflike(ccs->array[1], table); } if (strlen(ccs->array[2])) { replace = replace_string_printflike(ccs->array[2], table); } else { replace = g_strdup(""); } snr2_run_extern_replace(ccs->bfwin->current_document, search, atoi(ccs->array[3]), atoi(ccs->array[4]), atoi(ccs->array[5]), replace, TRUE); tmpt = table; while (tmpt->my_char) { g_free(tmpt->my_char); tmpt++; } g_free(table); if (search) { g_free(search); } if (replace) { g_free(replace); } } cust_con_struc_dialog_cancel_lcb(NULL, ccs); } static void cust_con_struc_dialog(Tbfwin *bfwin, gchar **array, gint type) { Tcust_con_struc *ccs; GtkWidget *vbox, *hbox, *okb, *cancb; gint i, num_vars; ccs = g_malloc(sizeof(Tcust_con_struc)); ccs->type = type; ccs->bfwin = bfwin; DEBUG_MSG("cust_con_struc_dialog_cb, ccs at %p\n", ccs); ccs->array = array; DEBUG_MSG("cust_con_struc_dialog_cb, array at %p, &array[0]=%p\n", ccs->array, &ccs->array[0]); DEBUG_MSG("cust_con_struc_dialog_cb, array[0] at %p, *array=%p\n", ccs->array[0], *ccs->array); ccs->dialog = window_full2(ccs->array[0], GTK_WIN_POS_MOUSE, 5, G_CALLBACK(cust_con_struc_dialog_destroy_lcb), ccs, TRUE, NULL); vbox = gtk_vbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(ccs->dialog), vbox); DEBUG_MSG("cust_con_struc_dialog_cb, ccs->array[0]=%s\n", ccs->array[0]); if (type == 0) { num_vars = atoi(ccs->array[3]); } else { num_vars = atoi(ccs->array[6]); } DEBUG_MSG("cust_con_struc_dialog_cb, num_vars=%d\n", num_vars); for (i=0; iarray[i+4]), TRUE, TRUE, 2); } else { gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(ccs->array[i+7]), TRUE, TRUE, 2); } ccs->textentry[i] = gtk_entry_new(); DEBUG_MSG("cust_con_struc_dialog_cb, textentry[%d]=%p\n", i, ccs->textentry[i]); gtk_entry_set_activates_default(GTK_ENTRY(ccs->textentry[i]), TRUE); gtk_box_pack_start(GTK_BOX(hbox), ccs->textentry[i], TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); } gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); okb = bf_stock_ok_button(G_CALLBACK(cust_con_struc_dialog_ok_lcb), ccs); cancb = bf_stock_cancel_button(G_CALLBACK(cust_con_struc_dialog_cancel_lcb), ccs); gtk_box_pack_start(GTK_BOX(hbox),cancb , FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox),okb , FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_grab_focus(ccs->textentry[0]); gtk_widget_grab_default(okb); gtk_widget_show_all(ccs->dialog); } static void cust_menu_lcb(Tcmenu_entry *cmentry,guint callback_action,GtkWidget *widget) { if (cmentry->type == 0) { DEBUG_MSG("cust_menu_lcb, a custom insert, array[3]=%s\n", cmentry->array[3]); if (atoi(cmentry->array[3]) > 0) { cust_con_struc_dialog(cmentry->bfwin,cmentry->array, 0); } else { doc_insert_two_strings(cmentry->bfwin->current_document, cmentry->array[1],cmentry->array[2]); } } else { DEBUG_MSG("cust_menu_lcb, a custom replace!, cmentry->array[6]=%s\n", cmentry->array[6]); if (strcmp(cmentry->array[3], "2")==0 && !doc_has_selection(cmentry->bfwin->current_document)) { warning_dialog(cmentry->bfwin->main_window,_("This custom search and replace requires a selection"), NULL); return; } if (atoi(cmentry->array[6]) > 0) { cust_con_struc_dialog(cmentry->bfwin,cmentry->array, 1); } else { snr2_run_extern_replace(cmentry->bfwin->current_document,cmentry->array[1], atoi(cmentry->array[3]), atoi(cmentry->array[4]), atoi(cmentry->array[5]), cmentry->array[2],TRUE); } } } static Tcmenu_entry *create_cmentry(Tbfwin *bfwin,const gchar *menupath, gint count, gchar **array, GtkItemFactory *ifactory, gint type) { Tcmenu_entry *cmentry = g_malloc0(sizeof(Tcmenu_entry)); cmentry->bfwin = bfwin; cmentry->entry.path = g_strdup(menupath); DEBUG_MSG("create_cmentry, entry.path=%s, count=%d\n", cmentry->entry.path, count); cmentry->entry.callback = cust_menu_lcb; cmentry->entry.callback_action = count; cmentry->array = array; cmentry->type = type; create_parent_and_tearoff(cmentry->entry.path, ifactory); gtk_item_factory_create_item(ifactory, &cmentry->entry, cmentry, 1); return cmentry; } static void fill_cust_menubar(Tbfwin *bfwin) { GtkItemFactory *ifactory; gint count; gchar **splittedstring; GList *tmplist; Tcmenu_entry *cmentry; ifactory = gtk_item_factory_from_widget(bfwin->menu_cmenu); tmplist = g_list_first(bfwin->menu_cmenu_entries); while (tmplist) { cmentry = (Tcmenu_entry *) tmplist->data; gtk_item_factory_delete_entry(ifactory, &cmentry->entry); DEBUG_MSG("fill_cust_menubar, removed entry.path=%s\n", cmentry->entry.path); g_free(cmentry->entry.path); g_free(cmentry); tmplist = g_list_next(tmplist); } g_list_free(bfwin->menu_cmenu_entries); bfwin->menu_cmenu_entries = NULL; count = 0; tmplist = g_list_first(main_v->props.cmenu_insert); while (tmplist) { gint count2; splittedstring = (gchar **) tmplist->data; count2 = count_array(splittedstring); if (count2 >= 4) { cmentry = create_cmentry(bfwin,splittedstring[0], count, splittedstring, ifactory, 0); bfwin->menu_cmenu_entries = g_list_append(bfwin->menu_cmenu_entries, cmentry); } count++; tmplist = g_list_next(tmplist); } tmplist = g_list_first(main_v->props.cmenu_replace); while (tmplist) { gint count2; splittedstring = (gchar **) tmplist->data; count2 = count_array(splittedstring); if (count2 >= 4) { cmentry = create_cmentry(bfwin,splittedstring[0], count, splittedstring, ifactory, 1); bfwin->menu_cmenu_entries = g_list_append(bfwin->menu_cmenu_entries, cmentry); } count++; tmplist = g_list_next(tmplist); } } static void cmenu_reset_lcb(Tbfwin *bfwin,guint callback_action,GtkWidget *widget) { GList *tmplist; rcfile_parse_custom_menu(TRUE, FALSE); tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { fill_cust_menubar(BFWIN(tmplist->data)); tmplist = g_list_next(tmplist); } } static void cmenu_load_new_lcb(Tbfwin *bfwin,guint callback_action,GtkWidget *widget) { GList *tmplist; rcfile_parse_custom_menu(FALSE, TRUE); tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { fill_cust_menubar(BFWIN(tmplist->data)); tmplist = g_list_next(tmplist); } } /* function declaration needed here */ void cmenu_editor(Tbfwin *bfwin,guint callback_action,GtkWidget *widget); void make_cust_menubar(Tbfwin *bfwin, GtkWidget *cust_handle_box) { static GtkItemFactoryEntry cust_menu[] = { {N_("/_Custom menu"), NULL, NULL, 0, ""}, {N_("/Custom menu/sep"), NULL, NULL, 0, ""}, {N_("/Custom menu/Edit custom menu..."), NULL, cmenu_editor, 0, NULL}, {N_("/Custom menu/Reset"), NULL, cmenu_reset_lcb, 0, NULL}, {N_("/Custom menu/Load new"), NULL, cmenu_load_new_lcb, 0, NULL} }; GtkItemFactory *item_factory; GtkAccelGroup *accel_group; gint nmenu_items = sizeof(cust_menu) / sizeof(cust_menu[0]); DEBUG_MSG("make_cust_menubar, started\n"); /* this should only happen once !!!!!!!!!! */ accel_group = gtk_accel_group_new(); item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "", accel_group); #ifdef ENABLE_NLS gtk_item_factory_set_translate_func(item_factory, menu_translate, "", NULL); #endif gtk_item_factory_create_items(item_factory, nmenu_items, cust_menu, bfwin); gtk_window_add_accel_group(GTK_WINDOW(bfwin->main_window), accel_group); bfwin->menu_cmenu = gtk_item_factory_get_widget(item_factory, ""); gtk_container_add(GTK_CONTAINER(bfwin->custom_menu_hb), bfwin->menu_cmenu); gtk_widget_show(bfwin->menu_cmenu); fill_cust_menubar(bfwin); DEBUG_MSG("make_cust_menubar, finished\n"); } /*******************************************************************/ /* Custom menu editor */ /*******************************************************************/ typedef struct { GtkWidget *win; GtkWidget *type[2]; GtkListStore *lstore; GtkWidget *lview; GtkWidget *label1; GtkWidget *label2; GtkWidget *menupath; /* GtkWidget *befv;*/ GtkTextBuffer *befb; /* GtkWidget *aftv;*/ GtkTextBuffer *aftb; GtkWidget *num; gchar **lastarray; GtkWidget *dynvbox; GtkWidget *hboxes[MAX_TEXT_ENTRY]; GtkWidget *descriptions[MAX_TEXT_ENTRY]; GtkWidget *csnr_box; GtkWidget *region; GtkWidget *matching; GtkWidget *is_case_sens; /* GList *worklist;*/ GList *worklist_insert; GList *worklist_replace; Tbfwin *bfwin; } Tcmenu_editor; static void cme_destroy_lcb(GtkWidget *widget, Tcmenu_editor* cme) { window_destroy(cme->win); free_arraylist(cme->worklist_insert); free_arraylist(cme->worklist_replace); g_free(cme); } static void cme_close_lcb(GtkWidget *widget, gpointer data) { cme_destroy_lcb(NULL, data); } static void cme_ok_lcb(GtkWidget *widget, Tcmenu_editor *cme) { GList *tmplist; DEBUG_MSG("cme_ok_lcb, start cmenu_insert=%p, worklist_insert=%p\n",main_v->props.cmenu_insert, cme->worklist_insert); pointer_switch_addresses((gpointer)&main_v->props.cmenu_insert, (gpointer)&cme->worklist_insert); DEBUG_MSG("cme_ok_lcb, after cmenu_insert=%p, worklist_insert=%p\n",main_v->props.cmenu_insert, cme->worklist_insert); pointer_switch_addresses((gpointer)&main_v->props.cmenu_replace, (gpointer)&cme->worklist_replace); cme_destroy_lcb(NULL, cme); tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { fill_cust_menubar(BFWIN(tmplist->data)); tmplist = g_list_next(tmplist); } } static void cme_create_entries(Tcmenu_editor *cme, gint num) { gint i; for (i = 0; i < MAX_TEXT_ENTRY ; i++) { if (i < num) { gtk_widget_show(cme->hboxes[i]); } else { gtk_widget_hide(cme->hboxes[i]); } } } static gboolean cme_iter_at_pointer(GtkTreeIter *iter, gpointer pointer, Tcmenu_editor *cme) { gpointer tmp; gboolean cont; cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(cme->lstore),iter); while (cont) { gtk_tree_model_get(GTK_TREE_MODEL(cme->lstore),iter,2,&tmp,-1); if (pointer == tmp) { return TRUE; } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(cme->lstore),iter); } return FALSE; } static void cme_lview_selection_changed(GtkTreeSelection *selection, Tcmenu_editor *cme) { GtkTreeIter iter; GtkTreeModel *model; if (gtk_tree_selection_get_selected (selection,&model,&iter)) { gint num=0, i; gint type=0; gtk_tree_model_get(model, &iter, 1, &type, 2, &cme->lastarray, -1); DEBUG_MSG("cme_clist_select_lcb, lastarray=%p, lastarray[0]=%s, type=%d\n", cme->lastarray, cme->lastarray[0], type); DEBUG_MSG("cme_clist_select_lcb, cme->lastarray[0]=%s, [i]='%s'\n", cme->lastarray[0], cme->lastarray[1]); gtk_entry_set_text(GTK_ENTRY(cme->menupath), cme->lastarray[0]); DEBUG_MSG("cme_clist_select_lcb, cme->lastarray[1]='%s'\n", cme->lastarray[1]); gtk_text_buffer_set_text(cme->befb, cme->lastarray[1], -1); DEBUG_MSG("cme_clist_select_lcb, cme->lastarray[2]='%s'\n", cme->lastarray[2]); gtk_text_buffer_set_text(cme->aftb, cme->lastarray[2], -1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cme->type[type]), TRUE); if (type == 0) { DEBUG_MSG("cme_clist_select_lcb, type=0, custom dialog\n"); gtk_widget_hide(cme->csnr_box); num = atoi(cme->lastarray[3]); DEBUG_MSG("cme_clist_select_lcb, num=%d\n", num); gtk_spin_button_set_value(GTK_SPIN_BUTTON(cme->num), num); cme_create_entries(cme, num); DEBUG_MSG("cme_clist_select_lcb, %d entries created\n", num); for (i = 0 ; i < num; i++) { gtk_entry_set_text(GTK_ENTRY(cme->descriptions[i]), cme->lastarray[i+4]); } for (i = num ; i < MAX_TEXT_ENTRY; i++) { gtk_entry_set_text(GTK_ENTRY(cme->descriptions[i]), ""); } } else if (type == 1) { static Tconvert_table table1[] = {{0, "0"}, {1, "1"}, {0, NULL}}; /* static Tconvert_table table2[] = {{0, N_("in current document")}, {1, N_("from cursor")}, {2, N_("in selection")}, {3, N_("in all open documents")}, {0,NULL}}; static Tconvert_table table3[] = {{0, N_("normal")}, {1, N_("posix regular expressions")}, {2, N_("perl regular expressions")}, {0, NULL}};*/ gint converti; /*gchar *convertc;*/ DEBUG_MSG("cme_clist_select_lcb, type=1, custom search and replace\n"); gtk_widget_show(cme->csnr_box); DEBUG_MSG("cme_clist_select_lcb, cme->lastarray[4]=%s\n", cme->lastarray[4]); /*gtk_editable_delete_text(GTK_EDITABLE(GTK_COMBO(cme->matching)->entry), 0, -1); converti = atoi(cme->lastarray[4]); convertc = table_convert_int2char(table3, converti); if (convertc) { gint pos=0; gtk_editable_insert_text(GTK_EDITABLE(GTK_COMBO(cme->matching)->entry), convertc, strlen(convertc), &pos); }*/ converti = atoi(cme->lastarray[4]); gtk_option_menu_set_history(GTK_OPTION_MENU(cme->matching),converti); DEBUG_MSG("cme_clist_select_lcb, cme->lastarray[5]=%s\n", cme->lastarray[5]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cme->is_case_sens), table_convert_char2int(table1, cme->lastarray[5], tcc2i_full_match)); /*gtk_editable_delete_text(GTK_EDITABLE(GTK_COMBO(cme->region)->entry), 0, -1); converti = atoi(cme->lastarray[3]); convertc = table_convert_int2char(table2, converti); if (convertc) { gint pos=0; gtk_editable_insert_text(GTK_EDITABLE(GTK_COMBO(cme->region)->entry), convertc, strlen(convertc), &pos); }*/ converti = atoi(cme->lastarray[3]); gtk_option_menu_set_history(GTK_OPTION_MENU(cme->region),converti); num = atoi(cme->lastarray[6]); gtk_spin_button_set_value(GTK_SPIN_BUTTON(cme->num), num); cme_create_entries(cme, num); for (i = 0 ; i < num; i++) { gtk_entry_set_text(GTK_ENTRY(cme->descriptions[i]), cme->lastarray[i+7]); } for (i = num ; i < MAX_TEXT_ENTRY; i++) { gtk_entry_set_text(GTK_ENTRY(cme->descriptions[i]), ""); } } DEBUG_MSG("cme_clist_select_lcb, finished\n"); } else { gint i; gtk_entry_set_text(GTK_ENTRY(cme->menupath), ""); { GtkTextIter itstart, itend; gtk_text_buffer_get_bounds(cme->befb,&itstart,&itend); gtk_text_buffer_delete(cme->befb,&itstart,&itend); gtk_text_buffer_get_bounds(cme->aftb,&itstart,&itend); gtk_text_buffer_delete(cme->aftb,&itstart,&itend); } gtk_spin_button_set_value(GTK_SPIN_BUTTON(cme->num), 0); for (i = 0 ; i < MAX_TEXT_ENTRY; i++) { gtk_entry_set_text(GTK_ENTRY(cme->descriptions[i]), ""); } cme->lastarray = NULL; DEBUG_MSG("cme_clist_unselect_lcb, lastarray=%p\n", cme->lastarray); } } static void cme_spin_changed_lcb(GtkWidget *widget, Tcmenu_editor *cme) { cme_create_entries(cme, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(cme->num))); } static void cme_type_changed_lcb(GtkWidget *widget, Tcmenu_editor *cme) { if (GTK_TOGGLE_BUTTON(cme->type[1])->active) { DEBUG_MSG("cme_clist_select_lcb, type[1] is active\n"); gtk_widget_show(cme->csnr_box); gtk_label_set_text(GTK_LABEL(cme->label1), _("Search Pattern")); gtk_label_set_text(GTK_LABEL(cme->label2), _("Replace String")); } else { gtk_widget_hide(cme->csnr_box); gtk_label_set_text(GTK_LABEL(cme->label1), _("Formatstring Before")); gtk_label_set_text(GTK_LABEL(cme->label2), _("Formatstring After")); } } static gchar **cme_create_array(Tcmenu_editor *cme, gboolean is_update) { gchar **newarray; gint num, i, type; gtk_spin_button_update(GTK_SPIN_BUTTON(cme->num)); num = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(cme->num)); DEBUG_MSG("cme_create_array, num=%d\n", num); if (GTK_TOGGLE_BUTTON(cme->type[1])->active) { type = 1; } else { type = 0; } if (type == 0) { newarray = g_malloc0((num+5) * sizeof(char *)); } else { newarray = g_malloc0((num+8) * sizeof(char *)); } DEBUG_MSG("cme_create_array, newarray at %p\n",newarray); newarray[0] = gtk_editable_get_chars(GTK_EDITABLE(cme->menupath), 0, -1); { gboolean invalid=is_update; GList *tmplist = g_list_first(cme->worklist_insert); while (tmplist) { gchar **tmparr = (gchar **)tmplist->data; if (strcmp(tmparr[0],newarray[0])==0) { /* if it is an update they path should exist already, else is should not */ invalid = (!is_update); break; } tmplist = g_list_next(tmplist); } tmplist = g_list_first(cme->worklist_replace); while (tmplist) { gchar **tmparr = (gchar **)tmplist->data; if (strcmp(tmparr[0],newarray[0])==0) { /* if it is an update they path should exist already, else is should not */ invalid = (!is_update); break; } tmplist = g_list_next(tmplist); } if (invalid) { if (is_update) { warning_dialog(cme->bfwin->main_window,_("The menupath you want to update does not exist yet"), _("Try 'add' instead.")); } else { warning_dialog(cme->bfwin->main_window,_("The menupath you want to add already exists."), NULL); } } if (newarray[0][0] != '/') { DEBUG_MSG("cme_create_array, menupath does not start with slash, returning NULL\n"); warning_dialog(cme->bfwin->main_window,_("The menupath should start with a / character"), NULL); invalid = TRUE; } if (invalid) { g_free(newarray[0]); g_free(newarray); return (NULL); } } if (type == 0) { newarray[3] = gtk_editable_get_chars(GTK_EDITABLE(cme->num), 0, -1); for (i = 0 ; i < num; i++) { DEBUG_MSG("cme_create_array, adding descriptions[%d] to newarray[%d]\n", i, i+4); newarray[4+i] = gtk_editable_get_chars(GTK_EDITABLE(cme->descriptions[i]), 0, -1); } DEBUG_MSG("cme_create_array, setting newarray[%d] to NULL\n",i+4); newarray[4+i] = NULL; } else { /* static Tconvert_table table2[] = {{0, N_("in current document")}, {1, N_("from cursor")}, {2, N_("in selection")}, {3, N_("in all open documents")}, {0,NULL}}; static Tconvert_table table3[] = {{0, N_("normal")}, {1, N_("posix regular expresions")}, {2, N_("perl regular expresions")}, {0, NULL}};*/ gint converti; /* gchar *convertc; convertc = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(cme->region)->entry), 0, -1); converti = table_convert_char2int(table2, convertc, tcc2i_full_match_gettext); g_free(convertc);*/ converti = gtk_option_menu_get_history(GTK_OPTION_MENU(cme->region)); newarray[3] = g_strdup_printf("%d", converti); /*convertc = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(cme->matching)->entry), 0, -1); g_free(convertc);*/ converti = gtk_option_menu_get_history(GTK_OPTION_MENU(cme->matching)); newarray[4] = g_strdup_printf("%d", converti); newarray[5] = g_strdup_printf("%d", GTK_TOGGLE_BUTTON(cme->is_case_sens)->active); newarray[6] = gtk_editable_get_chars(GTK_EDITABLE(cme->num), 0, -1); DEBUG_MSG("cme_create_array, newarray[6]=%s\n", newarray[6]); for (i = 0 ; i < num; i++) { DEBUG_MSG("cme_create_array, adding descriptions[%d] to newarray[%d]\n", i, i+7); newarray[7+i] = gtk_editable_get_chars(GTK_EDITABLE(cme->descriptions[i]), 0, -1); } DEBUG_MSG("cme_create_array, setting newarray[%d] to NULL\n",i+7); newarray[7+i] = NULL; } { GtkTextIter itstart, itend; gtk_text_buffer_get_bounds(cme->befb,&itstart,&itend); newarray[1] = gtk_text_buffer_get_text(cme->befb,&itstart,&itend, FALSE); gtk_text_buffer_get_bounds(cme->aftb,&itstart,&itend); newarray[2] = gtk_text_buffer_get_text(cme->aftb,&itstart,&itend, FALSE); } return newarray; } static void cme_add_lcb(GtkWidget *widget, Tcmenu_editor *cme) { gchar **newarray; newarray = cme_create_array(cme, FALSE); if (newarray != NULL){ GtkTreeIter iter; GtkTreeSelection *gtsel; gint type = GTK_TOGGLE_BUTTON(cme->type[1])->active; DEBUG_MSG("cme_add_lcb, adding %p with type %d\n",newarray,type); if (type == 0) { cme->worklist_insert = g_list_append(cme->worklist_insert, newarray); } else { cme->worklist_replace = g_list_append(cme->worklist_replace, newarray); } gtk_list_store_append(GTK_LIST_STORE(cme->lstore),&iter); gtk_list_store_set(GTK_LIST_STORE(cme->lstore),&iter,0,newarray[0],1,type,2,newarray,-1); cme->lastarray = newarray; gtsel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cme->lview)); gtk_tree_selection_select_iter(gtsel,&iter); } } static void cme_update_lcb(GtkWidget *widget, Tcmenu_editor *cme) { gchar **newarray; if (cme->lastarray == NULL) { cme_add_lcb(NULL, cme); return; } newarray = cme_create_array(cme, TRUE); if (newarray) { GtkTreeIter iter; if (cme_iter_at_pointer(&iter, cme->lastarray, cme)) { gint newtype, oldtype; gtk_tree_model_get(GTK_TREE_MODEL(cme->lstore),&iter,1,&oldtype,-1); newtype = GTK_TOGGLE_BUTTON(cme->type[1])->active; gtk_list_store_set(GTK_LIST_STORE(cme->lstore),&iter,0,newarray[0],1,newtype,2,newarray,-1); if (oldtype == 0) { if (newtype == 1) { cme->worklist_insert = g_list_remove(cme->worklist_insert, cme->lastarray); cme->worklist_replace = g_list_append(cme->worklist_replace, newarray); } else { GList *tmplist = g_list_find(cme->worklist_insert,cme->lastarray); tmplist->data = newarray; } } else if (oldtype == 1) { if (newtype == 0) { cme->worklist_replace = g_list_remove(cme->worklist_replace, cme->lastarray); cme->worklist_insert = g_list_append(cme->worklist_insert, newarray); } else { GList *tmplist = g_list_find(cme->worklist_replace,cme->lastarray); tmplist->data = newarray; } } } else { DEBUG_MSG("cme_update_lcb, cannot find iter for pointer %p\n",cme->lastarray); } g_strfreev(cme->lastarray); cme->lastarray = newarray; } else { DEBUG_MSG ("cme_update_lcb, no new array, cancelled\n"); } DEBUG_MSG ("cme_update_lcb finished\n"); } static void cme_delete_lcb(GtkWidget *widget, Tcmenu_editor *cme) { if (cme->lastarray) { GtkTreeIter iter; if (cme_iter_at_pointer(&iter, cme->lastarray, cme)) { gint type; DEBUG_MSG("cme_delete_lcb, removing from listmodel\n"); gtk_tree_model_get(GTK_TREE_MODEL(cme->lstore),&iter,1,&type,-1); if (type == 0) { cme->worklist_insert = g_list_remove(cme->worklist_insert, cme->lastarray); } else if (type == 1) { cme->worklist_replace = g_list_remove(cme->worklist_replace, cme->lastarray); } else { DEBUG_MSG("NOT removed from lists, type=%d ???\n",type); } if (type == 1 || type == 0) { g_strfreev(cme->lastarray); } /* removing the iter will call cme_clist_unselect_lcb which will set the lastarray to NULL therefore we will do this as last action */ gtk_list_store_remove(GTK_LIST_STORE(cme->lstore),&iter); } else { DEBUG_MSG("NOT REMOVED, no iter can be found for pointer %p?!?\n",cme->lastarray); } DEBUG_MSG("cme_delete_lcb, setting lastarray NULL\n"); cme->lastarray = NULL; } else { DEBUG_MSG("cme_delete_lcb, lastarray=NULL, nothing to delete\n"); } } gint menu_entry_sort(gchar ** a,gchar ** b) { return strcmp(a[0],b[0]); } void cmenu_editor(Tbfwin *bfwin,guint callback_action,GtkWidget *widget) { Tcmenu_editor *cme; GtkWidget *hbox, *vbox, *frame, *vbox2, *vbox3, *hbox2, *label, *toolbar; GList *tmplist; gint i; gchar *tmpstr; cme = g_malloc0(sizeof(Tcmenu_editor)); cme->bfwin = bfwin; DEBUG_MSG("cmenu_editor, cme is at %p\n", cme); cme->win = window_full2(_("Custom Menu Editor"), GTK_WIN_POS_CENTER, 0, G_CALLBACK(cme_destroy_lcb), cme, TRUE, bfwin->main_window); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(cme->win), vbox); toolbar = gtk_toolbar_new(); gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL); gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_ADD, _("Add New Menu Entry"), NULL, G_CALLBACK(cme_add_lcb), cme, -1); gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_APPLY, _("Apply Changes"), NULL, G_CALLBACK(cme_update_lcb), cme, -1); gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_DELETE, _("Delete Menu Entry"), NULL, G_CALLBACK(cme_delete_lcb), cme, -1); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLOSE, _("Close Discards Changes"), NULL, G_CALLBACK(cme_close_lcb), cme, -1); gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, _("Save Changes and Exit"), NULL, G_CALLBACK(cme_ok_lcb), cme, -1); vbox2 = gtk_vbox_new(FALSE, 12); gtk_container_set_border_width(GTK_CONTAINER(vbox2), 6); gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0); /* upper area */ hbox = gtk_hbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, TRUE, 6); label = gtk_label_new_with_mnemonic(_("_Menu Path:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); cme->menupath = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(label), cme->menupath); gtk_box_pack_start(GTK_BOX(hbox),cme->menupath , TRUE, TRUE, 0); hbox = gtk_hbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 6); /* clist & type area */ vbox3 = gtk_vbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 0); { GtkWidget *scrolwin; GtkTreeViewColumn *column; GtkTreeSelection *select; GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); cme->lstore = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER); cme->lview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(cme->lstore)); column = gtk_tree_view_column_new_with_attributes (_("Menu path"), renderer,"text", 0,NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(cme->lview), column); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); DEBUG_MSG("cmenu_editor, created lstore and lview\n"); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolwin), cme->lview); gtk_widget_set_size_request(scrolwin, 180, 250); gtk_box_pack_start(GTK_BOX(vbox3), scrolwin, TRUE, TRUE, 0); select = gtk_tree_view_get_selection(GTK_TREE_VIEW(cme->lview)); g_signal_connect(G_OBJECT(select), "changed",G_CALLBACK(cme_lview_selection_changed),cme); } /* dynamic entries area */ vbox3 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 0); hbox2 = gtk_hbox_new(FALSE, 12); label = gtk_label_new_with_mnemonic(_("Number of _Variables:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); cme->num = spinbut_with_value(NULL, 0, MAX_TEXT_ENTRY, 1,1); g_signal_connect(GTK_OBJECT(cme->num), "changed", G_CALLBACK(cme_spin_changed_lcb), cme); gtk_label_set_mnemonic_widget(GTK_LABEL(label), cme->num); gtk_box_pack_start(GTK_BOX(hbox2),cme->num , FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox3), hbox2, FALSE, FALSE, 0); frame = gtk_frame_new(_("Variables")); gtk_box_pack_end(GTK_BOX(vbox3), frame, TRUE, TRUE, 0); cme->dynvbox = gtk_vbox_new(FALSE, 2); gtk_container_add(GTK_CONTAINER(frame), cme->dynvbox); for (i = 0; i < MAX_TEXT_ENTRY; i++) { cme->hboxes[i] = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(cme->dynvbox), cme->hboxes[i], FALSE, FALSE, 0); tmpstr = g_strdup_printf("%%%d: ", i); gtk_box_pack_start(GTK_BOX(cme->hboxes[i]), gtk_label_new(tmpstr), FALSE, FALSE, 0); g_free(tmpstr); cme->descriptions[i] = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(cme->hboxes[i]), cme->descriptions[i], TRUE, TRUE, 0); } /* lower area */ /* before and after text area */ vbox3 = gtk_vbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox), vbox3, TRUE, TRUE, 0); cme->type[0] = gtk_radio_button_new_with_mnemonic(NULL, _("Custom Dialo_g")); gtk_box_pack_start(GTK_BOX(vbox3), cme->type[0], FALSE, TRUE, 0); cme->type[1] = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(cme->type[0]), _("Custom Replace")); gtk_box_pack_start(GTK_BOX(vbox3), cme->type[1], FALSE, TRUE, 0); g_signal_connect(GTK_OBJECT(cme->type[0]), "toggled", G_CALLBACK(cme_type_changed_lcb), cme); /* csnr area */ cme->csnr_box = gtk_vbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(vbox3), cme->csnr_box, FALSE, TRUE, 12); hbox2 = gtk_hbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(cme->csnr_box), hbox2, FALSE, TRUE, 0); label = gtk_label_new_with_mnemonic(_("_Replace:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); { gchar *whereoptions[] = {N_("in current document"),N_("from cursor"),N_("in selection"),N_("in all open documents"), NULL}; cme->region = optionmenu_with_value(whereoptions, 0); } gtk_box_pack_start(GTK_BOX(hbox2),cme->region , TRUE, TRUE, 3); gtk_label_set_mnemonic_widget(GTK_LABEL(label), cme->region); hbox2 = gtk_hbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(cme->csnr_box), hbox2, TRUE, TRUE, 0); label = gtk_label_new_with_mnemonic(_("Matc_hing:")); gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); { gchar *matchactions[] = {N_("normal"), N_("posix regular expresions"), N_("perl regular expresions"), NULL}; cme->matching = optionmenu_with_value(matchactions, 0); } gtk_box_pack_start(GTK_BOX(hbox2),cme->matching , TRUE, TRUE, 3); gtk_label_set_mnemonic_widget(GTK_LABEL(label), cme->matching); cme->is_case_sens = boxed_checkbut_with_value(_("Case Se_nsitive"), 0, cme->csnr_box); { GtkWidget *scrolwin, *textview; cme->label1 = gtk_label_new_with_mnemonic(""); gtk_box_pack_start(GTK_BOX(vbox3), cme->label1, FALSE, FALSE, 0); scrolwin = textview_buffer_in_scrolwin(&textview, -1, -1, NULL, GTK_WRAP_NONE); cme->befb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_box_pack_start(GTK_BOX(vbox3), scrolwin, TRUE, TRUE, 0); cme->label2 = gtk_label_new_with_mnemonic(""); gtk_box_pack_start(GTK_BOX(vbox3), cme->label2, FALSE, FALSE, 0); scrolwin = textview_buffer_in_scrolwin(&textview, -1, -1, NULL, GTK_WRAP_NONE); cme->aftb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_box_pack_start(GTK_BOX(vbox3), scrolwin, TRUE, TRUE, 0); } /* ready !! */ cme->worklist_insert = duplicate_arraylist(main_v->props.cmenu_insert); cme->worklist_replace = duplicate_arraylist(main_v->props.cmenu_replace); cme->worklist_insert = g_list_sort(cme->worklist_insert, (GCompareFunc)menu_entry_sort); cme->worklist_replace = g_list_sort(cme->worklist_replace, (GCompareFunc)menu_entry_sort); { GtkTreeIter iter; tmplist = g_list_first(cme->worklist_insert); while (tmplist) { DEBUG_MSG("cmenu_editor, adding type 0 '%s'\n", *(gchar **)tmplist->data); gtk_list_store_append(GTK_LIST_STORE(cme->lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(cme->lstore), &iter, 0, *(gchar **)tmplist->data, 1, 0, 2, tmplist->data, -1); /* the name , the type, the pointer */ tmplist = g_list_next(tmplist); } tmplist = g_list_first(cme->worklist_replace); while (tmplist) { DEBUG_MSG("cmenu_editor, adding type 1 '%s'\n", *(gchar **)tmplist->data); gtk_list_store_append(GTK_LIST_STORE(cme->lstore), &iter); gtk_list_store_set(GTK_LIST_STORE(cme->lstore), &iter, 0, *(gchar **)tmplist->data, 1, 1, 2, tmplist->data, -1); /* the name , the type, the pointer */ tmplist = g_list_next(tmplist); } } gtk_widget_show_all(cme->win); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cme->type[0]), TRUE); cme_type_changed_lcb(NULL, cme); } /*************************************************************************/ winefish-1.3.3/src/stringlist.h0000600000047200004720000000653010373411041015470 0ustar kyanhkyanh/* $Id: stringlist.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * stringlist.h - functions that deal with stringlists * * Copyright (C) 1999 Olivier Sessink and Hylke van der Schaaf * Copyright (C) 2000-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __STRINGLIST_H_ #define __STRINGLIST_H_ #include /* void estrl_dialog(GList **which_list, gchar *title, gint what_list , gint column_num, gchar **column_titles, void (*post_dialog_func)());*/ gint count_array(gchar **array); gchar *array_to_string(gchar **array); gchar **string_to_array(gchar *string); gchar **array_from_arglist(const gchar *string1, ...); GList *list_from_arglist(gboolean allocate_strings, ...); GList *duplicate_stringlist(GList *list, gint dup_data); gint free_stringlist(GList * which_list); GList *get_list(const gchar * filename, GList * which_list, gboolean is_arraylist); GList *get_stringlist(const gchar * filename, GList * which_list); gboolean put_stringlist_limited(gchar * filename, GList * which_list, gint maxentries); gboolean put_stringlist(gchar * filename, GList * which_list); gint free_arraylist(GList * which_list); gchar **duplicate_stringarray(gchar **array); GList *duplicate_arraylist(GList *arraylist); /* removes a string from a stringlist if it is the same */ GList *remove_from_stringlist(GList *which_list, const gchar * string); GList *limit_stringlist(GList *which_list, gint num_entries, gboolean keep_end); GList *add_to_history_stringlist(GList *which_list, const gchar *string, gboolean recent_on_top, gboolean move_if_exists); /* adds a string to a stringlist if it is not yet in there */ GList *add_to_stringlist(GList * which_list, const gchar * string); gchar *stringlist_to_string(GList *stringlist, gchar *delimiter); gint array_n_strings_identical(gchar **array1, gchar **array2, gboolean case_sensitive, gint testlevel); GList *arraylist_delete_identical(GList *arraylist, gchar **compare, gint testlevel, gboolean case_sensitive); GList *arraylist_append_identical_from_list(GList *thelist, GList *source, gchar **compare, gint testlevel, gboolean case_sensitive); GList *arraylist_append_identical_from_file(GList *thelist, const gchar *sourcefilename, gchar **compare, gint testlevel, gboolean case_sensitive); gboolean arraylist_value_exists(GList *arraylist, gchar **value, gint testlevel, gboolean case_sensitive); GList *arraylist_load_new_identifiers_from_list(GList *mylist, GList *deflist, gint uniquelevel); GList *arraylist_load_new_identifiers_from_file(GList *mylist, const gchar *fromfilename, gint uniquelevel); #endif /* __STRINGLIST_H_ */ winefish-1.3.3/src/project.c0000600000047200004720000006024110375350210014730 0ustar kyanhkyanh/* $Id: project.c 1984 2006-02-17 13:32:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * project.c - project functionality * * Copyright (C) 2003-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include #include #include "bluefish.h" #include "project.h" #include "stringlist.h" #include "gui.h" #include "document.h" #include "gtk_easy.h" #include "rcfile.h" #include "bf_lib.h" #include "filebrowser.h" #include "menu.h" #include "bookmark.h" static void free_session(Tsessionvars *session) { free_stringlist(session->classlist); free_stringlist(session->colorlist); free_stringlist(session->targetlist); free_stringlist(session->fontlist); /* free_stringlist(session->dtd_cblist); */ /* free_stringlist(session->headerlist); */ /* free_stringlist(session->positionlist); */ free_stringlist(session->searchlist); free_stringlist(session->replacelist); free_arraylist(session->bmarks); g_free(session); } Tbfwin *project_is_open(gchar *filename) { GList *tmplist; tmplist = g_list_first(main_v->bfwinlist); while(tmplist){ if (BFWIN(tmplist->data)->project && BFWIN(tmplist->data)->project->filename && strcmp(BFWIN(tmplist->data)->project->filename, filename)==0) { return BFWIN(tmplist->data); } tmplist = g_list_next(tmplist); } return NULL; } static void update_project_filelist(Tbfwin *bfwin, Tproject *prj) { DEBUG_MSG("update_project_filelist, started, bfwin=%p, prj=%p\n",bfwin,prj); free_stringlist(prj->files); DEBUG_MSG("update_project_filelist, old list free'd, creating new list from documentlist %p (len=%d)\n",bfwin->documentlist,g_list_length(bfwin->documentlist)); prj->files = return_filenamestringlist_from_doclist(bfwin->documentlist); } static void setup_bfwin_for_project(Tbfwin *bfwin) { bfwin->session = bfwin->project->session; bfwin->bookmarkstore = bfwin->project->bookmarkstore; bmark_set_store(bfwin); bmark_reload(bfwin); filebrowser_set_basedir(bfwin, bfwin->project->basedir); recent_menu_from_list(bfwin, bfwin->project->session->recent_files, FALSE); set_project_menu_widgets(bfwin, TRUE); } /* bfwin is allowed to be NULL for an empty project */ static Tproject *create_new_project(Tbfwin *bfwin) { Tproject *prj; prj = g_new0(Tproject,1); prj->name = g_strdup(_("New project")); prj->bookmarkstore = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); DEBUG_MSG("create_new_project, project=%p, bookmarkstore=%p, bfwin=%p\n",prj,prj->bookmarkstore,bfwin); if (bfwin) { DEBUG_MSG("create_new_project, new project for bfwin %p\n",bfwin); update_project_filelist(bfwin,prj); bfwin->project = prj; } else { DEBUG_MSG("create_new_project, new project, no bfwin\n"); } prj->session = g_new0(Tsessionvars,1); /* we should copy bookmarks from the files to this session */ if (bfwin && prj->files) { GList *tmplist; tmplist = g_list_first(bfwin->documentlist); while (tmplist) { bmark_clean_for_doc(DOCUMENT(tmplist->data)); tmplist = g_list_next(tmplist); } tmplist = g_list_first(bfwin->session->bmarks); while (tmplist) { gchar **entry = (gchar**)tmplist->data; if (count_array(entry) > 2) { GList *tmplist2 = g_list_first(prj->files); while (tmplist2) { if (strcmp(tmplist2->data, entry[2])==0) { /* move it out of the default session into this session */ bfwin->session->bmarks = g_list_remove_link(bfwin->session->bmarks,tmplist); prj->session->bmarks = g_list_concat(prj->session->bmarks, tmplist); /* no further filenames to check */ tmplist2 = g_list_last(tmplist2); } tmplist2 = g_list_next(tmplist2); } } tmplist = g_list_next(tmplist); } } if (prj->files) { gint len; gchar *somefile, *prefix; len = find_common_prefixlen_in_stringlist(prj->files); somefile = (gchar *)prj->files->data; prefix = g_strndup(somefile, len); if (prefix[strlen(prefix)-1] == '/') { prj->basedir = g_strdup(prefix); } else { prj->basedir = g_path_get_dirname(prefix); } g_free(prefix); } else { prj->basedir = g_strdup(""); } prj->basefile = g_strdup(""); prj->template = g_strdup(""); prj->view_bars = main_v->session->view_bars; /* prj->word_wrap = main_v->props.word_wrap; */ if (bfwin) { setup_bfwin_for_project(bfwin); } return prj; } gboolean project_save(Tbfwin *bfwin, gboolean save_as) { gboolean retval; DEBUG_MSG("project_save, bfwin=%p, save_as=%d\n",bfwin,save_as); if (!bfwin->project) { /* there is no project yet, we have to create one */ DEBUG_MSG("project_save, bfwin=%p does not have a project yet, create one\n",bfwin); bfwin->project= create_new_project(bfwin); bmark_reload(bfwin); } DEBUG_MSG("project_save, project=%p, num files was %d\n", bfwin->project, g_list_length(bfwin->project->files)); update_project_filelist(bfwin, bfwin->project); /* bfwin->project->recentfiles = limit_stringlist(bfwin->project->recentfiles, main_v->props.max_recent_files, TRUE);*/ bfwin->project->session->searchlist = limit_stringlist(bfwin->project->session->searchlist, 10, TRUE); bfwin->project->session->replacelist = limit_stringlist(bfwin->project->session->replacelist, 10, TRUE); bmark_store_all(bfwin); if (save_as || bfwin->project->filename == NULL) { gint suflen,filen; gchar *filename = NULL; #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; dialog = file_chooser_dialog(bfwin,_("Enter Winefish project filename"),GTK_FILE_CHOOSER_ACTION_SAVE, NULL, TRUE, FALSE, "wfproject"); if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); } gtk_widget_destroy(dialog); } #else filename = return_file_w_title(NULL, _("Enter Winefish project filename")); #endif if (!filename) { return FALSE; } if (save_as || bfwin->project->filename == NULL) { /* gchar *ondiskencoding = get_filename_on_disk_encoding(filename); */ /* we do not use ondiskencoding as (g_file_test) uses GLib encoding for filename */ if (g_file_test(filename, G_FILE_TEST_EXISTS)) { gchar *tmpstr; gint retval; gchar *options[] = {_("_Cancel"), _("_Overwrite"), NULL}; tmpstr = g_strdup_printf(_("A file named \"%s\" already exists."), filename); retval = multi_warning_dialog(bfwin->main_window,tmpstr, _("Do you want to replace the existing file?"), 1, 0, options); g_free(tmpstr); if (retval == 0) { g_free(filename); /* g_free(ondiskencoding); */ return FALSE; } } /* g_free(ondiskencoding); */ } suflen = strlen(main_v->props.project_suffix); filen = strlen(filename); if (filen > suflen && strcmp(&filename[filen - suflen], main_v->props.project_suffix)==0) { bfwin->project->filename = filename; } else { bfwin->project->filename = g_strconcat(filename, main_v->props.project_suffix,NULL); g_free(filename); } } DEBUG_MSG("project_save, saving project %p to file %s\n",bfwin->project,bfwin->project->filename); retval = rcfile_save_project(bfwin->project, bfwin->project->filename); add_to_recent_list(bfwin,bfwin->project->filename, FALSE, TRUE); return retval; } void set_project_menu_widgets(Tbfwin *bfwin, gboolean win_has_project) { menuitem_set_sensitive(bfwin->menubar, N_("/Project/Save"), win_has_project); menuitem_set_sensitive(bfwin->menubar, N_("/Project/Save as..."), win_has_project); menuitem_set_sensitive(bfwin->menubar, N_("/Project/Save & close"), win_has_project); menuitem_set_sensitive(bfwin->menubar, N_("/Project/Project options..."), win_has_project); /* kyanh, added */ menuitem_set_sensitive(bfwin->menubar, N_("/External/Project mode"), win_has_project); if (win_has_project) { setup_toggle_item_from_widget(bfwin->menubar, N_("/External/Project mode"), bfwin->project->view_bars & MODE_PROJECT); }else{ setup_toggle_item_from_widget(bfwin->menubar, N_("/External/Project mode"),FALSE); } } void project_open_from_file(Tbfwin *bfwin, gchar *fromfilename, gint linenumber) { Tbfwin *prwin; Tproject *prj; gboolean retval; /* first we test if the project is already open */ prwin = project_is_open(fromfilename); if (prwin != NULL) { DEBUG_MSG("project_open_from_file, project is open in bfwin=%p\n",prwin); gtk_window_present(GTK_WINDOW(prwin->main_window)); /* TODO: select line for all documents in project ;) */ return; } prj = g_new0(Tproject,1); prj->session = g_new0(Tsessionvars,1); prj->bookmarkstore = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); retval = rcfile_parse_project(prj, fromfilename); if (!retval) { DEBUG_MSG("project_open_from_file, failed parsing the project at file %s\n",fromfilename); g_free(prj); return; } add_to_recent_list(bfwin,fromfilename, FALSE, TRUE); prj->filename = g_strdup(fromfilename); DEBUG_MSG("project_open_from_file, basedir=%s\n",prj->basedir); if (bfwin->project == NULL && test_only_empty_doc_left(bfwin->documentlist)) { /* we will use this Winefish window to open the project */ prwin = bfwin; /* now we need to clean the session, and reset it to the session from the project */ /* free_session(bfwin->session); there is no session specific to a window anymore, only a global one*/ bfwin->session = prj->session; prwin->project = prj; prwin->bookmarkstore = prj->bookmarkstore; /* FIXED: BUG#26. Moved stuff downwards */ filebrowser_set_basedir(prwin, prj->basedir); DEBUG_MSG("project_open_from_file, calling docs_new_from_files for existing bfwin=%p\n",prwin); docs_new_from_files(prwin, prj->files, TRUE, linenumber); } else { /* we will open a new Winefish window for this project */ DEBUG_MSG("project_open_from_file, we need a new window\n"); prwin = gui_new_window(prj->files, prj); DEBUG_MSG("project_open_from_file, new window with files ready\n"); gui_set_title(prwin, prwin->current_document); } /* FIXED: BUG#26. See lines above. */ /* gui_set_html_toolbar_visible(prwin, prj->view_bars & VIEW_LATEX_TOOLBAR, TRUE); gui_set_main_toolbar_visible(prwin, prj->view_bars & VIEW_MAIN_TOOLBAR, TRUE); */ gui_set_custom_menu_visible(prwin, prj->view_bars & VIEW_CUSTOM_MENU, TRUE); DEBUG_MSG("project_open_from_file, calling left_panel_show_hide_toggle bfwin=%p\n",prwin); left_panel_show_hide_toggle(prwin,FALSE,prj->view_bars & VIEW_LEFT_PANEL, TRUE); /* /FIXED */ set_project_menu_widgets(prwin, TRUE); recent_menu_init_project(prwin); bmark_reload(bfwin); bmark_set_store(bfwin); } static void project_open(Tbfwin *bfwin) { /* first we ask for a filename */ gchar *filename = NULL; #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; dialog = file_chooser_dialog(bfwin, _("Select Winefish project filename"), GTK_FILE_CHOOSER_ACTION_OPEN, NULL, TRUE, FALSE, "wfproject"); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); } gtk_widget_destroy(dialog); } #else filename = return_file_w_title(NULL, _("Select Winefish project filename")); #endif if (filename) { DEBUG_MSG("project_open, for filename %s\n",filename); project_open_from_file(bfwin,filename,-1); g_free(filename); } else { DEBUG_MSG("project_open, no filename.., returning\n"); } } static void project_destroy(Tproject *project) { g_object_unref(G_OBJECT(project->bookmarkstore)); free_stringlist(project->files); free_session(project->session); g_free(project->filename); g_free(project->name); g_free(project->basedir); g_free(project->basefile); g_free(project->template); g_free(project); } static void setup_bfwin_for_nonproject(Tbfwin *bfwin) { bfwin->session = main_v->session; bfwin->bookmarkstore = main_v->bookmarkstore; bfwin->project = NULL; bmark_set_store(bfwin); gui_set_title(bfwin, bfwin->current_document); filebrowser_set_basedir(bfwin, NULL); recent_menu_from_list(bfwin, main_v->session->recent_files, FALSE); set_project_menu_widgets(bfwin, FALSE); /* FIXED BUG#58 */ /* gui_set_html_toolbar_visible(bfwin, main_v->session->view_bars & VIEW_LATEX_TOOLBAR, TRUE); gui_set_main_toolbar_visible(bfwin, main_v->session->view_bars & VIEW_MAIN_TOOLBAR, TRUE); */ gui_set_custom_menu_visible(bfwin, main_v->session->view_bars & VIEW_CUSTOM_MENU, TRUE); left_panel_show_hide_toggle(bfwin, FALSE, main_v->session->view_bars & VIEW_LEFT_PANEL, TRUE); /* /FIXED */ } /* * returns TRUE if the project is closed, * returns FALSE if something went wrong or was cancelled */ gboolean project_save_and_close(Tbfwin *bfwin) { gboolean dont_save = FALSE; while (!bfwin->project->filename) { gchar *text; gint retval; gchar *buttons[] = {_("Do_n't save"), GTK_STOCK_CANCEL, GTK_STOCK_SAVE, NULL}; if (dont_save) { break; } DEBUG_MSG("project_save_and_close, project not named, getting action\n"); /* dialog */ text = g_strdup(_("Do you want to save the project?")); retval = multi_query_dialog(bfwin->main_window, text, _("If you don't save your changes they will be lost."), 2, 1, buttons); switch (retval) { case 0: /* don't save proj. save files, though */ DEBUG_MSG("project_save_and_close, don't save project, but save files\n"); dont_save = TRUE; break; case 1: /* cancel */ DEBUG_MSG("project_save_and_close, not closing window any more"); return FALSE; break; case 2: DEBUG_MSG("project_save_and_close, bringing up save project dialog\n"); dont_save = project_save(bfwin, FALSE); break; default: break; } } /* test if we should save */ if (!dont_save) { if (!project_save(bfwin, FALSE)) { DEBUG_MSG("project_save failed, returning\n"); return FALSE; } add_to_recent_list(bfwin,bfwin->project->filename, TRUE, TRUE); } bfwin_close_all_documents(bfwin, TRUE); project_destroy(bfwin->project); setup_bfwin_for_nonproject(bfwin); DEBUG_MSG("project_save_and_close, returning TRUE\n"); return TRUE; } typedef enum { name, basedir, basefile, template, word_wrap, projecteditor_entries_num } Tprojecteditor_entries; typedef struct { GtkWidget *win; Tbfwin *bfwin; Tproject *project; GtkWidget *entries[projecteditor_entries_num]; gboolean destroy_project_on_close; } Tprojecteditor; static void project_edit_destroy_lcb(GtkWidget *widget, Tprojecteditor *pred) { DEBUG_MSG("project_edit_destroy_lcb, called for pred=%p\n",pred); /* gtk_widget_destroy(pred->win);*/ if (pred->destroy_project_on_close) { project_destroy(pred->project); if (pred->bfwin) { setup_bfwin_for_nonproject(pred->bfwin); } } if (pred->project) { pred->project->editor = NULL; } g_free(pred); } /* added by KyAnh, copied from document:...select_basedir_lcb */ static void project_select_basedir_lcb(GtkWidget * widget, Tprojecteditor *pred) { gchar *olddir = gtk_editable_get_chars(GTK_EDITABLE(pred->entries[basedir]),0,-1); gchar *newdir = NULL; #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; dialog = file_chooser_dialog(NULL, _("Select basedir"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, olddir, TRUE, FALSE, NULL); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { newdir = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); } gtk_widget_destroy(dialog); } #else newdir = return_dir(olddir, _("Select basedir")); #endif g_free(olddir); if (newdir) { gtk_entry_set_text(GTK_ENTRY(pred->entries[basedir]),newdir); g_free(newdir); } } static void project_edit_cancel_clicked_lcb(GtkWidget *widget, Tprojecteditor *pred) { gtk_widget_destroy(pred->win); } static void project_edit_ok_clicked_lcb(GtkWidget *widget, Tprojecteditor *pred) { gchar *tmpstr = /* kyanh */ g_strconcat(gtk_editable_get_chars(GTK_EDITABLE(pred->entries[basedir]),0,-1),"/",gtk_editable_get_chars(GTK_EDITABLE(pred->entries[basefile]),0,-1),NULL); if (g_file_test(tmpstr, G_FILE_TEST_EXISTS)) { Tproject *prj = pred->project; pred->destroy_project_on_close = FALSE; gtk_widget_hide(pred->win); DEBUG_MSG("project_edit_ok_clicked_lcb, Tproject at %p, bfwin at %p\n",prj,pred->bfwin); string_apply(&prj->name, pred->entries[name]); string_apply(&prj->basedir, pred->entries[basedir]); if (prj->basedir && strlen(prj->basedir)) { gchar *tmp = prj->basedir; prj->basedir = ending_slash(prj->basedir); g_free(tmp); } string_apply(&prj->basefile, pred->entries[basefile]); string_apply(&prj->template, pred->entries[template]); integer_apply(&prj->word_wrap, pred->entries[word_wrap], TRUE); DEBUG_MSG("project_edit_ok_clicked_lcb, name=%s, basedir=%s, basefile=%s\n",prj->name,prj->basedir,prj->basefile); if (pred->bfwin == NULL) { pred->bfwin = gui_new_window(NULL, pred->project); setup_bfwin_for_project(pred->bfwin); } else { gui_set_title(pred->bfwin, pred->bfwin->current_document); } /* set_project_menu_widgets(pred->bfwin, TRUE);*/ project_save(pred->bfwin,FALSE); gtk_widget_destroy(pred->win); }else{/* added by kyanh */ /* old: warning_dialog(widget,..). related to BUG#95 */ warning_dialog(pred->win,_("The BaseDir must exist.\nThe BaseFile must be located in BaseDir."), NULL); } g_free(tmpstr); } /* if NULL is passed as bfwin, a new window will be created for this project once OK is clicked */ void project_edit(Tbfwin *bfwin) { GtkWidget *vbox, *but, *hbox, *label, *table; gchar *wintitle = NULL; Tprojecteditor *pred; if (bfwin && bfwin->project && bfwin->project->editor) { gtk_window_present(GTK_WINDOW(((Tprojecteditor *)bfwin->project->editor)->win)); return; } pred = g_new(Tprojecteditor,1); if (!bfwin || !bfwin->project) { /* there is no project yet, we have to create one */ DEBUG_MSG("project_edit, no project yet, create one\n"); pred->project= create_new_project(bfwin); if (bfwin) { bfwin->project = pred->project; } /* id the user does not press OK, we destroy the project */ pred->destroy_project_on_close = TRUE; wintitle = g_strdup(_("Create New Project")); } else { pred->destroy_project_on_close = FALSE; wintitle = g_strdup(_("Edit Project")); if (bfwin) { pred->project = bfwin->project; } } DEBUG_MSG("project_edit, Tproject at %p\n",pred->project); pred->bfwin = bfwin; pred->project->editor = pred; pred->win = window_full2(wintitle, GTK_WIN_POS_CENTER_ALWAYS, 5 , G_CALLBACK(project_edit_destroy_lcb), pred, TRUE, NULL); vbox = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(pred->win),vbox); if (wintitle) { g_free(wintitle); } label = gtk_label_new(NULL); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0); gtk_label_set_line_wrap(GTK_LABEL(label),TRUE); { gchar *message; message = g_strdup_printf(_("This project contains %d files"), g_list_length(pred->project->files)); gtk_label_set_markup(GTK_LABEL(label), message); g_free(message); } table = gtk_table_new (5, 4, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 12); pred->entries[name] = entry_with_text(pred->project->name, 255); gtk_widget_set_size_request(GTK_WIDGET(pred->entries[name]), 250, -1); bf_mnemonic_label_tad_with_alignment(_("Project _Name:"), pred->entries[name], 1, 0.5, table, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), pred->entries[name], 2, 3, 0, 1); pred->entries[basedir] = entry_with_text(pred->project->basedir, 255); bf_mnemonic_label_tad_with_alignment(_("_BaseDir:"), pred->entries[basedir], 1, 0.5, table, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), pred->entries[basedir], 2, 3, 1, 2); /* KyAnh */ gtk_table_attach(GTK_TABLE(table), bf_generic_button_with_image(_("Browse..."), 112, G_CALLBACK(project_select_basedir_lcb), pred), 3, 4, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); pred->entries[basefile] = entry_with_text(pred->project->basefile, 255); bf_mnemonic_label_tad_with_alignment(_("BaseFile:"), pred->entries[basefile], 1, 0.5, table, 0, 1, 2, 3); but = file_but_new(pred->entries[basefile], 0, bfwin); /* KyAnh, basefile, not full path */ gtk_table_attach_defaults(GTK_TABLE(table), pred->entries[basefile], 2, 3, 2, 3); gtk_table_attach_defaults(GTK_TABLE(table), but, 3, 4, 2, 3); pred->entries[template] = entry_with_text(pred->project->template, 255); bf_mnemonic_label_tad_with_alignment(_("_Template:"), pred->entries[template], 1, 0.5, table, 0, 1, 3, 4); but = file_but_new(pred->entries[template], 1, bfwin); gtk_table_attach_defaults(GTK_TABLE(table), pred->entries[template], 2, 3, 3, 4); gtk_table_attach_defaults(GTK_TABLE(table), but, 3, 4, 3, 4); gtk_table_set_row_spacing(GTK_TABLE(table), 3, 18); pred->entries[word_wrap] = checkbut_with_value(_("_Word wrap by default"), pred->project->word_wrap); gtk_table_attach_defaults(GTK_TABLE(table), pred->entries[word_wrap], 0, 3, 4, 5); /* Buttons */ gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new(), FALSE, FALSE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); but = bf_stock_cancel_button(G_CALLBACK(project_edit_cancel_clicked_lcb), pred); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 0); if (pred->destroy_project_on_close == TRUE) { but = bf_allbuttons_backend(_("Create _Project"), 1, 0, G_CALLBACK(project_edit_ok_clicked_lcb), pred); } else { but = bf_stock_ok_button(G_CALLBACK(project_edit_ok_clicked_lcb), pred); } gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, FALSE, 0); gtk_widget_grab_default(but); gtk_widget_show_all(pred->win); } typedef struct { GtkWidget *win; GtkWidget *rad[2]; Tbfwin *bfwin; } Tpc; static void project_create_destroy_lcb(GtkWidget *widget, Tpc *pc) { g_free(pc); } static void project_create_cancel_clicked_lcb(GtkWidget *widget, Tpc *pc) { gtk_widget_destroy(pc->win); } static void project_create_ok_clicked_lcb(GtkWidget *widget, Tpc *pc) { gtk_widget_hide(pc->win); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pc->rad[0]))) { project_edit(pc->bfwin); } else { project_edit(NULL); } gtk_widget_destroy(pc->win); } void project_create_gui(Tbfwin *bfwin) { GtkWidget *vbox, *hbox, *but; Tpc *pc; pc = g_new(Tpc,1); pc->bfwin = bfwin; pc->win = window_full2(_("Create project"), GTK_WIN_POS_NONE, 5 , G_CALLBACK(project_create_destroy_lcb), pc, TRUE, NULL); vbox = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(pc->win),vbox); pc->rad[0] = boxed_radiobut_with_value(_("Create project with currently opened documents"), TRUE, NULL, vbox); pc->rad[1] = boxed_radiobut_with_value(_("Create empty project"), FALSE, GTK_RADIO_BUTTON(pc->rad[0]), vbox); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); but = bf_stock_cancel_button(G_CALLBACK(project_create_cancel_clicked_lcb), pc); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, TRUE, 0); but = bf_stock_ok_button(G_CALLBACK(project_create_ok_clicked_lcb), pc); gtk_box_pack_start(GTK_BOX(hbox), but, FALSE, TRUE, 0); gtk_widget_show_all(pc->win); } void project_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { DEBUG_MSG("project_menu_cb, bfwin=%p, callback_action=%d\n",bfwin,callback_action); switch (callback_action) { case 1: project_open(bfwin); break; case 2: project_save(bfwin, FALSE); break; case 3: project_save(bfwin, TRUE); break; case 4: project_save_and_close(bfwin); break; case 5: project_edit(bfwin); break; case 6: if (bfwin->project) { project_edit(NULL); } else { if (test_only_empty_doc_left(bfwin->documentlist)) { project_edit(bfwin); } else { project_create_gui(bfwin); } } break; default: DEBUG_MSG("project_menu_cb, no such callback_action %d\n",callback_action); exit(54); break; } } winefish-1.3.3/src/project.h0000600000047200004720000000246710375350210014743 0ustar kyanhkyanh/* $Id: project.h 1984 2006-02-17 13:32:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * project.h - project prototypes * * Copyright (C) 2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __PROJECT_H_ #define __PROJECT_H_ /* #define DEBUG */ gboolean project_save_and_close(Tbfwin *bfwin); void project_open_from_file(Tbfwin *bfwin, gchar *fromfilename, gint linenumber); void set_project_menu_widgets(Tbfwin *bfwin, gboolean win_has_project); void project_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); #endif /* __PROJECT_H_ */ winefish-1.3.3/src/menu.h0000600000047200004720000000414310373411041014230 0ustar kyanhkyanh/* $Id: menu.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * menu.h - uhh, duh. * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MENU_H_ #define __MENU_H_ void menu_current_document_set_toggle_wo_activate(Tbfwin *bfwin, Tfiletype *filetype, gchar *encoding); void menu_create_main(Tbfwin *bfwin,GtkWidget *vbox); void add_to_recent_list(Tbfwin *bfwin,gchar *filename, gint closed_file, gboolean is_project); GList *recent_menu_from_list(Tbfwin *bfwin, GList *startat, gboolean is_project); void recent_menu_init(Tbfwin *bfwin); void recent_menu_init_project(Tbfwin *bfwin); void add_window_entry_to_all_windows(Tbfwin *tobfwin); void add_allwindows_entries_to_window(Tbfwin *menubfwin); void remove_window_entry_from_all_windows(Tbfwin *tobfwin); void rename_window_entry_in_all_windows(Tbfwin *tobfwin, gchar *newtitle); /* kyanh, removed, 20050309 void browser_toolbar_cb(GtkWidget *widget, Tbfwin *bfwin); */ void external_menu_rebuild(Tbfwin *bfwin); void encoding_menu_rebuild(Tbfwin *bfwin); void make_cust_menubar(Tbfwin *bfwin,GtkWidget *cust_handle_box); void filetype_menu_rebuild(Tbfwin *bfwin,GtkItemFactory *item_factory); void filetype_menus_empty(void); gchar *menu_translate(const gchar * path, gpointer data); #endif /* __MENU_H_ */ winefish-1.3.3/src/config.h.in0000600000047200004720000000525510411546042015146 0ustar kyanhkyanh/* $Id: config.h.in 2231 2006-03-26 17:15:14Z kyanh $ */ /* Winefish LaTeX Editor * config.h.in - autoconf template * * Copyright (C) 2002-2004 Olivier Sessink * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* header files */ #ifndef HAVE_STDLIB_H /* supress warning when jconfig.h is included */ #undef HAVE_STDLIB_H #endif /* HAVE_STDLIB_H */ #undef HAVE_UNISTD_H #undef HAVE_STRING_H #undef HAVE_STRINGS_H #undef HAVE_ERRNO_H #undef HAVE_STDIO_H #undef HAVE_SYS_STAT_H #undef HAVE_CTYPE_H #undef HAVE_GETOPT_H #undef HAVE_MATH_H #undef HAVE_TIME_H #undef HAVE_SYS_TYPES_H #undef HAVE_FCNTL_H #undef HAVE_NETDB_H #undef HAVE_NETINET_IN_H #undef HAVE_SYS_SOCKET_H #undef HAVE_ARPA_INET_H #undef HAVE_DIRENT_H #undef HAVE_SYS_SELECT_H #undef HAVE_MALLOC_H #undef HAVE_NL_TYPES_H #undef HAVE_ALLOCA_H #undef HAVE_SYS_IPC_H #undef HAVE_SYS_MSG_H /* libaspell */ #undef HAVE_LIBASPELL /* gnome-vfs-2.0 */ #undef HAVE_GNOME_VFS /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if using alloca.c. */ #undef C_ALLOCA #undef PACKAGE #undef VERSION #undef CURRENT_VERSION_NAME #undef CONFIGURE_OPTIONS /* debugging output */ #undef DEBUG #undef DEVELOPMENT /* find and grep for open advanced */ #undef EXTERNAL_FIND #undef EXTERNAL_GREP #undef EXTERNAL_SED #undef EXTERNAL_XARGS /* i18n */ #undef ENABLE_NLS /* highlighting pattern profiling */ #undef HL_PROFILING #undef HAVE_ATLEAST_GTK_2_2 #undef HAVE_ATLEAST_GTK_2_4 #undef HAVE_ATLEAST_GNOMEUI_2_6 #undef HAVE_VTE_TERMINAL #undef PLATFORM_DARWIN /*********************** winefish *********************** * * donot alter following stuffs * *********************** winefish ***********************/ #undef ENABLE_UNIKEY_GTK #undef ENABLE_COLUMN_MARKER #undef HAVE_VNTEX #undef HAVE_CONTEXT /* with splash screen */ #undef NOSPLASH #include "config_spec.h" /*********************** winefish ***********************/ winefish-1.3.3/src/bf_lib.c0000600000047200004720000013404410406554723014514 0ustar kyanhkyanh/* $Id: bf_lib.c 2177 2006-03-17 15:46:27Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * bf_lib.c - non-GUI general functions * * Copyright (C) 2000-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* chdir(), getpid() */ #include /* fopen() */ #include /* toupper */ #include /* strrchr strncmp memmove strncat*/ #include /* S_IFDIR */ #include /* errno */ #include "bluefish.h" /* for DEBUG_MSG and stuff like that */ #include "bf_lib.h" /* myself */ #ifdef WIN32 #define DIRSTR "\\" #define DIRCHR 92 #else #define DIRSTR "/" #define DIRCHR '/' #endif /** * get_filename_on_disk_encoding * * if gnome_vfs is defined, this function will also escape local paths * to make sure we can open files with a # in their name */ gchar *get_filename_on_disk_encoding(const gchar *utf8filename) { if (utf8filename) { GError *gerror=NULL; gsize b_written; gchar *ondiskencoding = g_filename_from_utf8(utf8filename,-1, NULL,&b_written,&gerror); if (gerror) { g_print(_("Winefish has trouble reading the filenames. Try to set the environment variable G_BROKEN_FILENAMES=1\n")); ondiskencoding = g_strdup(utf8filename); } return ondiskencoding; } return NULL; } gchar *get_utf8filename_from_on_disk_encoding(const gchar *encodedname) { if (encodedname) { GError *gerror=NULL; gsize b_written; gchar *ondiskencoding = g_filename_to_utf8(encodedname,-1, NULL,&b_written,&gerror); if (gerror) { g_print(_("Winefish has trouble reading the filenames. Try to set the environment variable G_BROKEN_FILENAMES=1\n")); ondiskencoding = g_strdup(encodedname); } DEBUG_MSG("get_utf8filename_from_on_disk_encoding, utf8filename=%s\n",ondiskencoding); return ondiskencoding; } return NULL; } gboolean string_is_color(const gchar *color) { GdkColor gcolor; return gdk_color_parse(color, &gcolor); } static void fill_rwx(short unsigned int bits, char *chars) { chars[0] = (bits & S_IRUSR) ? 'r' : '-'; chars[1] = (bits & S_IWUSR) ? 'w' : '-'; chars[2] = (bits & S_IXUSR) ? 'x' : '-'; } static void fill_setid(short unsigned int bits, char *chars) { #ifdef S_ISUID if (bits & S_ISUID) { /* Set-uid, but not executable by owner. */ if (chars[3] != 'x') chars[3] = 'S'; else chars[3] = 's'; } #endif #ifdef S_ISGID if (bits & S_ISGID) { /* Set-gid, but not executable by group. */ if (chars[6] != 'x') chars[6] = 'S'; else chars[6] = 's'; } #endif #ifdef S_ISVTX if (bits & S_ISVTX) { /* Sticky, but not executable by others. */ if (chars[9] != 'x') chars[9] = 'T'; else chars[9] = 't'; } #endif } gchar *filemode_to_string(mode_t statmode) { gchar *str = g_malloc0(10); /* following code "adapted" from GNU filemode.c program */ fill_rwx((statmode & 0700) << 0, &str[0]); fill_rwx((statmode & 0070) << 3, &str[3]); fill_rwx((statmode & 0007) << 6, &str[6]); fill_setid(statmode, str); return str; } /** * return_root_with_protocol: * @url: #const gchar* with the url * * returns the root of the url, including its trailing slash * this might be in the form * - "protocol://server:port/" * - "/" * - NULL, if the url contains no url, nor does it start with a / character * * if there is no trailing slash, this function will return the root WITH a * trailing slash appended!! * * Return value: #gchar* newly allocated, or NULL */ gchar *return_root_with_protocol(const gchar *url) { gchar *q; if (!url) return NULL; q = strchr(url,':'); if (q && *(q+1)=='/' && *(q+2)=='/' && *(q+3)!='\0') { /* we have a protocol */ gchar *root = strchr(q+3, '/'); if (root) return g_strndup(url, root - url + 1); /* if there is no third slash character, we probably have an url like http://someserver so we will append the slash ourselves */ return g_strconcat(url, "/",NULL); } else if (url[0] == '/') { /* no protocol, return / */ return g_strdup("/"); } /* no root known */ return NULL; } /** * pointer_switch_addresses: * a: #gpointer; * b: #gpointer * * after this call, a will contain the address previously in a * and b will contain the address previously in b * * Return value: void */ #ifdef __GNUC__ __inline__ #endif void pointer_switch_addresses(gpointer *a, gpointer *b) { gpointer c; DEBUG_MSG("pointer_switch_addresses, before, a=%p, b=%p\n",a,b); c = *a; *a = *b; *b = c; DEBUG_MSG("pointer_switch_addresses, after, a=%p, b=%p\n",a,b); } /** * list_switch_order: * @first: a #GList * item * @second: a #GList * item * * this function will switch place of these two list items * actually not the items themselves, but the data they are * pointer to is switched * * Return value: void **/ void list_switch_order(GList *first, GList *second) { gpointer tmp; tmp = first->data; first->data = second->data; second->data = tmp; } /** * file_copy: * @source: a #gchar * containing the source filename * @dest: a #gchar * containing the destination filename * * copies the contents of the file source to dest * this function is Gnome-VFS aware, so it will work on URI's * * Return value: gboolean, TRUE if the function succeeds **/ gboolean file_copy(gchar *source, gchar *dest) { #ifdef DEVELOPMENT g_assert(source); g_assert(dest); #endif int c; FILE *in, *out; gchar *OnDiEn_source, *OnDiEn_dest; OnDiEn_source = get_filename_on_disk_encoding(source); OnDiEn_dest = get_filename_on_disk_encoding(dest); in = fopen(OnDiEn_source, "r"); g_free(OnDiEn_source); if (!in) { return FALSE; } out = fopen(OnDiEn_dest, "w"); g_free(OnDiEn_dest); if (!out) { fclose(in); return FALSE; } while((c=fgetc(in)) != EOF) { fputc(c,out); } fclose(in); fclose(out); return TRUE; } static gint length_common_prefix(gchar *first, gchar *second) { gint i=0; while (first[i] == second[i] && first[i] != '\0') { i++; } return i; } /** * find_common_prefix_in_stringlist: * @stringlist: a #GList* with strings * * tests every string in stringlist, and returns the length of the * common prefix all these strings have * * This is for example useful to find out if a list of filenames * share the same base directory * * Return value: #gint with number of common characters **/ gint find_common_prefixlen_in_stringlist(GList *stringlist) { gchar *firststring; gint commonlen; GList *tmplist; tmplist = g_list_first(stringlist); firststring = (gchar *)tmplist->data; commonlen = strlen(firststring); tmplist = g_list_next(tmplist); while(tmplist){ gint testlen; gchar *secondstring = (gchar *)tmplist->data; testlen = length_common_prefix(firststring, secondstring); if (testlen < commonlen) { commonlen = testlen; } tmplist = g_list_next(tmplist); } return commonlen; } /** * append_string_to_file: * @filename: a #gchar * containing the destination filename * @string: a #gchar * containing the string to append * * opens the file filename in append mode, and appends the string * no newline or anything else is appended, just the string * * DOES NOT YET SUPPORT GNOME_VFS !!! * * Return value: gboolean, TRUE if the function succeeds **/ gboolean append_string_to_file(gchar *filename, gchar *string) { FILE *out; gchar *ondiskencoding = get_filename_on_disk_encoding(filename); out = fopen(ondiskencoding, "a"); g_free(ondiskencoding); if (!out) { DEBUG_MSG("append_to_file, could not open file %s for append\n", filename); return FALSE; } fputs(string, out); fclose(out); return TRUE; } /** * countchars: * @string: a gchar * to count the chars in * @chars: a gchar * with the characters you are interested in * * this function will count every character in string that is also in chars * * Return value: guint with the number of characters found **/ guint countchars(const gchar *string, const gchar *chars) { guint count=0; gchar *newstr = strpbrk(string, chars); while(newstr) { count++; newstr = strpbrk(++newstr, chars); } DEBUG_MSG("countchars, returning %d\n",count); return count; } static gint table_convert_char2int_backend(Tconvert_table *table, const gchar *my_char , Ttcc2i_mode mode, int (*func)(const gchar *arg1, const gchar *arg2) ) { Tconvert_table *entry; entry = table; while (entry->my_char) { if (func(my_char,entry->my_char)==0) { return entry->my_int; } entry++; } return -1; } static int strfirstchar(const gchar *mychar, const gchar *tablechar) { return mychar[0] - tablechar[0]; } static int strmycharlen(const gchar *mychar, const gchar *tablechar) { return strncmp(mychar,tablechar,strlen(mychar)); } static int strfull_match_gettext(const gchar *mychar, const gchar *tablechar) { return strcmp(mychar,_(tablechar)); } /** * table_convert_char2int: * @table: a #tconvert_table * with strings and integers * @my_char: a #gchar * containing the string to convert * @mode: #Ttcc2i_mode * * this function can be used to translate a string from some set (in table) * to an integer * * Return value: gint, found in table, or -1 if not found **/ gint table_convert_char2int(Tconvert_table *table, const gchar *my_char, Ttcc2i_mode mode) { switch (mode) { case tcc2i_firstchar: return table_convert_char2int_backend(table,my_char,mode,strfirstchar); case tcc2i_mycharlen: return table_convert_char2int_backend(table,my_char,mode,strmycharlen); case tcc2i_full_match: return table_convert_char2int_backend(table,my_char,mode,strcmp); case tcc2i_full_match_gettext: return table_convert_char2int_backend(table,my_char,mode,strfull_match_gettext); default: DEBUG_MSG("bug in call to table_convert_char2int()\n"); return -1; } } /** * table_convert_int2char: * @table: a #tconvert_table * with strings and integers * @my_int: a #gint containing the integer to convert * * this function can be used to translate an integer from some set (in table) * to a string * WARNING: This function will return a pointer into table, it will * NOT allocate new memory * * Return value: gchar * found in table, else NULL **/ gchar *table_convert_int2char(Tconvert_table *table, gint my_int) { Tconvert_table *entry; entry = table; while (entry->my_char) { if (my_int == entry->my_int) { return entry->my_char; } entry++; } return NULL; } /** * expand_string: * @string: a formatstring #gchar * to convert * @specialchar: a const char to use as 'delimited' or 'special character' * @table: a #Tconvert_table * array to use for conversion * * this function can convert a format string with %0, %1, or \n, \t * into the final string, where each %number or \char entry is replaced * with the string found in table * * so this function is the backend for unescape_string() and * for replace_string_printflike() * * table is an array with last entry {0, NULL} * * Return value: a newly allocated gchar * with the resulting string **/ gchar *expand_string(const gchar *string, const char specialchar, Tconvert_table *table) { gchar *p, *prev, *stringdup; gchar *tmp, *dest = g_strdup(""); stringdup = g_strdup(string); /* we make a copy so we can set some \0 chars in the string */ prev = stringdup; DEBUG_MSG("expand_string, string='%s'\n", string); p = strchr(prev, specialchar); while (p) { gchar *converted; tmp = dest; *p = '\0'; /* set a \0 at this point, the pointer prev now contains everything up to the current % */ DEBUG_MSG("expand_string, prev='%s'\n", prev); p++; converted = table_convert_int2char(table, *p); DEBUG_MSG("expand_string, converted='%s'\n", converted); dest = g_strconcat(dest, prev, converted, NULL); g_free(tmp); prev = ++p; p = strchr(p, specialchar); } tmp = dest; dest = g_strconcat(dest, prev, NULL); /* append the end to the current string */ g_free(tmp); g_free(stringdup); DEBUG_MSG("expand_string, dest='%s'\n", dest); return dest; } gchar *replace_string_printflike(const gchar *string, Tconvert_table *table) { return expand_string(string,'%',table); } static gint tablesize(Tconvert_table *table) { Tconvert_table *tmpentry = table; while (tmpentry->my_char) tmpentry++; return (tmpentry - table); } /* for now this function can only unexpand strings with tables that contain only single character strings like "\n", "\t" etc. */ gchar *unexpand_string(const gchar *original, const char specialchar, Tconvert_table *table) { gchar *tmp, *tosearchfor, *retval, *prev, *dest, *orig; Tconvert_table *tmpentry; orig = g_strdup(original); DEBUG_MSG("original='%s', strlen()=%d\n",original,strlen(original)); tosearchfor = g_malloc(tablesize(table)+1); DEBUG_MSG("tablesize(table)=%d, alloc'ed %d bytes for tosearchfor\n",tablesize(table), tablesize(table)+1); tmp = tosearchfor; tmpentry = table; while(tmpentry->my_char != NULL) { *tmp = tmpentry->my_char[0]; /* we fill the search string with the first character */ tmpentry++; tmp++; } *tmp = '\0'; DEBUG_MSG("unexpand_string, tosearchfor='%s'\n",tosearchfor); DEBUG_MSG("alloc'ing %d bytes\n", (countchars(original, tosearchfor) + strlen(original) + 1)); retval = g_malloc((countchars(original, tosearchfor) + strlen(original) + 1) * sizeof(gchar)); dest = retval; prev = orig; /* now we go trough the original till we hit specialchar */ tmp = strpbrk(prev, tosearchfor); while (tmp) { gint len = tmp - prev; gint mychar = table_convert_char2int(table, tmp, tcc2i_firstchar); DEBUG_MSG("unexpand_string, tmp='%s', prev='%s'\n",tmp, prev); if (mychar == -1) mychar = *tmp; DEBUG_MSG("unexpand_string, copy %d bytes and advancing dest\n",len); memcpy(dest, prev, len); dest += len; *dest = specialchar; dest++; *dest = mychar; dest++; prev=tmp+1; DEBUG_MSG("prev now is '%s'\n",prev); tmp = strpbrk(prev, tosearchfor); } DEBUG_MSG("unexpand_string, copy the rest (%s) to dest\n",prev); memcpy(dest,prev,strlen(prev)+1); /* this will also make sure there is a \0 at the end */ DEBUG_MSG("unexpand_string, retval='%s'\n",retval); g_free(orig); g_free(tosearchfor); return retval; } /* if you change this table, please change escape_string() and unescape_string() and new_convert_table() in the same way */ static Tconvert_table standardescapetable [] = { {'n', "\n"}, {'t', "\t"}, {'\\', "\\"}, {'f', "\f"}, {'r', "\r"}, {'a', "\a"}, {'b', "\b"}, {'v', "\v"}, {'n', "\n"}, {':', ":"}, /* this double entry is there to make unescape_string and escape_string work efficient */ {0, NULL} }; gchar *unescape_string(const gchar *original, gboolean escape_colon) { gchar *string, *tmp=NULL; DEBUG_MSG("unescape_string, started\n"); if (!escape_colon) { tmp = standardescapetable[9].my_char; standardescapetable[9].my_char = NULL; } string = expand_string(original,'\\',standardescapetable); if (!escape_colon) { standardescapetable[9].my_char = tmp; } return string; } gchar *escape_string(const gchar *original, gboolean escape_colon) { gchar *string, *tmp=NULL; DEBUG_MSG("escape_string, started\n"); if (!escape_colon) { tmp = standardescapetable[9].my_char; standardescapetable[9].my_char = NULL; } string = unexpand_string(original,'\\',standardescapetable); if (!escape_colon) { standardescapetable[9].my_char = tmp; } return string; } Tconvert_table *new_convert_table(gint size, gboolean fill_standardescape) { gint realsize = (fill_standardescape) ? size + 10 : size; Tconvert_table * tct = g_new(Tconvert_table, realsize+1); DEBUG_MSG("new_convert_table, size=%d, realsize=%d,alloced=%d\n",size,realsize,realsize+1); if (fill_standardescape) { gint i; for (i=size;imy_char) { DEBUG_MSG("free_convert_table, my_char=%s\n",tmp->my_char); g_free(tmp->my_char); tmp++; } DEBUG_MSG("free_convert_table, free table %p\n",tct); g_free(tct); } /* kyanh, added, 20050223 */ gchar *convert_command(Tbfwin *bfwin, const gchar *command) { if (! bfwin->current_document) { return g_strdup(command); } gchar *result; gboolean need_D, need_B, need_d, need_b, need_f, need_l, need_p ; gint num_needs; need_D = (strstr(command, "%D") != NULL); need_B = (strstr(command, "%B") != NULL); need_d = (strstr(command, "%d") != NULL); need_b = (strstr(command, "%b") != NULL); need_f = (strstr(command, "%f") != NULL); need_l = (strstr(command, "%l") != NULL); need_p = (strstr(command,"%%") != NULL); /*need_e = (strstr(command, "%e") != NULL);*/ num_needs = need_D + need_B + need_d + need_b + need_f + need_l +need_p; if (num_needs) { Tconvert_table *table, *tmpt; table = tmpt = g_new(Tconvert_table, num_needs +1); if (need_p) { tmpt->my_int = '%'; tmpt->my_char = g_strdup("%"); tmpt++; } if (need_D) { tmpt->my_int = 'D'; if ( bfwin->project && (bfwin->project->view_bars & MODE_PROJECT) && g_file_test(bfwin->project->basedir, G_FILE_TEST_IS_DIR)) { tmpt->my_char = g_strdup(bfwin->project->basedir); }else{ if (bfwin->current_document->filename) { tmpt->my_char = g_path_get_dirname(bfwin->current_document->filename); }else{ tmpt->my_char = g_strdup("?D"); } } tmpt++; } if (need_B) { tmpt->my_int = 'B'; { gchar *tmpstring=NULL; if (bfwin->project && (bfwin->project->view_bars & MODE_PROJECT) && g_file_test(bfwin->project->basedir,G_FILE_TEST_IS_DIR) ) { tmpstring = g_strconcat(bfwin->project->basedir,"/",bfwin->project->basefile,NULL); if ( g_file_test(tmpstring,G_FILE_TEST_EXISTS) ) { g_free(tmpstring); tmpstring = g_strdup(bfwin->project->basefile); }else{ g_free(tmpstring); if (bfwin->current_document->filename) { tmpstring = g_path_get_basename(bfwin->current_document->filename); }else{ tmpstring = NULL; } } }else{ if (bfwin->current_document->filename) { tmpstring = g_path_get_basename(bfwin->current_document->filename); } } if (tmpstring) { /* remove extension */ gchar *ext = g_strrstr(tmpstring,"."); if (ext) { tmpstring = g_strndup(tmpstring,strlen(tmpstring)-strlen(ext)); } tmpt->my_char = g_strdup(tmpstring); g_free(tmpstring); }else{ tmpt->my_char = g_strdup("?B"); } /* kyanh, 200550301, We should not free *ext -- the result of g_strrstr(). See glib/string documentation. */ /* if (ext) { g_free(ext); } */ } tmpt++; } if (need_d) { tmpt->my_int = 'd'; tmpt->my_char = bfwin->current_document->filename ? g_path_get_dirname(bfwin->current_document->filename) : g_strdup("?d"); tmpt++; } if (need_f) { tmpt->my_int = 'f'; /* should we check for filename ? */ tmpt->my_char = bfwin->current_document->filename ? g_strdup(bfwin->current_document->filename) : g_strdup("?f"); tmpt++; } if (need_b) { tmpt->my_int = 'b'; if (bfwin->current_document->filename) { gchar *tmpstring; tmpstring = g_path_get_basename(bfwin->current_document->filename); gchar *ext = g_strrstr(tmpstring,"."); if (ext) { tmpstring = g_strndup(tmpstring,strlen(tmpstring)-strlen(ext)); } tmpt->my_char = g_strdup(tmpstring); g_free(tmpstring); }else{ tmpt->my_char = g_strdup("?b"); } tmpt++; } if (need_l) { tmpt->my_int = 'l'; { gint linenumber; GtkTextIter iter; gtk_text_buffer_get_iter_at_mark(bfwin->current_document->buffer,&iter,gtk_text_buffer_get_insert(bfwin->current_document->buffer)); linenumber = gtk_text_iter_get_line(&iter); linenumber++; /* gkt_text_iter_get_line start numbering from 0 */ tmpt->my_char = g_strdup_printf("%d",linenumber); } tmpt++; } tmpt->my_char = NULL; result = replace_string_printflike(command, table); free_convert_table(table); }else{ result = g_strdup(command); } return result; } /**************************************************/ /* byte offset to UTF8 character offset functions */ /**************************************************/ /* html files usually have enough cache at size 4 large php files, a cache of 10 resulted in 160% of the buffer to be parsed 12 resulted in 152% of the buffer to be parsed 14 resulted in 152% of the buffer to be parsed 16 resulted in 152% of the buffer to be parsed so we keep it at 10 for the moment */ #define UTF8_OFFSET_CACHE_SIZE 10 /* #define UTF8_BYTECHARDEBUG */ typedef struct { gchar *last_buf; /* the two arrays must be grouped and in this order, because they are moved back one position in ONE memmove() call */ guint last_byteoffset[UTF8_OFFSET_CACHE_SIZE]; guint last_charoffset[UTF8_OFFSET_CACHE_SIZE]; #ifdef UTF8_BYTECHARDEBUG guint numcalls_since_reset; unsigned long long int numbytes_parsed; guint numcalls_cached_since_reset; unsigned long long int numbytes_cached_parsed; #endif } Tutf8_offset_cache; static Tutf8_offset_cache utf8_offset_cache; /** * utf8_offset_cache_reset: * * this function will reset the utf8 offset cache used by * utf8_byteoffset_to_charsoffset_cached() * * normally this is done automatically if utf8_byteoffset_to_charsoffset_cached() * is called with a new buffer. But if you ever call that function for * the same buffer but the buffer is changed in the meantime you have * to reset it manually using utf8_offset_cache_reset() * * Return value: void **/ #ifdef __GNUC__ __inline__ #endif void utf8_offset_cache_reset() { #ifdef UTF8_BYTECHARDEBUG g_print("UTF8_BYTECHARDEBUG: called %d times for total %llu bytes\n",utf8_offset_cache.numcalls_since_reset,utf8_offset_cache.numbytes_parsed); g_print("UTF8_BYTECHARDEBUG: cache HIT %d times, reduced to %llu bytes, cache size %d\n",utf8_offset_cache.numcalls_cached_since_reset,utf8_offset_cache.numbytes_cached_parsed,UTF8_OFFSET_CACHE_SIZE); #endif memset(&utf8_offset_cache, 0, sizeof(Tutf8_offset_cache)); } /** * utf8_byteoffset_to_charsoffset_cached: * @string: the gchar * you want to count * @byteoffset: glong with the byteoffset you want the charoffset for * * this function calculates the UTF-8 character offset in a string for * a given byte offset * It uses caching to speedup multiple calls for the same buffer, the cache * is emptied if you change to another buffer. If you use the same buffer but * change it inbetween calls, you have to reset it yourself using * the utf8_offset_cache_reset() function * * Return value: guint with character offset **/ guint utf8_byteoffset_to_charsoffset_cached(gchar *string, glong byteoffset) { guint retval; gint i = UTF8_OFFSET_CACHE_SIZE-1; if (string != utf8_offset_cache.last_buf) { utf8_offset_cache_reset(); utf8_offset_cache.last_buf = string; } #ifdef DEBUG DEBUG_MSG("utf8_byteoffset_to_charsoffset_cached, string %p has strlen %d\n", string, strlen(string)); #endif while (i > 0 && utf8_offset_cache.last_byteoffset[i] > byteoffset) { i--; } if (i > 0) { retval = g_utf8_pointer_to_offset(string+utf8_offset_cache.last_byteoffset[i], string+byteoffset)+utf8_offset_cache.last_charoffset[i]; #ifdef UTF8_BYTECHARDEBUG utf8_offset_cache.numbytes_parsed += (byteoffset - utf8_offset_cache.last_byteoffset[i]); utf8_offset_cache.numbytes_cached_parsed += (byteoffset - utf8_offset_cache.last_byteoffset[i]); utf8_offset_cache.numcalls_cached_since_reset++; #endif } else { retval = g_utf8_pointer_to_offset(string, string+byteoffset); #ifdef UTF8_BYTECHARDEBUG utf8_offset_cache.numbytes_parsed += byteoffset; #endif } if (i == (UTF8_OFFSET_CACHE_SIZE-1)) { /* add this new calculation to the cache */ /* this is a nasty trick to move all guint entries one back in the array, so we can add the new one */ memmove(&utf8_offset_cache.last_byteoffset[0], &utf8_offset_cache.last_byteoffset[1], (UTF8_OFFSET_CACHE_SIZE+UTF8_OFFSET_CACHE_SIZE-1)*sizeof(guint)); utf8_offset_cache.last_byteoffset[UTF8_OFFSET_CACHE_SIZE-1] = byteoffset; utf8_offset_cache.last_charoffset[UTF8_OFFSET_CACHE_SIZE-1] = retval; } #ifdef UTF8_BYTECHARDEBUG utf8_offset_cache.numcalls_since_reset++; #endif return retval; } /** * escapestring: * @original: a gchar * to escape * @delimiter: a gchar that needs escaping, use '\0' if you don't need one * * this function will backslash escape \n, \t, and \ characters, and if * there is a delimiter it will also be escaped * * Return value: a newly allocated gchar * that is escaped **/ /*gchar *old_escapestring(gchar *original, gchar delimiter) { gchar *tmp, *newstring, *escapedchars; guint newsize, pos=0; * count the size of the new string * escapedchars = g_strdup_printf("\n\t\\%c", delimiter); DEBUG_MSG("escapestring, escapedchars=%s, extra length=%d\n", escapedchars, countchars(original, escapedchars)); newsize = countchars(original, escapedchars) + strlen(original) + 1; newstring = g_malloc0(newsize * sizeof(gchar)); g_free(escapedchars); DEBUG_MSG("escapestring, original=%s, newsize=%d\n", original, newsize); tmp = original; while (*tmp != '\0') { switch (*tmp) { case '\\': strcat(newstring, "\\\\"); pos +=2; break; case '\n': strcat(newstring, "\\n"); pos +=2; break; case '\t': strcat(newstring, "\\t"); pos +=2; break; default: if (*tmp == delimiter) { newstring[pos] = '\\'; newstring[pos+1] = delimiter; pos +=2; } else { newstring[pos] = *tmp; pos++; } break; } newstring[pos] = '\0'; tmp++; } DEBUG_MSG("escapestring, newstring = %s\n", newstring); return newstring; }*/ /** * unescapestring: * @original: a gchar * to unescape * * this function will backslash unescape \n, \t, and \\ sequences to * their characters, and if there is any other escaped character * it will be replaced without the backslash * * Return value: a newly allocated gchar * that is unescaped **/ /*gchar *old_unescapestring(gchar *original) { gchar *tmp1, *tmp2, *newstring; guint newsize; gint escaped; newsize = strlen(original) + 1; newstring = g_malloc0(newsize * sizeof(gchar)); DEBUG_MSG("unescapestring, original=%s, newsize = %d\n", original, newsize); tmp1 = original; tmp2 = newstring; escaped = 0; while (*tmp1 != '\0') { if (escaped) { switch (*tmp1) { case '\\': *tmp2++ = '\\'; break; case 'n': *tmp2++ = '\n'; break; case 't': *tmp2++ = '\t'; break; default: *tmp2++ = *tmp1; break; } escaped = 0; } else { if (*tmp1 == '\\') escaped = 1; else *tmp2++ = *tmp1; } tmp1++; } DEBUG_MSG("unescapestring, newstring = %s\n", newstring); return newstring; }*/ /** * strip_any_whitespace: * @string: a gchar * to strip * * strips any double chars defined by isspace() from the string, * only single spaces are returned * the same string is returned, no memory is allocated in this function * * Return value: the same gchar * as passed to the function **/ gchar *strip_any_whitespace(gchar *string) { gint count=0, len; #ifdef DEVELOPMENT g_assert(string); #endif DEBUG_MSG("strip_any_whitespace, starting string='%s'\n", string); len = strlen(string); while(string[count]) { if (isspace((char)string[count])) { string[count] = ' '; if (string[count+1] && isspace((char)string[count+1])) { gint fcount = count; while (string[fcount] && isspace((char)string[fcount])) { fcount++; } DEBUG_MSG("strip_any_whitespace, found %d spaces\n", fcount - count); memmove(&string[count+1], &string[fcount], len - (count+1)); string[len- (fcount-count)+1] = '\0'; DEBUG_MSG("strip_any_whitespace, after memmove, string='%s'\n", string); } } count++; } g_strstrip(string); DEBUG_MSG("strip_any_whitespace, returning string='%s'\n", string); return string; } /** * trunc_on_char: * @string: a #gchar * to truncate * @which_char: a #gchar with the char to truncate on * * Returns a pointer to the same string which is truncated at the first * occurence of which_char * * Return value: the same gchar * as passed to the function **/ gchar *trunc_on_char(gchar * string, gchar which_char) { gchar *tmpchar = string; while(*tmpchar) { if (*tmpchar == which_char) { *tmpchar = '\0'; return string; } tmpchar++; } return string; } /* gchar *strip_common_path(char *image_fn, char *html_fn) * returns a newly allocated string containing the the to_filename * but all the common path with from_filename is removed * * IS THIS IN USE ?? OBVIOUSLY NOT BECAUSE I CAN REMOVE IT */ /*gchar *strip_common_path(char *to_filename, char *from_filename) { gchar *tempstr; int count, count2, dir_length; count = 0; tempstr = strrchr(to_filename, DIRCHR); dir_length = strlen(to_filename) - strlen(tempstr); dir_length += 1; DEBUG_MSG("strip_common_path, dir_lenght=%d\n", dir_length); while ((strncmp(to_filename, from_filename, count + 1)) == 0) { count++; if (count > dir_length) { count = dir_length; break; } } while (to_filename[count - 1] != DIRCHR) count--; DEBUG_MSG("strip_common_path, equal count = %d\n", count); count2 = strlen(to_filename); tempstr = g_malloc(count2 - count + 2); memcpy(tempstr, &to_filename[count], count2 - count + 2); DEBUG_MSG("strip_common_path, tempstr= %s, should be %d long\n", tempstr, count2 - count); return tempstr; } */ /** * most_efficient_filename: * @filename: a gchar * with a possibly inefficient filename like /hello/../tmp/../myfile * * tries to eliminate any dir/../ combinations in filename * this function could do evern better, it should also remove /./ entries * * Return value: the same gchar * as passed to the function **/ gchar *most_efficient_filename(gchar *filename) { gint i,j, len; DEBUG_MSG("most_efficient_filename, 1 filename=%s\n", filename); len = strlen(filename); for (i=0; i < len-4; i++) { /* DEBUG_MSG("most_efficient_filename, i=%d\n", i); */ if (strncmp(&filename[i], "/../", 4) == 0) { for (j=1; j < i; j++) { if ((filename[i - j] == DIRCHR) || (i==j)) { DEBUG_MSG("most_efficient_filename, &filename[%d-%d]=%s, &filename[%d+3]=%s, %d-%d-4=%d\n", i,j,&filename[i-j],i, &filename[i+3], len, j, len-j-4); memmove(&filename[i-j], &filename[i+3], len-i); j=i; i--; } } } } DEBUG_MSG("most_efficient_filename, 3 filename=%s\n", filename); return filename; } /** * create_relative_link_to: * @current_filepath: a #gchar * with the current filename * @link_to_filepath: a #gchar * with a file to link to * * creates a newly allocated relative link from current_filepath * to link_to_filepath * * if current_filepath == NULL it returns the most efficient filepath * for link_to_filepath * * if link_to_filepath == NULL it will return NULL * * Return value: a newly allocated gchar * with the relative link **/ gchar *create_relative_link_to(gchar * current_filepath, gchar * link_to_filepath) { gchar *returnstring = NULL; gchar *eff_current_filepath, *eff_link_to_filepath; gint common_lenght, maxcommonlen; gint current_filename_length, link_to_filename_length, current_dirname_length, link_to_dirname_length; gint count, deeper_dirs; if (!current_filepath){ returnstring = most_efficient_filename(g_strdup(link_to_filepath)); return returnstring; } if (!link_to_filepath) { return NULL; } eff_current_filepath = most_efficient_filename(g_strdup(current_filepath)); eff_link_to_filepath = most_efficient_filename(g_strdup(link_to_filepath)); DEBUG_MSG("eff_current: '%s'\n",eff_current_filepath); DEBUG_MSG("eff_link_to: '%s'\n",eff_link_to_filepath); /* get the size of the directory of the current_filename */ current_filename_length = strlen(strrchr(eff_current_filepath, DIRCHR))-1; link_to_filename_length = strlen(strrchr(eff_link_to_filepath, DIRCHR))-1; DEBUG_MSG("create_relative_link_to, filenames: current: %d, link_to:%d\n", current_filename_length,link_to_filename_length); current_dirname_length = strlen(eff_current_filepath) - current_filename_length; link_to_dirname_length = strlen(eff_link_to_filepath) - link_to_filename_length; DEBUG_MSG("create_relative_link_to, dir's: current: %d, link_to:%d\n", current_dirname_length, link_to_dirname_length); if (current_dirname_length < link_to_dirname_length) { maxcommonlen = current_dirname_length; } else { maxcommonlen = link_to_dirname_length; } /* first lets get the common basedir for both dir+file by comparing the common path in the directories */ common_lenght = 0; while ((strncmp(eff_current_filepath, eff_link_to_filepath, common_lenght + 1)) == 0) { common_lenght++; if (common_lenght >= maxcommonlen) { common_lenght = maxcommonlen; break; } } DEBUG_MSG("create_relative_link_to, common_lenght=%d (not checked for directory)\n", common_lenght); /* this is the common length, but we need the common directories */ if (eff_current_filepath[common_lenght] != DIRCHR) { gchar *ltmp = &eff_current_filepath[common_lenght]; while ((*ltmp != DIRCHR) && (common_lenght > 0)) { common_lenght--; ltmp--; } } DEBUG_MSG("create_relative_link_to, common_lenght=%d (checked for directory)\n", common_lenght); /* now we need to count how much deeper (in directories) the current_filename is compared to the link_to_file, that is the amount of ../ we need to add */ deeper_dirs = 0; for (count = common_lenght+1; count <= current_dirname_length; count++) { if (eff_current_filepath[count] == DIRCHR) { deeper_dirs++; DEBUG_MSG("create_relative_link_to, on count=%d, deeper_dirs=%d\n", count, deeper_dirs); } } DEBUG_MSG("create_relative_link_to, deeper_dirs=%d\n", deeper_dirs); /* now we know everything we need to know we can create the relative link */ returnstring = g_malloc0((strlen(link_to_filepath) - common_lenght + 3 * deeper_dirs + 1) * sizeof(gchar *)); count = deeper_dirs; while (count) { strcat(returnstring, "../"); count--; } strcat(returnstring, &eff_link_to_filepath[common_lenght+1]); DEBUG_MSG("create_relative_link_to, returnstring=%s\n", returnstring); g_free(eff_current_filepath); g_free(eff_link_to_filepath); return returnstring; } #ifdef HAVE_ATLEAST_GTK_2_4 #define STRIP_FILE_URI #endif /** * create_full_path: * @filename: a gchar * with the (relative or not) filename * @basedir: a gchar * with a basedir or NULL for current dir * * if filename is already absolute, it returns it * else it will use basedir if available, else the current dir * to add to the filename to form the full path * * for URL's it will simply return a strdup(), except for file:// URL's, * there the file:// bit is stripped and * IF YOU HAVE GNOME_VFS any %XX sequenves are converted * so if you DON'T have gnome_vfs, you should not feed file:// uri's!! * * it does use most_efficient_filename() to remote unwanted dir/../ entries * * Return value: a newly allocated gchar * with the full path **/ gchar *create_full_path(const gchar * filename, const gchar *basedir) { gchar *absolute_filename; gchar *tmpcdir; if (!filename) return NULL; DEBUG_MSG("create_full_path, filename=%s, basedir=%s\n", filename, basedir); #ifdef STRIP_FILE_URI if (strchr(filename, ':') != NULL) { /* it is an URI!! */ DEBUG_MSG("create_full_path, %s is an URI\n",filename); if (strncmp(filename, "file://", 7)==0) { /* THIS IS A BUG, IF YOU DON'T HAVE GNOME_VFS BUT YOU DO HAVE GTK-2.4 A %21 OR SOMETHING LIKE THAT IS NOW NOT CONVERTED !!!!!!!!! */ return g_strdup(filename+7); /* file:// URI's are never relative paths */ } return g_strdup(filename); /* cannot do this on remote paths */ } #endif if (g_path_is_absolute(filename)) { absolute_filename = g_strdup(filename); } else { if (basedir) { tmpcdir = ending_slash(basedir); } else { gchar *curdir = g_get_current_dir(); tmpcdir = ending_slash(curdir); g_free(curdir); } absolute_filename = g_strconcat(tmpcdir, filename, NULL); g_free(tmpcdir); } absolute_filename = most_efficient_filename(absolute_filename); return absolute_filename; } /** * ending_slash: * @dirname: a #const gchar * with a diretory name * * makes sure the last character of the newly allocated * string it returns is a '/' * * Return value: a newly allocated gchar * dirname that does end on a '/' **/ gchar *ending_slash(const gchar *dirname) { if (!dirname) { return g_strdup(""); } if (dirname[strlen(dirname)-1] == DIRCHR) { return g_strdup(dirname); } else { return g_strconcat(dirname, DIRSTR, NULL); } } /** * path_get_dirname_with_ending_slash: * @filename: a #const gchar * with a file path * * returns a newly allocated string, containing everything up to * the last '/' character, including that character itself. * * if no '/' character is found it returns NULL * * Return value: a newly allocated gchar * dirname that does end on a '/', or NULL on failure **/ gchar *path_get_dirname_with_ending_slash(const gchar *filename) { gchar *tmp = strrchr(filename, DIRCHR); if (tmp) { return g_strndup(filename, (tmp - filename + 1)); } else { return NULL; } } /** * file_exists_and_readable: * @filename: a #const gchar * with a file path * * tests if the file exists, and if it is readable, the last * check is not reliable, it does not check all the groups you are * in, so change this function before you rely on that check! * * this function is Gnome-VFS aware, so it will work on URI's * * Return value: gboolean, TRUE if readable, else FALSE **/ gboolean file_exists_and_readable(const gchar * filename) { gchar *ondiskencoding; gboolean retval=TRUE; #ifdef DEVELOPMENT g_assert(filename); #endif if (!filename || strlen(filename) < 2) { DEBUG_MSG("file_exists_and_readable, strlen(filename) < 2 or no filename!!!!\n"); return FALSE; } DEBUG_MSG("file_exists_and_readable, filename(%p)=\"%s\", strlen(filename)=%d\n", filename, filename, strlen(filename)); /* BUG#98 */ if ( g_file_test(filename, G_FILE_TEST_IS_DIR) ) { return FALSE; } #ifndef WIN32 ondiskencoding = get_filename_on_disk_encoding(filename); DEBUG_MSG("file_exists_and_readable, ondiskencoding='%s'\n",ondiskencoding); { struct stat naamstat; errno = 0; retval = ((stat(ondiskencoding, &naamstat) == 0) && (errno == 0)); DEBUG_MSG("file_exists_and_readable, retval=%d (ernno=%d) for %s\n",retval,errno,ondiskencoding); } g_free(ondiskencoding); #endif /* WIN32 */ return retval; } /** * return_first_existing_filename: * @filename: a #const gchar * with a filename * @...: more filenames * * you can pass multiple filenames to this function, and it will return * the first filename that really exists according to file_exists_and_readable() * * Return value: gchar * with the first filename found **/ gchar *return_first_existing_filename(const gchar *filename, ...) { va_list args; gchar *retval=NULL; va_start(args, filename); while (filename) { if (file_exists_and_readable(filename)) { retval = g_strdup(filename); break; } filename = va_arg(args, gchar*); } va_end(args); return retval; } /** * filename_test_extensions: * @extensions: a #gchar ** NULL terminated arrau of strings * @filename: a #const gchar * with a filename * * tests if the filename matches one of the extensions passed in the NULL terminated array * of strings * * Return value: gboolean, TRUE if the file has one of the extensions in the array **/ gboolean filename_test_extensions(gchar **extensions, gchar *filename) { if (!extensions) { return FALSE; } while (*extensions) { if (strncmp(&filename[strlen(filename)-strlen(*extensions)], *extensions, strlen(*extensions)) == 0 ) { /* kyanh added then removed, g_print("File of type %s\n",*extensions); */ return TRUE; } extensions++; } return FALSE; } /** * bf_str_repeat: * @str: a #const gchar * * @number_of: a #gint * * returns a newly allocated string, * containing str repeated number_of times * * Return value: the newly allocated #gchar * **/ gchar *bf_str_repeat(const gchar * str, gint number_of) { gchar *retstr; gint len = strlen(str) * number_of; retstr = g_malloc(len + 1); retstr[0] = '\0'; while (number_of) { strncat(retstr, str, len); number_of--; }; return retstr; } /** * get_int_from_string: * @string: a #const gchar * * * tries to find a positive integer value in the string and returns it * the string does not have to start or end with the integer * it returns -1 if no integer was found somewhere in the string * * Return value: the found #gint, -1 on failure **/ gint get_int_from_string(gchar *string) { if (string) { gint faktor = 1, result=-1; gint i,len = strlen(string); for (i=len-1;i>=0;i--) { if ((string[i] < 58) && (string[i] > 47)) { if (result == -1) { result = 0; } else { faktor *= 10; } result += (((gint)string[i])-48)*faktor; DEBUG_MSG("get_int_from_string, set result to %d\n", result); } else { if (result !=-1) { return result; } } } return result; } return -1; } /** * create_secure_dir_return_filename: * * this function uses mkdir(name) to create a dir with permissions rwx------ * mkdir will fail if name already exists or is a symlink or something * the name is chosen by tempnam() so the chance that mkdir() fails in * a normal situation is minimal, it almost must be a hacking attempt * * the filename generated can safely be used for output of an external * script because the dir has rwx------ permissions * * Return value: a newly allocated #gchar * containing a temporary filename in a secure dir **/ /* kyanh, 20050301, used by outputbox.c and menu.c rewrite, use `mkstemp' instead of `tempnam' -- See man tempnam(3) */ gchar *create_secure_dir_return_filename() { /* gchar *name, *name2; */ /* DEBUG_MSG("create_secure_dir_return_filename,g_get_tmp_dir()=%s\n", g_get_tmp_dir()); */ /* it is SAFE to use tempnam() here, because we don't open a file with that name, * we create a directory with that name. mkdir() will FAIL if this name is a hardlink * or a symlink, so we DO NOT overwrite any file the link is pointing to */ /* kyanh, removed, 20050301, removed */ /* name = tempnam(g_get_tmp_dir(), NULL); DEBUG_MSG("create_secure_dir_return_filename, name=%s\n", name); if (!name) { return NULL; } if (mkdir(name, 0700) != 0) { g_free(name); return NULL; } name2 = tempnam(name, NULL); DEBUG_MSG("create_secure_dir_return_filename, name2=%s\n", name2); g_free(name); return name2; */ /* kyanh, 20050220 */ /* kyanh, uncommented-rewrote, 20050301 */ gchar *tmpstr; /* gchar *tmpdir = g_strdup(g_getenv("TMPDIR")); if (!tmpdir) { tmpdir = g_strdup(P_tmpdir); } */ /* g_get_tmp_dir(): The return value is never NULL. */ tmpstr = g_strdup_printf("%s/winefish-XXXXXX",g_get_tmp_dir()); /* g_free(tmpdir); */ if (mkstemp(tmpstr)) { unlink(tmpstr); /* for mkfifo() */ g_print("create_secure_dir_return_filename: return [%s]\n",tmpstr); /* g_print("P_tmpdir=%s\n", P_tmpdir); */ return tmpstr; }else{ g_free(tmpstr); return NULL; } } /** * remove_secure_dir_and_filename: * @filename: the #gchar * filename to remove * * this function will remove a the filename created * by create_secure_dir_return_filename(), and the safe * directory the file was created in * * Return value: void **/ void remove_secure_dir_and_filename(gchar *filename) { /*gchar *dirname = g_path_get_dirname(filename); */ unlink(filename); /*rmdir(dirname); g_free(dirname);*/ g_free(filename); } /* gchar *buf_replace_char(gchar *buf, gint len, gchar srcchar, gchar destchar) { gint curlen=0; gchar *tmpbuf=buf; while(tmpbuf[curlen] != '\0' && curlen < len) { if (tmpbuf[curlen] == srcchar) { tmpbuf[curlen] = destchar; } curlen++; } return buf; }*/ /** * wordcount: * @text: A #gchar* to examine. * @chars: #guint*, will contain no. chars in text. * @lines: #guint*, will contain no. lines in text. * @words: #guint*, will contain no. words in text. * * Returns number of characters, lines and words in the supplied #gchar*. * Handles UTF-8 correctly. Input must be properly encoded UTF-8. * Words are defined as any characters grouped, separated with spaces. * I.e., this is a word: "12a42a,.". This is two words: ". ." * * This function contains a switch() with inspiration from the GNU wc utility. * Rewritten for glib UTF-8 handling by Christian Tellefsen, chris@tellefsen.net. * * Note that gchar == char, so that gives us no problems here. * * Return value: void **/ void wordcount(gchar *text, guint *chars, guint *lines, guint *words) { guint in_word = 0; gunichar utext; if(!text) return; /* politely refuse to operate on NULL .. */ *chars = *words = *lines = 0; while (*text != '\0') { (*chars)++; switch (*text) { case '\n': (*lines)++; /* Fall through. */ case '\r': case '\f': case '\t': case ' ': case '\v': mb_word_separator: if (in_word) { in_word = 0; (*words)++; } break; default: utext = g_utf8_get_char_validated(text, 2); /* This might be an utf-8 char..*/ if (g_unichar_isspace (utext)) /* Unicode encoded space? */ goto mb_word_separator; if (g_unichar_isgraph (utext)) /* Is this something printable? */ in_word = 1; break; } /* switch */ text = g_utf8_next_char(text); /* Even if the current char is 2 bytes, this will iterate correctly. */ } /* Capture last word, if there's no whitespace at the end of the file. */ if(in_word) (*words)++; /* We start counting line numbers from 1 */ if(*chars > 0) (*lines)++; } GSList *gslist_from_glist(GList *src) { GSList *target=NULL; GList *tmplist = g_list_first(src); while (tmplist) { target = g_slist_append(target, tmplist->data); tmplist = g_list_next(tmplist); } return target; } GList *glist_from_gslist(GSList *src) { GList *target=NULL; GSList *tmplist = src; while (tmplist) { target = g_list_append(target, tmplist->data); tmplist = g_slist_next(tmplist); } return target; } winefish-1.3.3/src/outputbox_cfg.h0000600000047200004720000000102310366103606016155 0ustar kyanhkyanh#ifndef __OUTPUTBOX_CFG_H_ #define __OUTPUTBOX_CFG_H_ #include "config.h" /* kyanh's backend: <=== unmaintained !!! - good, but for *nix* only - trouble with dvips - require gtk2.2 - use `deprecated' functions: g_io_channel_* bluefish's backend: - good - TODO: better handling (OB_FETCHING) - require gtk2.4 */ /* #define __KA_BACKEND__ 1 */ #define __BF_BACKEND__ 1 #ifndef HAVE_ATLEAST_GTK_2_4 #undef __BF_BACKEND__ #define __KA_BACKEND__ 1 #endif /* HAVE_ATLEAST_GTK_2_4 */ #endif /* __OUTPUTBOX_CFG_H_ */ winefish-1.3.3/src/outputbox_bf.c0000600000047200004720000003327210407464642016021 0ustar kyanhkyanh/* $Id: outputbox_bf.c 2195 2006-03-20 08:36:50Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish) * external_commands.c - backend for external commands, filters and the outputbox * * Copyright (C) 2005 Olivier Sessink * Modified for Winefish (c) 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "outputbox_cfg.h" /*#define DEBUG*/ #ifdef __BF_BACKEND__ #include #include #include #include "config.h" #include "bluefish.h" #include "document.h" #include "bf_lib.h" #include "outputbox.h" #include "outputbox_filter.h" #include "outputbox_bf.h" #include "gtk_easy.h" /* * for the external commands, the external filters, and the outputbox, we have some general code * to create the command, and to start the command * * the external command is simple: it only needs formatting of the commandstring, and creation of any output files * for the outputbox, it needs the above, but also the output needs to go back to the outputbox widget * for filters it needs formatting of the commandstring, and the output should go to the text widget * */ static void start_command_backend(Texternalp *ep); static gint child_pid_exit_code; static void externalp_unref(Texternalp *ep) { ep->refcount--; DEBUG_MSG("externalp_unref, started for %p, refount=%d\n",ep,ep->refcount); if (ep->refcount <= 0) { DEBUG_MSG("externalp_unref, cleanup!\n"); if (ep->commandstring) g_free(ep->commandstring); if (ep->fifo_in) { unlink(ep->fifo_in); g_free(ep->fifo_in); } if (ep->fifo_out) { unlink(ep->fifo_out); g_free(ep->fifo_out); } if (ep->tmp_in) { unlink(ep->tmp_in); g_free(ep->tmp_in); } if (ep->tmp_out) { unlink(ep->tmp_out); g_free(ep->tmp_out); } if (ep->inplace) { unlink(ep->inplace); g_free(ep->inplace); } if (ep->buffer_out) g_free(ep->buffer_out); if (ep->securedir) { rmdir(ep->securedir); g_free(ep->securedir); } g_free(ep); finish_execute(ep->ob); } /*finish_execute(ep->ob);*/ /* BUG#70 */ } static gboolean start_command_write_lcb(GIOChannel *channel,GIOCondition condition,gpointer data) { Texternalp *ep = data; GIOStatus status; GError *error=NULL; gsize bytes_written=0; DEBUG_MSG("start_command_write_lcb, started, still %d bytes to go\n",strlen(ep->buffer_out_position)); status = g_io_channel_write_chars(channel,ep->buffer_out_position,-1,&bytes_written,&error); DEBUG_MSG("start_command_write_lcb, %d bytes written\n",bytes_written); ep->buffer_out_position += bytes_written; if (strlen(ep->buffer_out) <= (ep->buffer_out_position - ep->buffer_out)) { DEBUG_MSG("start_command_write_lcb, finished, shutting down channel\n"); g_io_channel_flush(channel,NULL); g_io_channel_shutdown(channel,TRUE,&error); /* TODO: g_io_channel_unref( ob->handle->channel_out ); */ if (ep->tmp_in) { start_command_backend(ep); } else { externalp_unref(ep); } return FALSE; } return TRUE; } static void spawn_setup_lcb(gpointer data) { Texternalp *ep = data; #ifndef WIN32 /* because win32 does not have both fork() and excec(), this function is not called in the child but in the parent on win32 */ if (ep->include_stderr) { dup2(STDOUT_FILENO,STDERR_FILENO); } #endif } /* watch for child_pid when it exists */ static void child_watch_lcb(GPid pid,gint status,gpointer data) { Texternalp *ep = data; DEBUG_MSG("child_watch_lcb, status=%d\n",status); /* if there was a temporary output file, we should now open it and start to read it */ if (ep->tmp_out) { ep->channel_out = g_io_channel_new_file(ep->tmp_out,"r",NULL); DEBUG_MSG("child_watch_lcb, created channel_out from file %s\n",ep->tmp_out); } else if (ep->inplace) { ep->channel_out = g_io_channel_new_file(ep->inplace,"r",NULL); DEBUG_MSG("child_watch_lcb, created channel_out from file %s\n",ep->inplace); } if (ep->tmp_out||ep->inplace){ ep->refcount++; g_io_channel_set_flags(ep->channel_out,G_IO_FLAG_NONBLOCK,NULL); g_io_channel_set_encoding( ep->channel_out, NULL, NULL ); /* kyanh, BUG#20 */ DEBUG_MSG("child_watch_lcb, add watch for channel_out\n"); g_io_add_watch(ep->channel_out, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP,ep->channel_out_lcb,ep->channel_out_data); } g_spawn_close_pid(pid); externalp_unref(ep); if ( WIFEXITED (status) ){ gint exitcode = WEXITSTATUS( status ); child_pid_exit_code = exitcode; }else{ child_pid_exit_code = -1; } } static void start_command_backend(Texternalp *ep) { gchar *argv[4]; gint standard_input=0,standard_output=0; GError *error=NULL; gchar *tmpstr; argv[0] = "/bin/sh"; argv[1] = "-c"; argv[2] = ep->commandstring; argv[3] = NULL; if (ep->fifo_in) { if (mkfifo(ep->fifo_in, 0600) != 0) { tmpstr = g_strdup_printf(_("some error happened creating fifo %s"),ep->fifo_in); outputbox_message(ep->ob, tmpstr, OB_MESSAGE_RED); g_free(tmpstr); return; } DEBUG_MSG("start_command, created fifo %s\n",ep->fifo_in); } if (ep->fifo_out) { if (mkfifo(ep->fifo_out, 0600) != 0) { tmpstr = g_strdup_printf(_("some error happened creating fifo %s"),ep->fifo_out); outputbox_message(ep->ob, tmpstr, OB_MESSAGE_RED); g_free(tmpstr); return; } } #ifdef WIN32 ep->include_stderr = FALSE; #endif DEBUG_MSG("start_command, pipe_in=%d, pipe_out=%d, fifo_in=%s, fifo_out=%s,include_stderr=%d\n",ep->pipe_in,ep->pipe_out,ep->fifo_in,ep->fifo_out,ep->include_stderr); DEBUG_MSG("start_command, about to spawn process /bin/sh -c %s\n",argv[2]); g_spawn_async_with_pipes(NULL,argv,NULL,G_SPAWN_DO_NOT_REAP_CHILD,(ep->include_stderr)?spawn_setup_lcb:NULL,ep,&ep->child_pid, (ep->pipe_in) ? &standard_input : NULL, (ep->pipe_out) ? &standard_output : NULL, NULL,&error); ep->refcount++; g_child_watch_add(ep->child_pid,child_watch_lcb,ep); if (error) { DEBUG_MSG("start_command, there is an error!!\n"); } if (ep->pipe_in) { ep->channel_in = g_io_channel_unix_new(standard_input); } else if (ep->fifo_in) { DEBUG_MSG("start_command, connecting channel_in to fifo %s\n",ep->fifo_in); ep->channel_in = g_io_channel_new_file(ep->fifo_in,"w",NULL); } if (ep->pipe_in || ep->fifo_in) { ep->refcount++; ep->buffer_out = ep->buffer_out_position = doc_get_chars(OUTPUTBOX(ep->ob)->bfwin->current_document,0,-1); g_io_channel_set_flags(ep->channel_in,G_IO_FLAG_NONBLOCK,NULL); /* now we should start writing, correct ? */ DEBUG_MSG("start_command, add watch for channel_in\n"); g_io_channel_set_encoding( ep->channel_in, NULL, NULL ); /* kyanh, BUG#20 */ g_io_add_watch(ep->channel_in,G_IO_OUT,start_command_write_lcb,ep); } if (ep->pipe_out) { ep->channel_out = g_io_channel_unix_new(standard_output); DEBUG_MSG("start_command, created channel_out from pipe\n"); } else if (ep->fifo_out) { ep->channel_out = g_io_channel_new_file(ep->fifo_out,"r",NULL); DEBUG_MSG("start_command, created channel_out from fifo %s\n",ep->fifo_out); } if (ep->channel_out_lcb && (ep->pipe_out || ep->fifo_out)) { ep->refcount++; g_io_channel_set_flags(ep->channel_out,G_IO_FLAG_NONBLOCK,NULL); DEBUG_MSG("start_command, add watch for channel_out\n"); g_io_channel_set_encoding( ep->channel_out, NULL, NULL ); /* kyanh, BUG#20 */ g_io_add_watch(ep->channel_out, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP,ep->channel_out_lcb,ep->channel_out_data); OUTPUTBOX(ep->ob)->OB_FETCHING = OB_GO_FETCHING; } } static void start_command(Texternalp *ep) { if (ep->tmp_in) { /* first create tmp_in, then start the real command in the callback */ ep->channel_in = g_io_channel_new_file(ep->tmp_in,"w",NULL); ep->buffer_out = ep->buffer_out_position = doc_get_chars(OUTPUTBOX(ep->ob)->bfwin->current_document,0,-1); g_io_channel_set_flags(ep->channel_in,G_IO_FLAG_NONBLOCK,NULL); DEBUG_MSG("start_command, add watch for channel_in\n"); g_io_channel_set_encoding( ep->channel_in, NULL, NULL ); /* kyanh, BUG#20 */ g_io_add_watch(ep->channel_in,G_IO_OUT,start_command_write_lcb,ep); } else { start_command_backend(ep); } } static gboolean outputbox_io_watch_lcb(GIOChannel *channel,GIOCondition condition,gpointer data) { Texternalp *ep = data; Toutputbox *ob = OUTPUTBOX(ep->ob); switch (ob->OB_FETCHING) { case OB_GO_FETCHING: break; case OB_IS_FETCHING: DEBUG_MSG("outputbox_io_watch_lcb: fetching. Return now.\n"); return FALSE; break; /* never reach here */ case OB_STOP_REQUEST: DEBUG_MSG("outputbox_io_watch_lcb: stop request. Call finish_execute()...\n"); finish_execute(ep->ob); return FALSE; break; default: DEBUG_MSG("outputbox_io_watch_lcb: stoppped flag. return. fetching=%d\n", ob->OB_FETCHING); return FALSE; break; } ob->OB_FETCHING = OB_IS_FETCHING; DEBUG_MSG("outputbox_io_watch_lcb, called with condition %d\n",condition); if (condition & G_IO_IN) { gchar *buf=NULL; gsize buflen=0,termpos=0; GError *error=NULL; GIOStatus status = g_io_channel_read_line(channel,&buf,&buflen,&termpos,&error); while ((status == G_IO_STATUS_NORMAL) && (ob->OB_FETCHING == OB_IS_FETCHING)) { if (buflen > 0) { if (termpos < buflen) buf[termpos] = '\0'; outputbox_filter_line(ep->ob, buf); g_free(buf); } if (ep->child_pid) { status = g_io_channel_read_line(channel,&buf,&buflen,&termpos,&error); }else{ ob->OB_FETCHING = OB_IS_READY; /* tool is already stopped */ } } if (status == G_IO_STATUS_EOF) { ob->OB_FETCHING = OB_STOP_REQUEST; finish_execute(ep->ob); return FALSE; } } if (condition & G_IO_OUT) { DEBUG_MSG("outputbox_io_watch_lcb, condition %d G_IO_OUT not handled\n",condition); } if (condition & G_IO_PRI) { DEBUG_MSG("outputbox_io_watch_lcb, condition %d G_IO_PRI not handled\n",condition); } if (condition & G_IO_ERR) { DEBUG_MSG("outputbox_io_watch_lcb, condition %d G_IO_ERR not handled\n",condition); } if (condition & G_IO_HUP) { DEBUG_MSG("outputbox_io_watch_lcb, condition %d G_IO_HUP\n",condition); ob->OB_FETCHING = OB_STOP_REQUEST; finish_execute(ep->ob); return FALSE; } if (condition & G_IO_NVAL) { DEBUG_MSG("outputbox_io_watch_lcb, condition %d G_IO_NVAL not handled\n",condition); } if (ob->OB_FETCHING == OB_IS_FETCHING) { ob->OB_FETCHING = OB_GO_FETCHING; } return TRUE; } void run_command(Toutputbox *ob) { DEBUG_MSG("run_command, ==================================\n"); /*if ( ob->bfwin->current_document->filename ) {*/ { gchar * tmpstring; if ( ob->bfwin->project && ( ob->bfwin->project->view_bars & MODE_PROJECT ) && ob->bfwin->project->basedir ) { tmpstring = g_strdup( ob->bfwin->project->basedir ); } else { if (ob->bfwin->current_document->filename) { tmpstring = g_path_get_dirname( ob->bfwin->current_document->filename ); }else{ tmpstring = g_strdup("."); } } /* outputbox_message(ob, g_strconcat("> working dir: ", tmpstring, NULL)); */ chdir( tmpstring ); g_free( tmpstring ); } Texternalp *ep; /* menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), TRUE); */ outputbox_set_status(ob, TRUE, FALSE); ep = g_new0(Texternalp,1); /* ep->formatstring = formatstring; */ ep->commandstring = convert_command(ob->bfwin,ob->def->command); if (!ep->commandstring) { /**/ g_free( ob->def->pattern ); pcre_free(ob->def->pcre_c); pcre_free(ob->def->pcre_s); g_free( ob->def->command ); g_free( ob->def ); /**/ g_free(ep); /* BUG: is the user notified of the error ?*/ return; } outputbox_message( ob, ep->commandstring, OB_MESSAGE_BLUE); ep->pipe_out = TRUE; ep->include_stderr = TRUE; ep->channel_out_lcb = outputbox_io_watch_lcb; ep->channel_out_data = ep; ob->handle = ep; ep->ob = ob; start_command(ep); /* } else { ob->OB_FETCHING = OB_IS_READY; outputbox_message( ob, _("tool canceled."), "b" ); } */ } static gboolean finish_execute_called = FALSE; void finish_execute( Toutputbox *ob ) { if ((ob->handle->child_pid == 0) || finish_execute_called) { DEBUG_MSG("finish_execute: entering... refused.\n"); return; }else{ finish_execute_called = TRUE; DEBUG_MSG("finish_execute: entering... okay.\n"); } if (!(ob->OB_FETCHING == OB_IS_STOPPED)) { ob->OB_FETCHING = OB_IS_STOPPED; g_io_channel_flush(ob->handle->channel_out,NULL); g_io_channel_shutdown(ob->handle->channel_out,TRUE/*flush*/,NULL); g_io_channel_unref( ob->handle->channel_out ); if ( child_pid_exit_code > -1 ) { gchar *str_status = g_strdup_printf(_("exit code: %d"), child_pid_exit_code); if (child_pid_exit_code) { outputbox_message( ob, str_status, OB_MESSAGE_RED ); }else{ outputbox_message( ob, str_status, OB_MESSAGE_BLUE ); } g_free( str_status ); } else { outputbox_message( ob, _("the child process exited abnormally"), OB_MESSAGE_RED); } } /**/ ob->basepath_cached_color = FALSE; g_free( ob->basepath_cached ); g_free( ob->def->pattern ); pcre_free(ob->def->pcre_c); pcre_free(ob->def->pcre_s); g_free( ob->def->command ); g_free( ob->def ); /**/ /* menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), FALSE); */ outputbox_set_status(ob, FALSE, FALSE); ob->handle->child_pid = 0; ob->OB_FETCHING = OB_IS_READY; finish_execute_called = FALSE; gtk_tree_view_columns_autosize( GTK_TREE_VIEW( ob->lview ) ); } #endif /* __BF_BACKEND__ */ winefish-1.3.3/src/bf_lib.h0000600000047200004720000000752010373411041014503 0ustar kyanhkyanh/* $Id: bf_lib.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * bf_lib.h - non-GUI general functions * * Copyright (C) 2000-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BF_LIB_H_ #define __BF_LIB_H_ typedef struct { gint my_int; gchar *my_char; } Tconvert_table; typedef enum { tcc2i_full_match = 0, tcc2i_firstchar, tcc2i_mycharlen, tcc2i_full_match_gettext } Ttcc2i_mode; gchar *get_filename_on_disk_encoding(const gchar *utf8filename); gchar *get_utf8filename_from_on_disk_encoding(const gchar *encodedname); gboolean string_is_color(const gchar *color); gchar *filemode_to_string(mode_t statmode); gchar *return_root_with_protocol(const gchar *url); void pointer_switch_addresses(gpointer *a, gpointer *b); void list_switch_order(GList *first, GList *second); gboolean file_copy(gchar *source, gchar *dest); gint find_common_prefixlen_in_stringlist(GList *stringlist); gboolean append_string_to_file(gchar *filename, gchar *string); gint table_convert_char2int(Tconvert_table *table, const gchar *my_char, Ttcc2i_mode mode); gchar *table_convert_int2char(Tconvert_table *table, gint my_int); gchar *expand_string(const gchar *string, const char specialchar, Tconvert_table *table); gchar *unexpand_string(const gchar *original, const char specialchar, Tconvert_table *table); gchar *replace_string_printflike(const gchar *string, Tconvert_table *table); gchar *unescape_string(const gchar *original, gboolean escape_colon); gchar *escape_string(const gchar *original, gboolean escape_colon); Tconvert_table *new_convert_table(gint size, gboolean fill_standardescape); void free_convert_table(Tconvert_table *tct); /* kyanh, added, 20050223 */ gchar *convert_command(Tbfwin *bfwin, const gchar *command); #define utf8_byteoffset_to_charsoffset(string,byteoffset) g_utf8_pointer_to_offset(string, string+byteoffset) /*glong utf8_byteoffset_to_charsoffset(gchar *string, glong byteoffset);*/ void utf8_offset_cache_reset(); guint utf8_byteoffset_to_charsoffset_cached(gchar *string, glong byteoffset); gchar *strip_any_whitespace(gchar *string); gchar *trunc_on_char(gchar * string, gchar which_char); gchar *strip_common_path(char *to_filename, char *from_filename); gchar *most_efficient_filename(gchar *filename); gchar *create_relative_link_to(gchar * current_filepath, gchar * link_to_filepath); gchar *create_full_path(const gchar * filename, const gchar *basedir); gchar *ending_slash(const gchar *dirname); gchar *path_get_dirname_with_ending_slash(const gchar *filename); gboolean file_exists_and_readable(const gchar * filename); gchar *return_first_existing_filename(const gchar * filename, ...); gboolean filename_test_extensions(gchar **extensions, gchar *filename); gchar *bf_str_repeat(const gchar * str, gint number_of); gint get_int_from_string(gchar *string); gchar *create_secure_dir_return_filename(); void remove_secure_dir_and_filename(gchar *filename); /*gchar *buf_replace_char(gchar *buf, gint len, gchar srcchar, gchar destchar);*/ void wordcount(gchar *text, guint *chars, guint *lines, guint *words); GList *glist_from_gslist(GSList *src); #endif /* __BF_LIB_H_ */ winefish-1.3.3/src/filebrowser.c0000600000047200004720000023062610375350210015613 0ustar kyanhkyanh/* $Id: filebrowser.c 1984 2006-02-17 13:32:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * filebrowser.c the filebrowser * * Copyright (C) 2002-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ /* ******* NEW FILEBROWSER DESIGN ******** I'm thinking about a new design for the filebrowser, the code is too complicated right now. For now I'll just write some thoughts, so after we have the next stable releae we can implement it. we'll drop the one-pane-view, we'll only have the files and directories separate the public API: -------------- GtkWidget *fb2_init(Tbfwin *bfwin); void fb2_cleanup(Tbfwin *bfwin); void fb2_set_basedir(Tbfwin *bfwin, gchar *basedir); void fb2_focus_document(Tbfwin *bfwin, Tdocument *doc); -------------- in the treemodel for the directories, we'll have two columns. A visible column (with the name), and a column with the full path, so if a click on an item is done, it is very easy to see which full path corresponds to that item. to make 'focus document' very easy, each document can have a GtkTreeIter pointing to the directory where the file located. If it does not have the treeiter, the document has not been focused before (so it is not required to have a treeiter for every document). the most difficult thing to code now is when we for example open a new file, we'll have to find which directory item corresponds to that filename, and if it is not yet there, we'll have to find where we should add it. Same for a document that has not been focused before. A possibility to do this is to have a hashtable with TreeIters to each directory that is already in the tree. If you then want to open some directory, you check the full path in the hashtable, if not exists you remove the last directory component, check again etc. until you have found a position in the tree where you can add things. USER INTERFACE NOTES: each directory should be expandable by default (so have a dummy item) unless we know there are no subdirectories (and not the other way around like it is right now) */ #include #include /* stat() getuid */ #include /* stat() */ #include /* stat() getuid */ #include /*strchr() */ #include /* rename() */ #include /* atoi() */ #include "bluefish.h" #include "filebrowser.h" #include "bf_lib.h" #include "document.h" #include "gtk_easy.h" /* *_dialog(), flush_queue() */ #include "gui.h" /* statusbar_message() */ #include "image.h" /* image_insert_from_filename() */ #include "menu.h" /* translation */ #include "project.h" /* project_open_from_file() */ #include "stringlist.h" /* count_array() */ #include "func_grep.h" /* open_advanced_from_filebrowser */ /*#define DEBUG_SORTING #define DEBUG_FILTER #define DEBUG_ADDING_TO_TREE*/ #define FILEBROWSER(var) ((Tfilebrowser *)(var)) #define FILEBROWSERCONFIG(var) ((Tfilebrowserconfig *)(var)) enum { TYPE_DIR, TYPE_FILE }; enum { PIXMAP_COLUMN, FILENAME_COLUMN, N_COLUMNS }; typedef struct { gchar *name; gboolean mode; /* 0= hide matching files, 1=show matching files */ GList *filetypes; /* if NULL all files are OK */ } Tfilter; typedef struct { gchar *name; struct stat stat; gint type; gboolean has_widget; GdkPixbuf *icon; } Tdir_entry; /* the Tfilebbrowser is specific for every bfwin, * it is located at FILEBROWSER(bfwin->filebrowser) * * the filebrowser is initialised if both bfwin->filebrowser * and filebrowser->tree are non-NULL pointers * * the tree2 and store2 pointers are only used if the two-paned filebrowser * is chosen in the config * * the basedir pointer might be NULL if no basedir is set, if so * the showfulltree widget should be set insensitive * * if the basedir is set, the state of the toggle widget showfulltree * can be used to find if the basedir should be used */ typedef struct { Tfilter *curfilter; GtkWidget *tree; GtkTreeStore *store; GtkWidget *tree2; GtkListStore *store2; GtkWidget *dirmenu; GtkWidget *showfulltree; GtkWidget *focus_follow; GList *dirmenu_entries; gchar *last_opened_dir; /* SHOULD end on a '/' */ gboolean last_popup_on_dir; Tbfwin *bfwin; gchar *basedir; } Tfilebrowser; /* the Tfilebrowserconfig is only once present in the Bluefish memory, located * at FILEBROWSERCONFIG(main_v->filebrowserconfig) * * it contains the filters and the filetypes with their icons */ typedef struct { GdkPixbuf *unknown_icon; GdkPixbuf *dir_icon; GList *filters; GList *filetypes_with_icon; } Tfilebrowserconfig; /***********************************************************************************/ /* some functions need to be referenced before they are declared*/ static void row_expanded_lcb(GtkTreeView *tree,GtkTreeIter *iter,GtkTreePath *path,Tfilebrowser *filebrowser); static void populate_dir_history(Tfilebrowser *filebrowser,gboolean firsttime, gchar *activedir); #ifdef DEBUG void DEBUG_DUMP_TREE_PATH(GtkTreePath *path) { if (path) { gchar *tmpstr = gtk_tree_path_to_string(path); DEBUG_MSG("path='%s'\n", tmpstr); g_free(tmpstr); } else { DEBUG_MSG("path=NULL\n"); } } #else #define DEBUG_DUMP_TREE_PATH(path) /**/ #endif /* DEBUG */ /* returns TRUE if there is no basedir, or if the file is indeed in the basedir, else returns FALSE */ static gboolean path_in_basedir(Tfilebrowser *filebrowser, const gchar *path) { if (!filebrowser->basedir || strncmp(filebrowser->basedir, path, strlen(filebrowser->basedir))==0) { return TRUE; } return FALSE; } /* MODIFIES THE ITER POINTER TO BY 'found' !!!!!!!! */ static gboolean get_iter_by_filename_from_parent(GtkTreeStore *store, GtkTreeIter *parent, GtkTreeIter *found, gchar *filename) { gboolean valid; GtkTreeIter iter; valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(store),&iter,parent); while (valid) { gchar *name; gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILENAME_COLUMN, &name, -1); DEBUG_MSG("get_iter_by_filename_from_parent, comparing '%s' and '%s'\n",name,filename); if (strcmp(name, filename)==0) { *found = iter; DEBUG_MSG("get_iter_by_filename_from_parent, found!!\n"); g_free(name); return TRUE; } valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); g_free(name); } DEBUG_MSG("get_iter_by_filename_from_parent, NOT found..\n"); return FALSE; } static gchar *return_filename_from_path(Tfilebrowser *filebrowser, GtkTreeModel *store,const GtkTreePath *thispath) { gboolean valid = TRUE; gchar *retval = NULL, *tmp; gboolean showfulltree = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filebrowser->showfulltree)); GtkTreePath *path = gtk_tree_path_copy(thispath); DEBUG_MSG("return_filename_from_path, "); DEBUG_DUMP_TREE_PATH(path); if (!path) { return NULL; } while (valid) { gchar *name = NULL, *tmpstr; GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(store),&iter,path); gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, FILENAME_COLUMN, &name, -1); tmpstr = gtk_tree_path_to_string(path); DEBUG_MSG("return_filename_from_path, path='%s' contains '%s'\n", tmpstr, name); g_free(tmpstr); if (!showfulltree && filebrowser->basedir && strcmp(name, filebrowser->basedir) == 0) { tmp = retval; retval = g_strconcat(name, retval,NULL); g_free(tmp); DEBUG_MSG("return_filename_from_path, found the root (%s ?), retval=%s\n", name,retval); valid = FALSE; } else if ((showfulltree || filebrowser->basedir == NULL) && name[strlen(name)-1]=='/') { /* found the root or protocol/server */ tmp = retval; retval = g_strconcat(name, retval,NULL); g_free(tmp); DEBUG_MSG("return_filename_from_path, found the root (%s ?), retval=%s\n", name,retval); valid = FALSE; } else { tmp = retval; if (retval) { retval = g_strconcat(name, "/", retval,NULL); } else { retval = g_strdup(name); } g_free(tmp); DEBUG_MSG("return_filename_from_path, added a file or directory component %s, retval=%s\n",name,retval); valid = gtk_tree_path_up(path); } g_free(name); } gtk_tree_path_free(path); DEBUG_MSG("return_filename_from_path, returning %s\n",retval); return retval; } static gboolean view_filter(Tfilebrowser *filebrowser, Tdir_entry *entry) { if (!main_v->props.filebrowser_show_hidden_files) { if (entry->name[0] == '.') { #ifdef DEBUG_FILTER DEBUG_MSG("view_filter, hidden file %s\n", entry->name); #endif return FALSE; } } if (entry->type == TYPE_DIR) { /* all other filter types don't apply to directories */ return TRUE; } if (!main_v->props.filebrowser_show_backup_files) { if (entry->name[strlen(entry->name)-1] == '~') { #ifdef DEBUG_FILTER DEBUG_MSG("view_filter, backup file %s\n", entry->name); #endif return FALSE; } } { gboolean default_retval; GList *tmplist; if (filebrowser->curfilter && filebrowser->curfilter->filetypes && filebrowser->curfilter->mode == 1) { /* there is some filter active, set the default to FALSE except if we find the extension */ tmplist = g_list_first(filebrowser->curfilter->filetypes); default_retval = FALSE; } else { if (filebrowser->curfilter && filebrowser->curfilter->filetypes) { /* mode == 0, hide certain files */ tmplist = g_list_first(filebrowser->curfilter->filetypes); while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; if (filename_test_extensions(filetype->extensions, entry->name)) { return FALSE; } tmplist = g_list_next(tmplist); } } /* everything that comes here only needs the icon */ tmplist = g_list_first(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filetypes_with_icon); default_retval = TRUE; } while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; if (filename_test_extensions(filetype->extensions, entry->name)) { entry->icon = filetype->icon; return TRUE; } tmplist = g_list_next(tmplist); } return default_retval; } } static gboolean find_name_in_dir_entries(GList *list, gchar *name) { GList *tmplist; tmplist = g_list_first(list); while (tmplist) { Tdir_entry *entry = (Tdir_entry *)tmplist->data; if (strcmp(entry->name, name)==0) { entry->has_widget = TRUE; return TRUE; } tmplist = g_list_next(tmplist); } return FALSE; } static GList *return_dir_entries(Tfilebrowser *filebrowser,gchar *dirname) { GDir *dir; GList *tmplist=NULL; Tdir_entry *entry; const gchar *name; gchar *ode_dirname = get_filename_on_disk_encoding(dirname); dir = g_dir_open(ode_dirname, 0, NULL); while ((name = g_dir_read_name(dir))) { gchar *fullpath; entry = g_new(Tdir_entry,1); entry->icon = NULL; entry->name = get_utf8filename_from_on_disk_encoding(name); fullpath = g_strconcat(ode_dirname, "/", entry->name, NULL); stat(fullpath, &entry->stat); g_free(fullpath); if (S_ISDIR(entry->stat.st_mode)) { entry->type = TYPE_DIR; } else { entry->type = TYPE_FILE; } if (!view_filter(filebrowser,entry)) { /* free entry */ g_free(entry->name); g_free(entry); } else { entry->has_widget = FALSE; tmplist = g_list_append(tmplist, entry); } } g_dir_close(dir); g_free(ode_dirname); return tmplist; } static void free_dir_entries(GList *direntrylist) { GList *tmplist = g_list_first(direntrylist); while (tmplist) { g_free(((Tdir_entry *)(tmplist->data))->name); g_free(tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(direntrylist); } static GtkTreePath *return_path_from_filename(Tfilebrowser *filebrowser,gchar *this_filename) { gchar *tmpstr, *p, *filepath; gint totlen, curlen, prevlen=1; gboolean found=TRUE; gboolean showfulltree = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filebrowser->showfulltree)); GtkTreeStore *store = filebrowser->store; GtkTreeIter iter,parent; gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); parent = iter; if (showfulltree) { /* the first thing we do is that we try to find the root element where this filename should belong to */ gchar *root = return_root_with_protocol(this_filename); DEBUG_MSG("return_path_from_filename, root=%s\n",root); if (root && root[0] != '/') { DEBUG_MSG("return_path_from_filename, the root is an URL\n"); /* we have an URL like sftp:// or http:// or something like that */ found = FALSE; while (!found && gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)) { gchar *found_root; gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILENAME_COLUMN, &found_root, -1); DEBUG_MSG("return_path_from_filename, searching for the root, comparing %s and %s\n",root,found_root); if (strcmp(found_root, root)==0) { /* we found the root for this protocol/server */ parent = iter; prevlen = strlen(root); found = TRUE; DEBUG_MSG("return_path_from_filename, we found '%s'!\n",found_root); } g_free(found_root); } if (found && strcmp(root, this_filename)==0) { /* we are looking for the root!! */ g_free(root); DEBUG_MSG("return_path_from_filename, 'this_filename' and 'root' are equal! return the GtkTreePath for 'found_root'\n"); return gtk_tree_model_get_path(GTK_TREE_MODEL(store),&parent); } g_free(root); } else { DEBUG_MSG("return_path_from_filename, the root is local\n"); g_free(root); /* it is a local file, that normally means that we can use the first toplevel node in the tree */ if (!showfulltree && filebrowser->basedir) { gint basedirlen = strlen(filebrowser->basedir); gint thislen = strlen(this_filename); DEBUG_MSG("return_path_from_filename, basedirlen=%d, strlen(filename)=%d\n",basedirlen,thislen); if (thislen == basedirlen && strcmp(this_filename, filebrowser->basedir)==0) { /* we are looking for the basedir itself */ return gtk_tree_model_get_path(GTK_TREE_MODEL(store),&parent); } else if ((strlen(this_filename)>basedirlen) && (strncmp(filebrowser->basedir, this_filename, basedirlen)==0)) { prevlen = strlen(filebrowser->basedir); } else { DEBUG_MSG("return_path_from_filename, the path is outside the current basedir?!?\n"); found = FALSE; } } } } else { /* there is no showfulltree */ if (filebrowser->basedir) { gint basedirlen = strlen(filebrowser->basedir); if (strncmp(this_filename,filebrowser->basedir,basedirlen)==0) { prevlen = strlen(filebrowser->basedir); } else { DEBUG_MSG("return_path_from_filename, file %s is not in basedir %s, return NULL\n",this_filename,filebrowser->basedir); return NULL; } } } totlen = strlen(this_filename); filepath = g_strdup(this_filename); p = strchr(&filepath[prevlen], '/'); if (p) { curlen = strlen(p); } else { curlen = prevlen; } DEBUG_MSG("return_path_from_filename, filepath=%s\n",filepath); while (p && found) { gboolean valid; found = FALSE; curlen = strlen(p); tmpstr = g_strndup(&filepath[prevlen], (totlen - curlen - prevlen)); /* now search for this dirname */ DEBUG_MSG("return_path_from_filename, searching for '%s'\n",tmpstr); valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(store),&iter,&parent); while (valid) { gchar *found_name; gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILENAME_COLUMN, &found_name, -1); DEBUG_MSG("return_path_from_filename, comparing %s and %s\n", found_name, tmpstr); if (strcmp(found_name, tmpstr)==0) { /* we found the node!!, make this node the next parent */ found = TRUE; parent = iter; g_free(found_name); break; } valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); g_free(found_name); } g_free(tmpstr); prevlen = (totlen - curlen+1); p = strchr(&filepath[prevlen], '/'); } g_free(filepath); if (found) { DEBUG_MSG("return_path_from_filename, we DID found the path, return a path\n"); return gtk_tree_model_get_path(GTK_TREE_MODEL(store),&iter); } else { DEBUG_MSG("return_path_from_filename, we did NOT found the path, return NULL\n"); return NULL; } } static int comparefunc(GtkTreeModel *store, gchar *name, GtkTreeIter *iter, const gchar *text, gint type) { #ifdef DEBUG_SORTING DEBUG_MSG("comparefunc, comparing %s and %s\n", name, text); #endif gboolean iter_is_dir; iter_is_dir = gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), iter); if (type == TYPE_DIR) { if (iter_is_dir) { return strcmp(name, text); } else { return 1; } } else { if (iter_is_dir) { return -1; } else { return strcmp(name, text); } } } static gboolean get_iter_at_correct_position(GtkTreeModel *store, GtkTreeIter *parent, GtkTreeIter *iter, const gchar *text, gint type, gboolean two_paned) { gint num_children, jumpsize, child, possible_positions; gchar *name; DEBUG_MSG("get_iter_at_correct_position, started, parent=%p, two_paned=%d\n",parent,two_paned); /* if parent=NULL it will return the top level, which is correct for the liststore */ num_children = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent); if (num_children == 0) { DEBUG_MSG("get_iter_at_correct_position, 0 children so we return FALSE\n"); return FALSE; } possible_positions = num_children+1; jumpsize = (possible_positions+1)/2; child = possible_positions - jumpsize; #ifdef DEBUG_SORTING DEBUG_MSG("get_iter_at_correct_position, num_children=%d, jumpsize=%d\n", num_children, jumpsize); #endif if (num_children == 1) { gint compare; /* if parent=NULL it will return the child from the toplevel which is correct for the liststore */ gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, parent, 0); gtk_tree_model_get(GTK_TREE_MODEL(store),iter,FILENAME_COLUMN,&name, -1); if (parent == NULL || two_paned) { compare = strcmp(name,text); } else { compare = comparefunc(store, name, iter, text, type); } g_free(name); if (compare == 0) { return FALSE; } else if (compare < 0) { return FALSE; } else { return TRUE; } } while (jumpsize > 0) { gint compare; if (child > num_children) child = num_children; if (child < 1) child = 1; #ifdef DEBUG_SORTING DEBUG_MSG("get_iter_at_correct_position, compare %d\n", child); #endif gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, parent, child-1); gtk_tree_model_get(GTK_TREE_MODEL(store),iter,FILENAME_COLUMN,&name, -1); if (parent == NULL || two_paned) { compare = strcmp(name,text); } else { compare = comparefunc(store, name, iter, text, type); } g_free(name); if (compare == 0) { return TRUE; } else if (compare > 0) { jumpsize = (jumpsize > 3) ? (jumpsize+1)/2 : jumpsize-1; child = child - jumpsize; } else { jumpsize = (jumpsize > 3) ? (jumpsize+1)/2 : jumpsize-1; child = child + jumpsize; if (jumpsize<=0) { #ifdef DEBUG_SORTING DEBUG_MSG("get_iter_at_correct_position, jumpsize too small and compare negative --> next iter\n"); #endif return gtk_tree_model_iter_next(GTK_TREE_MODEL(store), iter); } } #ifdef DEBUG_SORTING DEBUG_MSG("get_iter_at_correct_position, compare=%d, jumpsize=%d, child=%d\n", compare, jumpsize, child); #endif } return TRUE; } static GtkTreeIter add_tree_item(GtkTreeIter *parent, Tfilebrowser *filebrowser, const gchar *text, gint type, GdkPixbuf *pixbuf) { GtkTreeIter iter1, iter2; DEBUG_MSG("add_tree_item, started for %s\n",text); if (!pixbuf) { if (type == TYPE_DIR) { pixbuf = FILEBROWSERCONFIG(main_v->filebrowserconfig)->dir_icon; } else { pixbuf = FILEBROWSERCONFIG(main_v->filebrowserconfig)->unknown_icon; } } if (type == TYPE_FILE && filebrowser->store2 && parent==NULL) { if (get_iter_at_correct_position(GTK_TREE_MODEL(filebrowser->store2),parent,&iter2,text,type,TRUE)) { DEBUG_MSG("add_tree_item, inserting %s in store2\n", text); gtk_list_store_insert_before(GTK_LIST_STORE(filebrowser->store2),&iter1,&iter2); } else { DEBUG_MSG("add_tree_item, appending %s in store2\n", text); gtk_list_store_append(GTK_LIST_STORE(filebrowser->store2),&iter1); } gtk_list_store_set(GTK_LIST_STORE(filebrowser->store2),&iter1, PIXMAP_COLUMN, pixbuf, FILENAME_COLUMN, text, -1); } else { if (get_iter_at_correct_position(GTK_TREE_MODEL(filebrowser->store),parent,&iter2,text,type,(filebrowser->store2 != NULL))) { #ifdef DEBUG DEBUG_MSG("add_tree_item, inserting %s in store1\n", text); #endif gtk_tree_store_insert_before(GTK_TREE_STORE(filebrowser->store),&iter1,parent,&iter2); } else { #ifdef DEBUG DEBUG_MSG("add_tree_item, appending %s in store1\n", text); #endif gtk_tree_store_append(GTK_TREE_STORE(filebrowser->store), &iter1, parent); } gtk_tree_store_set(GTK_TREE_STORE(filebrowser->store), &iter1, PIXMAP_COLUMN, pixbuf, FILENAME_COLUMN, text, -1); } return iter1; } static void refresh_dir_by_path_and_filename(Tfilebrowser *filebrowser, GtkTreePath *thispath, gchar *filename) { GList *direntrylist; gboolean valid, remove_dot = FALSE; GtkTreeIter myiter, remove_dot_iter; #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("refresh_dir_by_path_and_filename, filename='%s'\n", filename); #endif if (filebrowser->last_opened_dir) g_free(filebrowser->last_opened_dir); filebrowser->last_opened_dir = ending_slash(filename); populate_dir_history(filebrowser,FALSE, filebrowser->last_opened_dir); direntrylist = return_dir_entries(filebrowser,filename); { GtkTreePath *path = gtk_tree_path_copy(thispath); DEBUG_DUMP_TREE_PATH(path); gtk_tree_path_down(path); valid = gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store),&myiter,path); gtk_tree_path_free(path); } while (valid) { gchar *name; gtk_tree_model_get(GTK_TREE_MODEL(filebrowser->store), &myiter, 1, &name, -1); if (!find_name_in_dir_entries(direntrylist, name)) { if (direntrylist == NULL && strcmp(name, ".")==0) { #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("refresh_dir_by_path_and_filename, not removing fake entry for empty \n"); #endif valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store), &myiter); } else { if (strcmp(name, ".")==0) { /* the dot entry is removed as last one, because the rows fail expanding if they are emptied on the way*/ remove_dot_iter = myiter; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store), &myiter); remove_dot = TRUE; } else { GtkTreeIter myiter2 = myiter; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store), &myiter); #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("refresh_dir_by_path_and_filename, removing row for name %s\n", name); #endif gtk_tree_store_remove(filebrowser->store,&myiter2); } } } else { valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store), &myiter); } g_free(name); } /* we should also check the entries in the listtore, if they have to be refreshed as well */ if (filebrowser->store2) { valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(filebrowser->store2),&myiter); while (valid) { gchar *name; gtk_tree_model_get(GTK_TREE_MODEL(filebrowser->store2), &myiter, 1, &name, -1); if (!find_name_in_dir_entries(direntrylist, name)) { GtkTreeIter myiter2 = myiter; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store2), &myiter); DEBUG_MSG("refresh_dir_by_path_and_filename, removing %s from liststore\n",name); gtk_list_store_remove(filebrowser->store2,&myiter2); } else { DEBUG_MSG("refresh_dir_by_path_and_filename, %s is valid\n",name); valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(filebrowser->store2), &myiter); } g_free(name); } } /* now add the new entries */ { GList *tmplist; gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store),&myiter,thispath); tmplist = g_list_first(direntrylist); while (tmplist) { Tdir_entry *entry = (Tdir_entry *)tmplist->data; if (!entry->has_widget) { GtkTreeIter myiter2; #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("refresh_dir_by_path_and_filename, adding row for name=%s\n", entry->name); #endif if (entry->type == TYPE_FILE && filebrowser->store2) { myiter2 = add_tree_item(NULL, filebrowser, entry->name, entry->type, entry->icon); } else { myiter2 = add_tree_item(&myiter, filebrowser, entry->name, entry->type, entry->icon); } if (entry->type == TYPE_DIR && !filebrowser->store2) { #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("refresh_dir_by_path_and_filename, %s is TYPE_DIR so we setup the fake item\n", entry->name); #endif add_tree_item(&myiter2, filebrowser, ".", TYPE_FILE, entry->icon); } } tmplist = g_list_next(tmplist); } } if (remove_dot) { gtk_tree_store_remove(filebrowser->store,&remove_dot_iter); } free_dir_entries(direntrylist); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(filebrowser->tree)); } /* can return NULL if for example the filepath is not in the basedir */ static GtkTreePath *build_tree_from_path(Tfilebrowser *filebrowser, const gchar *filepath) { GtkTreeIter iter; gboolean showfulltree = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filebrowser->showfulltree)); DEBUG_MSG("build_tree_from_path, started for filebrowser=%p and filepath=%s\n",filebrowser,filepath); if (!showfulltree && filebrowser->basedir && strncmp(filepath, filebrowser->basedir, strlen(filebrowser->basedir))!=0) { DEBUG_MSG("build_tree_from_path, filepath %s outside basedir %s, returning NULL\n",filepath, filebrowser->basedir); return NULL; } /* first build path from root to here */ { gchar *tmpstr, *p; gint totlen, curlen, prevlen=0; /* if we're working on an URL, prevlen should be 0, else it should be 1 */ if (filepath[0] == '/') prevlen = 1; if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(filebrowser->store), &iter)) { if (!showfulltree && filebrowser->basedir) { DEBUG_MSG("build_tree_from_path, creating root %s\n",filebrowser->basedir); iter = add_tree_item(NULL, filebrowser, filebrowser->basedir, TYPE_DIR, NULL); } else { DEBUG_MSG("build_tree_from_path, creating root /\n"); iter = add_tree_item(NULL, filebrowser, "/", TYPE_DIR, NULL); } } totlen = strlen(filepath); DEBUG_MSG("build_tree_from_path, totlen=%d\n", totlen); if (prevlen > totlen) { prevlen = totlen; } if (!showfulltree && filebrowser->basedir) { prevlen = strlen(filebrowser->basedir); } DEBUG_MSG("build_tree_from_path, initial prevlen=%d, searching for / in '%s'\n", prevlen, &filepath[prevlen]); if (prevlen >= totlen) { DEBUG_MSG("build_tree_from_path, it seems we're building only the root ?!?\n"); p = NULL; } else { gchar *root = return_root_with_protocol(filepath); if (root && root[0] != '/') { DEBUG_MSG("finding iter for '%s' in the root of the tree\n",root); if (!get_iter_by_filename_from_parent(filebrowser->store, NULL, &iter, root)) { DEBUG_MSG("not found --> adding '%s'\n",root); iter = add_tree_item(NULL, filebrowser, root, TYPE_DIR, NULL); } prevlen = strlen(root); } g_free(root); p = strchr(&filepath[prevlen], '/'); } while (p) { curlen = strlen(p); #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("build_tree_from_path, curlen=%d\n", curlen); #endif tmpstr = g_strndup(&filepath[prevlen], (totlen - curlen - prevlen)); #ifdef DEBUG_ADDING_TO_TREE DEBUG_MSG("build_tree_from_path, tmpstr='%s'\n", tmpstr); #endif if (!get_iter_by_filename_from_parent(filebrowser->store, &iter, &iter, tmpstr)) { iter = add_tree_item(&iter, filebrowser, tmpstr, TYPE_DIR, NULL); } g_free(tmpstr); prevlen = (totlen - curlen+1); p = strchr(&filepath[prevlen], '/'); } } { gchar *dirname; GList *direntrylist, *tmplist; dirname = g_path_get_dirname(filepath); DEBUG_MSG("build_tree_from_path, dirname='%s'\n",dirname); if (filebrowser->last_opened_dir) g_free(filebrowser->last_opened_dir); DEBUG_MSG("build_tree_from_path, freed last_opened_dir\n"); filebrowser->last_opened_dir = ending_slash(dirname); populate_dir_history(filebrowser,FALSE, filebrowser->last_opened_dir); DEBUG_MSG("build_tree_from_path, after ending slash\n"); /* we need to add an empty item to each dir so it can be expanded */ direntrylist = return_dir_entries(filebrowser,dirname); DEBUG_MSG("build_tree_from_path, after return_dir_entries\n"); tmplist = g_list_first(direntrylist); while (tmplist) { Tdir_entry *entry = (Tdir_entry *)tmplist->data; DEBUG_MSG("build_tree_from_path, entry=%s\n",entry->name); if (entry->type == TYPE_DIR) { GtkTreeIter tmp; tmp = add_tree_item(&iter, filebrowser, entry->name, TYPE_DIR, NULL); add_tree_item(&tmp, filebrowser, ".", TYPE_FILE, NULL); } else { if (filebrowser->store2) { add_tree_item(NULL, filebrowser, entry->name, TYPE_FILE, entry->icon); } else { add_tree_item(&iter, filebrowser, entry->name, TYPE_FILE, entry->icon); } } tmplist = g_list_next(tmplist); } g_free(dirname); DEBUG_MSG("build_tree_from_path, freed dirname\n"); free_dir_entries(direntrylist); DEBUG_MSG("build_tree_from_path, cleaned direntrylist\n"); /* if the toplevel is an empty directory, it needs a '.' item as well */ if (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store), &iter)) { add_tree_item(&iter, filebrowser, ".", TYPE_FILE, NULL); } } return gtk_tree_model_get_path(GTK_TREE_MODEL(filebrowser->store),&iter); } /* I guess the dir must have a trailing slash in this function .. not sure if the GtkTreePath is already known, one should call refresh_dir_by_path_and_filename() directly instead of this function */ void filebrowser_refresh_dir(Tfilebrowser *filebrowser, gchar *dir) { if (filebrowser->tree && dir) { /* get the path for this dir */ GtkTreePath *path = return_path_from_filename(filebrowser, dir); DEBUG_DUMP_TREE_PATH(path); if (!path) return; /* check if the dir is expanded, or if we have a two paned view, return if not */ if (filebrowser->store2 || gtk_tree_view_row_expanded(GTK_TREE_VIEW(filebrowser->tree), path)) { DEBUG_MSG("refresh_dir, it IS expanded, or we have a two paned view\n"); /* refresh it */ refresh_dir_by_path_and_filename(filebrowser, path, dir); } else { DEBUG_MSG("refresh_dir, it is NOT expanded in a single paned view, returning\n"); } gtk_tree_path_free(path); } } void bfwin_filebrowser_refresh_dir(Tbfwin *bfwin, gchar *dir) { if (bfwin->filebrowser) { gboolean showfulltree = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FILEBROWSER(bfwin->filebrowser)->showfulltree)); if (!showfulltree && !path_in_basedir(FILEBROWSER(bfwin->filebrowser), dir)) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FILEBROWSER(bfwin->filebrowser)->showfulltree),TRUE); } filebrowser_refresh_dir(FILEBROWSER(bfwin->filebrowser), dir); } } static void filebrowser_expand_to_root(Tfilebrowser *filebrowser, const GtkTreePath *this_path) { GtkTreePath *path = gtk_tree_path_copy(this_path); g_signal_handlers_block_matched(G_OBJECT(filebrowser->tree), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, row_expanded_lcb, NULL); #ifndef HAVE_ATLEAST_GTK_2_2 gtktreepath_expand_to_root(filebrowser->tree, path); #else gtk_tree_view_expand_to_path(GTK_TREE_VIEW(filebrowser->tree), path); #endif g_signal_handlers_unblock_matched(G_OBJECT(filebrowser->tree), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, row_expanded_lcb, NULL); gtk_tree_path_free(path); } /** * filebrowser_get_path_from_selection: * @model: #GtkTreeModel* * @treeview: #GtkTreeView* * @iter: #GtkTreeIter * * Retrieves a path to the currently selected item in the filebrowser-> * iter may be omitted, set to NULL (and usually is). * * Returns: #GtkTreePath identifying currently selected item. NULL if no item is selected. **/ static GtkTreePath *filebrowser_get_path_from_selection(GtkTreeModel *model, GtkTreeView *treeview, GtkTreeIter *iter) { GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); GtkTreeIter localiter; GtkTreeIter *usethisiter = (iter != NULL) ? iter : &localiter; DEBUG_MSG("filebrowser_get_path_from_selection, selection=%p for treeview %p and model %p\n", selection, treeview, model); if (gtk_tree_selection_get_selected(selection,&model,usethisiter)) { return gtk_tree_model_get_path(GTK_TREE_MODEL(model),usethisiter); } return NULL; } /* is_directory is only meaningful if you have a two paned view and you want the directory name */ static gchar *get_selected_filename(Tfilebrowser *filebrowser, gboolean is_directory) { GtkTreePath *path; gchar *retval=NULL; if (filebrowser->store2 && !is_directory) { path = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store2),GTK_TREE_VIEW(filebrowser->tree2),NULL); if (path) { gchar *tmp2, *name; GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store2),&iter,path); gtk_tree_model_get(GTK_TREE_MODEL(filebrowser->store2), &iter, FILENAME_COLUMN, &name, -1); tmp2 = g_strconcat(filebrowser->last_opened_dir, name, NULL); gtk_tree_path_free(path); g_free(name); retval = tmp2; } } else { path = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store),GTK_TREE_VIEW(filebrowser->tree),NULL); if (path) { gchar *filename = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store), path); gtk_tree_path_free(path); retval = filename; } } return retval; } /** * filebrowser_open_dir: * bfwin: #Tbfwin* with filebrowser window * @dirarg const #char * dirname or filename to focus on * * This function makes the filebrowser zoom to a designated directory, * if the dirname is a directory, it should end on a slash / * **/ void filebrowser_open_dir(Tbfwin *bfwin,const gchar *dirarg) { Tfilebrowser *filebrowser = FILEBROWSER(bfwin->filebrowser); DEBUG_MSG("filebrowser_open_dir, filebrowser=%p\n",filebrowser); if (filebrowser && filebrowser->tree) { gchar *dir; GtkTreePath *path; gboolean showfulltree = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(filebrowser->showfulltree)); if (!showfulltree && !path_in_basedir(filebrowser, dirarg)) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filebrowser->showfulltree),TRUE); } dir = path_get_dirname_with_ending_slash(dirarg); path = return_path_from_filename(filebrowser, dir); DEBUG_MSG("filebrowser_open_dir, called for '%s', dir is '%s'\n", dirarg, dir); DEBUG_DUMP_TREE_PATH(path); if (!path) { DEBUG_MSG("filebrowser_open_dir, '%s' does NOT exist in the tree, building..\n", dir); path = build_tree_from_path(filebrowser, dir); } else { DEBUG_MSG("filebrowser_open_dir, it exists in tree, refreshing\n"); refresh_dir_by_path_and_filename(filebrowser, path, dir); } if (path) { DEBUG_MSG("filebrowser_open_dir, now scroll to the path\n"); filebrowser_expand_to_root(filebrowser,path); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(filebrowser->tree),path,0,TRUE,0.5,0.5); gtk_tree_selection_select_path(gtk_tree_view_get_selection(GTK_TREE_VIEW(filebrowser->tree)),path); gtk_tree_path_free(path); } g_free(dir); } } typedef struct { GtkWidget *win; GtkWidget *entry; gchar *basedir; /* must have a trailing slash */ gint is_file; Tfilebrowser *filebrowser; } Tcfod; static void create_file_or_dir_destroy_lcb(GtkWidget *widget, Tcfod *ws) { window_destroy(ws->win); g_free(ws->basedir); g_free(ws); } static void create_file_or_dir_cancel_clicked_lcb(GtkWidget *widget, Tcfod *ws) { create_file_or_dir_destroy_lcb(NULL, ws); } static void create_file_or_dir_ok_clicked_lcb(GtkWidget *widget, Tcfod *ws) { gchar *newname, *name; name = gtk_editable_get_chars(GTK_EDITABLE(ws->entry), 0, -1); if (name) { if (strlen(name)) { newname = g_strconcat(ws->basedir,name, NULL); DEBUG_MSG("create_file_or_dir_ok_clicked_lcb, newname=%s\n", newname); if (file_exists_and_readable(newname)) { error_dialog(ws->filebrowser->bfwin->main_window,_("Error creating path"),_("The specified pathname already exists.")); } else { if (ws->is_file) { doc_new_with_new_file(ws->filebrowser->bfwin,newname); } else { gchar *ondiskencoding; ondiskencoding = get_filename_on_disk_encoding(newname); if(mkdir(ondiskencoding, 0755)== -1) { /* error_dialog(_("Error creating directory"),strerror(errno));*/ } g_free(ondiskencoding); } } g_free(newname); DEBUG_MSG("create_file_or_dir_ok_clicked_lcb, refreshing basedir %s\n", ws->basedir); filebrowser_refresh_dir(ws->filebrowser,ws->basedir); } g_free(name); } create_file_or_dir_destroy_lcb(NULL, ws); } static void create_file_or_dir_win(Tfilebrowser *filebrowser, gint is_file) { /* if we have a one pane view, we need to find the selection; where to add the directory, if we have a two pane view, we need to find out IF we have a selection, if not we add it in the current directory*/ GtkTreePath *selection; GtkTreeIter iter; gchar *basedir = NULL; selection = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store),GTK_TREE_VIEW(filebrowser->tree),&iter); DEBUG_MSG("create_file_or_dir_win, selection "); DEBUG_DUMP_TREE_PATH(selection); if (filebrowser->store2 && !selection) { /* there is no selection, we'll use the current last used dir */ if (filebrowser->last_opened_dir) { basedir = ending_slash(filebrowser->last_opened_dir); } } else { GtkTreePath *path; gchar *tmp; if (filebrowser->store2 || gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store), &iter)) { /* the selection does point to a directory, not a file */ DEBUG_MSG("create_file_or_dir_win, is a directory: filebrowser->store2=%p, tree_model_iter_has_child=%d\n",filebrowser->store2 ,gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store), &iter)); } else { /* the selection points to a file, get the parent */ GtkTreeIter parent; DEBUG_MSG("create_file_or_dir_win, a file is selected\n"); gtk_tree_model_iter_parent(GTK_TREE_MODEL(filebrowser->store), &parent, &iter); iter = parent; } path = gtk_tree_model_get_path(GTK_TREE_MODEL(filebrowser->store),&iter); tmp = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); basedir = ending_slash(tmp); gtk_tree_path_free(path); } DEBUG_MSG("create_file_or_dir_win, basedir=%s, selection=%p\n",basedir,selection); if (selection) gtk_tree_path_free(selection); if (basedir) { Tcfod *ws; gchar *title; GtkWidget *vbox, *but, *hbox; ws = g_malloc(sizeof(Tcfod)); ws->filebrowser = filebrowser; ws->basedir = basedir; if (is_file) { title = _("File name"); } else { title = _("Directory name"); } ws->is_file = is_file; ws->win = window_full2(title, GTK_WIN_POS_MOUSE, 5,G_CALLBACK(create_file_or_dir_destroy_lcb), ws, TRUE, NULL); vbox = gtk_vbox_new(FALSE, 12); gtk_container_add(GTK_CONTAINER(ws->win), vbox); ws->entry = boxed_entry_with_text(NULL, 250, vbox); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); but = bf_stock_cancel_button(G_CALLBACK(create_file_or_dir_cancel_clicked_lcb), ws); gtk_box_pack_start(GTK_BOX(hbox),but , FALSE, FALSE, 0); but = bf_stock_ok_button(G_CALLBACK(create_file_or_dir_ok_clicked_lcb), ws); gtk_box_pack_start(GTK_BOX(hbox),but , FALSE, FALSE, 0); gtk_entry_set_activates_default(GTK_ENTRY(ws->entry), TRUE); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_grab_focus(ws->entry); gtk_widget_grab_default(but); gtk_widget_show_all(GTK_WIDGET(ws->win)); } } static void row_expanded_lcb(GtkTreeView *tree,GtkTreeIter *iter,GtkTreePath *path,Tfilebrowser *filebrowser) { gchar *filename = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); DEBUG_MSG("row_expanded_lcb, started on filename=%s\n", filename); statusbar_message(filebrowser->bfwin,_("opening directory..."), 500); flush_queue(); refresh_dir_by_path_and_filename(filebrowser, path, filename); g_free(filename); DEBUG_MSG("row_expanded_lcb, finished\n"); } /* needs the UTF8 encoded filename */ static void handle_activate_on_file(Tfilebrowser *filebrowser, gchar *filename) { Tfiletype *ft = get_filetype_by_filename_and_content(filename, NULL); DEBUG_MSG("handle_activate_on_file, file %s has type %p\n",filename, ft); if (ft == NULL || ft->editable) { doc_new_with_file(filebrowser->bfwin,filename, FALSE, FALSE); } else if (strcmp(ft->type, "image")==0) { /* gchar *relfilename = create_relative_link_to(filebrowser->bfwin->current_document->filename, filename); */ /* kyanh, 20050227, BUG[200502]#8 Orignal: image_insert_from_filename(filebrowser->bfwin,relfilename); */ image_insert_from_filename(filebrowser->bfwin,filename); /* g_free(relfilename); */ } else if (strcmp(ft->type, "wfproject") == 0) { project_open_from_file(filebrowser->bfwin, filename, -1); } else { DEBUG_MSG("handle_activate_on_file, file %s is not-editable, do something special now?\n",filename); } DEBUG_MSG("handle_activate_on_file, finished\n"); } /* Called both by the filebrowser "activate"-signal and filebrowser_rpopup_open_lcb */ static void row_activated_lcb(GtkTreeView *tree, GtkTreePath *path,GtkTreeViewColumn *column, Tfilebrowser *filebrowser) { if (filebrowser->store2) { /* it is a dir, expand it */ if (!gtk_tree_view_row_expanded(tree, path)) { gtk_tree_view_expand_row(tree,path,FALSE); } } else { GtkTreeIter iter; gchar *filename = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); DEBUG_MSG("row_activated_lcb, filename=%s\n", filename); /* test if this is a dir */ gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store),&iter,path); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store),&iter)) { if (gtk_tree_view_row_expanded(tree, path)) { gtk_tree_view_collapse_row(tree,path); } else { gtk_tree_view_expand_row(tree,path,FALSE); } } else { handle_activate_on_file(filebrowser,filename); } g_free(filename); } DEBUG_MSG("row_activated_lcb, finished\n"); } /* * filebrowser_rpopup_rename * * Called by filebrowser-> Renames the currently selected item. * If the selected item is an opened document, doc_save() is used. * Else, it uses the same logic as the former callback to filebrowser-> * * widget and data are not used. */ static void filebrowser_rpopup_rename(Tfilebrowser *filebrowser) { gchar *oldfilename; /* this function should, together with doc_save() use a common backend.. */ oldfilename = get_selected_filename(filebrowser, FALSE); if (oldfilename) { Tdocument *tmpdoc; GList *alldocs; gchar *newfilename=NULL, *errmessage = NULL, *dirname; /* Use doc_save(doc, 1, 1) if the file is open. */ alldocs = return_allwindows_documentlist(); tmpdoc = documentlist_return_document_from_filename(alldocs,oldfilename); g_list_free(alldocs); if (tmpdoc != NULL) { DEBUG_MSG("File is open. Calling doc_save().\n"); /* If an error occurs, doc_save takes care of notifying the user. * Currently, nothing is done here. */ doc_save(tmpdoc, TRUE, TRUE, FALSE); } else { /* Promt user, "File/Move To"-style. */ newfilename = ask_new_filename(filebrowser->bfwin, oldfilename, oldfilename, TRUE); if (newfilename) { gchar *old_OnDiEn, *new_OnDiEn; /* OnDiskEncoding */ old_OnDiEn = get_filename_on_disk_encoding(oldfilename); new_OnDiEn = get_filename_on_disk_encoding(newfilename); if(rename(old_OnDiEn, new_OnDiEn) != 0) { errmessage = g_strconcat(_("Could not rename\n"), oldfilename, NULL); } g_free(old_OnDiEn); g_free(new_OnDiEn); } } /* if(oldfilename is open) */ if (errmessage) { error_dialog(filebrowser->bfwin->main_window,errmessage, NULL); g_free(errmessage); } else { /* Refresh the appropriate parts of the filebrowser-> */ char *tmp; tmp = g_path_get_dirname(oldfilename); DEBUG_MSG("Got olddirname %s\n", tmp); dirname = ending_slash(tmp); filebrowser_refresh_dir(filebrowser,dirname); g_free(dirname); g_free(tmp); if (newfilename && (tmp = path_get_dirname_with_ending_slash(newfilename))) { /* Don't refresh the NULL-directory.. */ DEBUG_MSG("Got newdirname %s\n", tmp); dirname = ending_slash(tmp); filebrowser_refresh_dir(filebrowser,dirname); g_free(dirname); g_free(tmp); } } /* if(error) */ if (newfilename) { g_free(newfilename); } g_free(oldfilename); } } static void filebrowser_rpopup_delete(Tfilebrowser *filebrowser) { gchar *filename = get_selected_filename(filebrowser, FALSE); if (filename) { gchar *buttons[] = {GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL}; gchar *label; gint retval; label = g_strdup_printf(_("Are you sure you want to delete \"%s\" ?"), filename); retval = multi_query_dialog(filebrowser->bfwin->main_window,label, _("If you delete this file, it will be permanently lost."), 0, 0, buttons); g_free(label); if (retval == 1) { gchar *errmessage = NULL; gchar *tmp, *dir, *ondiskenc; DEBUG_MSG("file_list_rpopup_file_delete %s\n", filename); ondiskenc = get_filename_on_disk_encoding(filename); if( unlink(ondiskenc) != 0) { errmessage = g_strconcat(_("Could not delete \n"), filename, NULL); } g_free(ondiskenc); if (errmessage) { error_dialog(filebrowser->bfwin->main_window,errmessage, NULL); g_free(errmessage); } else { GList *alldocs = return_allwindows_documentlist(); Tdocument *exdoc = documentlist_return_document_from_filename(alldocs, filename); if (exdoc) document_unset_filename(exdoc); g_list_free(alldocs); } tmp = g_path_get_dirname(filename); dir = ending_slash(tmp); g_free(tmp); filebrowser_refresh_dir(filebrowser,dir); g_free(dir); } g_free(filename); } } static void filebrowser_rpopup_refresh(Tfilebrowser *filebrowser) { GtkTreePath *path1; GtkTreeIter iter; path1 = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store),GTK_TREE_VIEW(filebrowser->tree),&iter); if (path1) { gchar *tmp, *dir; GtkTreePath *path2; if (filebrowser->store2 || gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store), &iter)) { DEBUG_MSG("create_file_or_dir_win, a dir is selected\n"); } else { GtkTreeIter parent; DEBUG_MSG("create_file_or_dir_win, a file is selected\n"); gtk_tree_model_iter_parent(GTK_TREE_MODEL(filebrowser->store), &parent, &iter); iter = parent; } path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(filebrowser->store),&iter); tmp = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path2); DEBUG_MSG("filebrowser_rpopup_refresh_lcb, return_filename_from_path returned %s for path %p\n", tmp, path2); dir = ending_slash(tmp); DEBUG_MSG("filebrowser_rpopup_refresh_lcb, ending_slash returned %s\n", dir); refresh_dir_by_path_and_filename(filebrowser, path2, dir); g_free(tmp); g_free(dir); gtk_tree_path_free(path2); gtk_tree_path_free(path1); } } static void filebrowser_rpopup_action_lcb(Tfilebrowser *filebrowser,guint callback_action, GtkWidget *widget) { switch (callback_action) { case 1: { gchar *filename = get_selected_filename(filebrowser, FALSE); if (filename) { GdkRectangle r; gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(filebrowser->tree),&r); handle_activate_on_file(filebrowser, filename); g_free(filename); gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(filebrowser->tree),-1,r.y); } } break; case 2: filebrowser_rpopup_rename(filebrowser); break; case 3: filebrowser_rpopup_delete(filebrowser); break; case 4: create_file_or_dir_win(filebrowser, TRUE); break; case 5: create_file_or_dir_win(filebrowser,FALSE); break; case 6: filebrowser_rpopup_refresh(filebrowser); break; #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND case 7: { gchar *path = get_selected_filename(filebrowser, TRUE); if (path) { open_advanced_from_filebrowser(filebrowser->bfwin, path); g_free(path); } } break; #endif #endif case 8: { gchar *path = get_selected_filename(filebrowser, TRUE); DEBUG_MSG("filebrowser_rpopup_action_lcb, path=%s\n", path); if (path) { filebrowser_set_basedir(filebrowser->bfwin, path); g_free(path); } } break; } } static Tfilter *find_filter_by_name(const gchar *name) { GList *tmplist = g_list_first(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters); while(tmplist) { Tfilter *filter = (Tfilter *)tmplist->data; if (strcmp(filter->name, name)==0) { return filter; } tmplist = g_list_next(tmplist); } return NULL; } static void filebrowser_rpopup_filter_toggled_lcb(GtkWidget *widget, Tfilebrowser *filebrowser) { if (GTK_CHECK_MENU_ITEM(widget)->active) { /* loop trough the filters for a filter with this name */ const gchar *name = gtk_label_get_text(GTK_LABEL(GTK_BIN(widget)->child)); Tfilter *filter = find_filter_by_name(name); DEBUG_MSG("filebrowser_rpopup_filter_toggled_lcb, setting curfilter to %p from name %s\n", filter, name); filebrowser->curfilter = filter; if (main_v->props.last_filefilter) g_free(main_v->props.last_filefilter); main_v->props.last_filefilter = g_strdup(filter->name); filebrowser_rpopup_refresh(filebrowser); } } static void filebrowser_rpopup_shf_toggled_lcb(GtkWidget *widget, Tfilebrowser *filebrowser) { main_v->props.filebrowser_show_hidden_files = GTK_CHECK_MENU_ITEM(widget)->active; filebrowser_rpopup_refresh(filebrowser); } static void filebrowser_rpopup_sbf_toggled_lcb(GtkWidget *widget, Tfilebrowser *filebrowser) { main_v->props.filebrowser_show_backup_files = GTK_CHECK_MENU_ITEM(widget)->active; filebrowser_rpopup_refresh(filebrowser); } static GtkItemFactoryEntry filebrowser_dirmenu_entries[] = { #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND { N_("/Open _Advanced..."), NULL, filebrowser_rpopup_action_lcb, 7, "" }, #endif #endif { N_("/_Refresh"), NULL, filebrowser_rpopup_action_lcb, 6, "" }, { N_("/_Set as basedir"), NULL, filebrowser_rpopup_action_lcb, 8, "" } }; static GtkItemFactoryEntry filebrowser_bothmenu_entries[] = { { N_("/New _File"), NULL, filebrowser_rpopup_action_lcb, 4, "" }, { N_("/_New Directory"), NULL, filebrowser_rpopup_action_lcb, 5, "" }, { "/sep", NULL, NULL, 0, "" } }; static GtkItemFactoryEntry filebrowser_filemenu_entries[] = { { N_("/_Open"), NULL, filebrowser_rpopup_action_lcb, 1, "" }, { N_("/Rena_me"), NULL, filebrowser_rpopup_action_lcb, 2, "" }, { N_("/_Delete"), NULL, filebrowser_rpopup_action_lcb, 3, "" } }; static GtkWidget *filebrowser_rpopup_create_menu(Tfilebrowser *filebrowser, gboolean is_directory) { GtkWidget *menu, *menu_item; GtkItemFactory *menumaker; filebrowser->last_popup_on_dir = is_directory; /* Create menu as defined in filebrowser_menu_entries[] */ menumaker = gtk_item_factory_new(GTK_TYPE_MENU, "", NULL); #ifdef ENABLE_NLS gtk_item_factory_set_translate_func(menumaker,menu_translate,"",NULL); #endif if (is_directory) { gtk_item_factory_create_items(menumaker, sizeof(filebrowser_dirmenu_entries)/sizeof(GtkItemFactoryEntry), filebrowser_dirmenu_entries, filebrowser); } else { gtk_item_factory_create_items(menumaker, sizeof(filebrowser_filemenu_entries)/sizeof(GtkItemFactoryEntry), filebrowser_filemenu_entries, filebrowser); } gtk_item_factory_create_items(menumaker, sizeof(filebrowser_bothmenu_entries)/sizeof(GtkItemFactoryEntry), filebrowser_bothmenu_entries, filebrowser); menu = gtk_item_factory_get_widget(menumaker, ""); /* set toggle options */ menu_item = gtk_check_menu_item_new_with_label(_("Show hidden files")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), main_v->props.filebrowser_show_hidden_files); g_signal_connect(GTK_OBJECT(menu_item), "toggled", G_CALLBACK(filebrowser_rpopup_shf_toggled_lcb), filebrowser); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); menu_item = gtk_check_menu_item_new_with_label(_("Show backup files")); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), main_v->props.filebrowser_show_backup_files); g_signal_connect(GTK_OBJECT(menu_item), "toggled", G_CALLBACK(filebrowser_rpopup_sbf_toggled_lcb), filebrowser); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); /* Add filter submenu */ menu_item = gtk_menu_item_new_with_label(_("Filter")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); { GtkWidget *fmenu; GSList *group=NULL; GList *tmplist; fmenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), fmenu); tmplist = g_list_first(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters); while (tmplist) { Tfilter *filter = (Tfilter *)tmplist->data; menu_item = gtk_radio_menu_item_new_with_label(group, filter->name); if (filebrowser->curfilter == filter) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item), TRUE); } g_signal_connect(GTK_OBJECT(menu_item), "toggled", G_CALLBACK(filebrowser_rpopup_filter_toggled_lcb), filebrowser); if (!group) { group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menu_item)); } gtk_menu_shell_append(GTK_MENU_SHELL(fmenu), menu_item); tmplist = g_list_next(tmplist); } } gtk_widget_show_all(menu); g_signal_connect_after(G_OBJECT(menu), "destroy", G_CALLBACK(destroy_disposable_menu_cb), menu); return menu; } static gboolean filebrowser_button_press_lcb(GtkWidget *widget, GdkEventButton *event, Tfilebrowser *filebrowser) { DEBUG_MSG("filebrowser_button_press_lcb, button=%d, store2=%p\n",event->button, filebrowser->store2); if (event->button == 3) { GtkWidget *menu = NULL;; if (filebrowser->store2) { menu = filebrowser_rpopup_create_menu(filebrowser, TRUE); } else { GtkTreePath *path; GtkTreeIter iter; gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(filebrowser->tree), event->x, event->y, &path, NULL, NULL, NULL); if (path) { gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store),&iter,path); gtk_tree_path_free(path); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store),&iter)) { /* it is a directory */ menu = filebrowser_rpopup_create_menu(filebrowser, TRUE); } else { /* it is a file */ menu = filebrowser_rpopup_create_menu(filebrowser, FALSE); } } } if (menu) gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); } if (event->button==1) { GtkTreeIter iter; GtkTreePath *path; /* path = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store), GTK_TREE_VIEW(filebrowser->tree),NULL);*/ gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(filebrowser->tree), event->x, event->y, &path, NULL, NULL, NULL); DEBUG_MSG("filebrowser_button_press_lcb, path for position x=%f,y=%f is %p\n",event->x, event->y, path); if (path) { /* now we have two things: for the two paned, we know it is a directory, so we should refresh it, for the one paned we need to know if it is a directory or a file and handle appropriately */ if (filebrowser->store2) { gchar *tmp, *dir; tmp = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); dir = ending_slash(tmp); DEBUG_MSG("two paned view, refresh the directory %s\n", dir); refresh_dir_by_path_and_filename(filebrowser, path, dir); /* filebrowser_refresh_dir(filebrowser,dir); */ g_free(tmp); g_free(dir); } else { DEBUG_MSG("one paned view (store2=%p), check if it is a file or directory\n", filebrowser->store2); gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store),&iter,path); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(filebrowser->store),&iter)) { DEBUG_MSG("filebrowser_button_press_lcb, clicked a directory, refresh!\n"); if (!filebrowser->store2 && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(filebrowser->tree), path)) { DEBUG_MSG("filebrowser_button_press_lcb, was not yet explanded, in single paned view, refresh makes no sense\n"); } else { gchar *tmp, *dir; tmp = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); dir = ending_slash(tmp); DEBUG_MSG("filebrowser_button_press_lcb, ending_slash returned %s\n", dir); refresh_dir_by_path_and_filename(filebrowser, path, dir); /* filebrowser_refresh_dir(filebrowser,dir);*/ g_free(tmp); g_free(dir); } } else if (event->type == GDK_2BUTTON_PRESS) { GdkRectangle r; gchar *filename = return_filename_from_path(filebrowser,GTK_TREE_MODEL(filebrowser->store),path); DEBUG_MSG("filebrowser_button_press_lcb, doubleclick!! open the file %s\n", filename); gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(filebrowser->tree),&r); handle_activate_on_file(filebrowser,filename); g_free(filename); gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(filebrowser->tree),-1,r.y); gtk_tree_path_free (path); return TRUE; } } gtk_tree_path_free(path); } } return FALSE; /* pass the event on */ } static gboolean filebrowser_tree2_button_press_lcb(GtkWidget *widget, GdkEventButton *event, Tfilebrowser *filebrowser) { GtkTreePath *path2; DEBUG_MSG("filebrowser_tree2_button_press_lcb, button=%d\n",event->button); gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(filebrowser->tree2), event->x, event->y, &path2, NULL, NULL, NULL); /* path2 = filebrowser_get_path_from_selection(GTK_TREE_MODEL(filebrowser->store2), GTK_TREE_VIEW(filebrowser->tree2),NULL); */ if (event->button==1 && event->type == GDK_2BUTTON_PRESS && path2) { gchar *tmp1, *tmp3; GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(filebrowser->store2),&iter,path2); gtk_tree_model_get(GTK_TREE_MODEL(filebrowser->store2), &iter, FILENAME_COLUMN, &tmp1, -1); DEBUG_MSG("filebrowser_tree2_button_press_lcb, last_opened=%s,tmp1=%s\n",filebrowser->last_opened_dir,tmp1); tmp3 = g_strconcat(filebrowser->last_opened_dir,tmp1,NULL); handle_activate_on_file(filebrowser,tmp3); g_free(tmp1); g_free(tmp3); gtk_tree_path_free(path2); return TRUE; } else if (event->button == 3) { GtkWidget *menu; /* hmm, just after the very first click, there is no selection yet, because this handler is called *before* the gtk handler crates the selection... */ if (path2) { menu = filebrowser_rpopup_create_menu(filebrowser, FALSE); } else { menu = filebrowser_rpopup_create_menu(filebrowser, TRUE); } gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); } if (path2) gtk_tree_path_free(path2); return FALSE; /* pass the event on */ } static Tfilter *new_filter(gchar *name, gchar *mode, gchar *filetypes) { Tfilter *filter = g_new(Tfilter,1); filter->name = g_strdup(name); filter->mode = atoi(mode); filter->filetypes = NULL; if (filetypes){ GList *tmplist; gchar **types = g_strsplit(filetypes, ":", 127); tmplist = g_list_first(main_v->filetypelist); while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; gchar **type = types; while (*type) { if (strcmp(*type, filetype->type)==0) { filter->filetypes = g_list_append(filter->filetypes, filetype); break; } type++; } tmplist = g_list_next(tmplist); } g_strfreev(types); } return filter; } static void filter_destroy(Tfilter *filter) { g_free(filter->name); g_list_free(filter->filetypes); g_free(filter); } /** * filebrowser_filters_rebuild: * * Reinitializes the filebrowser filters. **/ void filebrowser_filters_rebuild() { GList *tmplist; if (!FILEBROWSERCONFIG(main_v->filebrowserconfig)->dir_icon || !FILEBROWSERCONFIG(main_v->filebrowserconfig)->unknown_icon) { g_print("the dir_icon and unknown_icon items in the config file are invalid\n"); /* return gtk_label_new("cannot load icons");*/ } tmplist = g_list_first(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters); while (tmplist) { filter_destroy(tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters); FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters = NULL; FILEBROWSERCONFIG(main_v->filebrowserconfig)->filetypes_with_icon = NULL; tmplist = g_list_first(main_v->filetypelist); while (tmplist) { if (((Tfiletype *)tmplist->data)->icon) { FILEBROWSERCONFIG(main_v->filebrowserconfig)->filetypes_with_icon = g_list_append(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filetypes_with_icon, tmplist->data); } tmplist = g_list_next(tmplist); } FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters = g_list_append(NULL, new_filter(_("All files"), "0", NULL)); tmplist = g_list_first(main_v->props.filefilters); while (tmplist) { gchar **strarr = (gchar **) tmplist->data; if (count_array(strarr) == 3) { Tfilter *filter = new_filter(strarr[0], strarr[1], strarr[2]); FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters = g_list_append(FILEBROWSERCONFIG(main_v->filebrowserconfig)->filters, filter); } tmplist = g_list_next(tmplist); } } static void showfulltree_toggled_lcb(GtkToggleButton *togglebutton, Tbfwin *bfwin) { GtkTreePath *path; gchar *to_open; /* now rebuild the tree */ DEBUG_MSG("showfulltree_toggled_lcb, clearing the tree\n"); gtk_tree_store_clear(FILEBROWSER(bfwin->filebrowser)->store); if (FILEBROWSER(bfwin->filebrowser)->store2) { gtk_list_store_clear(FILEBROWSER(bfwin->filebrowser)->store2); } if (togglebutton->active) { to_open = FILEBROWSER(bfwin->filebrowser)->last_opened_dir ? FILEBROWSER(bfwin->filebrowser)->last_opened_dir : "/"; } else { g_assert(FILEBROWSER(bfwin->filebrowser)->basedir); to_open = FILEBROWSER(bfwin->filebrowser)->basedir; } DEBUG_MSG("showfulltree_toggled_lcb, build tree for %s\n", to_open); path = build_tree_from_path(FILEBROWSER(bfwin->filebrowser), to_open); if (path) { filebrowser_expand_to_root(FILEBROWSER(bfwin->filebrowser),path); gtk_tree_path_free(path); } } /** * filebrowser_set_basedir: * @bfwin: #Tbfwin* * @basedir: #const gchar* * * will set this dir as the basedir for the filebrowser * a call with NULL is basically the same as setting it to the default value * * it there is no slash / appended, this function will add a slash to the end dir * * Return value: #void **/ void filebrowser_set_basedir(Tbfwin *bfwin, const gchar *basedir) { if (bfwin->filebrowser) { gchar *newbasedir = NULL; if (basedir && strlen(basedir)>2) { newbasedir = ending_slash(basedir); } else if (main_v->props.default_basedir && strlen(main_v->props.default_basedir)>2) { newbasedir = ending_slash(main_v->props.default_basedir); } if (newbasedir && FILEBROWSER(bfwin->filebrowser)->basedir && strcmp(newbasedir, FILEBROWSER(bfwin->filebrowser)->basedir)==0) { /* if the old and new basedir are the same: return; */ g_free(newbasedir); return; } if (FILEBROWSER(bfwin->filebrowser)->basedir) g_free(FILEBROWSER(bfwin->filebrowser)->basedir); FILEBROWSER(bfwin->filebrowser)->basedir = newbasedir; gtk_widget_set_sensitive(GTK_WIDGET(FILEBROWSER(bfwin->filebrowser)->showfulltree), (newbasedir != NULL)); if (newbasedir) { DEBUG_MSG("filebrowser_set_basedir, set basedir to %s\n",FILEBROWSER(bfwin->filebrowser)->basedir); if (!GTK_TOGGLE_BUTTON(FILEBROWSER(bfwin->filebrowser)->showfulltree)->active) { /* it is already inactive, call the callback directly */ DEBUG_MSG("filebrowser_set_basedir, calling showfulltree_toggled_lcb()\n"); showfulltree_toggled_lcb(GTK_TOGGLE_BUTTON(FILEBROWSER(bfwin->filebrowser)->showfulltree), bfwin); } else { DEBUG_MSG("filebrowser_set_basedir, calling gtk_toggle_button_set_active()\n"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FILEBROWSER(bfwin->filebrowser)->showfulltree), FALSE); } } } } static void filebrowser_two_pane_notify_position_lcb(GObject *object,GParamSpec *pspec,gpointer data){ gint position; g_object_get(object, pspec->name, &position, NULL); if (main_v->props.view_bars & MODE_RESTORE_DIMENSION) { main_v->globses.two_pane_filebrowser_height = position; } } static void dirmenu_activate_lcb(GtkMenuItem *widget, Tfilebrowser *filebrowser) { const gchar *dir = gtk_label_get_text(GTK_LABEL(GTK_BIN(widget)->child)); if (dir) { DEBUG_MSG("dirmenu_activate_lcb, dir=%s\n", dir); filebrowser_open_dir(filebrowser->bfwin,dir); } } static void populate_dir_history(Tfilebrowser *filebrowser,gboolean firsttime, gchar *activedir) { GtkWidget *menu; gchar *tmpchar, *tmpdir; GList *tmplist; GList *new_history_list=NULL; /* if (!firsttime) { */ DEBUG_MSG("populate_dir_history,remove menu, free stringlist etc.\n "); gtk_option_menu_remove_menu(GTK_OPTION_MENU(filebrowser->dirmenu)); free_stringlist(filebrowser->dirmenu_entries); filebrowser->dirmenu_entries = NULL; menu = gtk_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(filebrowser->dirmenu), menu); gtk_widget_show(menu); /* } else { DEBUG_MSG("populate_dir_history, first time, get the menu\n"); filebrowser->dirmenu_entries = NULL; menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(filebrowser->dirmenu)); gtk_widget_show(menu); }*/ if (activedir) { gint rootlen=0; gchar *root; DEBUG_MSG("populate_dir_history, activedir=%s\n",activedir); tmpdir = ending_slash(activedir); new_history_list = add_to_stringlist(new_history_list, tmpdir); root = return_root_with_protocol(tmpdir); if (root) { rootlen = strlen(root)-1; g_free(root); } while ((tmpchar = strrchr(tmpdir, DIRCHR)) && (tmpchar - tmpdir) >= rootlen) { tmpchar++; *tmpchar = '\0'; DEBUG_MSG("populate_dir_history, adding %s\n", tmpdir); new_history_list = add_to_stringlist(new_history_list, tmpdir); tmpchar--; *tmpchar = '\0'; } g_free(tmpdir); } tmpdir = g_strconcat(g_get_home_dir(), DIRSTR, NULL); new_history_list = add_to_stringlist(new_history_list, tmpdir); g_free(tmpdir); tmplist = g_list_last(main_v->recent_directories); while (tmplist) { new_history_list = add_to_stringlist(new_history_list, (gchar *)tmplist->data); tmplist = g_list_previous(tmplist); } /* make the actual option menu */ tmplist = g_list_first(new_history_list); while (tmplist) { GtkWidget *menuitem; gchar *dirname = ending_slash((gchar *)tmplist->data); DEBUG_MSG("populate_dir_history, adding %s to menu\n", dirname); menuitem = gtk_menu_item_new_with_label(dirname); g_signal_connect(G_OBJECT(menuitem),"activate",G_CALLBACK(dirmenu_activate_lcb),filebrowser); g_free(dirname); gtk_menu_append(GTK_MENU(menu), menuitem); gtk_widget_show(menuitem); g_free(tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(new_history_list); gtk_option_menu_set_history(GTK_OPTION_MENU(filebrowser->dirmenu), 0); } static void focus_follow_toggled_lcb(GtkToggleButton *togglebutton, Tbfwin *bfwin) { main_v->props.filebrowser_focus_follow = togglebutton->active; } /** * filebrowsel_init: * @bfwin: #Tbfwin* * * Initializer. Currently called from left_panel_build(). * builds the filebrowser GUI * * Return value: #void **/ GtkWidget *filebrowser_init(Tbfwin *bfwin) { Tfilebrowser *filebrowser; if (bfwin->filebrowser) { filebrowser = (Tfilebrowser *)bfwin->filebrowser; } else { filebrowser = g_new0(Tfilebrowser,1); bfwin->filebrowser = filebrowser; filebrowser->bfwin = bfwin; if (bfwin->project && bfwin->project->basedir && strlen(bfwin->project->basedir)>2) { filebrowser->basedir = ending_slash(bfwin->project->basedir); } else if (main_v->props.default_basedir && strlen(main_v->props.default_basedir)>2) { filebrowser->basedir = ending_slash(main_v->props.default_basedir); } DEBUG_MSG("filebrowser_init, the basedir is set to %s\n",filebrowser->basedir); } DEBUG_MSG("filebrowser_init, filebrowser is at %p for bfwin %p\n", filebrowser, bfwin); if (!filebrowser->curfilter) { /* get the default filter */ filebrowser->curfilter = find_filter_by_name(main_v->props.last_filefilter); } filebrowser->dirmenu = gtk_option_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(filebrowser->dirmenu), gtk_menu_new()); /* populate_dir_history(filebrowser,TRUE, NULL);*/ filebrowser->store = gtk_tree_store_new (N_COLUMNS,GDK_TYPE_PIXBUF,G_TYPE_STRING); filebrowser->tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(filebrowser->store)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(filebrowser->tree), FALSE); /*gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(filebrowser->tree), TRUE);*/ { GtkCellRenderer *renderer; GtkTreeViewColumn *column; renderer = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new (); gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_set_attributes(column,renderer ,"pixbuf",PIXMAP_COLUMN ,"pixbuf_expander_closed",PIXMAP_COLUMN ,"pixbuf_expander_open",PIXMAP_COLUMN ,NULL); /* g_object_set(G_OBJECT(renderer), "xpad", 1, NULL); g_object_set(G_OBJECT(renderer), "ypad", 1, NULL); gtk_tree_view_column_set_spacing(column, 1); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);*/ gtk_tree_view_append_column (GTK_TREE_VIEW(filebrowser->tree), column); renderer = gtk_cell_renderer_text_new(); /* column = gtk_tree_view_column_new ();*/ g_object_set(G_OBJECT(renderer), "editable", FALSE, NULL); /* Not editable. */ /* g_object_set(G_OBJECT(renderer), "xpad", 1, NULL); g_object_set(G_OBJECT(renderer), "ypad", 1, NULL);*/ /* g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(renderer_edited_lcb), filebrowser->store); */ gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_set_attributes(column,renderer ,"text", FILENAME_COLUMN,NULL); /* gtk_tree_view_column_set_spacing(column, 1); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);*/ /* gtk_tree_view_append_column(GTK_TREE_VIEW(filebrowser->tree), column);*/ } if (main_v->props.view_bars & MODE_FILE_BROWSERS_TWO_VIEW) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; filebrowser->store2 = gtk_list_store_new (N_COLUMNS,GDK_TYPE_PIXBUF,G_TYPE_STRING); filebrowser->tree2 = gtk_tree_view_new_with_model(GTK_TREE_MODEL(filebrowser->store2)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(filebrowser->tree2), FALSE); /*gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(filebrowser->tree2), TRUE);*/ renderer = gtk_cell_renderer_pixbuf_new(); column = gtk_tree_view_column_new (); gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_set_attributes(column,renderer ,"pixbuf",PIXMAP_COLUMN ,"pixbuf_expander_closed",PIXMAP_COLUMN ,"pixbuf_expander_open",PIXMAP_COLUMN ,NULL); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", FALSE, NULL); /* Not editable. */ gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_set_attributes(column,renderer,"text", FILENAME_COLUMN,NULL); gtk_tree_view_append_column (GTK_TREE_VIEW(filebrowser->tree2), column); } else { filebrowser->store2 = NULL; filebrowser->tree2 = NULL; } { GtkTreePath *path = NULL; gchar *buildfrom = NULL; filebrowser->showfulltree = checkbut_with_value(_("Show full tree"), FALSE); filebrowser->focus_follow = checkbut_with_value(_("Follow focus"), main_v->props.filebrowser_focus_follow); if (bfwin->project && bfwin->project->basedir && strlen(bfwin->project->basedir)>2) { buildfrom = bfwin->project->basedir; } else { if (bfwin->current_document && bfwin->current_document->filename){ DEBUG_MSG("filebrowser_init, build tree from current doc %s\n",bfwin->current_document->filename); buildfrom = bfwin->current_document->filename; } else if (filebrowser->basedir && strlen(filebrowser->basedir)>2) { buildfrom = filebrowser->basedir; } else { gchar curdir[1024]; getcwd(curdir, 1023); strncat(curdir, "/", 1023); DEBUG_MSG("filebrowser_init, build tree from curdir=%s\n",curdir); buildfrom = curdir; } } path = build_tree_from_path(filebrowser, buildfrom); if (filebrowser->last_opened_dir) g_free(filebrowser->last_opened_dir); filebrowser->last_opened_dir = ending_slash(buildfrom); populate_dir_history(filebrowser,FALSE, filebrowser->last_opened_dir); if (path) { filebrowser_expand_to_root(filebrowser,path); gtk_tree_path_free(path); } } g_signal_connect(G_OBJECT(filebrowser->tree), "row-expanded", G_CALLBACK(row_expanded_lcb), filebrowser); g_signal_connect(G_OBJECT(filebrowser->tree), "row-activated",G_CALLBACK(row_activated_lcb),filebrowser); g_signal_connect(G_OBJECT(filebrowser->tree), "button_press_event",G_CALLBACK(filebrowser_button_press_lcb),filebrowser); if (filebrowser->store2) { g_signal_connect(G_OBJECT(filebrowser->tree2), "button_press_event",G_CALLBACK(filebrowser_tree2_button_press_lcb),filebrowser); } { GtkWidget *vbox, *scrolwin; /* GtkAdjustment* adj;*/ vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox),filebrowser->dirmenu, FALSE, FALSE, 0); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin), filebrowser->tree); if (filebrowser->store2) { GtkWidget *vpaned, *scrolwin2; vpaned = gtk_vpaned_new(); gtk_paned_add1(GTK_PANED(vpaned), scrolwin); scrolwin2 = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolwin2), filebrowser->tree2); gtk_paned_add2(GTK_PANED(vpaned), scrolwin2); gtk_widget_set_size_request(vpaned, main_v->props.left_panel_width, -1); gtk_box_pack_start(GTK_BOX(vbox), vpaned, TRUE, TRUE, 0); gtk_paned_set_position(GTK_PANED(vpaned), main_v->globses.two_pane_filebrowser_height); g_signal_connect(G_OBJECT(vpaned),"notify::position",G_CALLBACK(filebrowser_two_pane_notify_position_lcb), NULL); } else { gtk_widget_set_size_request(scrolwin, main_v->props.left_panel_width, -1); gtk_box_pack_start(GTK_BOX(vbox), scrolwin, TRUE, TRUE, 0); } /* adj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolwin)); gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), GTK_ADJUSTMENT(adj)->lower); adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolwin)); gtk_adjustment_set_value(GTK_ADJUSTMENT(adj), GTK_ADJUSTMENT(adj)->lower);*/ gtk_box_pack_start(GTK_BOX(vbox), filebrowser->showfulltree, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), filebrowser->focus_follow, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(filebrowser->showfulltree), "toggled", G_CALLBACK(showfulltree_toggled_lcb), bfwin); g_signal_connect(G_OBJECT(filebrowser->focus_follow), "toggled", G_CALLBACK(focus_follow_toggled_lcb), bfwin); if (filebrowser->basedir == NULL) { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(filebrowser->showfulltree), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(filebrowser->showfulltree), FALSE); } return vbox; } } void filebrowser_scroll_initial(Tbfwin *bfwin) { DEBUG_MSG("filebrowser_scroll_initial, bfwin=%p, filebrowser=%p\n",bfwin,bfwin->filebrowser); if (FILEBROWSER(bfwin->filebrowser) && FILEBROWSER(bfwin->filebrowser)->tree) { gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(FILEBROWSER(bfwin->filebrowser)->tree), 2000, 2000); } } /** * filebrowser_cleanup: * @bfwin: #Tbfwin* * * this function is called when the filebrowser is hidden, all memory can be * free-ed here, and everything set to zero * * Return value: void */ void filebrowser_cleanup(Tbfwin *bfwin) { /* is this cleanup complete ? I wonder... we need some memleak detection here.. */ if (bfwin->filebrowser) { DEBUG_MSG("filebrowser_cleanup, cleanup store\n"); gtk_tree_store_clear(GTK_TREE_STORE(FILEBROWSER(bfwin->filebrowser)->store)); g_object_unref(G_OBJECT(FILEBROWSER(bfwin->filebrowser)->store)); if (FILEBROWSER(bfwin->filebrowser)->store2) { DEBUG_MSG("filebrowser_cleanup, cleanup store2\n"); gtk_list_store_clear(GTK_LIST_STORE(FILEBROWSER(bfwin->filebrowser)->store2)); g_object_unref(G_OBJECT(FILEBROWSER(bfwin->filebrowser)->store2)); } if (FILEBROWSER(bfwin->filebrowser)->basedir) g_free(FILEBROWSER(bfwin->filebrowser)->basedir); if (FILEBROWSER(bfwin->filebrowser)->last_opened_dir) g_free(FILEBROWSER(bfwin->filebrowser)->last_opened_dir); DEBUG_MSG("filebrowser_cleanup, free filebrowser\n"); g_free(bfwin->filebrowser); bfwin->filebrowser = NULL; } } /* this function is omly called once for every bluefish process */ void filebrowserconfig_init() { gchar *filename; Tfilebrowserconfig *fc = g_new0(Tfilebrowserconfig,1); main_v->filebrowserconfig = fc; filename = return_first_existing_filename(main_v->props.filebrowser_unknown_icon, "icon_unknown.png","../icons/icon_unknown.png", "icons/icon_unknown.png",NULL); fc->unknown_icon = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); filename = return_first_existing_filename(main_v->props.filebrowser_dir_icon, "icon_dir.png","../icons/icon_dir.png", "icons/icon_dir.png",NULL); fc->dir_icon = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); } winefish-1.3.3/src/gui.c0000600000047200004720000012222010412067166014051 0ustar kyanhkyanh/* $Id: gui.c 2260 2006-03-27 23:00:06Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * gui.c - the main GUI * * Copyright (C) 2002-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* nanosleep() */ #include /* strchr() */ #include /* exit() */ #include /* exit() on Solaris */ #include "config.h" #include "bluefish.h" #include "gui.h" #include "document.h" /* file_new_cb() */ #include "gtk_easy.h" #include "menu.h" /* menu_create_main(), recent_menu_init() */ #include "bf_lib.h" /* get_int_from_string() */ #include "pixmap.h" /* new_pixmap(); */ #include "undo_redo.h" /* undo_cb() redo_cb() etc. */ #include "snr2.h" /* search_cb, replace_cb */ /* #include "html_table.h" */ #include "html.h" /* kyanh, removed, 200503030 #include "html2.h" */ #include "wizards.h" #include "image.h" /* #include "html_form.h" */ #include "filebrowser.h" #include "stringlist.h" #include "preferences.h" /* open_preferences_cb */ #include "outputbox.h" #include "fref.h" #include "bookmark.h" #include "project.h" #include "snooper.h" /* COMPLETION_* enum */ #ifdef HAVE_LIBASPELL #include "bfspell.h" #endif /* HAVE_LIBASPELL */ typedef struct { GtkWidget *window; GtkWidget *label; } Tsplashscreen; /******************************/ /* global vars for this module */ /******************************/ #ifndef NOSPLASH static Tsplashscreen splashscreen; #endif /**************************/ /* start of the functions */ /**************************/ /** * notebook_hide: * * Hides the notebook. Used when loading a large amount of files, to avoid * slowing things down. Shows a "Stand by..." label instead.. * * Return value: void **/ void notebook_hide(Tbfwin *bfwin) { gtk_widget_hide (bfwin->notebook); gtk_widget_show (bfwin->notebook_fake); } /** * notebook_show: * * Shows the notebook, after a notebook_hide() has been called. * * Return value: void **/ void notebook_show(Tbfwin *bfwin) { gtk_widget_hide (bfwin->notebook_fake); gtk_widget_show (bfwin->notebook); } void notebook_changed(Tbfwin *bfwin, gint newpage) { /* BUG#69 */ if (main_v->completion.show == COMPLETION_WINDOW_SHOW) { gtk_widget_hide( GTK_WIDGET( main_v->completion.window )); main_v->completion.show = COMPLETION_WINDOW_HIDE; } gint cur = newpage; gint doclistlen; DEBUG_MSG("notebook_changed, doclistlen=%d, newpage=%d, notebook_curpage=%d, last_notebook_page=%d, curdoc=%p\n" ,g_list_length(bfwin->documentlist) ,newpage ,gtk_notebook_get_current_page(GTK_NOTEBOOK(bfwin->notebook)) ,bfwin->last_notebook_page ,bfwin->current_document ); if (newpage == -1) { /* this returns -1 if there is no current page */ cur = gtk_notebook_get_current_page(GTK_NOTEBOOK(bfwin->notebook)); } if ((bfwin->last_notebook_page == cur) && (bfwin->current_document != NULL) && (bfwin->current_document == g_list_nth_data(bfwin->documentlist, cur))) { DEBUG_MSG("notebook_changed, NOT CHANGED cur=%d, documentlist[cur]==current_document (=%p), RETURNING\n",cur,bfwin->current_document); return; } doclistlen = g_list_length(bfwin->documentlist); if (cur == -1) { if (doclistlen > 0) { DEBUG_MSG("notebook_changed, WEIRD 1 cur=%d, but doclistlen=%d RETURNING\n",cur,doclistlen); bfwin->last_notebook_page = -2; return; } } if (doclistlen == 0) { DEBUG_MSG("notebook_changed, doclistlen=%d, before doc_new()!\n",doclistlen); /* related to BUG#62. I moved from TRUE to FALSE */ bfwin->current_document = doc_new(bfwin,FALSE); bfwin->last_notebook_page = 1; DEBUG_MSG("notebook_changed, after doc_new(), returning\n"); return; } /* if the documentlist has length 1, cur should not be larger then 0, if 2, cur should not be larger then 1, etc.*/ if (cur >= doclistlen) { DEBUG_MSG("notebook_changed, DOCALREADYCLOSED, cur=%d, doclistlen=%d, RETURNING\n", cur, doclistlen); bfwin->last_notebook_page = -2; return; } bfwin->current_document = g_list_nth_data(bfwin->documentlist, cur); if (bfwin->current_document == NULL) { DEBUG_MSG("notebook_changed, WEIRD 2, doclist[%d] == NULL, RETURNING\n",cur); return; } DEBUG_MSG("notebook_changed, current_document=%p\n",bfwin->current_document); bfwin->last_notebook_page = cur; /* now we flush the queue first, so that we don't call doc_activate on _this_ document if the user has another close click in the queue */ flush_queue(); doc_activate(bfwin->current_document); /* bmark_adjust_visible(bfwin);*/ } gboolean switch_to_document_by_index(Tbfwin *bfwin,gint index) { if (index >= 0) { gtk_notebook_set_page(GTK_NOTEBOOK(bfwin->notebook), (index)); /* notebook_changed();*/ return TRUE; } return FALSE; } gboolean switch_to_document_by_pointer(Tbfwin *bfwin,Tdocument *document) { gint index; index = g_list_index(bfwin->documentlist, document); return switch_to_document_by_index(bfwin,index); } gboolean switch_to_document_by_filename(Tbfwin *bfwin,gchar *filename) { gint index; index = documentlist_return_index_from_filename(bfwin->documentlist,filename); return switch_to_document_by_index(bfwin,index); } static void notebook_switch_page_lcb(GtkWidget *notebook,GtkNotebookPage *page,gint page_num,Tbfwin *bfwin) { DEBUG_MSG("notebook_switch_page_lcb, page=%d\n", page_num); notebook_changed(bfwin,page_num); } void gui_notebook_switch(Tbfwin *bfwin,guint action,GtkWidget *widget) { switch (action) { case 1: gtk_notebook_prev_page(GTK_NOTEBOOK(bfwin->notebook)); break; case 2: gtk_notebook_next_page(GTK_NOTEBOOK(bfwin->notebook)); break; case 3: gtk_notebook_set_page(GTK_NOTEBOOK(bfwin->notebook), 0); break; case 4: gtk_notebook_set_page(GTK_NOTEBOOK(bfwin->notebook), -1); } } static void left_panel_notify_position_lcb(GObject *object,GParamSpec *pspec,gpointer data){ gint position; g_object_get(object, pspec->name, &position, NULL); DEBUG_MSG("left_panel_notify_position_lcb, new position=%d\n", position); if (main_v->props.view_bars & MODE_RESTORE_DIMENSION) { if (main_v->props.left_panel_left) { main_v->props.left_panel_width = position; } else { main_v->props.left_panel_width = main_v->globses.main_window_w - position; } } } GtkWidget *left_panel_build(Tbfwin *bfwin) { GtkWidget *fileb; GtkWidget *left_notebook = gtk_notebook_new(); GtkWidget *fref; GtkWidget *bmarks; gtk_notebook_set_tab_pos(GTK_NOTEBOOK(left_notebook),main_v->props.leftpanel_tabposition); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(left_notebook), TRUE); gtk_notebook_set_show_border(GTK_NOTEBOOK(left_notebook), FALSE); gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(left_notebook), 0); gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(left_notebook), 0); gtk_notebook_popup_enable(GTK_NOTEBOOK(left_notebook)); fileb = filebrowser_init(bfwin); fref = fref_gui(bfwin); bmarks = bmark_gui(bfwin); /* gtk_notebook_append_page_menu(GTK_NOTEBOOK(left_notebook),fileb,(105),gtk_label_new(_("Filebrowser"))); */ gtk_notebook_append_page_menu(GTK_NOTEBOOK(left_notebook),fileb,gtk_label_new(_("tree")), NULL); gtk_notebook_append_page_menu(GTK_NOTEBOOK(left_notebook),fref,gtk_label_new(_("functions")),NULL); gtk_notebook_append_page_menu(GTK_NOTEBOOK(left_notebook),bmarks,gtk_label_new(_("marks")),NULL); gtk_widget_show_all(left_notebook); gtk_notebook_set_current_page(GTK_NOTEBOOK(left_notebook),0); return left_notebook; } /** * if there is a left panel, this function will rebuild all widgets */ void left_panel_rebuild(Tbfwin *bfwin) { if (bfwin->hpane) { DEBUG_MSG("left_panel_rebuild, destroying widgets\n"); gtk_widget_destroy(bfwin->leftpanel_notebook); DEBUG_MSG("left_panel_rebuild, cleanup\n"); filebrowser_cleanup(bfwin); fref_cleanup(bfwin); bmark_cleanup(bfwin); DEBUG_MSG("left_panel_rebuild, re-init\n"); bfwin->leftpanel_notebook = left_panel_build(bfwin); if (main_v->props.left_panel_left) { gtk_paned_add1(GTK_PANED(bfwin->hpane), bfwin->leftpanel_notebook); } else { gtk_paned_add2(GTK_PANED(bfwin->hpane), bfwin->leftpanel_notebook); } gtk_widget_show_all(bfwin->leftpanel_notebook); } } void left_panel_show_hide_toggle(Tbfwin *bfwin,gboolean first_time, gboolean show, gboolean sync_menu) { if (sync_menu) { DEBUG_MSG("left_panel_show_hide_toggle, trying to sync menu\n"); setup_toggle_item_from_widget(bfwin->menubar, "/View/View Sidebar", show); } if (!first_time && ((show && bfwin->hpane) || (!show && bfwin->hpane == NULL))) { DEBUG_MSG("left_panel_show_hide_toggle, retrurning!!, show=%d, bfwin->hpane=%p, first_time=%d\n",show,bfwin->hpane,first_time); return; } if (!first_time) { gtk_widget_ref(bfwin->notebook_box); if (show) { gtk_container_remove(GTK_CONTAINER(bfwin->middlebox), bfwin->notebook_box); } else { gtk_container_remove(GTK_CONTAINER(bfwin->hpane), bfwin->notebook_box); gtk_widget_destroy(bfwin->hpane); filebrowser_cleanup(bfwin); fref_cleanup(bfwin); bmark_cleanup(bfwin); } } if (show) { bfwin->hpane = gtk_hpaned_new(); if (main_v->props.left_panel_left) { DEBUG_MSG("set paned position to %d (left)\n",main_v->props.left_panel_width); gtk_paned_set_position(GTK_PANED(bfwin->hpane), main_v->props.left_panel_width); } else { DEBUG_MSG("set paned position to %d (right)\n",main_v->globses.main_window_w - main_v->props.left_panel_width); gtk_paned_set_position(GTK_PANED(bfwin->hpane), main_v->globses.main_window_w - main_v->props.left_panel_width); } g_signal_connect(G_OBJECT(bfwin->hpane),"notify::position",G_CALLBACK(left_panel_notify_position_lcb), NULL); bfwin->leftpanel_notebook = left_panel_build(bfwin); gtk_paned_add1(GTK_PANED(bfwin->hpane), main_v->props.left_panel_left ? bfwin->leftpanel_notebook : bfwin->notebook_box); gtk_paned_add2(GTK_PANED(bfwin->hpane), main_v->props.left_panel_left ? bfwin->notebook_box : bfwin->leftpanel_notebook); gtk_box_pack_start(GTK_BOX(bfwin->middlebox), bfwin->hpane, TRUE, TRUE, 0); gtk_widget_show(bfwin->hpane); } else { bfwin->hpane = NULL; bfwin->leftpanel_notebook = NULL; gtk_box_pack_start(GTK_BOX(bfwin->middlebox), bfwin->notebook_box, TRUE, TRUE, 0); } if (!first_time) { gtk_widget_unref(bfwin->notebook_box); /* , fix BUG#23(200503) */ gtk_widget_grab_focus(bfwin->current_document->view); } } void gui_set_title(Tbfwin *bfwin, Tdocument *doc) { gchar *title, *prfilepart; const gchar *tablabel; tablabel = gtk_label_get_text(GTK_LABEL(doc->tab_label)); if (bfwin->project) { prfilepart = g_strconcat(bfwin->project->name," - ",tablabel,NULL); } else { prfilepart = g_strdup(tablabel); } title = g_strconcat(prfilepart, " - Winefish "VERSION,NULL); gtk_window_set_title(GTK_WINDOW(bfwin->main_window),title); /*rename_window_entry_in_all_windows(bfwin, title);*/ g_free(title); g_free(prfilepart); } void gui_apply_settings(Tbfwin *bfwin) { gtk_notebook_set_tab_pos(GTK_NOTEBOOK(bfwin->notebook),main_v->props.document_tabposition); /* We don't want to set the tab position if the left panel is hidden */ if (bfwin->leftpanel_notebook) { gtk_notebook_set_tab_pos(GTK_NOTEBOOK(bfwin->leftpanel_notebook),main_v->props.leftpanel_tabposition); /* check if the left panel needs to move over to the right */ if (main_v->props.left_panel_left && bfwin->leftpanel_notebook == GTK_PANED(bfwin->hpane)->child1) { DEBUG_MSG("gui_apply_settings, left panel is on the right location\n"); } else { left_panel_show_hide_toggle(bfwin,FALSE, FALSE, FALSE); left_panel_show_hide_toggle(bfwin,FALSE, TRUE, FALSE); } } } /* void make_main_toolbar(Tbfwin *bfwin) { GtkWidget *toolbar = gtk_toolbar_new (); DEBUG_MSG("make_main_toolbar, started\n"); gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_container_add (GTK_CONTAINER(bfwin->main_toolbar_hb), toolbar); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_NEW, _("New"), "", G_CALLBACK(file_new_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_OPEN, _("Open..."), "", G_CALLBACK(file_open_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_SAVE, _("Save"), "", G_CALLBACK(file_save_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_SAVE_AS, _("Save As..."), "", G_CALLBACK(file_save_as_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_CLOSE, _("Close"), "", G_CALLBACK(file_close_cb), bfwin, -1); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_CUT, _("Cut"), "", G_CALLBACK(edit_cut_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_COPY, _("Copy"), "", G_CALLBACK(edit_copy_cb), bfwin, -1); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_PASTE, _("Paste"), "", G_CALLBACK(edit_paste_cb), bfwin, -1); gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), GTK_STOCK_PREFERENCES, _("Preferences..."),"", G_CALLBACK(open_preferences_cb), NULL, -1); gtk_widget_show_all(toolbar); } */ void gui_set_undo_redo_widgets(Tbfwin *bfwin, gboolean undo, gboolean redo) { /* if (GTK_WIDGET_VISIBLE(bfwin->main_toolbar_hb)) { gtk_widget_set_sensitive(bfwin->toolbar_redo, redo); gtk_widget_set_sensitive(bfwin->toolbar_undo, undo); } */ menuitem_set_sensitive(bfwin->menubar, "/Edit/Undo", undo); menuitem_set_sensitive(bfwin->menubar, "/Edit/Undo All", undo); menuitem_set_sensitive(bfwin->menubar, "/Edit/Redo", redo); menuitem_set_sensitive(bfwin->menubar, "/Edit/Redo All", redo); } void gui_set_document_widgets(Tdocument *doc) { DEBUG_MSG("gui_set_document_widgets: hellow world ================== \n"); GtkItemFactory *tmp1 = gtk_item_factory_from_widget(BFWIN(doc->bfwin)->menubar); setup_toggle_item(tmp1,("/Document/Highlight Syntax"), ((doc->view_bars & VIEW_COLORIZED) && (doc->hl->highlightlist != NULL))); /*gtk_widget_set_sensitive(gtk_item_factory_get_widget(tmp1,_("/Document/Highlight Syntax")), (doc->hl->highlightlist != NULL));*/ gui_set_undo_redo_widgets(doc->bfwin, doc_has_undo_list(doc), doc_has_redo_list(doc)); setup_toggle_item(gtk_item_factory_from_widget(BFWIN(doc->bfwin)->menubar),"/Document/Wrap", GET_BIT(doc->view_bars,MODE_WRAP)); setup_toggle_item(gtk_item_factory_from_widget(BFWIN(doc->bfwin)->menubar),"/Document/Line Numbers", GET_BIT(doc->view_bars, VIEW_LINE_NUMBER)); setup_toggle_item(gtk_item_factory_from_widget(BFWIN(doc->bfwin)->menubar),"/Document/AutoCompletion", GET_BIT(doc->view_bars, MODE_AUTO_COMPLETE)); menu_current_document_set_toggle_wo_activate(BFWIN(doc->bfwin),doc->hl, doc->encoding); DEBUG_MSG("gui_set_document_widgets: autocompletion =%d\n", GET_BIT(doc->view_bars, MODE_AUTO_COMPLETE)); } void gui_notebook_bind_signals(Tbfwin *bfwin) { bfwin->notebook_switch_signal = g_signal_connect_after(G_OBJECT(bfwin->notebook),"switch-page",G_CALLBACK(notebook_switch_page_lcb), bfwin); } void gui_notebook_unbind_signals(Tbfwin *bfwin) { DEBUG_MSG("gui_notebook_unbind_signals: started\n"); if (g_signal_handler_is_connected (G_OBJECT(bfwin->notebook),bfwin->notebook_switch_signal)) g_signal_handler_disconnect(G_OBJECT(bfwin->notebook),bfwin->notebook_switch_signal); bfwin->notebook_switch_signal = 0; DEBUG_MSG("gui_notebook_unbind_signals: finished\n"); } static gboolean gui_main_window_configure_event_lcb(GtkWidget *widget,GdkEvent *revent,Tbfwin *bfwin) { { /* hide the popuup menu for autocompletion */ if (main_v->completion.show & COMPLETION_WINDOW_SHOW ) { gtk_widget_hide(main_v->completion.window); main_v->completion.show = COMPLETION_WINDOW_HIDE; } } /* resize the outputbox */ #ifdef AUTO_RESIZE_OUTPUTBOX { gint h = (gint) (bfwin->vpane->allocation.height * 0.7); /* if (revent->type == GDK_CONFIGURE) { GdkEventConfigure *event = (GdkEventConfigure *)revent; g_print("size =%d\n", bfwin->vpane->allocation.height); } */ if (bfwin->ob_hbox && GTK_WIDGET_VISIBLE(GTK_WIDGET(bfwin->ob_hbox))) { gtk_paned_set_position( GTK_PANED( bfwin->vpane ), h); } } #endif if (main_v->props.view_bars &MODE_RESTORE_DIMENSION) { if (revent->type == GDK_CONFIGURE) { GdkEventConfigure *event = (GdkEventConfigure *)revent; if (main_v->globses.main_window_w > 0 ) { main_v->globses.main_window_w = event->width; main_v->globses.main_window_h = event->height; DEBUG_MSG("gui_main_window_configure_event_lcb, width=%d, height=%d\n",main_v->globses.main_window_w,main_v->globses.main_window_h); } } else if (revent->type == GDK_WINDOW_STATE) { GdkEventWindowState *event = (GdkEventWindowState *)revent; if (event->new_window_state == GDK_WINDOW_STATE_MAXIMIZED && main_v->globses.main_window_w > 0) { main_v->globses.main_window_w = -1 * main_v->globses.main_window_w; /* negative means it is maximized !! */ DEBUG_MSG("gui_main_window_configure_event_lcb, maximized!! width=%d\n",main_v->globses.main_window_w); } else if (event->new_window_state != GDK_WINDOW_STATE_MAXIMIZED && main_v->globses.main_window_w < 0) { main_v->globses.main_window_w = -1 * main_v->globses.main_window_w; /* make it positive again */ DEBUG_MSG("gui_main_window_configure_event_lcb, NOT-maximized, width=%d\n",main_v->globses.main_window_w); } } } return FALSE; } enum { TARGET_URI_LIST, TARGET_STRING } Tdnd_types; static void main_win_on_drag_data_lcb(GtkWidget * widget, GdkDragContext * context , gint x, gint y, GtkSelectionData * data , guint info, guint time, Tbfwin *bfwin) { gchar *filename, *url; int mode = 0; gint url_is_local; if ((data->length == 0) || (data->format != 8) || ((info != TARGET_STRING) && (info != TARGET_URI_LIST))) { DEBUG_MSG("on_drag_data_cb, currently unknown DnD object, need to do string comparision\n"); gtk_drag_finish(context, FALSE, TRUE, time); return; } /* netscape sends URL's labelled as string */ if (info == TARGET_STRING) { gchar *stringdata = g_strndup((gchar *)data->data, data->length); if (strchr(stringdata, ':')) { DEBUG_MSG("on_drag_data_cb, TARGET_STRING contains :, so it's probably an URL\n"); info = TARGET_URI_LIST; } g_free(stringdata); } /* construct both filename and url from the given data */ if (info == TARGET_STRING) { filename = g_strndup((gchar *)data->data, data->length); filename = trunc_on_char(trunc_on_char(filename, '\n'), '\r'); url = g_strconcat("file:", filename, NULL); url_is_local = 1; DEBUG_MSG("on_drag_data_cb, TARGET_STRING, url=%s\n",url); } else { /* TARGET_UTI_LIST*/ gchar *tmp2; gint len; url = g_strndup((gchar *)data->data, data->length); url = trunc_on_char(trunc_on_char(url, '\n'), '\r'); if (strncmp(url, "file://", 7) == 0) { filename = g_strdup(url+7); url_is_local = 1; DEBUG_MSG("on_drag_data_cb, TARGET_URI_LIST, url=%s, filename=%s\n",url,filename); } else { len = strlen(url); tmp2 = strrchr(url, '#'); if (tmp2) { len -= strlen(tmp2); } filename = g_strndup(url, len); url_is_local = 0; DEBUG_MSG("on_drag_data_cb, TARGET_URI_LIST, url=%s\n",url); } } DEBUG_MSG("on_drag_data_cb, filename='%s', url='%s'\n", filename, url); doc_new_with_file(bfwin,url_is_local ? filename : url, FALSE, FALSE); gtk_drag_finish(context, TRUE, (mode == GDK_ACTION_COPY), time); g_free(filename); g_free(url); } void gui_bfwin_cleanup(Tbfwin *bfwin) { GList *tmplist; /* call all cleanup functions here */ /*remove_window_entry_from_all_windows(bfwin);*/ /* all documents have to be freed for this window */ tmplist = g_list_first(bfwin->documentlist); DEBUG_MSG("gui_bfwin_cleanup, have %d documents in window %p\n",g_list_length(bfwin->documentlist),bfwin); while (tmplist) { DEBUG_MSG("gui_bfwin_cleanup closing doc=%p\n",tmplist->data); doc_destroy(DOCUMENT(tmplist->data), TRUE); /* no this is not an indefinite loop, because the documents remove themselves from the documentlist, we remove the top document untill there are no documents left */ tmplist = g_list_first(bfwin->documentlist); } bmark_cleanup(bfwin); snr2_cleanup(bfwin); } static gboolean gui_show_main_returned = FALSE; void main_window_destroy_lcb(GtkWidget *widget,Tbfwin *bfwin) { /* TODO: prevent from exit if... ??? */ if (!gui_show_main_returned) { /* popup a message */ return; } /* TODO: stop all other boxes! */ outputbox_stop(bfwin->outputbox); outputbox_stop(bfwin->grepbox); DEBUG_MSG("main_window_destroy_lcb, started\n"); DEBUG_MSG("main_window_destroy_lcb, will hide the window now\n"); gtk_widget_hide(bfwin->main_window); main_v->bfwinlist = g_list_remove(main_v->bfwinlist, bfwin); DEBUG_MSG("main_window_destroy_lcb, bfwin(%p) is removed from bfwinlist\n",bfwin); /* kyanh, 20050226, table_wiz and quiclist_wiz failed at this function. The program will terminate when it reaches this function [unexpectly]; the code followed the line will never be excuted */ gui_bfwin_cleanup(bfwin); DEBUG_MSG("main_window_destroy_lcb, will destroy the window now\n"); gtk_widget_destroy(bfwin->main_window); g_free(bfwin); DEBUG_MSG("main_window_destroy_lcb, bfwin is free'ed\n"); /* kyanh, 20050224, why do we need this check ? I try to removed :) - yes, if we remove the following line, then... we can exit winefish. in winefish.c, the message "before gtk_main()" was printed, but the message "after gtk_main()" wasNOT */ if (NULL == main_v->bfwinlist) { bluefish_exit_request(); } DEBUG_MSG("main_window_destroy_lcb, finished\n"); } gboolean main_window_delete_event_lcb(GtkWidget *widget,GdkEvent *event,Tbfwin *bfwin) { if (!gui_show_main_returned) { /* popup a message */ return TRUE; } /* If you return FALSE in the "delete_event" signal handler, * GTK will emit the "destroy" signal. Returning TRUE means * you don't want the window to be destroyed. * This is useful for popping up 'are you sure you want to quit?' * type dialogs. */ DEBUG_MSG("main_window_delete_event_lcb, started\n"); if (bfwin->project) { return !project_save_and_close(bfwin); } else { if (bfwin->documentlist && test_docs_modified(bfwin->documentlist)) { DEBUG_MSG("main_window_delete_event_lcb, we have changed documents!\n"); bfwin_close_all_documents(bfwin, TRUE); if (bfwin->documentlist && test_docs_modified(bfwin->documentlist)) { DEBUG_MSG("main_window_delete_event_lcb, we STILL have changed documents!?!\n"); /* if there are still documents modified we should cancel the closing */ return TRUE; } } else { /* no changed documents, but there might be changed bookmarks */ bmark_store_all(bfwin); } } return FALSE; } void gui_create_main(Tbfwin *bfwin, GList *filenames, gint linenumber) { GtkWidget *vbox; DEBUG_MSG("gui_create_main, bfwin=%p, bfwin->bookmarkstore=%p\n",bfwin,bfwin->bookmarkstore); bfwin->main_window = window_full2(_("New Winefish Window"), GTK_WIN_POS_CENTER, 0, G_CALLBACK(main_window_destroy_lcb), bfwin, FALSE, NULL); gtk_window_set_role(GTK_WINDOW(bfwin->main_window), "winefish"); if (main_v->globses.main_window_w > 0) { gtk_window_set_default_size(GTK_WINDOW(bfwin->main_window), main_v->globses.main_window_w, main_v->globses.main_window_h); } else { gtk_window_set_default_size(GTK_WINDOW(bfwin->main_window), main_v->globses.main_window_w * -1, main_v->globses.main_window_h); gtk_window_maximize(GTK_WINDOW(bfwin->main_window)); } g_signal_connect(G_OBJECT(bfwin->main_window), "delete_event", G_CALLBACK(main_window_delete_event_lcb), bfwin); g_signal_connect(G_OBJECT(bfwin->main_window), "configure-event", G_CALLBACK(gui_main_window_configure_event_lcb), bfwin); g_signal_connect(G_OBJECT(bfwin->main_window), "window-state-event", G_CALLBACK(gui_main_window_configure_event_lcb), bfwin); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(bfwin->main_window), vbox); gtk_widget_show(vbox); /* first a menubar */ DEBUG_MSG("gui_create_main, starting menu_create_main\n"); menu_create_main(bfwin, vbox); DEBUG_MSG("gui_create_main, starting recent_menu\n"); recent_menu_init(bfwin); DEBUG_MSG("gui_create_main, starting external-encoding_menu\n"); external_menu_rebuild(bfwin); encoding_menu_rebuild(bfwin); snr2_init(bfwin); /* add_window_entry_to_all_windows(bfwin); add_allwindows_entries_to_window(bfwin);*/ /* then the toolbars */ { /* DEBUG_MSG("gui_create_main, creating handles for all menu/toolbars\n"); bfwin->main_toolbar_hb = gtk_handle_box_new(); gtk_box_pack_start(GTK_BOX(vbox), bfwin->main_toolbar_hb, FALSE, FALSE, 0); bfwin->html_toolbar_hb = gtk_handle_box_new(); gtk_box_pack_start(GTK_BOX(vbox), bfwin->html_toolbar_hb, FALSE, FALSE, 0); */ bfwin->custom_menu_hb = gtk_handle_box_new(); gtk_box_pack_start(GTK_BOX(vbox), bfwin->custom_menu_hb, FALSE, FALSE, 0); /* if ((bfwin->project && (bfwin->project->view_bars & VIEW_MAIN_TOOLBAR) ) || (!bfwin->project && (main_v->session->view_bars & VIEW_MAIN_TOOLBAR) )) { make_main_toolbar(bfwin); gtk_widget_show(bfwin->main_toolbar_hb); } */ if ((bfwin->project && ( bfwin->project->view_bars & VIEW_CUSTOM_MENU) ) || (!bfwin->project && ( main_v->session->view_bars & VIEW_CUSTOM_MENU ) )) { make_cust_menubar(bfwin,bfwin->custom_menu_hb); gtk_widget_show(bfwin->custom_menu_hb); } } /* then the work area */ /* bfwin->middlebox = gtk_hbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), bfwin->middlebox, TRUE, TRUE, 0); gtk_widget_show(bfwin->middlebox); */ bfwin->vpane = gtk_vpaned_new(); gtk_box_pack_start(GTK_BOX(vbox), bfwin->vpane, TRUE, TRUE, 0); bfwin->middlebox = gtk_hbox_new(TRUE, 0); gtk_paned_add1(GTK_PANED(bfwin->vpane), bfwin->middlebox); gtk_widget_show(bfwin->middlebox); gtk_widget_show(bfwin->vpane); /* Fake-label (for notebook_hide() and _show() ;) */ bfwin->notebook_fake = gtk_label_new(_("Stand by...")); /* notebook with the text widget in there */ bfwin->notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(bfwin->notebook),main_v->props.document_tabposition); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(bfwin->notebook), TRUE); gtk_notebook_set_show_border(GTK_NOTEBOOK(bfwin->notebook), FALSE); gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(bfwin->notebook), 0); gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(bfwin->notebook), 0); gtk_notebook_popup_enable(GTK_NOTEBOOK(bfwin->notebook)); /* Add notebook and its fake friend to their common hbox. */ bfwin->notebook_box = gtk_hbox_new (TRUE, 0); gtk_box_pack_start(GTK_BOX(bfwin->notebook_box), bfwin->notebook, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(bfwin->notebook_box), bfwin->notebook_fake, TRUE, TRUE, 0); /* output_boxes */ bfwin->ob_hbox = NULL; bfwin->outputbox = NULL; bfwin->grepbox = NULL; left_panel_show_hide_toggle(bfwin,TRUE, (bfwin->project && (bfwin->project->view_bars & VIEW_LEFT_PANEL)) || (!bfwin->project && (main_v->session->view_bars & VIEW_LEFT_PANEL) ), FALSE); /* finally the statusbar */ { GtkWidget *hbox; gint onecharwidth; hbox = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); bfwin->statusbar = gtk_statusbar_new(); gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(bfwin->statusbar), FALSE); gtk_box_pack_start(GTK_BOX(hbox), bfwin->statusbar, TRUE, TRUE, 0); bfwin->statusbar_lncol = gtk_statusbar_new(); gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(bfwin->statusbar_lncol), FALSE); gtk_box_pack_start(GTK_BOX(hbox), bfwin->statusbar_lncol, FALSE, FALSE, 0); /* I hope the 'w' is an average width character */ onecharwidth = widget_get_string_size(bfwin->statusbar_lncol, "w"); gtk_widget_set_size_request(GTK_WIDGET(bfwin->statusbar_lncol), 12*onecharwidth, -1); bfwin->statusbar_insovr = gtk_statusbar_new(); gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(bfwin->statusbar_insovr), FALSE); gtk_box_pack_start(GTK_BOX(hbox), bfwin->statusbar_insovr, FALSE, FALSE, 0); gtk_widget_set_size_request(GTK_WIDGET(bfwin->statusbar_insovr), onecharwidth * 3, -1); bfwin->statusbar_editmode = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(hbox), bfwin->statusbar_editmode, FALSE, FALSE, 0); gtk_widget_set_size_request(GTK_WIDGET(bfwin->statusbar_editmode), onecharwidth * 16, -1); gtk_widget_show_all(hbox); } /* We have to know when the notebook changes */ gui_notebook_bind_signals(bfwin); /* everything is ready - we can start loading documents */ /* start to open an empty doc */ /* related to BUG#59(a) */ if (filenames) { DEBUG_MSG("gui_create_main, we have filenames, load them\n"); docs_new_from_files(bfwin,filenames,(bfwin->project != NULL), linenumber); } /* FIXED BUG#59(a) */ if (!bfwin->documentlist || g_list_length(bfwin->documentlist) ==0 || (g_list_length(bfwin->documentlist) == 1 && doc_is_empty_non_modified_and_nameless(bfwin->current_document)) ) { file_new_cb(NULL,bfwin); } gtk_notebook_set_page(GTK_NOTEBOOK(bfwin->notebook), 0); gtk_notebook_set_scrollable(GTK_NOTEBOOK(bfwin->notebook), TRUE); /* don't use show_all since some widgets are and should be hidden */ gtk_widget_show(bfwin->notebook); gtk_widget_show (bfwin->notebook_box); { /* drag n drop support */ const GtkTargetEntry drag_dest_types[] = { {"text/uri-list", 0, TARGET_URI_LIST }, {"STRING", 0, TARGET_STRING}, }; gtk_drag_dest_set(bfwin->main_window, (GTK_DEST_DEFAULT_ALL) ,drag_dest_types, 2 ,(GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_PRIVATE | GDK_ACTION_ASK)); g_signal_connect(G_OBJECT(bfwin->main_window), "drag_data_received", G_CALLBACK(main_win_on_drag_data_lcb), bfwin); } DEBUG_MSG("gui_create_main, finished\n"); } void gui_show_main(Tbfwin *bfwin) { /* show all */ DEBUG_MSG("gui_show_main, before show\n"); /* don't use show_all since some widgets are and should be hidden */ gtk_widget_show(bfwin->main_window); flush_queue(); gui_show_main_returned = TRUE; DEBUG_MSG("gui_show_main, flush_queue finished\n"); doc_scroll_to_cursor(bfwin->current_document); if ((bfwin->project && (bfwin->project->view_bars & VIEW_LEFT_PANEL) ) || (!bfwin->project && (main_v->session->view_bars & VIEW_LEFT_PANEL) )) { filebrowser_scroll_initial(bfwin); } DEBUG_MSG("gui_show_main, after show\n"); } /***********************/ /* statusbar functions */ /***********************/ typedef struct { gint message_id; Tbfwin *bfwin; } Tstatusbar_remove; static gint statusbar_remove(gpointer sr) { gtk_statusbar_remove(GTK_STATUSBAR(((Tstatusbar_remove *)sr)->bfwin->statusbar), 0, ((Tstatusbar_remove *)sr)->message_id); g_free(sr); return FALSE; } void statusbar_message(Tbfwin *bfwin,gchar *message, gint time) { if (bfwin->statusbar) { Tstatusbar_remove *sr = g_new(Tstatusbar_remove,1); sr->bfwin = bfwin; sr->message_id = gtk_statusbar_push(GTK_STATUSBAR(bfwin->statusbar), 0, message); gtk_timeout_add(time, statusbar_remove, sr); } } /***********************/ /* GOTO line functions */ /***********************/ typedef struct { GtkWidget *win; GtkWidget *entry; GtkWidget *check; Tbfwin *bfwin; } Tgotoline; static void tgl_destroy_lcb(GtkWidget * widget, Tgotoline *tgl) { window_destroy(tgl->win); g_free(tgl); } static void tgl_ok_clicked_lcb(GtkWidget * widget, Tgotoline *tgl) { gchar *linestr; gint linenum; linestr = gtk_editable_get_chars(GTK_EDITABLE(tgl->entry), 0, -1); linenum = get_int_from_string(linestr); DEBUG_MSG("tgl_ok_clicked_lcb, going to line %d (linestr=%s)\n", linenum, linestr); g_free(linestr); if (linenum > 0) { doc_select_line(tgl->bfwin->current_document, linenum, TRUE); } if (GTK_TOGGLE_BUTTON(tgl->check)->active) { if (linenum > 0) { gchar *new_text; gint position=0; gtk_editable_delete_text (GTK_EDITABLE(tgl->entry), 0, -1); new_text = g_strdup_printf("%d", linenum); gtk_editable_insert_text(GTK_EDITABLE(tgl->entry),new_text,strlen(new_text),&position); g_free(new_text); } } else { tgl_destroy_lcb(NULL, tgl); } } static void tgl_fromsel_clicked_lcb(GtkWidget * widget, Tgotoline *tgl) { gchar *string; GtkClipboard* cb; cb = gtk_clipboard_get(GDK_SELECTION_PRIMARY); string = gtk_clipboard_wait_for_text(cb); if (string) { gtk_entry_set_text(GTK_ENTRY(tgl->entry), string); } tgl_ok_clicked_lcb(widget, tgl); } static void tgl_cancel_clicked_lcb(GtkWidget *widget, gpointer data) { tgl_destroy_lcb(NULL, data); } void tgl_enter_lcb (GtkWidget *widget, gpointer ud) { Tgotoline *tgl; tgl = ud; tgl_ok_clicked_lcb (widget, tgl); } void go_to_line_win_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { Tgotoline *tgl; GtkWidget *but1, *vbox, *hbox, *label; tgl = g_new(Tgotoline, 1); tgl->bfwin = bfwin; tgl->win = window_full(_("Goto line"), GTK_WIN_POS_MOUSE ,12, G_CALLBACK(tgl_destroy_lcb), tgl, TRUE); vbox = gtk_vbox_new(FALSE, 12); gtk_container_add(GTK_CONTAINER(tgl->win), vbox); hbox = gtk_hbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic(_("_Line number:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); tgl->entry = boxed_entry_with_text(NULL, 20, hbox); gtk_label_set_mnemonic_widget(GTK_LABEL(label), tgl->entry); /* mnemonic for label */ but1 = bf_generic_mnemonic_button(_("From _selection"), G_CALLBACK(tgl_fromsel_clicked_lcb), tgl); gtk_box_pack_start(GTK_BOX(hbox), but1, FALSE, FALSE, 0); tgl->check = boxed_checkbut_with_value(_("Keep _dialog"), 0, vbox); gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), TRUE, TRUE, 0); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); but1 = bf_stock_cancel_button(G_CALLBACK(tgl_cancel_clicked_lcb), tgl); gtk_box_pack_start(GTK_BOX(hbox), but1, FALSE, FALSE, 0); gtk_widget_grab_focus (tgl->entry); but1 = bf_stock_ok_button(G_CALLBACK(tgl_ok_clicked_lcb), tgl); gtk_box_pack_start(GTK_BOX(hbox), but1, FALSE, FALSE, 0); gtk_window_set_default(GTK_WINDOW(tgl->win), but1); gtk_widget_show_all(tgl->win); } void go_to_line_from_selection_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { gchar *string; GtkClipboard* cb; gint linenum; cb = gtk_clipboard_get(GDK_SELECTION_PRIMARY); string = gtk_clipboard_wait_for_text(cb); if (string) { linenum = get_int_from_string(string); if (linenum > 0) { doc_select_line(bfwin->current_document, linenum, TRUE); } } } #ifndef NOSPLASH void splash_screen_set_label(gchar *label) { static struct timespec const req = { 0, 10000000}; #ifdef DEBUG DEBUG_MSG("Setting splash label to %s\n", label); #endif gtk_label_set(GTK_LABEL(splashscreen.label),label); flush_queue(); nanosleep(&req, NULL); } GtkWidget *start_splash_screen() { static struct timespec const req = { 0, 100000000}; GtkWidget *image, *vbox; GdkColor color; splashscreen.window = window_with_title(CURRENT_VERSION_NAME, GTK_WIN_POS_CENTER_ALWAYS, 0); gtk_window_set_default_icon_list(default_icon_list()); gtk_window_set_decorated(GTK_WINDOW(splashscreen.window), FALSE); gtk_window_set_role(GTK_WINDOW(splashscreen.window), "splash"); gtk_window_set_resizable(GTK_WINDOW(splashscreen.window),FALSE); color.red = 65535; color.blue = 65535; color.green = 65535; gtk_widget_modify_bg(splashscreen.window, GTK_STATE_NORMAL,&color); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(splashscreen.window), vbox); gtk_widget_show(vbox); splashscreen.label = gtk_label_new(_("starting winefish")); gtk_box_pack_end(GTK_BOX(vbox),splashscreen.label , FALSE, FALSE, 0); gtk_widget_show(splashscreen.label); { GError *error=NULL; GdkPixbuf* pixbuf= gdk_pixbuf_new_from_file(WINEFISH_SPLASH_FILENAME,&error); if (error) { DEBUG_MSG("ERROR while loading splash screen: %s\n", error->message); g_error_free(error); } else if (pixbuf) { image = gtk_image_new_from_pixbuf(pixbuf); gtk_box_pack_end(GTK_BOX(vbox), image, FALSE, FALSE, 0); g_object_unref(pixbuf); gtk_widget_show(image); } } gtk_widget_show(splashscreen.window); flush_queue(); DEBUG_MSG("start_splash_screen, should be visible\n"); nanosleep(&req, NULL); return splashscreen.window; } #endif /* #ifndef NOSPLASH */ /* void gui_set_html_toolbar_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu) { */ /* if (sync_menu) { DEBUG_MSG("gui_set_html_toolbar_visible, trying to sync menu\n"); setup_toggle_item_from_widget(bfwin->menubar, "/View/View LaTeX Toolbar", visible); } */ /* widget_set_visible(bfwin->html_toolbar_hb,visible); } */ /* void gui_set_main_toolbar_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu) { if (sync_menu) { DEBUG_MSG("gui_set_main_toolbar_visible, trying to sync menu\n"); setup_toggle_item_from_widget(bfwin->menubar, "/View/View Main Toolbar", visible); } */ /* if (gtk_container_children(GTK_CONTAINER(bfwin->main_toolbar_hb)) == NULL) { make_main_toolbar(bfwin); } */ /* widget_set_visible(bfwin->main_toolbar_hb,visible); } */ void gui_set_custom_menu_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu) { if (sync_menu) { DEBUG_MSG("gui_set_custom_menu_visible, trying to sync menu\n"); setup_toggle_item_from_widget(bfwin->menubar, "/View/View Custom Menu", visible); } if (gtk_container_children(GTK_CONTAINER(bfwin->custom_menu_hb)) == NULL) { make_cust_menubar(bfwin,bfwin->custom_menu_hb); } widget_set_visible(bfwin->custom_menu_hb,visible); } void gui_toggle_hidewidget_cb(Tbfwin *bfwin,guint action,GtkWidget *widget) { gboolean active = GTK_CHECK_MENU_ITEM(widget)->active; DEBUG_MSG("gui_toggle_hidewidget_cb, action=%d, active=%d\n",action,active); DEBUG_MSG("old view_bars =%d\n",main_v->session->view_bars); switch (action) { /* case 1: if (bfwin->project) { DEBUG_MSG("gui_toggle_hidewidget_cb: view main toolbar for project\n"); bfwin->project->view_bars = SET_BIT(bfwin->project->view_bars, VIEW_MAIN_TOOLBAR, active); }else{ main_v->session->view_bars = SET_BIT(main_v->session->view_bars, VIEW_MAIN_TOOLBAR, active); } gui_set_main_toolbar_visible(bfwin, active, FALSE); break; */ case 3: if (bfwin->project) { bfwin->project->view_bars = SET_BIT(bfwin->project->view_bars ,VIEW_CUSTOM_MENU, active); }else{ main_v->session->view_bars = SET_BIT(main_v->session->view_bars,VIEW_CUSTOM_MENU, active); } gui_set_custom_menu_visible(bfwin, active, FALSE); break; case 4: if (bfwin->project) { bfwin->project->view_bars = SET_BIT(bfwin->project->view_bars,VIEW_LEFT_PANEL, active); }else{ main_v->session->view_bars = SET_BIT(main_v->session->view_bars, VIEW_LEFT_PANEL, active); } left_panel_show_hide_toggle(bfwin,FALSE, active, FALSE); break; case 5: if (bfwin->ob_hbox) { setup_toggle_item_from_widget(bfwin->menubar, N_("/View/View Outputbox"), active); /* ob = OUTPUTBOX(bfwin->ob_hbox); */ if (active) { gtk_widget_show_all(bfwin->ob_hbox); }else{ gtk_widget_hide_all(bfwin->ob_hbox); } }else{ /* no outputbox; show off */ setup_toggle_item_from_widget(bfwin->menubar, N_("/View/View Outputbox"), FALSE); } break; #ifdef HAVE_VTE_TERMINAL case 6: setup_toggle_item_from_widget(bfwin->menubar, N_("/View/View Terminal"), active); if (active) { if (!bfwin->terminal) { bfwin->terminal = otuputbox_new_terminal_box(bfwin); } gtk_widget_show_all(bfwin->ob_hbox); menuitem_set_sensitive(bfwin->menubar, N_("/View/View Terminal"), FALSE); } break; #endif /* HAVE_VTE_TERMINAL */ default: DEBUG_MSG("gui_toggle_hidewidget_cb should NEVER be called with action %d\n", action); exit(1); break; } DEBUG_MSG("new view_bars =%d\n",main_v->session->view_bars); } Tbfwin *gui_new_window(GList *filenames, Tproject *project) { DEBUG_MSG("gui_new_window: hello!\n"); Tbfwin *bfwin = g_new0(Tbfwin,1); bfwin->bmark_files = NULL; /* Oskar */ if (project) { bfwin->project = project; bfwin->session = project->session; bfwin->bookmarkstore = project->bookmarkstore; DEBUG_MSG("gui_new_window, bfwin=%p, bfwin->bookmarkstore=%p (from project %p)\n",bfwin,bfwin->bookmarkstore,project); } else { bfwin->session = main_v->session; bfwin->bookmarkstore = main_v->bookmarkstore; DEBUG_MSG("gui_new_window, bfwin=%p, bfwin->bookmarkstore=%p (from main_v)\n",bfwin,bfwin->bookmarkstore); } /* FIXED BUG#59(b). Use -1 instead of 0. See a related problem: BUG#60. */ gui_create_main(bfwin,filenames,-1); /* never comment this out again Jim! */ main_v->bfwinlist = g_list_append(main_v->bfwinlist, bfwin); gui_show_main(bfwin); return bfwin; } void gui_window_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget) { switch (callback_action) { case 1: gui_new_window(NULL, NULL); break; case 2: /* close the window */ if (main_window_delete_event_lcb(NULL, NULL, bfwin) == FALSE) { gtk_widget_destroy(bfwin->main_window); } break; } } winefish-1.3.3/src/outputbox_bf.h0000600000047200004720000000256310366105730016017 0ustar kyanhkyanh/* $Id: outputbox_bf.h 1663 2006-01-26 08:44:08Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish) * external_commands.c - backend for external commands, filters and the outputbox * * Copyright (C) 1999-2005 Olivier Sessink * Modified for Winefish (C) 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __OUTPUTBOX_BF_H_ #define __OUTPUTBOX_BF_H_ #include "outputbox_cfg.h" #ifdef __BF_BACKEND__ void run_command( Toutputbox *ob ); void finish_execute( Toutputbox *ob ); /* void filter_command(Tbfwin *bfwin, const gchar *formatstring); void external_command(Tbfwin *bfwin, const gchar *formatstring); */ #endif /* __BF_BACKEND__ */ #endif /* __EXTERNAL_COMMANDS_H_ */ winefish-1.3.3/src/bfspell.c0000600000047200004720000004766610373411041014727 0ustar kyanhkyanh/* $Id: bfspell.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * bfspell.c - aspell spell checker * * Copyright (C) 2002-2004 Olivier Sessink * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /*#define DEBUG*/ #include "config.h" #ifdef HAVE_LIBASPELL #include #include #include #include /* isdigit() */ #include "bluefish.h" #include "gtk_easy.h" #include "document.h" #include "stringlist.h" #include "bfspell.h" /* * indent -ts4 -kr */ typedef enum {FILTER_NONE,FILTER_TEX,FILTER_HTML} Tspellfilter; typedef struct { AspellConfig *spell_config; AspellSpeller *spell_checker; Tspellfilter filtert; GtkWidget *win; GtkWidget *lang; GtkWidget *filter; GList *langs; GtkWidget *dict; GtkWidget *runbut; GtkWidget *repbut; GtkWidget *ignbut; GtkWidget *in_doc; GtkWidget *in_sel; /* during the checking */ GtkWidget *incorrectword; GtkWidget *suggestions; Tdocument *doc; gint offset; gint stop_position; GtkTextMark* so; GtkTextMark* eo; Tbfwin *bfwin; } Tbfspell; static void spell_gui_set_button_status(Tbfspell *bfspell, gboolean is_running) { gtk_widget_set_sensitive(bfspell->runbut,!is_running); gtk_widget_set_sensitive(bfspell->lang,!is_running); gtk_widget_set_sensitive(bfspell->repbut,is_running); gtk_widget_set_sensitive(bfspell->ignbut,is_running); } static gboolean test_unichar(gunichar ch,gpointer data) { if (ch == GPOINTER_TO_INT(data)) { return TRUE; } else { return FALSE; } } /* kyanh, added, 20060123 */ /* A=65; Z=90; a=97; z=122; \\=92 */ /* TODO: added @ support for guru mode */ static gboolean test_command(gunichar ch, gpointer data) { if ( ((64 eo && bfspell->offset ==-1) { gtk_text_buffer_get_iter_at_mark(bfspell->doc->buffer,itstart,bfspell->eo); } else { gtk_text_buffer_get_iter_at_offset(bfspell->doc->buffer,itstart,bfspell->offset); } /* determines whether iter ends a natural-language word */ havestart = gtk_text_iter_starts_word(itstart); while (!havestart) { /* HTML filter */ DEBUG_MSG("doc_get_next_word: current iter = %c\n", gtk_text_iter_get_char(itstart)); switch(bfspell->filtert) { case FILTER_HTML: /* 60 is the ascii code for <, 62 for > */ if (gtk_text_iter_get_char(itstart) == 60) { gtk_text_iter_forward_find_char(itstart, test_unichar,GINT_TO_POINTER(62), NULL); } break; case FILTER_TEX: /* \ = 92, next to non alphatetically */ if (gtk_text_iter_get_char(itstart) == 92) { DEBUG_MSG("doc_get_next_word: start a command, find forward...\n"); gtk_text_iter_forward_find_char(itstart, test_command,NULL, NULL); } break; case FILTER_NONE: default: break; } if (!gtk_text_iter_forward_char(itstart)) { return NULL; } havestart = gtk_text_iter_starts_word(itstart); } *itend = *itstart; gtk_text_iter_forward_word_end(itend); bfspell->offset = gtk_text_iter_get_offset(itend); if (bfspell->offset > bfspell->stop_position) { return NULL; } retval = gtk_text_buffer_get_text(bfspell->doc->buffer,itstart,itend,TRUE/*include hidden chars. why?*/); if (strlen(retval)<1) { g_free(retval); return NULL; } return retval; } static void spell_add_to_session(Tbfspell *bfspell, gboolean to_session, const gchar * word) { DEBUG_MSG("spell_add_to_session, to_session=%d, word=%s\n",to_session,word); if (word && strlen(word)) { if (to_session) { aspell_speller_add_to_session(bfspell->spell_checker, word, -1); } else { aspell_speller_add_to_personal(bfspell->spell_checker, word, -1); } } } /* spell check for a word */ static gboolean spell_check_word(Tbfspell *bfspell, gchar * tocheck, GtkTextIter *itstart, GtkTextIter *itend) { DEBUG_MSG("spell_check_word: check for '%s'\n", tocheck); if (tocheck && !isdigit(tocheck[0])) { int correct = aspell_speller_check(bfspell->spell_checker, tocheck, -1); DEBUG_MSG("word '%s' has correct=%d\n",tocheck,correct); if (!correct) { AspellWordList *awl = (AspellWordList *)aspell_speller_suggest(bfspell->spell_checker, tocheck,-1); if (!bfspell->so || !bfspell->eo) { bfspell->so = gtk_text_buffer_create_mark(bfspell->doc->buffer,NULL,itstart,FALSE); bfspell->eo = gtk_text_buffer_create_mark(bfspell->doc->buffer,NULL,itend,TRUE); } else { gtk_text_buffer_move_mark(bfspell->doc->buffer,bfspell->so,itstart); gtk_text_buffer_move_mark(bfspell->doc->buffer,bfspell->eo,itend); } doc_select_region(bfspell->doc, gtk_text_iter_get_offset(itstart),gtk_text_iter_get_offset(itend) , TRUE); bfspell->offset = -1; gtk_entry_set_text(GTK_ENTRY(bfspell->incorrectword), tocheck); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(bfspell->suggestions)->entry), ""); if (awl == 0) { DEBUG_MSG("spell_check_word error: %s\n", aspell_speller_error_message(bfspell->spell_checker)); } else { GList *poplist=NULL; AspellStringEnumeration *els = aspell_word_list_elements(awl); const char *word; while ((word = aspell_string_enumeration_next(els)) != 0) { poplist = g_list_append(poplist,g_strdup(word)); } if (!poplist) { poplist = g_list_append(poplist, g_strdup("(no suggested words)")); } gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(bfspell->suggestions)->entry), ""); gtk_combo_set_popdown_strings(GTK_COMBO(bfspell->suggestions), poplist); free_stringlist(poplist); delete_aspell_string_enumeration(els); } return FALSE; } } return TRUE; } static void spell_run_finished(Tbfspell *bfspell) { GList *poplist = NULL; DEBUG_MSG("spell_run_finished\n"); gtk_entry_set_text(GTK_ENTRY(bfspell->incorrectword), ""); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(bfspell->suggestions)->entry), ""); poplist = g_list_append(poplist,""); gtk_combo_set_popdown_strings(GTK_COMBO(bfspell->suggestions), poplist); g_list_free(poplist); bfspell->offset = 0; aspell_speller_save_all_word_lists(bfspell->spell_checker); delete_aspell_speller(bfspell->spell_checker); bfspell->spell_checker = NULL; spell_gui_set_button_status(bfspell, FALSE); } static gboolean spell_run(Tbfspell *bfspell) { GtkTextIter itstart,itend; gchar *word = doc_get_next_word(bfspell, &itstart,&itend); DEBUG_MSG("spell_run, started, bfspell=%p, word=%s\n",bfspell,word); if (!word) { spell_run_finished(bfspell); return FALSE; /* finished */ } while (word) { DEBUG_MSG("spell_run: word '%s'\n", word); if (spell_check_word(bfspell,word,&itstart,&itend)) { g_free(word); word = doc_get_next_word(bfspell,&itstart,&itend); if (!word) { spell_run_finished(bfspell); return FALSE; /* finished */ } } else { /* not correct ! */ g_free(word); word = NULL; } } return TRUE; /* not yet finished */ } static void spell_start(Tbfspell *bfspell) { DEBUG_MSG("spell_start, started for bfspell=%p\n",bfspell); bfspell->spell_config = new_aspell_config(); DEBUG_MSG("spell_start, created spell_config at %p\n",bfspell->spell_config); /* * default language should come from config file, runtime from GUI, * should first set the default one */ /* if (main_v->props.spell_default_lang) { */ aspell_config_replace(bfspell->spell_config, "lang", main_v->props.spell_default_lang); DEBUG_MSG("spell_start, default lang=%s\n",main_v->props.spell_default_lang); /* * it is unclear from the manual if aspell supports utf-8 in the * library, the utility does not support it.. */ aspell_config_replace(bfspell->spell_config, "encoding", "utf-8"); /* * from the aspell manual */ } static void spell_gui_destroy(GtkWidget * widget, Tbfspell *bfspell) { DEBUG_MSG("spell_gui_destroy started\n"); window_destroy(bfspell->win); if (bfspell->spell_checker) { aspell_speller_save_all_word_lists(bfspell->spell_checker); delete_aspell_speller(bfspell->spell_checker); } delete_aspell_config(bfspell->spell_config); if (bfspell->so) { gtk_text_buffer_delete_mark(bfspell->doc->buffer, bfspell->so); } if (bfspell->eo) { gtk_text_buffer_delete_mark(bfspell->doc->buffer, bfspell->eo); } g_free(bfspell); } static void spell_gui_cancel_clicked_cb(GtkWidget *widget, Tbfspell *bfspell) { spell_gui_destroy(NULL, bfspell); } static void spell_gui_ok_clicked_cb(GtkWidget *widget, Tbfspell *bfspell) { AspellCanHaveError *possible_err; const gchar *lang; DEBUG_MSG("spell_gui_ok_clicked_cb, bfspell=%p, bfwin=%p\n",bfspell, bfspell->bfwin); bfspell->doc = bfspell->bfwin->current_document; gint indx; indx = gtk_option_menu_get_history(GTK_OPTION_MENU(bfspell->lang)); lang = g_list_nth_data(bfspell->langs, indx); DEBUG_MSG("spell_gui_ok_clicked_cb, indx=%d has language %s\n",indx,lang); if (lang && strlen(lang)) { aspell_config_replace(bfspell->spell_config, "lang", lang); } DEBUG_MSG("spell_gui_ok_clicked_cb, about to create speller for spell_config=%p\n",bfspell->spell_config); possible_err = new_aspell_speller(bfspell->spell_config); bfspell->spell_checker = 0; if (aspell_error_number(possible_err) != 0) { DEBUG_MSG(aspell_error_message(possible_err)); /* now send an error, and stop */ return; } else { bfspell->spell_checker = to_aspell_speller(possible_err); } if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bfspell->in_doc))) { bfspell->stop_position = gtk_text_buffer_get_char_count(bfspell->doc->buffer); } else { GtkTextIter start, end; gtk_text_buffer_get_selection_bounds(bfspell->doc->buffer,&start,&end); bfspell->offset = gtk_text_iter_get_offset(&start); bfspell->stop_position = gtk_text_iter_get_offset(&end); } DEBUG_MSG("about to start spell_run()\n"); if (spell_run(bfspell)) { spell_gui_set_button_status(bfspell,TRUE); } else { spell_gui_set_button_status(bfspell,FALSE); } } static void spell_gui_fill_dicts(Tbfspell *bfspell) { GtkWidget *menu, *menuitem; AspellDictInfoEnumeration * dels; AspellDictInfoList * dlist; const AspellDictInfo * entry; dlist = get_aspell_dict_info_list(bfspell->spell_config); dels = aspell_dict_info_list_elements(dlist); free_stringlist(bfspell->langs); bfspell->langs = NULL; menu = gtk_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(bfspell->lang), menu); while ( (entry = aspell_dict_info_enumeration_next(dels)) != 0) { GtkWidget *label; menuitem = gtk_menu_item_new(); label = gtk_label_new(entry->name); gtk_misc_set_alignment(GTK_MISC(label),0,0.5); gtk_container_add(GTK_CONTAINER(menuitem), label); /* g_signal_connect(G_OBJECT (menuitem), "activate",G_CALLBACK(),GINT_TO_POINTER(0));*/ if (strcmp(entry->name, main_v->props.spell_default_lang) == 0) { DEBUG_MSG("spell_gui_fill_dicts, lang %s is the default language, inserting menuitem %p at position 0\n",entry->name,menuitem); gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, 0); bfspell->langs = g_list_prepend(bfspell->langs,g_strdup(entry->name)); } else { DEBUG_MSG("spell_gui_fill_dicts, lang %s is not the default language, appending menuitem %p\n",entry->name,menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); bfspell->langs = g_list_append(bfspell->langs,g_strdup(entry->name)); } } delete_aspell_dict_info_enumeration(dels); gtk_widget_show_all(menu); gtk_option_menu_set_menu(GTK_OPTION_MENU(bfspell->lang), menu); DEBUG_MSG("spell_gui_fill_dicts, set item 0 as selected item\n"); gtk_option_menu_set_history(GTK_OPTION_MENU(bfspell->lang),0); } static void spell_gui_add_clicked(GtkWidget *widget, Tbfspell *bfspell) { const gchar *original = gtk_entry_get_text(GTK_ENTRY(bfspell->incorrectword)); if (original && (strlen(original)>1)) { if (gtk_option_menu_get_history(GTK_OPTION_MENU(bfspell->dict))) { spell_add_to_session(bfspell, TRUE,original); /* add to session dict */ } else { spell_add_to_session(bfspell, FALSE,original); /* add to personal dict */ } } if (spell_run(bfspell)) { spell_gui_set_button_status(bfspell,TRUE); } else { spell_gui_set_button_status(bfspell,FALSE); } } static void spell_gui_ignore_clicked(GtkWidget *widget, Tbfspell *bfspell) { DEBUG_MSG("ignore\n"); if (spell_run(bfspell)) { spell_gui_set_button_status(bfspell,TRUE); } else { spell_gui_set_button_status(bfspell,FALSE); } } static void spell_gui_replace_clicked(GtkWidget *widget, Tbfspell *bfspell) { gint start, end; GtkTextIter iter; const gchar *original = gtk_entry_get_text(GTK_ENTRY(bfspell->incorrectword)); const gchar *newstring = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(bfspell->suggestions)->entry)); if (!original || !newstring) return; if (strlen(original)>0 && strlen(newstring)>0) { aspell_speller_store_replacement(bfspell->spell_checker,original,-1,newstring,-1); } gtk_text_buffer_get_iter_at_mark(bfspell->doc->buffer,&iter,bfspell->so); start = gtk_text_iter_get_offset(&iter); gtk_text_buffer_get_iter_at_mark(bfspell->doc->buffer,&iter,bfspell->eo); end = gtk_text_iter_get_offset(&iter); DEBUG_MSG("set %s from %d to %d\n",newstring,start,end); doc_replace_text(bfspell->doc, newstring, start, end); if (spell_run(bfspell)) { spell_gui_set_button_status(bfspell, TRUE); } else { spell_gui_set_button_status(bfspell, FALSE); } } static void defaultlang_clicked_lcb(GtkWidget *widget,Tbfspell *bfspell) { const gchar *lang; gint indx; indx = gtk_option_menu_get_history(GTK_OPTION_MENU(bfspell->lang)); lang = g_list_nth_data(bfspell->langs, indx); g_free(main_v->props.spell_default_lang); DEBUG_MSG("defaultlang_clicked_lcb, index=%d, default lang is now %s\n",indx, lang); main_v->props.spell_default_lang = g_strdup(lang); } static void filter_changed_lcb(GtkOptionMenu *optionmenu,Tbfspell *bfspell) { bfspell->filtert = gtk_option_menu_get_history(GTK_OPTION_MENU(bfspell->filter)); } static void spell_gui(Tbfspell *bfspell) { GtkWidget *vbox, *hbox, *but, *frame, *table, *label; bfspell->win = window_full(_("Check Spelling"), GTK_WIN_POS_NONE, 3, G_CALLBACK(spell_gui_destroy),bfspell, TRUE); vbox = gtk_vbox_new(FALSE, 2); gtk_container_add(GTK_CONTAINER(bfspell->win), vbox); frame = gtk_frame_new(_("Checking")); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); table = gtk_table_new(3,5,FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), 6); gtk_table_set_row_spacings(GTK_TABLE(table), 6); gtk_container_add(GTK_CONTAINER(frame), table); bfspell->incorrectword = gtk_entry_new(); gtk_entry_set_editable(GTK_ENTRY(bfspell->incorrectword),FALSE); bf_mnemonic_label_tad_with_alignment(_("_Misspelled word:"), bfspell->incorrectword, 1, 0.5, table, 1, 2, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->incorrectword,2,3,0,1); bfspell->suggestions = gtk_combo_new(); bf_mnemonic_label_tad_with_alignment(_("Change _to:"), bfspell->suggestions, 1, 0.5, table, 1, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->suggestions,2,3,1,2); bfspell->ignbut = bf_generic_mnemonic_button(_("I_gnore"), G_CALLBACK(spell_gui_ignore_clicked), bfspell); bfspell->repbut = bf_generic_mnemonic_button(_("_Replace"), G_CALLBACK(spell_gui_replace_clicked), bfspell); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->ignbut,3,4,0,1); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->repbut,3,4,1,2); gtk_widget_set_sensitive(bfspell->repbut,FALSE); gtk_widget_set_sensitive(bfspell->ignbut,FALSE); /* lower GUI part */ table = gtk_table_new(5,3,FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), 6); gtk_table_set_row_spacings(GTK_TABLE(table), 6); gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); bfspell->in_doc = gtk_radio_button_new_with_mnemonic(NULL, _("In _document")); bfspell->in_sel = gtk_radio_button_new_with_mnemonic(gtk_radio_button_get_group(GTK_RADIO_BUTTON(bfspell->in_doc)), _("I_n selection")); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->in_doc,0,1,0,1); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->in_sel,1,2,0,1); { GtkWidget *menu, *menuitem; bfspell->dict = gtk_option_menu_new(); menu = gtk_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(bfspell->dict), menu); menuitem = gtk_menu_item_new_with_label(_("personal dictionary")); /* g_signal_connect(G_OBJECT (menuitem), "activate",G_CALLBACK(),GINT_TO_POINTER(0));*/ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); menuitem = gtk_menu_item_new_with_label(_("session dictionary")); /* g_signal_connect(G_OBJECT (menuitem), "activate",G_CALLBACK(),GINT_TO_POINTER(1));*/ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_option_menu_set_history(GTK_OPTION_MENU(bfspell->dict),0); } label = gtk_label_new(_("Dictionary:")); gtk_table_attach_defaults(GTK_TABLE(table), label,0,1,2,3); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->dict,1,2,2,3); but = bf_generic_mnemonic_button(_("_Add"), G_CALLBACK(spell_gui_add_clicked), bfspell); gtk_table_attach_defaults(GTK_TABLE(table), but,2,3,2,3); bfspell->lang = gtk_option_menu_new(); label = gtk_label_new(_("Language:")); gtk_table_attach_defaults(GTK_TABLE(table), label,0,1,3,4); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->lang,1,2,3,4); but = bf_generic_mnemonic_button(_("Set defa_ult"), G_CALLBACK(defaultlang_clicked_lcb), bfspell); gtk_table_attach_defaults(GTK_TABLE(table), but,2,3,3,4); bfspell->filter = gtk_option_menu_new(); label = gtk_label_new(_("Filter:")); gtk_table_attach_defaults(GTK_TABLE(table), label,0,1,4,5); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); gtk_table_attach_defaults(GTK_TABLE(table), bfspell->filter,1,2,4,5); { GtkWidget *menu, *menuitem; menu = gtk_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(bfspell->filter), menu); menuitem = gtk_menu_item_new_with_label(_("no filter")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); menuitem = gtk_menu_item_new_with_label(_("TeX filter")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); menuitem = gtk_menu_item_new_with_label(_("html filter")); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); } g_signal_connect(G_OBJECT(bfspell->filter),"changed",G_CALLBACK(filter_changed_lcb),bfspell); gtk_option_menu_set_history(GTK_OPTION_MENU(bfspell->filter),1); gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); but = bf_gtkstock_button(GTK_STOCK_CLOSE, G_CALLBACK(spell_gui_cancel_clicked_cb), bfspell); gtk_box_pack_start(GTK_BOX(hbox),but,FALSE, FALSE, 0); bfspell->runbut = bf_gtkstock_button(GTK_STOCK_SPELL_CHECK,G_CALLBACK(spell_gui_ok_clicked_cb),bfspell); gtk_box_pack_start(GTK_BOX(hbox),bfspell->runbut,FALSE, FALSE, 0); gtk_window_set_default(GTK_WINDOW(bfspell->win), bfspell->runbut); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show_all(bfspell->win); } void spell_check_cb(GtkWidget *widget, Tbfwin *bfwin) { Tbfspell *bfspell = NULL; bfspell = g_new0(Tbfspell,1); bfwin->bfspell = bfspell; bfspell->bfwin = bfwin; spell_gui(bfspell); flush_queue(); spell_start(bfspell); spell_gui_fill_dicts(bfspell); } #endif /* HAVE_LIBASPELL */ winefish-1.3.3/src/filebrowser.h0000600000047200004720000000265410373411041015614 0ustar kyanhkyanh/* $Id: filebrowser.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * filebrowser.h the filebrowser * * Copyright (C) 2002-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __FILEBROWSER_H_ #define __FILEBROWSER_H_ void bfwin_filebrowser_refresh_dir(Tbfwin *bfwin, gchar *dir); void filebrowser_open_dir(Tbfwin *bfwin, const gchar *dirarg); void filebrowser_filters_rebuild(void); GtkWidget *filebrowser_init(Tbfwin *bfwin); void filebrowser_cleanup(Tbfwin *bfwin); void filebrowser_scroll_initial(Tbfwin *bfwin); void filebrowserconfig_init(void); void filebrowser_set_basedir(Tbfwin *bfwin, const gchar *basedir); #endif /* __FILEBROWSER_H_ */ winefish-1.3.3/src/gui.h0000600000047200004720000000534610373411041014056 0ustar kyanhkyanh/* $Id: gui.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * gui.h - global function for the GUI * * Copyright (C) 2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __GUI_H_ #define __GUI_H_ void gui_set_html_toolbar_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu); void gui_set_main_toolbar_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu); void gui_set_custom_menu_visible(Tbfwin *bfwin, gboolean visible, gboolean sync_menu); void gui_toggle_hidewidget_cb(Tbfwin *bfwin,guint action,GtkWidget *widget); void notebook_hide(Tbfwin *bfwin); void notebook_show(Tbfwin *bfwin); void notebook_changed(Tbfwin *bfwin,gint newpage); void gui_notebook_switch(Tbfwin *bfwin,guint action,GtkWidget *widget); void left_panel_rebuild(Tbfwin *bfwin); void left_panel_show_hide_toggle(Tbfwin *bfwin,gboolean first_time, gboolean show, gboolean sync_menu); void gui_set_title(Tbfwin *bfwin, Tdocument *doc); void gui_apply_settings(Tbfwin *bfwin); void gui_set_undo_redo_widgets(Tbfwin *bfwin,gboolean undo, gboolean redo); void gui_set_document_widgets(Tdocument *doc); void gui_notebook_bind_signals(Tbfwin *bfwin); void gui_notebook_unbind_signals(Tbfwin *bfwin); void gui_create_main(Tbfwin *bfwin, GList *filenames, gint linenumber); void gui_show_main(Tbfwin *bfwin); void statusbar_message(Tbfwin *bfwin,gchar *message, gint time); gboolean switch_to_document_by_index(Tbfwin *bfwin,gint index); gboolean switch_to_document_by_pointer(Tbfwin *bfwin,Tdocument *document); gboolean switch_to_document_by_filename(Tbfwin *bfwin,gchar *filename); void go_to_line_win_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void go_to_line_from_selection_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void splash_screen_set_label(gchar *label); GtkWidget *start_splash_screen(void); Tbfwin *gui_new_window(GList *filenames, Tproject *project); void gui_window_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); #endif /* __GUI_H_ */ winefish-1.3.3/src/bfspell.h0000600000047200004720000000033710373411041014714 0ustar kyanhkyanh/* $Id: bfspell.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* * Modified for Winefish (C) 2005 Ky Anh */ #ifdef HAVE_LIBASPELL void spell_check_cb(GtkWidget *widget, Tbfwin *bfwin); #endif /* HAVE_LIBASPELL */ winefish-1.3.3/src/brace_finder.c0000600000047200004720000003274110411777515015705 0ustar kyanhkyanh/* $Id: brace_finder.c 2248 2006-03-27 15:05:49Z kyanh $ */ /* Winefish LaTeX Editor * * brace_finder.c * * Copyright (C) 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* strlen */ #include "bluefish.h" #include "brace_finder.h" /* #include "document.h" */ /* (=40,)=41, $=36, %=37, \=92, {=123,}=125, [=91,]=93, \n=10, \r=13 */ /* */ static gboolean is_true_char(GtkTextIter *iter) { gboolean retval = TRUE; GtkTextIter tmpiter; tmpiter = *iter; gunichar ch; while (gtk_text_iter_backward_char(&tmpiter)) { ch =gtk_text_iter_get_char(&tmpiter); if ( ch == 92 ) { retval = ! retval; }else{ break; } } return retval; } /* static gboolean percent_predicate(gunichar ch, gpointer data) { if (ch == 37) { return TRUE; } else { return FALSE; } } static gboolean dollar_predicate(gunichar ch, gpointer data) { if (ch == 36) { return TRUE; } else { return FALSE; } } */ /* kyanh, 20060128 */ guint16 brace_finder(GtkTextBuffer *buffer, Tbracefinder *brfinder, gint opt, gint limit) { GtkTextIter iter_start, iter_start_new, iter_end; GtkTextIter tmpiter/* LEFT */, tmp2iter /* RIGHT */, tmpiter_extra /* = `tmpiter' for dollar sign if opt & BR_AUTO_FIND */; guint16 retval; retval = BRACEFINDER(brfinder)->last_status; DEBUG_MSG("\nbrace_finder: opt=%d, limit=%d, last_status=%hd, moved_left=%hd, moved_right=%hd\n", opt, limit,retval, retval &BR_RET_MOVED_LEFT, retval & BR_RET_MOVED_RIGHT ); if ( retval & BR_RET_FOUND ) { if (!(retval & BR_RET_MISS_MID_BRACE)) { #ifdef STUPID_USE_CACHE gboolean use_cached= FALSE; if (retval & (BR_RET_MOVED_LEFT | BR_RET_MOVED_RIGHT) ) { DEBUG_MSG("brace_finder: previous status: jump left/right from a brace\n"); if (opt & BR_MOVE_IF_FOUND) { use_cached = TRUE; } } if (use_cached) { gtk_text_buffer_get_iter_at_mark(buffer, &tmpiter, BRACEFINDER(brfinder)->mark_left); gtk_text_buffer_get_iter_at_mark(buffer, &tmp2iter, BRACEFINDER(brfinder)->mark_mid); if (retval & BR_RET_MOVED_LEFT) { gtk_text_buffer_place_cursor(buffer, &tmpiter); retval = SET_BIT(retval, BR_RET_MOVED_LEFT,0); retval = SET_BIT(retval, BR_RET_MOVED_RIGHT,1); }else{ retval = SET_BIT(retval, BR_RET_MOVED_LEFT,1); retval = SET_BIT(retval, BR_RET_MOVED_RIGHT,0); gtk_text_buffer_place_cursor(buffer, &tmp2iter); } BRACEFINDER(brfinder)->last_status = retval; return retval; }else{ #endif /* STUPID_USE_CACHE */ gtk_text_buffer_get_iter_at_mark(buffer, &tmp2iter, BRACEFINDER(brfinder)->mark_mid); tmpiter_extra = tmp2iter; gtk_text_iter_forward_char(&tmpiter_extra); gtk_text_buffer_remove_tag(buffer, BRACEFINDER(brfinder)->tag, &tmp2iter, &tmpiter_extra); #ifdef STUPID_USE_CACHE } #endif /* STUPID_USE_CACHE */ } if (retval & (BR_RET_FOUND_RIGHT_BRACE | BR_RET_FOUND_RIGHT_DOLLAR) ) { gtk_text_buffer_get_iter_at_mark(buffer, &tmpiter, BRACEFINDER(brfinder)->mark_left); tmpiter_extra = tmpiter; gtk_text_iter_forward_char(&tmpiter_extra); gtk_text_buffer_remove_tag(buffer, BRACEFINDER(brfinder)->tag, &tmpiter, &tmpiter_extra); } if ( retval & ( BR_RET_FOUND_LEFT_DOLLAR | BR_RET_FOUND_LEFT_BRACE ) ) { gtk_text_buffer_get_iter_at_mark(buffer, &tmpiter, BRACEFINDER(brfinder)->mark_right); tmpiter_extra = tmpiter; gtk_text_iter_forward_char(&tmpiter_extra); gtk_text_buffer_remove_tag(buffer, BRACEFINDER(brfinder)->tag, &tmpiter, &tmpiter_extra); } } if (limit <0 ) { DEBUG_MSG("brace_finder: limit<0, received 'flash' signal. done and return now...\n"); return BR_RET_NOOP; } BRACEFINDER(brfinder)->last_status = 0; GtkTextMark *insert, *select; insert = gtk_text_buffer_get_insert(buffer); select = gtk_text_buffer_get_selection_bound(buffer); gtk_text_buffer_get_iter_at_mark(buffer, &iter_start, insert); gtk_text_buffer_get_iter_at_mark(buffer, &iter_end, select); gchar *tmpstr; tmpstr = gtk_text_iter_get_text(&iter_start, &iter_end); /* if there's selection, its length should be 1 */ if (tmpstr && (strlen(tmpstr) > 1) ){ g_free(tmpstr); BRACEFINDER(brfinder)->last_status = BR_RET_IN_SELECTION; return BR_RET_IN_SELECTION; }else{ g_free(tmpstr); } gunichar ch, Lch, Rch; gint level, limit_idx, char_idx; retval = BR_RET_NOT_FOUND; gint found_comment_sign; /* A:: check if we are inside comment line */ DEBUG_MSG("brace_finder: check for comment status:\n"); tmpiter = iter_start; gtk_text_iter_set_line_offset(&tmpiter,0); /* move to start of line */ /* now forward to find next %. limit = iter_start_new */ found_comment_sign = FALSE; while ( (gtk_text_iter_compare(&tmpiter, &iter_start) < 0) ) { if ( ( gtk_text_iter_get_char(&tmpiter) == 37) && is_true_char(&tmpiter) ) { found_comment_sign = TRUE; break; }else{ gtk_text_iter_forward_char(&tmpiter); } } if ( found_comment_sign ) {/* in comment */ DEBUG_MSG("brace_finder: in comment line\n"); iter_start = tmpiter; } /* recaculate the iter_start */ tmpiter = iter_start; gtk_text_iter_backward_char(&tmpiter); Lch = gtk_text_iter_get_char(&tmpiter); Rch = gtk_text_iter_get_char(&iter_start); if ( (Rch == 36) && is_true_char(&iter_start) ) { iter_start_new = iter_start; } else if ( VALID_BRACE(Rch) && is_true_char(&iter_start) ) { if ( opt & BR_FIND_BACKWARD ) { if ( VALID_BRACE(Lch) && is_true_char(&tmpiter) ) { iter_start_new = tmpiter; }else{ iter_start_new = iter_start; } } else { iter_start_new = iter_start; } } else if ( VALID_BRACE(Lch) && is_true_char(&tmpiter) ) { iter_start_new = tmpiter; } else { iter_start_new = iter_start; retval = retval | BR_RET_MISS_MID_BRACE; DEBUG_MSG("brace_finder: missed mid brace\n"); } if (gtk_text_iter_get_char(&iter_start_new) ==37) { gtk_text_iter_backward_char(&iter_start_new); } #ifdef DEBUG Lch = gtk_text_iter_get_char(&iter_start_new); DEBUG_MSG("brace_finder: new start = %c\n", Lch); #endif limit_idx=1; level=1; char_idx=1; tmpiter = iter_start_new; if (retval & BR_RET_MISS_MID_BRACE) { Lch = 123; }else{ Lch = gtk_text_iter_get_char(&tmpiter); } DEBUG_MSG("brace_finder: Lch=%c\n", Lch); if ( VALID_LEFT_BRACE(Lch) ) {/* { */ DEBUG_MSG("brace_finder: find forward...\n"); Rch = (Lch==40)?41:((Lch==91)?93:125); /* we may meet } */ while (gtk_text_iter_forward_char(&tmpiter)) { if (limit) { char_idx++; if (char_idx > BRACE_FINDER_MAX_CHARS) { break; } } ch = gtk_text_iter_get_char(&tmpiter); DEBUG_MSG("%c",ch); if ((ch == 37) && is_true_char(&tmpiter)) {/* % */ gtk_text_iter_forward_to_line_end(&tmpiter); }else if( (ch == Lch) && is_true_char(&tmpiter)) {/* { */ level ++; }else if((ch == Rch) && is_true_char(&tmpiter)) {/* } */ level --; if (level==0) { retval = retval | BR_RET_FOUND | BR_RET_FOUND_RIGHT_BRACE; break; /* finish the loop */ }else if(level<0){ break; } }else if (limit && gtk_text_iter_ends_line(&tmpiter)) { limit_idx++; if (limit_idx > limit) { break; } } } } limit_idx=1; level=1; char_idx=1; tmpiter_extra = iter_start_new; if (retval & BR_RET_MISS_MID_BRACE) { Lch = 125; }else{ Lch = gtk_text_iter_get_char(&tmpiter_extra); } if ( VALID_RIGHT_BRACE(Lch) ) {/* } */ DEBUG_MSG("brace_finder: find backward...\n"); Rch = (Lch==41)?40:((Lch==93)?91:123); while (gtk_text_iter_backward_char(&tmpiter_extra) ){ if (limit) { char_idx++; if (char_idx > BRACE_FINDER_MAX_CHARS) { break; } } ch = gtk_text_iter_get_char(&tmpiter_extra); if ((ch==Rch) && is_true_char(&tmpiter_extra)) {/* { */ level--; if (level==0) { retval = retval | BR_RET_FOUND | BR_RET_FOUND_LEFT_BRACE; break; }else if (level<0) { break; } }else if((ch==Lch) && is_true_char(&tmpiter_extra)) {/* } */ level ++; }else if (gtk_text_iter_ends_line(&tmpiter_extra)) { DEBUG_MSG("brace_finder: end of line. check for comment status\n"); if (limit) { limit_idx++; if (limit_idx > limit) { break; } } tmp2iter = tmpiter_extra; gtk_text_iter_set_line_offset(&tmp2iter,0); /* if we are in a comment line search from the begining of line to the end == tmpiter; */ found_comment_sign = FALSE; while (gtk_text_iter_compare(&tmp2iter, &tmpiter_extra) < 0 ) { if ( (gtk_text_iter_get_char(&tmp2iter) ==37) && is_true_char(&tmp2iter) ) { found_comment_sign = TRUE; break; }else{ gtk_text_iter_forward_char(&tmp2iter); } } if (found_comment_sign) { tmpiter_extra = tmp2iter; } } } } if ( Lch == 36 ) { if ( (opt & BR_AUTO_FIND) || (opt & BR_FIND_FORWARD) ) { limit_idx=1; char_idx=1; tmpiter = iter_start_new; while (gtk_text_iter_forward_char(&tmpiter)) { if (limit) { char_idx++; if (char_idx > BRACE_FINDER_MAX_CHARS) { break; } } ch = gtk_text_iter_get_char(&tmpiter); if ((ch == 37) && is_true_char(&tmpiter)) {/* % */ gtk_text_iter_forward_to_line_end(&tmpiter); }else if( (ch == 36) && is_true_char(&tmpiter)) {/* { */ retval = retval | BR_RET_FOUND | BR_RET_FOUND_RIGHT_DOLLAR; break; }else if (limit && gtk_text_iter_ends_line(&tmpiter)) { limit_idx++; if (limit_idx > limit) { break; } } } } if ( (opt & BR_AUTO_FIND) || (opt & BR_FIND_BACKWARD) ) {/* try to find backward */ tmpiter_extra = iter_start_new; limit_idx=1; char_idx=1; while (gtk_text_iter_backward_char(&tmpiter_extra)) { if (limit) { char_idx++; if (char_idx > BRACE_FINDER_MAX_CHARS) { break; } } ch = gtk_text_iter_get_char(&tmpiter_extra); if( (ch == 36) && is_true_char(&tmpiter_extra)) {/* { */ retval = retval | BR_RET_FOUND | BR_RET_FOUND_LEFT_DOLLAR; break; } else if (gtk_text_iter_ends_line(&tmpiter_extra)) { if (limit) { limit_idx++; if (limit_idx > limit) { break; } } tmp2iter = tmpiter_extra; gtk_text_iter_set_line_offset(&tmp2iter,0); found_comment_sign = FALSE; while (gtk_text_iter_compare(&tmp2iter, &tmpiter_extra) < 0 ) { if ( (gtk_text_iter_get_char(&tmp2iter) ==37) && is_true_char(&tmp2iter) ) { found_comment_sign = TRUE; break; }else{ gtk_text_iter_forward_char(&tmp2iter); } } if (found_comment_sign) { tmpiter_extra = tmp2iter; } } } } } /* if (limit==0) { retval = retval | BR_RET_FOUND_WITH_LIMIT_O; } */ /* finished */ if (retval & BR_RET_FOUND ) { /* for $: result is (extra-mid-left) for others: result is (left-mid) or (mid-left) */ /* gtk_text_iter_order(&tmpiter,&iter_start_new); */ if ( opt & BR_MOVE_IF_FOUND ) { if (retval & BR_RET_MISS_MID_BRACE) { if ( (opt & BR_FIND_BACKWARD) && (retval & BR_RET_FOUND_LEFT_BRACE) ) { retval = retval | BR_RET_MOVED_LEFT; gtk_text_buffer_place_cursor (buffer, &tmpiter_extra); } else if ( (opt & BR_FIND_FORWARD) && (retval & BR_RET_FOUND_RIGHT_BRACE) ) { retval = retval | BR_RET_MOVED_RIGHT; gtk_text_buffer_place_cursor (buffer, &tmpiter); } }else{ if ( (opt & BR_FIND_BACKWARD) && (retval & BR_RET_FOUND_LEFT_DOLLAR) ) { retval = retval | BR_RET_MOVED_LEFT; gtk_text_buffer_place_cursor (buffer, &tmpiter_extra); }else if ( (opt & BR_FIND_FORWARD) && (retval & BR_RET_FOUND_RIGHT_DOLLAR) ) { retval = retval | BR_RET_MOVED_RIGHT; gtk_text_buffer_place_cursor (buffer, &tmpiter); }else if ( (retval & BR_RET_FOUND_RIGHT_BRACE) ){ retval = retval | BR_RET_MOVED_RIGHT; gtk_text_buffer_place_cursor (buffer, &tmpiter); }else if ( (retval & BR_RET_FOUND_LEFT_BRACE) ) { retval = retval | BR_RET_MOVED_LEFT; gtk_text_buffer_place_cursor (buffer, &tmpiter_extra); } } } if (retval & (BR_RET_FOUND_RIGHT_BRACE | BR_RET_FOUND_RIGHT_DOLLAR) ) { gtk_text_buffer_move_mark(buffer,BRACEFINDER(brfinder)->mark_left , &tmpiter); /* right matched */ tmp2iter = tmpiter; gtk_text_iter_forward_char(&tmp2iter); gtk_text_buffer_apply_tag(buffer,BRACEFINDER(brfinder)->tag,&tmpiter, &tmp2iter); } if (!(retval & BR_RET_MISS_MID_BRACE)) { gtk_text_buffer_move_mark(buffer,BRACEFINDER(brfinder)->mark_mid, &iter_start_new); /* mid matched or current cursor */ tmpiter = iter_start_new; tmp2iter = tmpiter; gtk_text_iter_forward_char(&tmp2iter); gtk_text_buffer_apply_tag(buffer,BRACEFINDER(brfinder)->tag,&tmpiter, &tmp2iter); } if ( retval & ( BR_RET_FOUND_LEFT_DOLLAR | BR_RET_FOUND_LEFT_BRACE ) ) { gtk_text_buffer_move_mark(buffer,BRACEFINDER(brfinder)->mark_right,&tmpiter_extra); /* left matched or extra dollar */ tmp2iter = tmpiter_extra; gtk_text_iter_forward_char(&tmp2iter); gtk_text_buffer_apply_tag(buffer,BRACEFINDER(brfinder)->tag,&tmpiter_extra, &tmp2iter); } } BRACEFINDER(brfinder)->last_status = retval; DEBUG_MSG("brace_finder: now_status=%d, moved_left=%d, moved_right=%d\n", retval, retval &BR_RET_MOVED_LEFT, retval & BR_RET_MOVED_RIGHT ); return retval; } winefish-1.3.3/src/rcfile.c0000600000047200004720000013071610412001744014530 0ustar kyanhkyanh/* $Id: rcfile.c 2254 2006-03-27 15:25:24Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * rcfile.c - loading and parsing of the configfiles * * Copyright (C) 2000-2004 Olivier Sessink * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include #include #include #include #include #include #include #include #include #include "bluefish.h" #include "rcfile.h" #include "bf_lib.h" #include "fref.h" #include "stringlist.h" #include "highlight.h" /* hl_reset_to_default()*/ #include "document.h" /* DOCUMENT_BACKUP_ABORT_ASK */ #include "outputbox.h" /* OB_NEED_SAVE_FILE, OB_SHOW_ALL_OUTPUT */ typedef struct { void *pointer; /* where should the value be stored ?*/ unsigned char type; /* a=arraylist, l=stringlist, s=string, e=string with escape, i=integer, m=limiTed stringlist */ gchar *identifier; /* the string that should be in the config file for this entry */ gint len; /* used for arrays and limitedstringlists, the length the list should have (only during save), or the number of items the array should have (during load) */ } Tconfig_list_item; static GList *main_configlist=NULL; static GList *highlighting_configlist=NULL; static GList *custom_menu_configlist=NULL; static void free_configlist(GList *configlist) { GList *tmplist = g_list_first(configlist); while(tmplist) { Tconfig_list_item *cli = tmplist->data; g_free(cli); tmplist = g_list_next(tmplist); } g_list_free(configlist); } /*this should add 1 empty entry to the configuration list */ GList *make_config_list_item(GList * config_list, void *pointer_to_var, unsigned char type_of_var, gchar * name_of_var, gint len) { Tconfig_list_item *config_list_item; if (!pointer_to_var) { DEBUG_MSG("make_config_list_item, pointer to var = NULL !\n"); return config_list; } config_list_item = g_malloc(sizeof(Tconfig_list_item)); config_list_item->pointer = pointer_to_var; config_list_item->type = type_of_var; config_list_item->identifier = name_of_var; config_list_item->len = len; return (GList *) g_list_append(config_list, config_list_item); } static void init_prop_integer(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gint default_value, gboolean set_default) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'i', name_of_var, 0); if (set_default) *(gint *)pointer_to_var = default_value; } static void xinit_prop_integer(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gint default_value, gboolean set_default) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'x', name_of_var, 0); if (set_default) *(guint32 *)pointer_to_var = default_value; } static void init_prop_string(GList ** config_list, void *pointer_to_var, gchar * name_of_var, const gchar * default_value) { *config_list = make_config_list_item(*config_list, pointer_to_var, 's', name_of_var, 0); if (*(gchar **) pointer_to_var == NULL) { *(gchar **) pointer_to_var = g_strdup(default_value); } DEBUG_MSG("init_prop_string, name_of_var=%s, default_value=%s, current value=%s\n", name_of_var, default_value, *(gchar **) pointer_to_var); } static void init_prop_string_with_escape(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gchar * default_value) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'e', name_of_var, 0); if (*(gchar **) pointer_to_var == NULL && default_value) { *(gchar **) pointer_to_var = unescape_string(default_value, FALSE); } DEBUG_MSG("init_prop_string, name_of_var=%s, default_value=%s\n", name_of_var, default_value); } static void init_prop_stringlist(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gboolean setNULL) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'l', name_of_var, 0); if (setNULL) { pointer_to_var = NULL; } } static void init_prop_arraylist(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gint len, gboolean setNULL) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'a', name_of_var, len); if (setNULL) { pointer_to_var = NULL; } } static void init_prop_limitedstringlist(GList ** config_list, void *pointer_to_var, gchar * name_of_var, gint len, gboolean setNULL) { *config_list = make_config_list_item(*config_list, pointer_to_var, 'm', name_of_var, len); if (setNULL) { pointer_to_var = NULL; } } static gint save_config_file(GList * config_list, gchar * filename) { gchar *tmpstring = NULL, *tmpstring2; GList *rclist, *tmplist, *tmplist2; Tconfig_list_item *tmpitem; DEBUG_MSG("save_config_file, started\n"); rclist = NULL; /* We must first make a list with 1 string per item. */ tmplist = g_list_first(config_list); while (tmplist != NULL) { DEBUG_MSG("save_config_file, tmpitem at %p\n", tmplist->data); tmpitem = tmplist->data; DEBUG_MSG("save_config_file, identifier=%s datatype %c\n", tmpitem->identifier,tmpitem->type); switch (tmpitem->type) { case 'x': DEBUG_MSG("save_config_file, converting \"%p\" to x integer\n", tmpitem); DEBUG_MSG("save_config_file, converting \"%s %d\"\n", tmpitem->identifier, *(guint32 *) (void *) tmpitem->pointer); tmpstring = g_strdup_printf("%s %d", tmpitem->identifier, *(guint32 *) (void *) tmpitem->pointer); DEBUG_MSG("save_config_file, adding %s\n", tmpstring); rclist = g_list_append(rclist, tmpstring); break; case 'i': DEBUG_MSG("save_config_file, converting \"%p\" to integer\n", tmpitem); DEBUG_MSG("save_config_file, converting \"%s %i\"\n", tmpitem->identifier, *(int *) (void *) tmpitem->pointer); tmpstring = g_strdup_printf("%s %i", tmpitem->identifier, *(int *) (void *) tmpitem->pointer); DEBUG_MSG("save_config_file, adding %s\n", tmpstring); rclist = g_list_append(rclist, tmpstring); break; case 's': DEBUG_MSG("save_config_file, converting \"%p\" to string\n", tmpitem); DEBUG_MSG("save_config_file, converting \"%s %s\"\n", tmpitem->identifier, (gchar *) * (void **) tmpitem->pointer); if (*(void **) tmpitem->pointer) { tmpstring = g_strdup_printf("%s %s", tmpitem->identifier, (gchar *) * (void **) tmpitem->pointer); DEBUG_MSG("save_config_file, adding %s\n", tmpstring); rclist = g_list_append(rclist, tmpstring); } break; case 'e': DEBUG_MSG("save_config_file, converting \"%p\"\n", tmpitem); DEBUG_MSG("save_config_file, converting \"%s %s\"\n", tmpitem->identifier, (gchar *) * (void **) tmpitem->pointer); if (*(void **) tmpitem->pointer) { tmpstring2 = escape_string((gchar*)*(void**)tmpitem->pointer, FALSE); tmpstring = g_strdup_printf("%s %s", tmpitem->identifier, tmpstring2); DEBUG_MSG("save_config_file, adding %s\n", tmpstring); rclist = g_list_append(rclist, tmpstring); g_free(tmpstring2); } break; case 'l': case 'm': { gint max = -1; /* by setting it to -1, it will never become zero if we substract 1 every round */ DEBUG_MSG("save_config_file, type %c, tmpitem(%p), &tmpitem=%p\n", tmpitem->type, tmpitem, &tmpitem); if (tmpitem->type == 'm') max = tmpitem->len; tmplist2 = g_list_last((GList *) * (void **) tmpitem->pointer); while (tmplist2 != NULL && max != 0) { tmpstring2 = (char *) tmplist2->data; DEBUG_MSG("save_config_file, tmpstring2(%p)=%s\n", tmpstring2, tmpstring2); tmpstring = g_strdup_printf("%s %s", tmpitem->identifier, tmpstring2); DEBUG_MSG("save_config_file, tmpstring(%p)=%s\n", tmpstring, tmpstring); rclist = g_list_append(rclist, tmpstring); tmplist2 = g_list_previous(tmplist2); max--; } } break; case 'a': DEBUG_MSG("save_config_file, tmpitem(%p), &tmpitem=%p\n", tmpitem, &tmpitem); tmplist2 = g_list_last((GList *) * (void **) tmpitem->pointer); DEBUG_MSG("save_config_file, the tmplist2(%p)\n", tmplist2); while (tmplist2 != NULL) { tmpstring2 = array_to_string((char **) tmplist2->data); tmpstring = g_strdup_printf("%s %s", tmpitem->identifier, tmpstring2); DEBUG_MSG("save_config_file, tmpstring(%p)=%s\n", tmpstring, tmpstring); rclist = g_list_append(rclist, tmpstring); tmplist2 = g_list_previous(tmplist2); g_free(tmpstring2); } break; default: break; } tmplist = g_list_next(tmplist); } put_stringlist(filename, rclist); free_stringlist(rclist); return 1; } static gboolean parse_config_file(GList * config_list, gchar * filename) { gboolean retval = FALSE; gchar *tmpstring = NULL, *tmpstring2; gchar **tmparray; GList *rclist, *tmplist, *tmplist2; Tconfig_list_item *tmpitem; DEBUG_MSG("parse_config_file, started\n"); rclist = NULL; rclist = get_list(filename, rclist,FALSE); if (rclist == NULL) { DEBUG_MSG("no rclist, returning!\n"); return retval; } /* empty all variables that have type GList ('l') */ tmplist = g_list_first(config_list); while (tmplist != NULL) { tmpitem = (Tconfig_list_item *) tmplist->data; DEBUG_MSG("parse_config_file, type=%c, identifier=%s\n", tmpitem->type, tmpitem->identifier); if (tmpitem->type == 'l' || tmpitem->type == 'a') { DEBUG_MSG("parse_config_file, freeing list before filling it\n"); free_stringlist((GList *) * (void **) tmpitem->pointer); *(void **) tmpitem->pointer = (GList *)NULL; } DEBUG_MSG("parse_config_file, type=%c, identifier=%s\n", tmpitem->type, tmpitem->identifier); tmplist = g_list_next(tmplist); } DEBUG_MSG("parse_config_file, all the type 'l' and 'a' have been emptied\n"); DEBUG_MSG("parse_config_file, length rclist=%d\n", g_list_length(rclist)); /* And now for parsing every line in the config file, first check if there is a valid identifier at the start. */ tmplist = g_list_first(rclist); while (tmplist) { tmpstring = (gchar *) tmplist->data; if (tmpstring != NULL) { DEBUG_MSG("parse_config_file, tmpstring=%s\n", tmpstring); g_strchug(tmpstring); tmplist2 = g_list_first(config_list); while (tmplist2) { tmpitem = (Tconfig_list_item *) tmplist2->data; #ifdef DEVELOPMENT if (!tmpitem || !tmpitem->identifier || !tmpstring) { g_print("WARNING: almost a problem!\n"); } #endif if (g_strncasecmp(tmpitem->identifier, tmpstring, strlen(tmpitem->identifier)) == 0) { /* we have found the correct identifier */ retval = TRUE; DEBUG_MSG("parse_config_file, identifier=%s, string=%s\n", tmpitem->identifier, tmpstring); /* move pointer past the identifier */ tmpstring += strlen(tmpitem->identifier); trunc_on_char(tmpstring, '\n'); g_strstrip(tmpstring); switch (tmpitem->type) { case 'x': *(guint32 *) (void *) tmpitem->pointer = GPOINTER_TO_UINT(tmpstring);/* kyanh, 20060127 */ case 'i': *(int *) (void *) tmpitem->pointer = atoi(tmpstring); break; case 's': *(void **) tmpitem->pointer = (char *) realloc((char *) *(void **) tmpitem->pointer, strlen(tmpstring) + 1); strcpy((char *) *(void **) tmpitem->pointer, tmpstring); break; case 'e': tmpstring2 = unescape_string(tmpstring, FALSE); /* I wonder if that should be TRUE */ *(void **) tmpitem->pointer = (char *) realloc((char *) *(void **) tmpitem->pointer, strlen(tmpstring2) + 1); strcpy((char *) *(void **) tmpitem->pointer, tmpstring2); g_free(tmpstring2); break; case 'l': case 'm': tmpstring2 = g_strdup(tmpstring); * (void **) tmpitem->pointer = g_list_prepend((GList *) * (void **) tmpitem->pointer, tmpstring2); DEBUG_MSG("parse_config_file, *(void **)tmpitem->pointer=%p\n", *(void **) tmpitem->pointer); break; case 'a': tmparray = string_to_array(tmpstring); if (tmpitem->len <= 0 || tmpitem->len == count_array(tmparray)) { * (void **) tmpitem->pointer = g_list_prepend((GList *) * (void **) tmpitem->pointer, tmparray); } else { DEBUG_MSG("parse_config_file, not storing array, count_array() != tmpitem->len\n"); g_strfreev(tmparray); } DEBUG_MSG("parse_config_file, *(void **)tmpitem->pointer=%p\n", *(void **) tmpitem->pointer); break; default: break; } tmplist2 = g_list_last(tmplist2); } tmplist2 = g_list_next(tmplist2); } } tmplist = g_list_next(tmplist); } DEBUG_MSG("parse_config_file, parsed all entries, freeing list read from file\n"); free_stringlist(rclist); return retval; } static GList *props_init_main(GList * config_rc) { /* these are used in the gtk-2 port already */ init_prop_integer (&config_rc, &main_v->props.filebrowser_show_hidden_files, "fb_show_hidden_f:", 0, TRUE); init_prop_integer (&config_rc, &main_v->props.filebrowser_show_backup_files, "fb_show_backup_f:", 0, TRUE); /* init_prop_integer (&config_rc, &main_v->props.filebrowser_two_pane_view, "fb_two_pane_view:", 1, TRUE);*/ init_prop_integer (&config_rc, &main_v->props.filebrowser_focus_follow, "fb_focus_follow:", 1, TRUE); init_prop_string (&config_rc, &main_v->props.filebrowser_unknown_icon, "fb_unknown_icon:", PKGDATADIR"icon_unknown.png"); init_prop_string (&config_rc, &main_v->props.filebrowser_dir_icon, "fb_dir_icon:", PKGDATADIR"icon_dir.png"); init_prop_string (&config_rc, &main_v->props.editor_font_string, "editor_font_string:", "courier 11"); init_prop_integer (&config_rc, &main_v->props.editor_tab_width, "editor_tab_width:", 3, TRUE); /* init_prop_integer (&config_rc, &main_v->props.editor_indent_wspaces, "editor_indent_wspaces:", 0, TRUE); */ init_prop_string (&config_rc, &main_v->props.tab_font_string, "tab_font_string:", ""); init_prop_arraylist (&config_rc, &main_v->props.browsers, "browsers:", 2, TRUE); init_prop_arraylist (&config_rc, &main_v->props.external_commands, "external_commands:", 2, TRUE); init_prop_integer (&config_rc, &main_v->props.highlight_num_lines_count, "highlight_num_lines_count:", 5, TRUE); xinit_prop_integer (&config_rc, &main_v->props.view_bars, "view_bars:", MODE_DEFAULT, TRUE); /* old type filetypes have a different count, they are converted below */ init_prop_arraylist (&config_rc, &main_v->props.filetypes, "filetypes:", 0, TRUE); init_prop_integer (&config_rc, &main_v->props.numcharsforfiletype, "numcharsforfiletype:", 30, TRUE); init_prop_arraylist (&config_rc, &main_v->props.filefilters, "filefilters:", 3, TRUE); init_prop_string (&config_rc, &main_v->props.last_filefilter, "last_filefilter:", ""); /* init_prop_integer (&config_rc, &main_v->props.transient_htdialogs, "transient_htdialogs:", 1, TRUE); */ /* init_prop_integer (&config_rc, &main_v->props.restore_dimensions, "restore_dimensions:", 1, TRUE); */ init_prop_integer (&config_rc, &main_v->props.left_panel_width, "left_panel_width:", 150, TRUE); init_prop_integer (&config_rc, &main_v->props.left_panel_left, "left_panel_left:", 1, TRUE); init_prop_integer (&config_rc, &main_v->props.max_recent_files, "max_recent_files:", 15, TRUE); init_prop_integer (&config_rc, &main_v->props.max_dir_history, "max_dir_history:", 15, TRUE); /* init_prop_integer (&config_rc, &main_v->props.backup_file,"backup_file:",1, TRUE); */ init_prop_string (&config_rc, &main_v->props.backup_filestring,"backup_filestring:","~"); init_prop_integer (&config_rc, &main_v->props.backup_abort_action,"backup_abort_action:",DOCUMENT_BACKUP_ABORT_ASK, TRUE); /* init_prop_integer (&config_rc, &main_v->props.backup_cleanuponclose,"backup_cleanuponclose:",0, TRUE); */ /* init_prop_integer (&config_rc, &main_v->props.allow_multi_instances,"allow_multi_instances:",0, TRUE); */ init_prop_integer (&config_rc, &main_v->props.modified_check_type,"modified_check_type:",1, TRUE); init_prop_integer (&config_rc, &main_v->props.num_undo_levels,"num_undo_levels:",100, TRUE); /* init_prop_integer (&config_rc, &main_v->props.clear_undo_on_save,"clear_undo_on_save:",0, TRUE); */ init_prop_string (&config_rc, &main_v->props.newfile_default_encoding,"newfile_default_encoding:","UTF-8"); init_prop_arraylist (&config_rc, &main_v->props.encodings, "encodings:", 2, TRUE); /* init_prop_integer (&config_rc, &main_v->props.encoding_search_Nbytes, "encoding_search_Nbytes:", 500, TRUE); */ init_prop_arraylist (&config_rc, &main_v->props.outputbox, "outputbox:", 7, TRUE); init_prop_arraylist (&config_rc, &main_v->props.reference_files, "reference_files:", 2, TRUE); init_prop_integer (&config_rc, &main_v->props.bookmarks_default_store,"bookmarks_default_store:",1, TRUE); init_prop_integer (&config_rc, &main_v->props.bookmarks_filename_mode,"bookmarks_filename_mode:",1, TRUE); init_prop_integer (&config_rc, &main_v->props.document_tabposition,"document_tabposition:",(gint)GTK_POS_BOTTOM, TRUE); init_prop_integer (&config_rc, &main_v->props.leftpanel_tabposition,"leftpanel_tabposition:",(gint)GTK_POS_BOTTOM, TRUE); init_prop_string (&config_rc, &main_v->props.default_basedir,"default_basedir:",g_get_home_dir()); #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND gchar *tmpstr; tmpstr = g_strconcat(g_get_home_dir(),"/tex/templates/",NULL); init_prop_string (&config_rc, &main_v->props.templates_dir,"templates_dir:",tmpstr); g_free(tmpstr); #endif #endif #ifdef ENABLE_COLUMN_MARKER init_prop_integer (&config_rc, &main_v->props.marker_i,"marker_i:",80, TRUE); init_prop_integer (&config_rc, &main_v->props.marker_ii,"marker_ii:",0, TRUE); init_prop_integer (&config_rc, &main_v->props.marker_iii,"marker_iii:",0, TRUE); #endif /* ENABLE_COLUMN_MARKER */ init_prop_string (&config_rc, &main_v->props.project_suffix,"project_suffix:",".wfproject"); #ifdef HAVE_LIBASPELL init_prop_string(&config_rc, &main_v->props.spell_default_lang, "spell_default_lang:", "en"); #endif /* HAVE_LIBASPELL */ /* init_prop_integer(&config_rc, &main_v->props.word_wrap, "word_wrap:", 0, TRUE); */ /* init_prop_integer(&config_rc, &main_v->props.autoindent, "autoindent:", 1, TRUE); */ /* init_prop_integer(&config_rc, &main_v->props.drop_at_drop_pos, "drop_at_drop_position:", 0, TRUE); */ #ifdef WITH_MSG_QUEUE /* init_prop_integer (&config_rc, &main_v->props.open_in_running_bluefish,"open_in_running_bluefish:",1, TRUE); */ #endif return config_rc; } /* we save the value in 'days' precision, so we can divide seconds by 24*60*60 , this way we can store it in a gint (which is the config file precision) */ #define TIME_T_TO_GINT(time) ((gint)(time / (24*60*60))) static gboolean config_file_is_newer(gint lasttime, const gchar *configfile) { struct stat statbuf; if(stat(configfile, &statbuf)==0) { if (TIME_T_TO_GINT(statbuf.st_mtime) >= lasttime) return TRUE; } return FALSE; } /* static GList *arraylist_load_defaults(GList *thelist, const gchar *filename, const gchar *name) { GList *deflist,*tmplist = g_list_first(thelist); if (name) { while (tmplist) { gchar **tmparr = tmplist->data; if (strcmp(tmparr[0],name)==0) { GList *todelete = tmplist; tmplist = g_list_next(tmplist); if (tmplist) { g_list_delete_link(tmplist, todelete); g_strfreev(tmparr); g_list_free_1(todelete); } else { thelist = NULL; g_strfreev(tmparr); g_list_free(todelete); } } else { tmplist = g_list_next(tmplist); } } } else { while (tmplist) { g_strfreev((gchar **)tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(thelist); thelist = NULL; } if (name) { deflist = get_list(filename,NULL,TRUE); tmplist = g_list_first(deflist); while (tmplist) { gchar **tmparr = tmplist->data; DEBUG_MSG("arraylist_load_defaults, testing if %s should be added (requested=%s)\n",tmparr[0],name); if (strcmp(tmparr[0],name)==0) { DEBUG_MSG("adding %s to thelist\n",tmparr[0]); thelist = g_list_append(thelist, duplicate_stringarray(tmparr)); } tmplist = g_list_next(tmplist); } free_arraylist(deflist); } else { thelist = get_list(filename,NULL,TRUE); } return thelist; } */ void rcfile_parse_main(void) { gchar *filename; DEBUG_MSG("rcfile_parse_main, started\n"); /* set the props struct completely empty */ memset(&main_v->props, 0, sizeof(Tproperties)); /*Make the config_rc list ready for filling with data and set default values */ main_configlist = props_init_main(NULL); filename = g_strconcat(g_get_home_dir(), "/.winefish/rcfile", NULL); if (!parse_config_file(main_configlist, filename)) { /* TODO: should we initialize some things ?? */ } g_free(filename); /* do some default configuration for the lists */ if (main_v->props.browsers == NULL) { /* if the user does not have browsers --> set them to defaults values */ gchar **arr; arr = array_from_arglist(_("DVI Viewer"), OB_DVI_Viewer,NULL); main_v->props.browsers = g_list_append(main_v->props.browsers,arr); arr = array_from_arglist(_("PDF Viewer"), OB_PDF_Viewer,NULL); main_v->props.browsers = g_list_append(main_v->props.browsers,arr); arr = array_from_arglist(_("EPS Viewer"), OB_EPS_Viewer,NULL); main_v->props.browsers = g_list_append(main_v->props.browsers,arr); } { gchar *defaultfile = return_first_existing_filename(PKGDATADIR"encodings.default", "data/encodings.default", "../data/encodings.default",NULL); if (main_v->props.encodings == NULL) { /* if the user does not have encodings --> set them to defaults values */ if (defaultfile) { main_v->props.encodings = get_list(defaultfile,NULL,TRUE); } else { g_print("Unable to find '"PKGDATADIR"encodings.default'\n"); } } else { if (config_file_is_newer(main_v->globses.lasttime_encodings,defaultfile)) { main_v->props.encodings = arraylist_load_new_identifiers_from_file(main_v->props.encodings,defaultfile,1); main_v->globses.lasttime_encodings = TIME_T_TO_GINT(time(NULL)); } } g_free(defaultfile); } if (main_v->props.outputbox==NULL) { /* if the user does not have outputbox settings --> set them to defaults values */ gchar *tmpstr; /* used GINT_TO_POINTER ==> failed */ tmpstr = g_strdup_printf("%d",OB_NEED_SAVE_FILE); main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("LaTeX","([^:]+):([0-9]+):(.*)","1","2","3",OB_LaTeX,tmpstr,NULL)); main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("PDFLaTeX","([^:]+):([0-9]+):(.*)","1","2","3",OB_PDFLaTeX,tmpstr,NULL)); tmpstr = g_strdup_printf("%d",OB_NEED_SAVE_FILE + OB_SHOW_ALL_OUTPUT); main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("DVIPS",".*","-1","-1","0",OB_DVIPS,tmpstr,NULL)); main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("DVIPDFM",".*","-1","-1","0",OB_DVIPDFM,tmpstr,NULL)); tmpstr = g_strdup_printf("%d", OB_SHOW_ALL_OUTPUT); main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("View Log File",".*","-1","-1","0",OB_ViewLog,tmpstr,NULL)); /* tmpstr = g_strdup_printf("%d", OB_SHOW_ALL_OUTPUT); */ /* dont save file, show output lines by lines */ main_v->props.outputbox = g_list_append(main_v->props.outputbox,array_from_arglist("Soft Clean",".*","-1","-1","0",OB_SoftClean,"0", NULL)); g_free(tmpstr); } if (main_v->props.external_commands == NULL) { /* if the user does not have external commands --> set them to defaults values */ gchar **arr; arr = array_from_arglist("Dos2Unix filter",OB_Dos2Unix,NULL); main_v->props.external_commands = g_list_append(main_v->props.external_commands,arr); arr = array_from_arglist("Tidy cleanup filter", OB_Tidy,NULL); main_v->props.external_commands = g_list_append(main_v->props.external_commands,arr); } { gchar *defaultfile = return_first_existing_filename(PKGDATADIR"filetypes.default", "data/filetypes.default", "../data/filetypes.default",NULL); if (main_v->props.filetypes == NULL) { /* if the user does not have file-types --> set them to defaults values */ if (defaultfile) { main_v->props.filetypes = get_list(defaultfile,NULL,TRUE); } else { g_print("Unable to find '"PKGDATADIR"filetypes.default'\n"); } } else { if (config_file_is_newer(main_v->globses.lasttime_filetypes,defaultfile)) { main_v->props.filetypes = arraylist_load_new_identifiers_from_file(main_v->props.filetypes,defaultfile,1); main_v->globses.lasttime_filetypes = TIME_T_TO_GINT(time(NULL)); } } g_free(defaultfile); } if (main_v->props.filefilters == NULL) { /* if the user does not have file filters --> set them to defaults values */ gchar **arr; arr = array_from_arglist(_("LaTeX"),"1","tex", NULL); main_v->props.filefilters = g_list_append(main_v->props.filefilters, arr); arr = array_from_arglist(_("XML"),"1","xml", NULL); main_v->props.filefilters = g_list_append(main_v->props.filefilters, arr); arr = array_from_arglist(_("Images"),"1", "image", NULL); main_v->props.filefilters = g_list_append(main_v->props.filefilters, arr); } if (main_v->props.reference_files == NULL) { gchar *userdir = g_strconcat(g_get_home_dir(), "/.winefish/", NULL); /* if the user does not yet have any function reference files, set them to default values */ fref_rescan_dir(PKGDATADIR); fref_rescan_dir(userdir); g_free(userdir); } } static gint rcfile_save_main(void) { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/rcfile", NULL); return save_config_file(main_configlist, filename); } /* static gboolean arraylist_test_identifier_exists(GList *arrlist, const gchar *name) { GList *tmplist = g_list_first(arrlist); while(tmplist) { if (strcmp(name, ((gchar **)(tmplist->data))[0])==0) { return TRUE; } tmplist = g_list_next(tmplist); } return FALSE; } */ void rcfile_parse_highlighting(void) { gchar *filename; gchar *defaultfile; DEBUG_MSG("rcfile_parse_highlighting, started\n"); highlighting_configlist = NULL; init_prop_arraylist(&highlighting_configlist, &main_v->props.highlight_patterns, "patterns:", 0, TRUE); filename = g_strconcat(g_get_home_dir(), "/.winefish/highlighting", NULL); defaultfile = return_first_existing_filename(PKGDATADIR"highlighting.default", "data/highlighting.default", "../data/highlighting.default",NULL); if (!parse_config_file(highlighting_configlist, filename)) { /* init the highlighting in some way? */ if (defaultfile) { DEBUG_MSG("Loading default highlighting file: %s\n", defaultfile); /* kyanh, removed, 20050222, i donnot know why: if we remove ~/.winefish/highlight file, close winefish, then reopen, WE CANNOT get the highlight patterns from, for e.g., /usr/local/winefish/hightlight */ /* main_v->props.highlight_patterns = get_list(defaultfile,NULL,TRUE); */ /* added by kyanh */ parse_config_file(highlighting_configlist, defaultfile); } else { g_print("Unable to find '"PKGDATADIR"highlighting.default'\n"); } /* save_config_file(highlighting_configlist, filename); */ DEBUG_MSG("rcfile_parse_highlighting, done saving\n"); } #ifdef NOPTIMIZE else { if (config_file_is_newer(main_v->globses.lasttime_highlighting,defaultfile)) { /* HERE WE SHOULD SEND A POPUP TO THE USER, SAYING THERE ARE NEW HIGHLIGHTING PATTERNS AVAILABLE, IF THEY WANT TO HAVE THEM */ /* main_v->props.highlight_patterns = arraylist_load_new_identifiers_from_file(main_v->props.highlight_patterns,defaultfile,2); main_v->globses.lasttime_highlighting = TIME_T_TO_GINT(time(NULL));*/ } } #endif g_free(filename); g_free(defaultfile); } static gint rcfile_save_highlighting(void) { gint retval; gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/highlighting", NULL); retval = save_config_file(highlighting_configlist, filename); g_free(filename); return retval; } static void autotext_insert_to_list(gchar *key, gchar *value, GList **rclist) { gint index = strtoul(value, NULL, 10); gchar **tmp; tmp = g_ptr_array_index(main_v->props.autotext_array, index); { gchar **strarr = g_malloc(4*sizeof(gchar *)); strarr[0] = g_strdup(key); strarr[1] = g_strdup(tmp[0]); strarr[2] = g_strdup(tmp[1]); strarr[3] = NULL; gchar *tmpstring, *tmpstring2; tmpstring2 = array_to_string(strarr); tmpstring = g_strdup_printf("att: %s", tmpstring2); *rclist = g_list_append(*rclist, tmpstring); g_free(tmpstring2); g_strfreev(strarr); } } gboolean rcfile_save_autotext(void) { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/autotext", NULL); GList *rclist = NULL; g_hash_table_foreach(main_v->props.autotext_hashtable, (GHFunc)autotext_insert_to_list, &rclist); put_stringlist(filename, rclist); free_stringlist(rclist); g_free(filename); return 1; } gboolean rcfile_save_completion(void) { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/words", NULL); GList *tmplist = g_list_first(main_v->props.completion->items); GList *rclist = NULL, *rclist_s=NULL; while (tmplist) { gchar *tmpstr = escape_string((gchar*) tmplist->data, TRUE); tmpstr = g_strdup_printf("w: tex:%s:", tmpstr); rclist = g_list_append(rclist, tmpstr); tmplist = g_list_next(tmplist); } put_stringlist(filename, rclist); free_stringlist(rclist); filename = g_strconcat(g_get_home_dir(), "/.winefish/words_s", NULL); tmplist = g_list_first(main_v->props.completion_s->items); while (tmplist) { gchar *tmpstr = escape_string((gchar*) tmplist->data, TRUE); tmpstr = g_strdup_printf("w: tex:%s:", tmpstr); rclist_s = g_list_append(rclist_s, tmpstr); tmplist = g_list_next(tmplist); } put_stringlist(filename, rclist_s); free_stringlist(rclist_s); g_free(filename); return 1; } static void rcfile_custom_menu_load_new(gchar *defaultfile) { GList *default_insert=NULL, *default_replace=NULL, *tmp_configlist=NULL; DEBUG_MSG("rcfile_custom_menu_load_new, started!\n"); init_prop_arraylist(&tmp_configlist, &default_insert, "cmenu_insert:", 0, TRUE); init_prop_arraylist(&tmp_configlist, &default_replace, "cmenu_replace:", 0, TRUE); parse_config_file(tmp_configlist, defaultfile); main_v->props.cmenu_insert = arraylist_load_new_identifiers_from_list(main_v->props.cmenu_insert, default_insert, 1); main_v->props.cmenu_replace = arraylist_load_new_identifiers_from_list(main_v->props.cmenu_replace, default_replace, 1); main_v->globses.lasttime_cust_menu = TIME_T_TO_GINT(time(NULL)); free_arraylist(default_replace); free_arraylist(default_insert); free_configlist(tmp_configlist); } static void rcfile_custom_menu_load_all(gboolean full_reset, gchar *defaultfile) { gchar *filename; custom_menu_configlist = NULL; init_prop_arraylist(&custom_menu_configlist, &main_v->props.cust_menu, "custom_menu:", 0, TRUE); init_prop_arraylist(&custom_menu_configlist, &main_v->props.cmenu_insert, "cmenu_insert:", 0, TRUE); init_prop_arraylist(&custom_menu_configlist, &main_v->props.cmenu_replace, "cmenu_replace:", 0, TRUE); filename = g_strconcat(g_get_home_dir(), "/.winefish/custom_menu", NULL); if (full_reset || !parse_config_file(custom_menu_configlist, filename) || (main_v->props.cust_menu==NULL && main_v->props.cmenu_insert==NULL && main_v->props.cmenu_replace==NULL )) { DEBUG_MSG("error parsing the custom menu file, or full_reset is set\n"); /* init the custom_menu in some way? */ if (defaultfile) { parse_config_file(custom_menu_configlist, defaultfile); } else { g_print("Unable to find '"PKGDATADIR"custom_menu.default'\n"); } } g_free(filename); /* for backwards compatibility with older (before Bluefish 0.10) custom menu files we can convert those.. we will not need the 'type' anymore, since we will put them in separate lists, hence the memmove() call */ DEBUG_MSG("main_v->props.cust_menu=%p\n",main_v->props.cust_menu); if (main_v->props.cust_menu) { GList *tmplist= g_list_first(main_v->props.cust_menu); while (tmplist) { gchar **strarr = (gchar **)tmplist->data; gint count = count_array(strarr); DEBUG_MSG("converting cust_menu, found count=%d\n",count); if (count >= 5 && strarr[1][0] == '0') { DEBUG_MSG("rcfile_parse_custom_menu, converting insert, 0=%s, 1=%s\n", strarr[0], strarr[1]); g_free(strarr[1]); memmove(&strarr[1], &strarr[2], (count-1) * sizeof(gchar *)); main_v->props.cmenu_insert = g_list_append(main_v->props.cmenu_insert, strarr); } else if (count >= 8 && strarr[1][0] == '1') { DEBUG_MSG("rcfile_parse_custom_menu, converting replace, 0=%s, 1=%s\n", strarr[0], strarr[1]); g_free(strarr[1]); memmove(&strarr[1], &strarr[2], (count-1) * sizeof(gchar *)); main_v->props.cmenu_replace = g_list_append(main_v->props.cmenu_replace, strarr); } else if (count >= 4 && count == (4+atoi(strarr[1]))) { /* the first check avoids a segfault if count == 1 */ /* a very old insert type, 0=menupath, 1=numvariables, 2=string1, 3=string2, 4... are variables we can re-arrange it for the new insert type */ gchar *numvars = strarr[1]; strarr[1] = strarr[2]; strarr[2] = strarr[3]; strarr[3] = numvars; /* the variables; beyond [3], are still the same */ DEBUG_MSG("rcfile_parse_custom_menu, converting very old insert, 0=%s\n", strarr[0]); main_v->props.cmenu_insert = g_list_append(main_v->props.cmenu_insert, strarr); } else { #ifdef DEBUG if (count > 2) { g_print("rcfile_parse_custom_menu, ignoring %s with type %s (count=%d)\n",strarr[0], strarr[1], count); } else { g_print("rcfile_parse_custom_menu, ignoring invalid cust_menu entry with count=%d..\n", count); } #endif } tmplist = g_list_next(tmplist); } g_list_free(main_v->props.cust_menu); main_v->props.cust_menu=NULL; } } void rcfile_parse_custom_menu(gboolean full_reset, gboolean load_new) { gchar *defaultfile, *langdefaultfile1=NULL, *langdefaultfile2=NULL, *tmp; DEBUG_MSG("rcfile_parse_custom_menu, started\n"); #ifdef PLATFORM_DARWIN tmp = g_strdup(g_getenv("LANGUAGE")); #else tmp = g_strdup(g_getenv("LANG")); #endif DEBUG_MSG("rcfile_parse_custom_menu, Language is: %s", tmp); if (tmp) { tmp = trunc_on_char(tmp, '.'); tmp = trunc_on_char(tmp, '@'); langdefaultfile1 = g_strconcat(PKGDATADIR"custom_menu.",tmp,".default", NULL); DEBUG_MSG("rcfile_parse_custom_menu, langdefaultfile1 is: %s", langdefaultfile1); tmp = trunc_on_char(tmp, '_'); langdefaultfile2 = g_strconcat(PKGDATADIR"custom_menu.",tmp,".default", NULL); DEBUG_MSG("rcfile_parse_custom_menu, langdefaultfile2 is: %s", langdefaultfile2); g_free(tmp); } if (langdefaultfile1) { defaultfile = return_first_existing_filename(langdefaultfile1, langdefaultfile2, PKGDATADIR"custom_menu.default", "data/custom_menu.default", "../data/custom_menu.default",NULL); } else { defaultfile = return_first_existing_filename(PKGDATADIR"custom_menu.default", "data/custom_menu.default", "../data/custom_menu.default",NULL); } DEBUG_MSG("rcfile_parse_custom_menu, defaultfile is: %s", defaultfile); if (full_reset) { free_arraylist(main_v->props.cmenu_insert); free_arraylist(main_v->props.cmenu_replace); main_v->props.cmenu_insert = NULL; main_v->props.cmenu_replace = NULL; } if (load_new && !full_reset) { rcfile_custom_menu_load_new(defaultfile); } else { rcfile_custom_menu_load_all(full_reset, defaultfile); } g_free(defaultfile); g_free(langdefaultfile1); g_free(langdefaultfile2); } static gint rcfile_save_custom_menu(void) { gint retval; gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/custom_menu", NULL); retval = save_config_file(custom_menu_configlist, filename); g_free(filename); return retval; } #define DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* same as 0755 */ void rcfile_check_directory(void) { gchar *rcdir = g_strconcat(g_get_home_dir(), "/.winefish", NULL); if (!g_file_test(rcdir, G_FILE_TEST_IS_DIR)) { mkdir(rcdir, DIR_MODE); } g_free(rcdir); } void rcfile_save_configfile_menu_cb(gpointer callback_data,guint action,GtkWidget *widget) { switch (action) { case 0: rcfile_save_main(); break; case 1: rcfile_save_highlighting(); break; case 2: rcfile_save_custom_menu(); break; case 3: { gchar *shortcutfilename = g_strconcat(g_get_home_dir(), "/.winefish/menudump_2", NULL); gtk_accel_map_save(shortcutfilename); g_free(shortcutfilename); } break; default: DEBUG_MSG("rcfile_save_configfile_menu_cb, unknown action %d\n", action); #ifdef DEBUG exit(10); #endif break; } } void rcfile_save_all(void) { rcfile_save_main(); rcfile_save_highlighting(); rcfile_save_custom_menu(); rcfile_save_autotext(); rcfile_save_completion(); rcfile_save_global_session(); } static GList *return_globalsession_configlist(gboolean init_values) { GList *config_rc = NULL; init_prop_stringlist(&config_rc, &main_v->globses.quickbar_items, "quickbar_items:", TRUE); init_prop_integer (&config_rc, &main_v->globses.two_pane_filebrowser_height, "two_pane_filebrowser_height:", 250, init_values); init_prop_integer (&config_rc, &main_v->globses.main_window_h, "main_window_height:", 400, init_values); init_prop_integer (&config_rc, &main_v->globses.main_window_w, "main_window_width:", 600, init_values); /* negative width means maximized */ init_prop_integer (&config_rc, &main_v->globses.fref_ldoubleclick_action,"fref_ldoubleclick_action:",0, init_values); init_prop_integer (&config_rc, &main_v->globses.fref_info_type,"fref_info_type:",0, init_values); init_prop_integer (&config_rc, &main_v->globses.lasttime_cust_menu, "lasttime_cust_menu:", 0, init_values); init_prop_integer (&config_rc, &main_v->globses.lasttime_highlighting, "lasttime_highlighting:", 0, init_values); init_prop_integer (&config_rc, &main_v->globses.lasttime_filetypes, "lasttime_filetypes:", 0, init_values); init_prop_integer (&config_rc, &main_v->globses.lasttime_encodings, "lasttime_encodings:", 0, init_values); init_prop_limitedstringlist(&config_rc, &main_v->globses.recent_projects, "recent_projects:", main_v->props.max_recent_files, FALSE); return config_rc; } /** * modifiedy by kyanh * @context = 0: normal mode * @context = 1: project mode * project has its own variables which may be duplicated * as project uses also main_v->session variables. * For example, 'view_bars' variable: * We initialize this variable only for main context; * as 'view_bars' is initialized once in (return_project_configlist) */ static GList *return_session_configlist(GList *configlist, Tsessionvars *session, gboolean context) { if (!context) { xinit_prop_integer(&configlist, &session->view_bars, "view_bars:", MODE_DEFAULT, FALSE); } init_prop_limitedstringlist(&configlist, &session->searchlist, "searchlist:", 10, FALSE); init_prop_limitedstringlist(&configlist, &session->replacelist, "replacelist:", 10, FALSE); init_prop_stringlist(&configlist, &session->classlist, "classlist:", FALSE); init_prop_stringlist(&configlist, &session->colorlist, "colorlist:", FALSE); init_prop_stringlist(&configlist, &session->targetlist, "targetlist:", FALSE); init_prop_stringlist(&configlist, &session->fontlist, "fontlist:", FALSE); /* init_prop_stringlist(&configlist, &session->dtd_cblist, "dtd_cblist:", FALSE); */ init_prop_arraylist (&configlist, &session->bmarks, "bmarks:", 6, FALSE); /* what is the lenght for a bookmark array? */ init_prop_limitedstringlist(&configlist, &session->recent_files, "recent_files:", main_v->props.max_recent_files, FALSE); init_prop_limitedstringlist(&configlist, &session->recent_dirs, "recent_dirs:", main_v->props.max_dir_history, FALSE); init_prop_string_with_escape(&configlist, &session->opendir, "opendir:", NULL); init_prop_string_with_escape(&configlist, &session->savedir, "savedir:", NULL); return configlist; } static GList *return_project_configlist(Tproject *project) { DEBUG_MSG("return_project_configlist: hello!\n"); GList *configlist = NULL; init_prop_string(&configlist, &project->name,"name:",_("Untitled Project")); init_prop_stringlist(&configlist, &project->files, "files:", FALSE); init_prop_string(&configlist, &project->basedir,"basedir:",""); init_prop_string(&configlist, &project->basefile,"basefile:",""); init_prop_string(&configlist, &project->template,"template:",""); xinit_prop_integer (&configlist, &project->view_bars,"view_bars:",MODE_DEFAULT, FALSE); init_prop_integer (&configlist, &project->word_wrap,"word_wrap:",1,FALSE); configlist = return_session_configlist(configlist, project->session, TRUE); return configlist; } gboolean rcfile_parse_project(Tproject *project, gchar *filename) { gboolean retval; GList *configlist = return_project_configlist(project); retval = parse_config_file(configlist, filename); free_configlist(configlist); return retval; } gboolean rcfile_save_project(Tproject *project, gchar *filename) { gboolean retval; GList *configlist = return_project_configlist(project); DEBUG_MSG("rcfile_save_project, project %p, name='%s', basedir='%s', basefile='%s'\n",project, project->name, project->basedir, project->basefile); DEBUG_MSG("rcfile_save_project, bmarks=%p, list length=%d\n",project->session->bmarks, g_list_length(project->session->bmarks)); DEBUG_MSG("rcfile_save_project, length session recent_files=%d\n",g_list_length(project->session->recent_files)); retval = save_config_file(configlist, filename); free_configlist(configlist); return retval; } gboolean rcfile_save_global_session(void) { gboolean retval; gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/session", NULL); GList *configlist = return_globalsession_configlist(FALSE); configlist = return_session_configlist(configlist, main_v->session, FALSE); DEBUG_MSG("rcfile_save_global_session, saving global session to %s\n",filename); DEBUG_MSG("rcfile_save_global_session, length session recent_files=%d\n",g_list_length(main_v->session->recent_files)); DEBUG_MSG("rcfile_save_global_session, length session recent_projects=%d\n",g_list_length(main_v->globses.recent_projects)); DEBUG_MSG("rcfile_save_global_session, main window width=%d\n",main_v->globses.main_window_w); retval = save_config_file(configlist, filename); free_configlist(configlist); g_free(filename); return TRUE; } /* should be called AFTER the normal properties are loaded, becauses return_session_configlist() uses settings from main_v->props */ gboolean rcfile_parse_global_session(void) { gboolean retval; gchar *filename; GList *configlist = return_globalsession_configlist(TRUE); configlist = return_session_configlist(configlist, main_v->session, FALSE); filename = g_strconcat(g_get_home_dir(), "/.winefish/session", NULL); #ifdef NOPTIMIZE /* TODO: removed this; please read the next comment */ if (!file_exists_and_readable(filename)) { /* versions before 0.13 did not have a separate session file, so we'll try to load these items from rcfile_v2 */ g_free(filename); filename = g_strconcat(g_get_home_dir(), "/.winefish/rcfile", NULL); } #endif retval = parse_config_file(configlist, filename); free_configlist(configlist); g_free(filename); return retval; } /* kyanh, added, 20050310 */ void rcfile_parse_autotext(void *autolist) { gchar *filename; GList *autotext_configlist=NULL; init_prop_arraylist(&autotext_configlist, autolist, "att:", 3, TRUE); filename = g_strconcat(g_get_home_dir(), "/.winefish/autotext", NULL); if (!parse_config_file(autotext_configlist, filename)) { gchar *defaultfile; defaultfile = return_first_existing_filename(PKGDATADIR"autotext.default", "data/autotext.default", "../data/autotext.default",NULL); if (defaultfile) { parse_config_file(autotext_configlist, defaultfile); }else{ g_print("winefish: unable to find '"PKGDATADIR"autotext.default'\n"); } g_free(defaultfile); /* save_config_file(autotext_configlist, filename); */ } free_configlist(autotext_configlist); g_free(filename); } void rcfile_parse_completion(void *autolist, void *autolist_s) { gchar *filename; GList *configlist=NULL, *configlist_s=NULL; init_prop_arraylist(&configlist, autolist, "w:", 2, TRUE); filename = g_strconcat(g_get_home_dir(), "/.winefish/words", NULL); if (!parse_config_file(configlist, filename)) { gchar *defaultfile; defaultfile = return_first_existing_filename(PKGDATADIR"words.default", "data/words.default", "../data/words.default",NULL); if (defaultfile) { parse_config_file(configlist, defaultfile); }else{ g_print("winefish: unable to find '"PKGDATADIR"words.default'\n"); } g_free(defaultfile); /* save_config_file(configlist, filename); */ } free_configlist(configlist); init_prop_arraylist(&configlist_s, autolist_s, "w:", 2, TRUE); filename = g_strconcat(g_get_home_dir(), "/.winefish/words_s", NULL); parse_config_file(configlist_s, filename); free_configlist(configlist_s); g_free(filename); } winefish-1.3.3/src/highlight.c0000600000047200004720000015070210373411041015231 0ustar kyanhkyanh/* $Id: highlight.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * highlight2.c - the syntax highlighting with perl compatible regular expressions * * Copyright (C) 2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * indenting is done with * indent --line-length 100 --k-and-r-style --tab-size 4 -bbo --ignore-newlines highlight.c */ /*#define HL_TIMING #define HL_DEBUG #define DEBUG*/ #ifdef DEBUG #define DEVELOPMENT #endif #ifdef HL_TIMING /* some overall profiling information, not per pattern, but per type of code , interesting to bluefish programmers*/ #include #include #endif #include #include /* _before_ regex.h for freeBSD */ #include /* pcre_*() */ #include /* strerror() */ #include /* atoi() */ #include "config.h" /* HL_PROFILING might be defined there */ #ifdef HL_PROFILING /* per pattern profiling information, interesting for users making a new pattern */ #include #include #endif #include "bluefish.h" #include "bf_lib.h" /* filename_test_extensions() */ #include "rcfile.h" /* array_from_arglist() */ #include "stringlist.h" /* count_array() */ #include "menu.h" /* menu_current_document_set_toggle_wo_activate */ #include "document.h" /* doc_get_chars() */ #include "highlight.h" #include "gtk_easy.h" /* error_dialog() */ #define MAX_OVECTOR 30 /* should be a multiple of three for pcre_exec(), and at maximum 2/3 of this size can really be used for substrings */ #define MIN_OVECTOR 9 /* the minimum size for the ovector */ typedef struct { pcre *pcre; pcre_extra *pcre_e; } Treg; typedef struct { gchar *name; GtkTextTag *tag; } Thlstyle; typedef struct { Treg reg1; Treg reg2; gint numsub; gint mode; GList *childs; GtkTextTag *tag; #ifdef HL_PROFILING gint runcount; gint applycount; struct tms tms1; struct tms tms2; glong total_ms; #endif int *ovector; gint ovector_size; gboolean is_match; } Tpattern; #define PATTERN(var) ((Tpattern *)(var)) /* proposed improvement (for speedup, but also simplicity): -add the int ovector[MAX_OVECTOR]; and gboolean is_match; fields to Tpattern -use the pcre_fullinfo() function to find the minimum required ovector[] length (remind the 3X!!) and if there are no child-patterns that need a subpattern we use the minimum -the results from a subpattern search are now automatically stored, improving the success ratio for applying/matching*100% as in the profiling information -the Tpatmatch structure is not needed anymore, also the start of applylevel() where this structure is initialized is now more simple */ typedef struct { gchar *filetype; gchar *name; gchar *parentmatch; pcre *pcre; Tpattern *pat; } Tmetapattern; /* mostly used during compiling since it contains some more meta-info about the pattern */ typedef struct { GtkTextTagTable *tagtable; /* this one should ultimately move to Tfiletype, so every set would have it's own tagtable, but there is currently no way to switch a document to a new tagtable */ GList *all_highlight_patterns; /* contains Tmetapattern, not Tpattern !! */ #ifdef HL_PROFILING struct tms tms1; /* start time for profiling info */ struct tms tms2; /* stop time for profiling info */ #endif } Thighlight; /*typedef struct { int ovector[MAX_OVECTOR]; gboolean is_match; Tpattern *pat; } Tpatmatch;*/ /*************************************************************** how it works: -types: 1 - a start pattern and an end pattern 2 - a pattern that defines the complete match 3 - a sub-pattern , this must be a child pattern for type 2 -matching all top-level patterns are matched, a matching table is formed with all the start positions for every type, the lowest start position is the pattern where we start. for this pattern we crate a new matching table with all the start values AND the end value for the parent pattern. If the parent pattern is type 2 or 3 this value is fixed, and no pattern or child-pattern can go beyond that value, if the parent is type 1 the end value is re-evaluated once another pattern has gone beyond it's value. Once a match is found, the text is tagged with the right style, and ***************************************************************/ /*********************************/ /* global vars for this module */ /*********************************/ static Thighlight highlight; /*********************************/ /* debugging */ /*********************************/ #ifdef DEBUG static void print_meta_for_pattern(Tpattern *pat) { GList *tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { if (((Tmetapattern *)tmplist->data)->pat == pat) { /* g_print("pattern %p: filetype=%s, name=%s, num_childs=%d, numsub=%d, mode=%d\n", pat, ((Tmetapattern *)tmplist->data)->filetype, ((Tmetapattern *)tmplist->data)->name, g_list_length(pat->childs), pat->numsub, pat->mode);*/ g_print("pattern %p: name=%s\n",pat,((Tmetapattern *)tmplist->data)->name); return; } tmplist = g_list_next(tmplist); } } static Tmetapattern *get_metapattern_from_tag(GtkTextTag *tag) { GList *tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { if (((Tmetapattern *)tmplist->data)->pat->tag == tag) { return ((Tmetapattern *)tmplist->data); } tmplist = g_list_next(tmplist); } return NULL; } static void print_meta_for_tag(GtkTextTag *tag) { Tmetapattern *mpat = get_metapattern_from_tag(tag); if (mpat) { DEBUG_MSG("tag %p: filetype=%s, name=%s, num_childs=%d\n", tag, mpat->filetype, mpat->name, g_list_length(mpat->pat->childs)); } } static char *get_metaname_from_tag(GtkTextTag *tag) { Tmetapattern *mpat = get_metapattern_from_tag(tag); if (mpat) { return mpat->name; } return ""; } /* because the gtk functions crash in one case, I tries these, and that works! */ static gboolean my_own_iter_backward_to_tag_toggle(GtkTextIter *iter,GtkTextTag *tag) { while (gtk_text_iter_backward_char(iter)) { if (gtk_text_iter_toggles_tag(iter, tag)) return TRUE; } return FALSE; } static gboolean my_own_iter_forward_to_tag_toggle(GtkTextIter *iter,GtkTextTag *tag) { while (gtk_text_iter_forward_char(iter)) { if (gtk_text_iter_toggles_tag(iter, tag)) return TRUE; } return FALSE; } #endif /* DEBUG */ #ifdef HL_PROFILING static void hl_profiling_reset(Tdocument *doc) { /* reset all patterns for the current filetype */ GList *tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = (Tmetapattern *)tmplist->data; if (strcmp(mpat->filetype, doc->hl->type)==0) { mpat->pat->runcount = 0; mpat->pat->applycount = 0; mpat->pat->total_ms = 0; } tmplist = g_list_next(tmplist); } times(&highlight.tms1); } static void hl_profiling_tagstart(Tpattern *pat) { times(&pat->tms1); pat->runcount++; } static void hl_profiling_tagstop(Tpattern *pat) { times(&pat->tms2); pat->total_ms += (glong) (double) ((pat->tms2.tms_utime - pat->tms1.tms_utime) * 1000 / sysconf(_SC_CLK_TCK)); } static void hl_profiling_tagapply(Tpattern *pat) { pat->applycount++; } static void hl_profiling_print(Tdocument *doc) { GList *tmplist; glong tot_ms; /* print results for all patterns for the current filetype */ times(&highlight.tms2); tot_ms = (glong) (double) ((highlight.tms2.tms_utime - highlight.tms1.tms_utime) * 1000 / sysconf(_SC_CLK_TCK)); g_print("PROFILING: total time %ld ms\n", tot_ms); tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = (Tmetapattern *)tmplist->data; if (strcmp(mpat->filetype, doc->hl->type)==0) { g_print("PROFILING: patterns %s ran %d times, %d times successful (%d%%), and was matching %ld ms\n", mpat->name, mpat->pat->runcount, mpat->pat->applycount,(int)(100.0*mpat->pat->applycount/mpat->pat->runcount),mpat->pat->total_ms); } tmplist = g_list_next(tmplist); } g_print("-- -- -- -- -- --\n"); } #endif /* HL_PROFILING */ #ifdef HL_TIMING typedef struct { struct tms tms1; struct tms tms2; glong total_ms; gint numtimes; } Ttiming; #define TIMING_TEXTBUF 0 #define TIMING_PCRE_EXEC 1 #define TIMING_TOTAL 2 #define TIMING_UTF8 3 #define TIMING_UTF8_INV 4 #define TIMING_TEXTBUF_ITER 5 #define TIMING_TEXTBUF_TAG 6 #define TIMING_LINE_HIGHLIGHTING 7 #define TIMING_NUM 8 static Ttiming timing[TIMING_NUM]; static void timing_init() { gint i; for (i=0;i 0 && atoi(pat1) < MAX_OVECTOR)) { g_print("error compiling pattern '%s' for mode 3: sub-pattern number missing, too large or incorrect\n", name); return; } break; default: g_print("error compiling pattern '%s', mode %d unknown\n", name, mode); return; break; } { Tmetapattern *mpat; Tpattern *pat = g_new0(Tpattern, 1); pat->mode = mode; if (mode == 1 || mode ==2) { const char *err=NULL; int erroffset=0; DEBUG_MSG("compiling pat1 '%s'\n", pat1); pat->reg1.pcre = pcre_compile(pat1, (case_insens) ? PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL : PCRE_MULTILINE|PCRE_DOTALL, &err,&erroffset,NULL); if (err) { gchar *str1, *str2; str1 = g_strconcat(_("Syntax highlighting error for "),filetype," - ",name,NULL); str2 = g_strdup_printf(_("compiling pattern '%s': %s at offset %d"), pat1, err, erroffset); highlight_error(gui_errors, str1, str2); g_free(str1); g_free(str2); g_free(pat); return; } else { DEBUG_MSG("result: pat->reg1.pcre=%p\n", pat->reg1.pcre); pat->reg1.pcre_e = pcre_study(pat->reg1.pcre,0,&err); if (err) { gchar *str1, *str2; str1 = g_strconcat(_("Syntax highlighting error for "),filetype," - ",name,NULL); str2 = g_strdup_printf(_("studying pattern '%s': %s"), pat1, err); highlight_error(gui_errors, str1, str2); g_free(str1); g_free(str2); pcre_free(pat->reg1.pcre); g_free(pat); return; } else { if (pcre_fullinfo(pat->reg1.pcre,pat->reg1.pcre_e,PCRE_INFO_CAPTURECOUNT,&pat->ovector_size)!=0) { g_print("Error for %s - %s, gettting info for pattern '%s'\n", filetype, name, pat1); } if (pat->ovector_size > MAX_OVECTOR) pat->ovector_size = MAX_OVECTOR; if (pat->ovector_size < MIN_OVECTOR) pat->ovector_size = MIN_OVECTOR; pat->ovector = g_malloc((pat->ovector_size+1)*3*sizeof(int)); } } } if (mode == 1) { const char *err=NULL; int erroffset=0; DEBUG_MSG("compiling pat2 '%s'\n", pat2); pat->reg2.pcre = pcre_compile(pat2, (case_insens) ? PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL : PCRE_MULTILINE|PCRE_DOTALL, &err,&erroffset,NULL); if (err) { gchar *str1, *str2; str1 = g_strconcat(_("Syntax highlighting error for "),filetype," - ",name,NULL); str2 = g_strdup_printf(_("compiling 2nd pattern '%s': %s at offset %d"), pat2, err, erroffset); highlight_error(gui_errors, str1, str2); g_free(str1); g_free(str2); pcre_free(pat->reg1.pcre); g_free(pat->ovector); g_free(pat); return; } DEBUG_MSG("result: pat->reg2.pcre=%p\n", pat->reg2.pcre); pat->reg2.pcre_e = pcre_study(pat->reg2.pcre,0,&err); if (err) { gchar *str1, *str2; str1 = g_strconcat(_("Syntax highlighting error for "),filetype," - ",name,NULL); str2 = g_strdup_printf(_("studying 2nd pattern '%s': %s"), pat2, err); highlight_error(gui_errors, str1, str2); g_free(str1); g_free(str2); pcre_free(pat->reg1.pcre); pcre_free(pat->reg2.pcre); g_free(pat->ovector); g_free(pat); return; } } if (mode == 3) { pat->numsub = atoi(pat1); pat->ovector_size = 3; pat->ovector = g_malloc((pat->ovector_size+1)*3*sizeof(int)); } pat->tag = gtk_text_tag_new(NULL); if (strlen(fgcolor)) { g_object_set(pat->tag, "foreground", fgcolor, NULL); } if (strlen(bgcolor)) { g_object_set(pat->tag, "background", bgcolor, NULL); } if (weight > 0) { if (1 == weight) { g_object_set(pat->tag, "weight", PANGO_WEIGHT_NORMAL, NULL); } else { g_object_set(pat->tag, "weight", PANGO_WEIGHT_BOLD, NULL); } } if (style > 0) { if (1 == style) { g_object_set(pat->tag, "style", PANGO_STYLE_NORMAL, NULL); } else { g_object_set(pat->tag, "style", PANGO_STYLE_ITALIC, NULL); } } DEBUG_MSG("adding tag %p to table %p\n", pat->tag, highlight.tagtable); gtk_text_tag_table_add(highlight.tagtable, pat->tag); /* this might fix a memory leak reported by Jim Hayward Fri, 13 Aug 2004 14:45:23 -0700 */ g_object_unref(pat->tag); /* from the documentation: When adding a tag to a tag table, it will be assigned the highest priority in the table by default; so normally the precedence of a set of tags is the order in which they were added to the table. so the order of the styles in the list will be the order in the tagtable */ mpat = g_new(Tmetapattern, 1); mpat->pat = pat; mpat->name = g_strdup(name); if (strlen(parentmatch)) { mpat->parentmatch = g_strdup(parentmatch); } else { mpat->parentmatch = g_strdup("^top$"); } mpat->filetype = g_strdup(filetype); DEBUG_MSG("adding mpat %s (%p) to list %p\n", mpat->name, mpat, highlight.all_highlight_patterns); highlight.all_highlight_patterns = g_list_append(highlight.all_highlight_patterns, mpat); DEBUG_MSG("finished compiling pattern %s and added it to the list\n", mpat->name); } } static void add_patterns_to_parent(GList **list, gchar *filetype, gchar *name) { GList *tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = (Tmetapattern *)tmplist->data; if (strcmp(filetype, mpat->filetype)==0) { int ovector[9]; if (pcre_exec(mpat->pcre,NULL, name,strlen(name),0,0,ovector,9) > 0) { *list = g_list_append(*list, mpat->pat); } } tmplist = g_list_next(tmplist); } } /* * if gui_errors is set, we can send a popup with an error message, * else (during startup) we use g_print() */ void filetype_highlighting_rebuild(gboolean gui_errors) { GList *tmplist; GList *alldoclist; alldoclist = return_allwindows_documentlist(); /* remove filetypes from documents, but to reconnect them again after the rebuild, we temporary put a string with the filetype on that pointer */ if (alldoclist) { tmplist = g_list_first(alldoclist); while (tmplist) { Tdocument *thisdoc = (Tdocument *)tmplist->data; if (thisdoc->hl) { DEBUG_MSG("doc %p has type %p named %s\n", thisdoc, thisdoc->hl, thisdoc->hl->type); DEBUG_MSG("disconnected document %p from filetype %s\n", thisdoc, thisdoc->hl->type); thisdoc->hl = (gpointer)g_strdup(thisdoc->hl->type); } tmplist = g_list_next(tmplist); } } /* first remove the menu widgets, and delete the filetype structs */ DEBUG_MSG("filetype_highlighting_rebuild, testing for filetypelist existance\n"); filetype_menus_empty(); tmplist = g_list_first(main_v->filetypelist); while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; g_free(filetype->type); g_strfreev(filetype->extensions); g_free(filetype->update_chars); if (filetype->icon) { g_object_unref(filetype->icon); } g_free(filetype->content_regex); /* the highlightpatterns are freed separately, see below */ g_free(filetype); tmplist = g_list_next(tmplist); } g_list_free(main_v->filetypelist); main_v->filetypelist = NULL; DEBUG_MSG("filetype_highlighting_rebuild, testing for metapattern existence\n"); if (highlight.all_highlight_patterns) { tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = tmplist->data; pcre_free(mpat->pat->reg1.pcre); pcre_free(mpat->pat->reg1.pcre_e); pcre_free(mpat->pat->reg2.pcre); pcre_free(mpat->pat->reg2.pcre_e); g_free(mpat->pat->ovector); gtk_text_tag_table_remove(highlight.tagtable,mpat->pat->tag); g_free(mpat->pat); g_free(mpat->name); g_free(mpat->parentmatch); g_free(mpat->filetype); g_free(mpat); tmplist = g_list_next(tmplist); } g_list_free(highlight.all_highlight_patterns); highlight.all_highlight_patterns = NULL; } DEBUG_MSG("filetype_highlighting_rebuild, rebuilding the filetype list\n"); /* now rebuild the filetype list */ tmplist = g_list_first(main_v->props.filetypes); while (tmplist) { gint arrcount; gchar **strarr; Tfiletype *filetype; strarr = (gchar **) tmplist->data; arrcount = count_array(strarr); if (arrcount ==7 ) { filetype = g_new(Tfiletype, 1); filetype->editable = (strarr[4][0] != '0'); filetype->content_regex = g_strdup(strarr[5]); filetype->type = g_strdup(strarr[0]); filetype->autoclosingtag = atoi(strarr[6]); DEBUG_MSG("extensions for %s loaded from %s\n", strarr[0], strarr[1]); filetype->extensions = g_strsplit(strarr[1], ":", 127); filetype->update_chars = g_strdup(strarr[2]); if (strlen(strarr[3])) { GError *error=NULL; filetype->icon = gdk_pixbuf_new_from_file(strarr[3], &error); if (error != NULL) { /* Report error to user, and free error */ g_print("ERROR while loading icon: %s\n", error->message); g_error_free(error); filetype->icon = NULL; } } else { filetype->icon = NULL; } filetype->highlightlist = NULL; main_v->filetypelist = g_list_append(main_v->filetypelist, filetype); } #ifdef DEBUG else { DEBUG_MSG("filetype_list_rebuild, filetype needs 4 params in array\n"); } #endif tmplist = g_list_next(tmplist); } DEBUG_MSG("filetype_highlighting_rebuild, compile configpatterns into metapatterns\n"); /* now compile the patterns in metapatterns, they should come from the configfile */ tmplist = g_list_first(main_v->props.highlight_patterns); while (tmplist) { gchar **strarr; strarr = (gchar **) tmplist->data; if (count_array(strarr) == 11) { compile_pattern(gui_errors, strarr[0], strarr[1], atoi(strarr[2]), strarr[3], strarr[4], atoi(strarr[5]), strarr[6] , strarr[7], strarr[8], atoi(strarr[9]), atoi(strarr[10])); } #ifdef DEBUG else { g_print("filetype_list_rebuild, pattern %s does NOT have 11 parameters in array\n", strarr[0]); } #endif tmplist = g_list_next(tmplist); } /* now start adding the patterns to the right filetype and the right pattern using the meta-info */ /* first compile the parentmatch pattern */ tmplist = g_list_first(highlight.all_highlight_patterns); DEBUG_MSG("filetype_highlighting_rebuild, compile parentmatch pattern\n"); while (tmplist) { const char *err=NULL; int erroffset=0; Tmetapattern *mpat = (Tmetapattern *)tmplist->data; mpat->pcre = pcre_compile(mpat->parentmatch, 0, &err, &erroffset,NULL); if (err) { g_print("error compiling parentmatch %s at %d\n", err, erroffset); } tmplist = g_list_next(tmplist); } /* now match the top-level patterns */ tmplist = g_list_first(main_v->filetypelist); DEBUG_MSG("filetype_highlighting_rebuild, match toplevel patterns\n"); while (tmplist) { Tfiletype *filetype = (Tfiletype *)tmplist->data; add_patterns_to_parent(&filetype->highlightlist, filetype->type, "top"); tmplist = g_list_next(tmplist); } /* now match the rest of the patterns */ DEBUG_MSG("filetype_highlighting_rebuild, match rest of the patterns\n"); tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = (Tmetapattern *)tmplist->data; add_patterns_to_parent(&mpat->pat->childs, mpat->filetype, mpat->name); tmplist = g_list_next(tmplist); } /* free the parentmatch pattern now */ DEBUG_MSG("filetype_highlighting_rebuild, free-ing mpat->pcre\n"); tmplist = g_list_first(highlight.all_highlight_patterns); while (tmplist) { Tmetapattern *mpat = (Tmetapattern *)tmplist->data; pcre_free(mpat->pcre); tmplist = g_list_next(tmplist); } /* now we have finished the rebuilding of the filetypes, we have to connect all the documents with their filetypes again, we stored the name of the filetype temporary in the place of the Tfiletype, undo that now */ if (alldoclist) { tmplist = g_list_first(alldoclist); while (tmplist) { if (((Tdocument *)tmplist->data)->hl) { gchar *tmpstr = (gchar *)((Tdocument *)tmplist->data)->hl; ((Tdocument *)tmplist->data)->hl = get_filetype_by_name(tmpstr); DEBUG_MSG("reconnecting document %p to filetype %s\n", tmplist->data, tmpstr); g_free(tmpstr); ((Tdocument *)tmplist->data)->need_highlighting = TRUE; } tmplist = g_list_next(tmplist); } } g_list_free(alldoclist); } void hl_init() { /* init main_v->filetypelist, the first set is the defaultset */ highlight.all_highlight_patterns = NULL; highlight.tagtable = gtk_text_tag_table_new(); filetype_highlighting_rebuild(FALSE); } /**************************************/ /* end of initialisation code */ /**************************************/ /*****************************/ /* applying the highlighting */ /*****************************/ static void patmatch_init_run(GList *level) { GList *tmplist = g_list_first(level); while (tmplist) { Tpattern * pat = (Tpattern *)tmplist->data; memset(pat->ovector,0,sizeof(pat->ovector)); pat->is_match = FALSE; patmatch_init_run(pat->childs); tmplist = g_list_next(tmplist); } } /** * patmatch_rematch: * @is_parentmatch: #gboolean if we search for the end pattern from (a mode 1) parent * @pat: #Tpattern* the pattern * @offset: #gint where to start the search, in bytes * @buf: #gchar* the buffer we work on * @to: #gint with the end location where to stop searching in the buffer * @parentpat: #Tpattern with the parent pattern, needed for a mode 3 subpattern */ static void patmatch_rematch(gboolean is_parentmatch, Tpattern *pat, gint offset, gchar *buf, gint to, Tpattern *parentpat) { #ifdef DEVELOPMENT if (to < offset) { DEBUG_MSG("patmatch_rematch: impossible, to < offset, to=%d, offset=%d\n", to, offset); DEBUG_MSG("is_parentmatch=%d, pat=%p, offset=%d, to=%d, parentpat=%p\n", is_parentmatch, pat, offset, to, parentpat); exit(23); } if (!pat) { g_print("no pattern, BUG, exiting!\n"); exit(32); } #endif #ifdef DEBUG if ((to-offset) < 20) { gchar *tmp = g_strndup(&buf[offset],to-offset); DEBUG_MSG("patmatch_rematch, searching offset=%d,to=%d, len=%d '%s' with pat ",offset,to,to-offset,tmp); g_free(tmp); } else { DEBUG_MSG("patmatch_rematch, searching offset=%d,to=%d, len=%d with pat ",offset,to, to-offset); } print_meta_for_pattern(pat); #endif if (is_parentmatch) { #ifdef HL_PROFILING hl_profiling_tagstart(pat); #endif #ifdef HL_TIMING timing_start(TIMING_PCRE_EXEC); #endif /* probably 'length' refers to the total buffer length, so if we want to stop at 'to', we need to pass 'to' as length*/ pat->is_match = pcre_exec(pat->reg2.pcre, pat->reg2.pcre_e, buf, to, offset, 0, pat->ovector, pat->ovector_size); #ifdef HL_TIMING timing_stop(TIMING_PCRE_EXEC); #endif #ifdef HL_PROFILING hl_profiling_tagstop(pat); #endif } else { if (pat->mode == 3) { #ifdef DEBUG DEBUG_MSG("patmatch_rematch, getting value from parentpat->ovector[%d]\n", pat->numsub*2+1); if ((pat->numsub*2+1) >= MAX_OVECTOR || (pat->numsub*2+1) >=parentpat->ovector_size) { DEBUG_MSG("wanted subpattern is out of bounds!!, parentpat->ovector_size=%d\n", parentpat->ovector_size); } else { DEBUG_MSG("parentpat=%p with ovector_size=%d,requested ovector segment=%d\n",parentpat,parentpat->ovector_size,pat->numsub*2+1); } #endif #ifdef HL_PROFILING hl_profiling_tagstart(pat); #endif pat->ovector[0] = parentpat->ovector[pat->numsub*2]; pat->ovector[1] = parentpat->ovector[pat->numsub*2+1]; pat->is_match = TRUE; #ifdef HL_PROFILING hl_profiling_tagstop(pat); #endif } else { #ifdef HL_PROFILING hl_profiling_tagstart(pat); #endif #ifdef HL_TIMING timing_start(TIMING_PCRE_EXEC); #endif /* probably 'length' refers to the total buffer length, so if we want to stop at 'to', we need to pass 'to' as length*/ pat->is_match = pcre_exec(pat->reg1.pcre, pat->reg1.pcre_e, buf, to, offset, 0, pat->ovector, pat->ovector_size); if (pat->is_match == -1) { pat->ovector[0] = to; pat->ovector[1] = to; } #ifdef HL_TIMING timing_stop(TIMING_PCRE_EXEC); #endif #ifdef HL_PROFILING hl_profiling_tagstop(pat); #endif } } #ifdef DEVELOPMENT if (pat->ovector[1] > to) { g_print("BUG: patmatch_rematch,end > to, setting ovector[1] to to (=%d)\n", to); /*pat->ovector[1] = to;*/ exit(567); } #endif } static void applystyle(Tdocument *doc, gchar *buf, guint buf_char_offset, gint so, gint eo, Tpattern *pat) { GtkTextIter itstart, itend; gint istart, iend; guint char_start, char_end, byte_char_diff_start; #ifdef DEBUG { gchar *tmp; DEBUG_MSG("applystyle, coloring from so=%d to eo=%d", so, eo); tmp = g_strndup(&buf[so],eo-so); DEBUG_MSG("'%s'\n", tmp); g_free(tmp); } #endif #ifdef HL_PROFILING hl_profiling_tagapply(pat); #endif #ifdef HL_TIMING timing_start(TIMING_UTF8); #endif char_start = utf8_byteoffset_to_charsoffset_cached(buf, so); char_end = utf8_byteoffset_to_charsoffset_cached(buf, eo); byte_char_diff_start = so-char_start; #ifdef HL_TIMING timing_stop(TIMING_UTF8); #endif istart = char_start+buf_char_offset; iend = char_end+buf_char_offset; #ifdef HL_DEBUG1 DEBUG_MSG("applystyle, byte_char_diff=%d\n", byte_char_diff_start); DEBUG_MSG("applystyle, coloring from %d to %d\n", istart, iend); #endif #ifdef HL_TIMING timing_start(TIMING_TEXTBUF); #endif #ifdef HL_TIMING timing_start(TIMING_TEXTBUF_ITER); #endif gtk_text_buffer_get_iter_at_offset(doc->buffer, &itstart, istart); gtk_text_buffer_get_iter_at_offset(doc->buffer, &itend, iend); #ifdef HL_TIMING timing_stop(TIMING_TEXTBUF_ITER); #endif #ifdef HL_TIMING timing_start(TIMING_TEXTBUF_TAG); #endif gtk_text_buffer_apply_tag(doc->buffer, pat->tag, &itstart, &itend); #ifdef HL_TIMING timing_stop(TIMING_TEXTBUF_TAG); #endif #ifdef HL_TIMING timing_stop(TIMING_TEXTBUF); #endif } /* applylevel(Tdocument * doc, gchar * buf, guint buf_char_offset, gint offset, gint length, Tpatmatch *parentmatch, GList *childs_list) * doc: the document * buf: the buffer with all characters to apply the highlighting to * buf_char_offset: the character offset of the first char of the buffer * offset: the byte offset where we start in the buffer * to: the byte offset where we stop the search for this level * parentmatch: if there is a parent with mode 1 we have to search for the end together with it's children * childs_list: a list of Tpattern that needs to be applied in this region * * if childs_list is NULL, it MUST BE a parent with mode 1 match! * this not checked in the code for performance reasons! */ static void applylevel(Tdocument * doc, gchar * buf, guint buf_char_offset, gint offset, const gint to, Tpattern *parentpat, GList *childs_list) { gint parent_mode1_start=offset; gint parent_mode1_offset=offset; #ifdef DEVELOPMENT if (offset >= to ) { DEBUG_MSG("applylevel, impossible start, offset >= to, offset=%d, to=%d\n", offset, to); exit(24); } if (!childs_list && (!parentpat || parentpat->mode != 1)) { g_print("applylevel: BUG, no child list, but also no mode 1 parent pattern!"); exit(31); } #endif if (parentpat && parentpat->mode == 1) { /* before any patmatch_rematch, this has the end of the start pattern */ parent_mode1_offset = parentpat->ovector[1]; } DEBUG_MSG("applylevel, started with offset=%d, to=%d, len=%d\n", offset, to, to - offset); if (!childs_list) { /* we assume the parent is mode 1, IF NOT we are called with INVALID ARGUMENTS */ patmatch_rematch(TRUE, parentpat, offset > parent_mode1_offset ? offset : parent_mode1_offset, buf, to, parentpat); if (parentpat->is_match<1) { DEBUG_MSG("no childs list, mode 1 parent has no match, set matching to 'to'=%d\n", to); parentpat->ovector[1] = to; parentpat->is_match = 1; } applystyle(doc, buf,buf_char_offset, offset, parentpat->ovector[1], parentpat); DEBUG_MSG("no childs list, mode 1 parent is applied, returning\n"); return; } else { GList *tmplist; Tpattern *lowest_pm = NULL; tmplist = g_list_first(childs_list); while (tmplist) { /* check if we need to match the pattern */ if (PATTERN(tmplist->data)->ovector[0] <= offset) { DEBUG_MSG("1, rematching pattern %p, ovector[0]=%d, offset=%d\n",PATTERN(tmplist->data),PATTERN(tmplist->data)->ovector[0], offset); patmatch_rematch(FALSE, PATTERN(tmplist->data), offset, buf, to, parentpat); #ifdef DEVELOPMENT if (PATTERN(tmplist->data)->ovector[1] > to) { g_print("BUG: PATTERN(tmplist->data)->ovector[1] > to\n"); exit(321); } #endif } #ifdef DEBUG else { DEBUG_MSG("1 not rematching pattern %p, ovector[0]=%d, offset=%d, pattern ",PATTERN(tmplist->data), PATTERN(tmplist->data)->ovector[0], offset); print_meta_for_pattern(PATTERN(tmplist->data)); } #endif if ((PATTERN(tmplist->data)->is_match > 0) && (PATTERN(tmplist->data)->ovector[1]<=to) &&(lowest_pm == NULL || (lowest_pm->ovector[0] > PATTERN(tmplist->data)->ovector[0]))) { lowest_pm = PATTERN(tmplist->data); #ifdef DEBUG DEBUG_MSG("1 new lowest_pm=%p, pat->is_match=%d, start=%d, pattern=",lowest_pm,PATTERN(tmplist->data)->is_match, PATTERN(tmplist->data)->ovector[0]); print_meta_for_pattern(lowest_pm); #endif } #ifdef DEBUG else { DEBUG_MSG("1 pat %p is NOT the lowest pm with is_match=%d and ovector[0]=%d\n", PATTERN(tmplist->data), PATTERN(tmplist->data)->is_match, PATTERN(tmplist->data)->ovector[0]); } #endif tmplist = g_list_next(tmplist); } if (parentpat && parentpat->mode == 1) { /* the end of the parent pattern needs matching too */ DEBUG_MSG("matching the parent-end with offset %d\n", offset > parent_mode1_start ? offset : parent_mode1_start); patmatch_rematch(TRUE, parentpat, offset > parent_mode1_offset ? offset : parent_mode1_offset, buf, to, parentpat); if (parentpat->is_match <=0) { DEBUG_MSG("mode 1 parent has no match, matching to=%d\n", to); parentpat->ovector[1] = to; parentpat->ovector[0] = to; parentpat->is_match = 1; } #ifdef DEVELOPMENT if (parentpat->ovector[1] > to) { g_print("BUG: parentpat->ovector[1] > to\n"); exit(765); } #endif if ((lowest_pm == NULL || (lowest_pm->ovector[0] > parentpat->ovector[0]))) { lowest_pm = parentpat; DEBUG_MSG("3 lowest_pm=%p (parentpat!!), parentpat->is_match=%d, start=%d\n",lowest_pm,parentpat->is_match, parentpat->ovector[0]); } #ifdef DEBUG else { DEBUG_MSG("3 (parent!!) is NOT the lowest pm with is_match=%d and ovector[0]=%d\n", parentpat->is_match, parentpat->ovector[0]); } #endif } #ifdef DEVELOPMENT if (offset > to ) { g_print("BUG: applylevel, impossible before applying, offset > to, offset=%d, to=%d\n", offset, to); g_print("lowest_pm->mode=%d, lowest_pm->childs=%p\n",lowest_pm->mode,lowest_pm->childs); exit(24); } #endif /* apply the lowest match */ while (lowest_pm != NULL) { if (lowest_pm == parentpat) { #ifdef DEBUG DEBUG_MSG("*apply: offset=%d, lowest_pm=%p with ovector=%d, ovector[1]=%d\n", offset, lowest_pm, parentpat->ovector[0],parentpat->ovector[1]); #endif /* apply the parent, and return from this level */ applystyle(doc, buf,buf_char_offset, parent_mode1_start, parentpat->ovector[1], parentpat); lowest_pm = NULL; /* makes us return */ } else { #ifdef DEBUG DEBUG_MSG("*apply:a child is the lowest match, offset=%d, lowest_pm=%p with start=%d and ovector[1]=%d ", offset, lowest_pm, lowest_pm->ovector[0],lowest_pm->ovector[1]); print_meta_for_pattern(lowest_pm); #endif switch (lowest_pm->mode) { case 1: /* if mode==1 the style is applied within the applylevel for the children because the end is not yet known, the end is set in ovector[1] after applylevel for the children is finished */ applylevel(doc, buf,buf_char_offset, lowest_pm->ovector[0], to, lowest_pm, lowest_pm->childs); offset = lowest_pm->ovector[1]; break; case 2: /* ovector[0] and ovector[1] are both offsets in the buffer matched by the entire pattern */ applystyle(doc, buf,buf_char_offset, lowest_pm->ovector[0], lowest_pm->ovector[1], lowest_pm); if (lowest_pm->childs) applylevel(doc, buf,buf_char_offset, lowest_pm->ovector[0], lowest_pm->ovector[1], lowest_pm, lowest_pm->childs); offset = lowest_pm->ovector[1]; break; case 3: applystyle(doc, buf,buf_char_offset, lowest_pm->ovector[0], lowest_pm->ovector[1], lowest_pm); if (lowest_pm->childs) applylevel(doc, buf,buf_char_offset, lowest_pm->ovector[0], lowest_pm->ovector[1], lowest_pm, lowest_pm->childs); offset = lowest_pm->ovector[1]; break; #ifdef DEBUG default: /* unknown mode, cannot pass the pattern-compile-stage??? */ g_print("applylevel, unknown mode, cannot pass the pattern-compile-stage???\n"); exit(2); break; #endif } if (offset == to) { DEBUG_MSG("offset==to, there is no further pattern that will match inb this level\n"); DEBUG_MSG("applylevel, finished, to=%d, returning to previous level\n", to); return; } /* init for the next round, rematch the patterns that have a startpoint < offset */ lowest_pm = NULL; tmplist = g_list_first(childs_list); while (tmplist) { if (((PATTERN(tmplist->data)->ovector[1] <=to) && (PATTERN(tmplist->data)->ovector[0] <= offset)) || PATTERN(tmplist->data)->ovector[1] > to) { if (PATTERN(tmplist->data)->mode == 3) { PATTERN(tmplist->data)->is_match = FALSE; /* mode 3 types can only match as first match */ } else { patmatch_rematch(FALSE, PATTERN(tmplist->data), offset, buf, to, parentpat); DEBUG_MSG("2 rematch: pat=%p, pat.is_match=%d, start=%d\n",PATTERN(tmplist->data),PATTERN(tmplist->data)->is_match,PATTERN(tmplist->data)->ovector[0]); } } else if (PATTERN(tmplist->data)->ovector[1] > to) { PATTERN(tmplist->data)->is_match = 0; } if ((PATTERN(tmplist->data)->is_match>0) && (lowest_pm == NULL || (lowest_pm->ovector[0] > PATTERN(tmplist->data)->ovector[0]))) { lowest_pm = PATTERN(tmplist->data); DEBUG_MSG("2 new lowest_pm=%p, start=%d\n",lowest_pm,lowest_pm->ovector[0]); } #ifdef DEBUG else { DEBUG_MSG("2 pat %p is NOT the lowest pm with is_match=%d and ovector[0]=%d\n", PATTERN(tmplist->data), PATTERN(tmplist->data)->is_match, PATTERN(tmplist->data)->ovector[0]); } #endif tmplist = g_list_next(tmplist); } if (parentpat && parentpat->mode == 1) { /* the end of the parent pattern needs matching too */ if (parentpat->ovector[0] < offset) { patmatch_rematch(TRUE, parentpat, offset, buf, to, parentpat); } if (parentpat->is_match<=0) { DEBUG_MSG("4 mode 1 parent has no match, matching to 'to'=%d\n", to); parentpat->ovector[1] = to; parentpat->ovector[0] = to; parentpat->is_match = 1; } if (lowest_pm == NULL || (lowest_pm->ovector[0] > parentpat->ovector[0])) { lowest_pm = parentpat; DEBUG_MSG("4 new lowest_pm=%p (parentmatch!!), start=%d\n",lowest_pm,lowest_pm->ovector[0]); } #ifdef DEBUG else { DEBUG_MSG("4 (parent!!) is NOT the lowest pm with is_match=%d and ovector[0]=%d\n", parentpat->is_match, parentpat->ovector[0]); } #endif } #ifdef DEVELOPMENT if (lowest_pm && lowest_pm->ovector[1] > to) { g_print("BUG: lowest_pm->ovector[1] > to !!\n"); g_print("is_parentpat=%d, lowest_pm->mode=%d\n",(lowest_pm == parentpat), lowest_pm->mode); exit(345); } #endif #ifdef DEBUG if (lowest_pm) { if (lowest_pm == parentpat) { DEBUG_MSG("lowest_match %p (parentpat) has start %d\n", lowest_pm, parentpat->ovector[0]); } else { DEBUG_MSG("lowest_match %p (some child) has start %d\n", lowest_pm, lowest_pm->ovector[0]); } } #endif } } } DEBUG_MSG("applylevel, finished, to=%d, returning to previous level\n", to); } void doc_remove_highlighting(Tdocument * doc) { GtkTextIter itstart, itend; gtk_text_buffer_get_bounds(doc->buffer, &itstart, &itend); gtk_text_buffer_remove_all_tags(doc->buffer, &itstart, &itend); } void doc_highlight_full(Tdocument * doc) { if (!doc->hl || !doc->hl->highlightlist) { return; } else { gchar *buf; guint charcount; /* GdkCursor *cursor = gdk_cursor_new(GDK_WATCH); gdk_window_set_cursor(main_v->main_window->window, cursor); gdk_window_set_cursor(main_v->current_document->view->window, cursor); flush_queue();*/ charcount = gtk_text_buffer_get_char_count(doc->buffer); doc_remove_highlighting(doc); #ifdef HL_TIMING timing_init(); #endif #ifdef HL_PROFILING hl_profiling_reset(doc); #endif #ifdef HL_TIMING timing_start(TIMING_TOTAL); #endif utf8_offset_cache_reset(); buf = doc_get_chars(doc, 0, charcount); #ifdef DEVELOPMENT g_assert(doc); g_assert(doc->hl); g_assert(buf); g_assert(doc->hl->highlightlist); #endif patmatch_init_run(doc->hl->highlightlist); applylevel(doc,buf,0,0,strlen(buf),NULL,doc->hl->highlightlist); g_free(buf); #ifdef HL_TIMING timing_stop(TIMING_TOTAL); g_print("doc_highlight_full done, %ld ms total, %ld ms tagging (%dX), %ld ms matching (%dX)\n",timing[TIMING_TOTAL].total_ms, timing[TIMING_TEXTBUF].total_ms, timing[TIMING_TEXTBUF].numtimes, timing[TIMING_PCRE_EXEC].total_ms, timing[TIMING_PCRE_EXEC].numtimes); g_print("%ld ms utf8-shit (%dX), %ld ms utf8-invalidate (%dX)\n", timing[TIMING_UTF8].total_ms, timing[TIMING_UTF8].numtimes, timing[TIMING_UTF8_INV].total_ms, timing[TIMING_UTF8_INV].numtimes); g_print("%ld ms setting iters, %ld ms setting tags\n", timing[TIMING_TEXTBUF_ITER].total_ms, timing[TIMING_TEXTBUF_TAG].total_ms); #endif #ifdef HL_PROFILING hl_profiling_print(doc); #endif doc->need_highlighting = FALSE; /* gdk_window_set_cursor(main_v->main_window->window, NULL); gdk_cursor_unref(cursor);*/ } } static void remove_tag_by_list_in_region(Tdocument * doc, GList * patlist, GtkTextIter * itstart, GtkTextIter * itend) { GList *tmplist = g_list_first(patlist); DEBUG_MSG("remove_tag_by_list_in_region, started on list %p\n", patlist); /* remove all tags that are children of patlist */ while (tmplist) { DEBUG_MSG("remove_tag_by_list_in_region, removing tags for pattern %p\n", tmplist->data); gtk_text_buffer_remove_tag(doc->buffer, ((Tpattern *) tmplist->data)->tag, itstart, itend); if (((Tpattern *) tmplist->data)->childs) { remove_tag_by_list_in_region(doc, ((Tpattern *) tmplist->data)->childs, itstart, itend); } tmplist = g_list_next(tmplist); } } static Tpattern *find_pattern_by_tag(GList * parentlist, GtkTextTag * tag) { GList *tmplist; tmplist = g_list_first(parentlist); while (tmplist) { if (((Tpattern *) tmplist->data)->tag == tag) { return (Tpattern *) tmplist->data; } tmplist = g_list_next(tmplist); } return NULL; } static gboolean pattern_has_mode3_child(Tpattern *pat) { GList *tmplist; tmplist = g_list_first(pat->childs); while (tmplist) { if (((Tpattern *)tmplist->data)->mode == 3) return TRUE; tmplist = g_list_next(tmplist); } return FALSE; } void doc_highlight_region(Tdocument * doc, guint startof, guint endof) { Tpattern *pat = NULL; guint so=-1, eo=-1; GList *patternlist = doc->hl->highlightlist; #ifdef HL_TIMING timing_init(); timing_start(TIMING_LINE_HIGHLIGHTING); #endif if (startof < endof) { GtkTextIter itstart, itend, itsearch; GSList *taglist = NULL, *slist; gtk_text_buffer_get_iter_at_offset(doc->buffer,&itstart,startof); gtk_text_buffer_get_iter_at_offset(doc->buffer,&itend,endof); /* get all the tags that itstart is in */ taglist = gtk_text_iter_get_tags(&itstart); DEBUG_MSG("doc_highlight_line, (1) getting all tags at itstart %d\n",gtk_text_iter_get_offset(&itstart)); /* find for every tag if it ends _after_ itend or not */ itsearch = itstart; slist = taglist; while (slist && slist->data) { gboolean tag_found; #ifdef DEBUG { Tpattern *testpat; gchar *test; testpat = find_pattern_by_tag(patternlist, GTK_TEXT_TAG(slist->data)); if (testpat) { DEBUG_MSG("doc_highlight_line, (1) tag %p goes with ", testpat->tag); print_meta_for_pattern(testpat); } else { DEBUG_MSG("doc_highlight_line, (1) tag %p doesn't have pattern??\n",slist->data); print_meta_for_tag(GTK_TEXT_TAG(slist->data)); /*exit(9);*/ } test = gtk_text_buffer_get_text(doc->buffer, &itstart, &itend,FALSE); DEBUG_MSG("doc_highlight_line, (1) current string='%s'\n", test); g_free(test); } #endif /* if the tags ends at itstart there is no need to search forward to the end */ if (!gtk_text_iter_ends_tag(&itstart, GTK_TEXT_TAG(slist->data))) { DEBUG_MSG("doc_highlight_line, (1) forward looking for tag %p (%s) from so=%d to eo=%d\n", slist->data, get_metaname_from_tag(slist->data), gtk_text_iter_get_offset(&itstart), gtk_text_iter_get_offset(&itend)); tag_found = gtk_text_iter_forward_to_tag_toggle(&itsearch, GTK_TEXT_TAG(slist->data)); if (!tag_found) { /* this happens with several gtk versions, up to 2.2.4 is buggy inbetween is unknown, 2.4.4 is fixed */ DEBUG_MSG("doc_highlight_line (1), very weird situation, the tag %p is started but it doesn't end ??, itsearch now is at %d\n", slist->data, gtk_text_iter_get_offset(&itsearch)); /* itsearch is now at the end of the buffer so we do a backward search to find the first start */ tag_found = gtk_text_iter_backward_to_tag_toggle(&itsearch, GTK_TEXT_TAG(slist->data)); DEBUG_MSG("(1) a backward search to the tag finds %d\n", gtk_text_iter_get_offset(&itsearch)); if (!tag_found) { g_print("doc_highlight_line, (1) a tag that is started is nowhere to be found ??? BUG!\n"); exit(123); } if (gtk_text_iter_compare(&itsearch, &itend) < 0) { /* there is no tag toggle found between itend and the end of the buffer, we probably have hit the gtk bug here, so we just set itsearch here to itend+1 */ itsearch = itend; gtk_text_iter_forward_char(&itsearch); } } DEBUG_MSG("doc_highlight_line, (1) tag %p (%s) ends at itsearch=%d\n", slist->data, get_metaname_from_tag(slist->data),gtk_text_iter_get_offset(&itsearch)); if (gtk_text_iter_compare(&itsearch, &itend) > 0) { /* both the start and endpoint are within this tag --> pattern matching can start with this subpattern */ pat = find_pattern_by_tag(patternlist, GTK_TEXT_TAG(slist->data)); #ifdef DEBUG DEBUG_MSG("found pattern %p with tag %p and childs %p", pat, pat->tag,pat->childs); print_meta_for_pattern(pat); #endif if (pat && (pat->mode == 1)) { gchar *string; int ovector[MAX_OVECTOR]; /* but first we do a quick test if the parent-pattern is indeed still valid */ string = gtk_text_buffer_get_text(doc->buffer, &itstart, &itend, FALSE); if (0 < pcre_exec(pat->reg2.pcre, pat->reg2.pcre_e, string, strlen(string), 0, 0, ovector, MAX_OVECTOR)) { /* the current line does not have the start of the tag or the end of the tag, but now it does have a match on the end pattern --> so the pattern should be invalidated */ pat = NULL; DEBUG_MSG("doc_highlight_line, (1) a match of the endpattern is found on this line '%s', the pattern is invalidated\n",string); itend = itsearch; gtk_text_iter_backward_to_tag_toggle(&itstart, slist->data); } g_free(string); } if (pat && !pattern_has_mode3_child(pat)) { /* what happens if patternlist = NULL ? that means we are inside a match without any subpatterns, but perhaps the subpattern should be invalidated... hmm.. */ patternlist = pat->childs; #ifdef DEBUG DEBUG_MSG("doc_highlight_line, (1) going to use patternlist %p from pattern ", patternlist); print_meta_for_pattern(pat); #endif } else { DEBUG_MSG("doc_highlight_line, (1) no pat or pat has a mode3 child, continue with next tag\n"); } } else { /* this tag stops somewhere in the middle of the line, move itstart to the beginning of this tag, there is also no need anymore to look further in slist, we have to start with this patternlist */ if (gtk_text_iter_begins_tag(&itstart, GTK_TEXT_TAG(slist->data))) { DEBUG_MSG("doc_highlight_line, (1) itstart at %d is already at the beginning of tag %p (%s)\n",gtk_text_iter_get_offset(&itstart), slist->data, get_metaname_from_tag(slist->data)); } else { DEBUG_MSG("doc_highlight_line, (1) move itstart from %d to beginning of tag %p (%s)\n", gtk_text_iter_get_offset(&itstart), slist->data, get_metaname_from_tag(slist->data)); gtk_text_iter_backward_to_tag_toggle(&itstart, GTK_TEXT_TAG(slist->data)); DEBUG_MSG("doc_highlight_line, (1) itstart is set back to %d\n", gtk_text_iter_get_offset(&itstart)); } if (pat) { DEBUG_MSG("doc_highlight_line, (1) skip all other tags, slist=g_list_last()\n"); slist = g_slist_last(slist); } } } itsearch = itstart; slist = g_slist_next(slist); } g_slist_free(taglist); /* get all the tags that itend is in */ taglist = gtk_text_iter_get_tags(&itend); DEBUG_MSG("doc_highlight_line, (2) getting all tags for itend at %d\n", gtk_text_iter_get_offset(&itend)); /* find for every tag if it starts _before_ itstart (that means all of this line-highlighting * is within that tag) or _after_ itstart (which means that we should remove that tag, move * our highlighting endpoint to the end of that tag, and rehighlight the whole bit) */ itsearch = itend; slist = taglist; while (slist && slist->data) { gboolean tag_found; /* if the tags starts at itend there is no need to search backward to the start */ if (!gtk_text_iter_begins_tag(&itend, GTK_TEXT_TAG(slist->data))) { DEBUG_MSG("doc_highlight_line, (2) backwards looking for tag %p (%s) from eo=%d to so=%d, itsearch=%d\n", slist->data, get_metaname_from_tag(slist->data), gtk_text_iter_get_offset(&itend),gtk_text_iter_get_offset(&itstart) ,gtk_text_iter_get_offset(&itsearch)); #ifdef DEBUG DEBUG_MSG("does the itsearch position (%d) toggle(%d), begin(%d) or end(%d) the tag %p (%s)?\n" ,gtk_text_iter_get_offset(&itsearch) ,gtk_text_iter_toggles_tag(&itsearch,GTK_TEXT_TAG(slist->data)),gtk_text_iter_begins_tag(&itsearch,GTK_TEXT_TAG(slist->data)) ,gtk_text_iter_ends_tag(&itsearch,GTK_TEXT_TAG(slist->data)),slist->data, get_metaname_from_tag(slist->data)); #endif /* this next function does crash sometimes, and I wonder why..... */ tag_found = gtk_text_iter_backward_to_tag_toggle(&itsearch, GTK_TEXT_TAG(slist->data)); if (!tag_found) { /* this happens with several gtk versions, up to 2.2.4 is buggy inbetween is unknown, 2.4.4 is fixed */ if (gtk_text_iter_begins_tag(&itsearch, GTK_TEXT_TAG(slist->data))) { /* we have hit the bug in gtk, this tag should have been found by gtk_text_iter_backward_to_tag_toggle */ } else { DEBUG_MSG("doc_highlight_line (2), very weird situation, the tag is ended but it doesn't start ??, itsearch now is at %d\n", gtk_text_iter_get_offset(&itsearch)); /* itsearch is now at offset 0, so we do a forward search to find the first start */ tag_found = gtk_text_iter_forward_to_tag_toggle(&itsearch, GTK_TEXT_TAG(slist->data)); DEBUG_MSG("(2) a forward search to the tag finds %d\n", gtk_text_iter_get_offset(&itsearch)); if (!tag_found) { g_print("doc_highlight_line, (2) a tag that is started is nowhere to be found ??? BUG!\n"); exit(123); } if (gtk_text_iter_compare(&itsearch, &itend) > 0) { itsearch = itstart; gtk_text_iter_backward_char(&itsearch); } } } DEBUG_MSG("doc_highlight_line, (2) tag %p (%s) starts at itsearch=%d\n", slist->data,get_metaname_from_tag(slist->data),gtk_text_iter_get_offset(&itsearch)); if (gtk_text_iter_compare(&itsearch, &itstart) <= 0) { /* both the start and endpoint are within this tag --> pattern matching can start with this subpattern, since we did run the same algorithm for itstart we can skip a bit now */ } else { /* this tag starts somewhere in the middle of the line, move itend to the end of this tag */ if (gtk_text_iter_ends_tag(&itend, GTK_TEXT_TAG(slist->data))) { DEBUG_MSG("doc_highlight_line, (2) itend at %d is already at the end of tag %p (%s)\n", gtk_text_iter_get_offset(&itend), slist->data,get_metaname_from_tag(slist->data)); } else { DEBUG_MSG("doc_highlight_line, (2) move itend from %d to end of tag %p (%s)\n",gtk_text_iter_get_offset(&itend), slist->data, get_metaname_from_tag(slist->data)); gtk_text_iter_forward_to_tag_toggle(&itend, GTK_TEXT_TAG(slist->data)); DEBUG_MSG("doc_highlight_line, (2) itend is set forward to %d\n", gtk_text_iter_get_offset(&itend)); } } } itsearch = itend; slist = g_slist_next(slist); } g_slist_free(taglist); /* this function removes some specific tags from the region */ remove_tag_by_list_in_region(doc, patternlist, &itstart, &itend); so = gtk_text_iter_get_offset(&itstart); eo = gtk_text_iter_get_offset(&itend); } else { DEBUG_MSG("doc_highlight_line, so >= eo, not highlighting!\n"); } #ifdef HL_TIMING timing_stop(TIMING_LINE_HIGHLIGHTING); #endif if (patternlist) { gchar *buf; DEBUG_MSG("doc_highlight_line from so=%d to eo=%d\n", so, eo); patmatch_init_run(doc->hl->highlightlist); #ifdef HL_TIMING timing_start(TIMING_TOTAL); #endif buf = doc_get_chars(doc, so, eo); applylevel(doc,buf,so,0,strlen(buf),NULL,patternlist); g_free(buf); #ifdef HL_TIMING timing_stop(TIMING_TOTAL); g_print("doc_highlight_line done, %ld ms total, %ld ms line_highlighting\n",timing[TIMING_TOTAL].total_ms, timing[TIMING_LINE_HIGHLIGHTING].total_ms); #endif } else { DEBUG_MSG("doc_highlight_line, no patternlist, not highlighting!\n"); } doc->need_highlighting = FALSE; } void doc_highlight_line(Tdocument * doc) { GtkTextIter itstart, itend; GtkTextMark *mark = gtk_text_buffer_get_insert(doc->buffer); gtk_text_buffer_get_iter_at_mark(doc->buffer, &itstart, mark); /* move to the beginning of the line */ gtk_text_iter_set_line_offset(&itstart, 0); if (main_v->props.highlight_num_lines_count) { gtk_text_iter_backward_lines(&itstart, main_v->props.highlight_num_lines_count); } gtk_text_buffer_get_iter_at_mark(doc->buffer, &itend, mark); /* gtk_text_iter_forward_to_line_end(&itend); gtk_text_iter_set_line_offset(&itend, 0);*/ if (main_v->props.highlight_num_lines_count) { gtk_text_iter_forward_lines(&itend, main_v->props.highlight_num_lines_count); } if (gtk_text_iter_forward_to_line_end(&itend)) { gtk_text_iter_forward_char(&itend); } doc_highlight_region(doc, gtk_text_iter_get_offset(&itstart), gtk_text_iter_get_offset(&itend)); } GtkTextTagTable *highlight_return_tagtable() { return highlight.tagtable; } winefish-1.3.3/src/brace_finder.h0000600000047200004720000000170310375304662015702 0ustar kyanhkyanh#ifndef __BRACE_FINDER_H_ #define _BRACE_FINDER_H_ enum { BR_MOVE_IF_FOUND = 1<<0, BR_FIND_FORWARD = 1<<1, BR_FIND_BACKWARD = 1<<2, BR_AUTO_FIND = 1<<3 }; enum { BR_RET_FOUND = 1<<0, BR_RET_NOT_FOUND =1 <<1, BR_RET_IN_COMMENT =1<<2, BR_RET_IN_SELECTION =1<<3, BR_RET_FOUND_RIGHT_DOLLAR =1<<4, BR_RET_FOUND_LEFT_BRACE =1<<5, BR_RET_FOUND_RIGHT_BRACE =1<<6, BR_RET_NOOP = 1<<7, BR_RET_MISS_MID_BRACE = 1<<8, BR_RET_FOUND_LEFT_DOLLAR =1<<9, BR_RET_MOVED_LEFT =1<<10, BR_RET_MOVED_RIGHT =1<<11, BR_RET_FOUND_WITH_LIMIT_O =1<<12 }; guint16 brace_finder(GtkTextBuffer *buffer, Tbracefinder *brfinder, gint opt, gint limit); #define VALID_LEFT_BRACE(Lch) ( (Lch == 123) || (Lch == 91) || (Lch==40) ) #define VALID_RIGHT_BRACE(Lch) ( (Lch == 125) || (Lch==93) || (Lch==41) ) #define VALID_LEFT_RIGHT_BRACE(Lch) ( VALID_LEFT_BRACE(Lch) || VALID_RIGHT_BRACE(Lch) ) #define VALID_BRACE(Lch) ( VALID_LEFT_RIGHT_BRACE(Lch) || (Lch == 36) ) #endif /* __BRACE_FINDER_H_ */ winefish-1.3.3/src/func_grep.c0000600000047200004720000006206210412074306015236 0ustar kyanhkyanh/* $Id: func_grep.c 2268 2006-03-27 23:44:06Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish) * * grep function: frontend and backend * * Copyright (c) 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* TODO: list all files contains a pattern. current: show details.. TODO: pass options to find and grep. */ /* #define DEBUG */ #include "config.h" #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND #include #include #include "bluefish.h" #include "outputbox.h" #include "gtk_easy.h" #include "gui.h" /* statusbar_message */ #include "bf_lib.h" /* create_secure_dir_return_filename, remove_secure_dir_and_filename */ #include "stringlist.h" /* get_stringlist */ #include "document.h"/* docs_new_from_files */ #include "func_grep.h" #ifndef FUNC_GREP_RECURSIVE_MAX_DEPTH #define FUNC_GREP_RECURSIVE_MAX_DEPTH "-maxdepth 50 " #endif #ifdef EXTERNAL_XARGS #ifdef EXTERNAL_SED #define HAVE_SED_XARGS #endif /* EXTERNAL_SED */ #endif /* EXTERNAL_XARGS */ /**************************************************************************/ /* the start of the callback functions for the menu, acting on a document */ /**************************************************************************/ typedef struct { GList *filenames_to_return; GtkWidget *win; GtkWidget *basedir; GtkWidget *skipdir; GtkWidget *find_pattern; GtkWidget *recursive; GtkWidget *open_files; GtkWidget *grep_pattern; GtkWidget *is_regex; GtkWidget *case_sensitive; Tbfwin *bfwin; gint retval; } Tfiles_advanced; static int open_files; enum { FIND_WITHOUT_PATTERN = 1<<0, FIND_IN_CURRENT_FILE = 1<<1, FIND_IN_ALL_OPENED_FILES = 1<<2, FIND_IN_DIRECTORY = 1<<3 }; /* FIND_IN_CURRENT_FILE FIND_IN_ALL_OPENED_FILES => FIND_WITHOUT_PATTERN == 0 */ enum { FIND_RET_FAILED=1<<0, FIND_RET_OK=1<<1, FIND_RET_FIND_IN_OPENED_FILE_HAS_NOT_FILENAME_YET=1<<2, FIND_RET_FIND_IN_OPENED_FILE_BUT_NOT_PATTERN_SPECIFIED=1<<3, FIND_RET_CANNOT_CREATE_SECURE_TEMP_FILE=1<<4, FIND_RET_EMPTY_FILE_LIST=1<<5, FIND_RET_NO_DIRECTORY_SPECIFIED=1<<6 }; static Tconvert_table func_grep_escape_table [] = { {'n', "\n"}, {'t', "\t"}, {'\\', "\\"}, {'r', "\r"}, {'a', "\a"}, {'b', "\b"}, {'v', "\v"}, {0, NULL} }; static gchar *func_grep_escape_string(const gchar *original) { gchar *string; DEBUG_MSG("func_grep: escape_string, started with %s\n", original); string = unexpand_string(original,'\\',func_grep_escape_table); DEBUG_MSG("func_grep: escape_string, finished with %s\n", string); return string; } static void files_advanced_win_destroy( GtkWidget * widget, Tfiles_advanced *tfs ) { DEBUG_MSG( "func_grep: destroy the dialog: start\n" ); gtk_main_quit(); DEBUG_MSG( "func_grep: call gtk_main_quit called\n" ); window_destroy( tfs->win ); open_files = 0; } static void files_advanced_win_ok_clicked( GtkWidget * widget, Tfiles_advanced *tfs ) { gchar * command =NULL, *temp_file=NULL, *c_basedir =NULL, *c_find_pattern =NULL, *c_recursive =NULL, *c_grep_pattern =NULL, *c_is_regex =NULL, *c_skipdir =NULL, *c_grep_pattern_escaped=NULL ; gint type = FIND_IN_DIRECTORY; tfs->retval = FIND_RET_OK; /* get type, get c_find_pattern ***********************************************/ c_find_pattern = gtk_editable_get_chars( GTK_EDITABLE( GTK_COMBO( tfs->find_pattern ) ->entry ), 0, -1 ); if (!c_find_pattern || strlen(c_find_pattern) == 0) { c_find_pattern = g_strdup("*"); }else if (g_str_has_prefix(c_find_pattern, "<0: ") ) { type = FIND_IN_CURRENT_FILE; }else if ( g_str_has_prefix(c_find_pattern, "<1: ") ) { type = FIND_IN_ALL_OPENED_FILES; } if (type & FIND_IN_DIRECTORY ) { open_files = 100 + gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->open_files ) ); if (open_files-100) { temp_file = create_secure_dir_return_filename(); if ( !temp_file ) { tfs->retval = tfs->retval | FIND_RET_CANNOT_CREATE_SECURE_TEMP_FILE | FIND_RET_FAILED; DEBUG_MSG( "func_grep: can't get a secure temp filename ?????\n" ); } DEBUG_MSG( "func_grep: temp_file=%s\n", temp_file ); } if (! (tfs->retval & FIND_RET_FAILED) ) { c_basedir = gtk_editable_get_chars( GTK_EDITABLE( GTK_COMBO(tfs->basedir)->entry ), 0, -1 ); if (!c_basedir || strlen(c_basedir)==0) { tfs->retval = tfs->retval | FIND_RET_NO_DIRECTORY_SPECIFIED | FIND_RET_FAILED ; DEBUG_MSG("func_grep: basedir is not specified\n"); } } /* create c_find_pattern ***********************************************/ if ( !( tfs->retval & FIND_RET_FAILED ) ){ gchar ** tmparray; /* TODO: escape the string: replace any ' by \' */ tmparray = g_strsplit(c_find_pattern,",",0); gchar **tmp2array = tmparray; gint newsize = 1; /* include terminator */ c_find_pattern = g_realloc(c_find_pattern,newsize); /* for new string: g_malloc0 */ c_find_pattern[0] = '\0'; /* TODO: use g_strconcat is easier (for coding?) */ while (*tmp2array) { newsize += strlen(*tmp2array) + 12; /* __'x' -name -o __ */ c_find_pattern = g_realloc(c_find_pattern,newsize); strcat(c_find_pattern,"-name '"); strcat(c_find_pattern,*tmp2array); strcat(c_find_pattern,"' -o "); tmp2array++; } DEBUG_MSG("func_grep: finalstring = %s\n", c_find_pattern); /* finalstring is of the form __X -o __ */ newsize -= 4; c_find_pattern = g_realloc(c_find_pattern, newsize); c_find_pattern[newsize-1] = '\0'; DEBUG_MSG("func_grep: truncated finalstring = %s\n", c_find_pattern); c_find_pattern = g_strconcat("\\( ",c_find_pattern, " \\)", NULL); g_strfreev(tmparray); } }else{ /* find in current file or all opened files */ if (type & FIND_IN_CURRENT_FILE) { if (! tfs->bfwin->current_document->filename ) { tfs->retval = tfs->retval | FIND_RET_FIND_IN_OPENED_FILE_HAS_NOT_FILENAME_YET | FIND_RET_FAILED; DEBUG_MSG("func_grep: find in current file but it hasnot filename yet\n"); } else { c_find_pattern = g_strdup_printf("'%s'", tfs->bfwin->current_document->filename); } }else{ GList *tmplist; tmplist = g_list_first(tfs->bfwin->documentlist); c_find_pattern = g_strdup(""); while (tmplist) { if (DOCUMENT(tmplist->data)->filename) { c_find_pattern = g_strdup_printf("%s '%s'", c_find_pattern, DOCUMENT(tmplist->data)->filename); } tmplist = g_list_next(tmplist); } if (!strlen(c_find_pattern)) { tfs->retval = tfs->retval | FIND_RET_FIND_IN_OPENED_FILE_HAS_NOT_FILENAME_YET | FIND_RET_FAILED; DEBUG_MSG("func_grep: find in current files but they havenot filename yet\n"); } } } if ( !(tfs->retval & FIND_RET_FAILED) ) { c_grep_pattern = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(tfs->grep_pattern)->entry),0,-1); type = SET_BIT(type, FIND_WITHOUT_PATTERN, (!c_grep_pattern || strlen(c_grep_pattern)==0) ); /* without patterns */ if ( type & FIND_IN_DIRECTORY ) { c_is_regex = g_strdup_printf( "-%s%s%s", (open_files-100)?"l":( type & FIND_WITHOUT_PATTERN ?"l":"nH"), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->is_regex ) ) ? "E": "", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->case_sensitive ) ) ? "" : "i" ); if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->recursive ) ) ) { c_recursive = FUNC_GREP_RECURSIVE_MAX_DEPTH; } else { c_recursive = "-maxdepth 1"; } if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->skipdir ) ) ) { c_skipdir = g_strdup("| grep -v SCCS/ | grep -v CVS/ | grep -v .svn/"); }else{ c_skipdir = g_strdup(""); } /* command = `find c_basedir -name c_find_pattern c_recursive` command = `grep -E 'c_grep_pattern' `find c_basedir -name c_find_pattern c_recursive`` */ if ( type & FIND_WITHOUT_PATTERN ) { command = g_strdup_printf("%s '%s' -type f %s %s %s", EXTERNAL_FIND, c_basedir, c_find_pattern, c_recursive, c_skipdir); } else { /* c_grep_pattern_escaped = g_strescape(c_grep_pattern,"\""); *//* TODO: escape \" */ c_grep_pattern_escaped = func_grep_escape_string(c_grep_pattern); DEBUG_MSG("func_grep: original: %s; escaped : %s\n", c_grep_pattern, c_grep_pattern_escaped); #ifdef HAVE_SED_XARGS DEBUG_MSG("func_grep: use xargs and sed\n"); command = g_strdup_printf("%s '%s' -type f %s %s %s | %s -e 's/ /\\\\\\ /g' | %s %s %s '%s'", EXTERNAL_FIND, c_basedir, c_find_pattern, c_recursive, c_skipdir, EXTERNAL_SED, EXTERNAL_XARGS, EXTERNAL_GREP, c_is_regex, c_grep_pattern_escaped); #else /* TODO: have find, have grep, but donot have sed/xargs. why???? */ command = g_strdup_printf("%s %s '%s' `%s '%s' -type f %s %s %s`",EXTERNAL_GREP, c_is_regex, c_grep_pattern_escaped, EXTERNAL_FIND, c_basedir, c_find_pattern, c_recursive, c_skipdir); #endif /* SED_XARGS */ } DEBUG_MSG( "func_grep: command=%s\n", command ); statusbar_message( tfs->bfwin, _( "searching files..." ), 1000 ); flush_queue(); if (open_files-100) { DEBUG_MSG("func_grep: redirect to %s\n", temp_file); command = g_strconcat(command, " > ", temp_file,NULL); system( command ); /* may halt !!! system call !!! */ tfs->filenames_to_return = get_stringlist( temp_file, tfs->filenames_to_return ); remove_secure_dir_and_filename( temp_file ); /* BUG#64, g_free( temp_file ); */ if (!tfs->filenames_to_return) { tfs->retval = tfs->retval | FIND_RET_EMPTY_FILE_LIST; } }else{ if (type & FIND_WITHOUT_PATTERN) { outputbox(tfs->bfwin,&tfs->bfwin->grepbox,_("grep"), ".*", 0, -1, 0, command, 0); }else{ /* the output maynot be captured completely. why? a line may be cut...*/ outputbox(tfs->bfwin,&tfs->bfwin->grepbox,_("grep"), "^([^:]+):([0-9]+):(.*)", 1, 2, 3, command, 0); } } /* add directory to history */ { gchar *tmpstr = gtk_editable_get_chars(GTK_EDITABLE( GTK_COMBO( tfs->basedir ) ->entry),0,-1); if (tfs->bfwin->project) { DEBUG_MSG("func_grep: add directory %s to history of project\n",tmpstr); tfs->bfwin->project->session->recent_dirs = add_to_history_stringlist(tfs->bfwin->project->session->recent_dirs, tmpstr, TRUE, TRUE); }else{ DEBUG_MSG("func_grep: add directory %s to history of global session\n",tmpstr); tfs->bfwin->session->recent_dirs = add_to_history_stringlist(tfs->bfwin->session->recent_dirs, tmpstr, TRUE, TRUE); } g_free(tmpstr); } }else{ DEBUG_MSG("func_grep: start finding in opened file(s)...\n"); if ( type & FIND_WITHOUT_PATTERN ) { tfs->retval = tfs->retval |FIND_RET_FIND_IN_OPENED_FILE_BUT_NOT_PATTERN_SPECIFIED | FIND_RET_FAILED; DEBUG_MSG("func_grep: find in open files but no pattern was specified\n"); }else{ c_is_regex = g_strdup_printf( "-nH%s%s", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->is_regex ) ) ? "E": "", gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tfs->case_sensitive ) ) ? "" : "i" ); /* c_grep_pattern_escaped = g_strescape(c_grep_pattern,"\""); *//* TODO: escape \" */ c_grep_pattern_escaped = func_grep_escape_string(c_grep_pattern); DEBUG_MSG("func_grep: original: %s; escaped : %s\n", c_grep_pattern, c_grep_pattern_escaped); command = g_strdup_printf("%s %s '%s' %s", EXTERNAL_GREP, c_is_regex, c_grep_pattern_escaped,c_find_pattern); outputbox(tfs->bfwin,&tfs->bfwin->grepbox,_("grep"), "^([^:]+):([0-9]+):(.*)", 1, 2, 3, command, 0); } } /* add pattern to history. only if found success ? */ if (! ( type & FIND_WITHOUT_PATTERN ) && ! (tfs->retval & FIND_RET_FAILED) ) { if (tfs->bfwin->project) { DEBUG_MSG("func_grep: add grep_pattern %s to history of project\n",c_grep_pattern); tfs->bfwin->project->session->searchlist = add_to_history_stringlist(tfs->bfwin->project->session->searchlist,c_grep_pattern,TRUE,TRUE); }else{ DEBUG_MSG("func_grep: add grep_pattern %s to history of global session\n",c_grep_pattern); tfs->bfwin->session->searchlist = add_to_history_stringlist(tfs->bfwin->session->searchlist,c_grep_pattern,TRUE/*top*/,TRUE/*move if exists */); } } } g_free( c_basedir ); g_free( c_find_pattern ); g_free( c_grep_pattern ); g_free( c_grep_pattern_escaped ); g_free( c_is_regex ); g_free( c_skipdir); g_free( command ); gboolean destroy_win = TRUE; if (tfs->retval &FIND_RET_FIND_IN_OPENED_FILE_HAS_NOT_FILENAME_YET) { statusbar_message(tfs->bfwin, _("func_grep: file(s) without filename"), 2000); }else if (tfs->retval &FIND_RET_FIND_IN_OPENED_FILE_BUT_NOT_PATTERN_SPECIFIED) { warning_dialog(tfs->win, _("please specify the pattern!"), NULL); /* gtk_widget_grab_focus(tfs->find_pattern); */ destroy_win = FALSE; } else if (tfs->retval &FIND_RET_CANNOT_CREATE_SECURE_TEMP_FILE) { statusbar_message(tfs->bfwin, _("func_grep: cannot create secure file"), 2000); } else if (tfs->retval &FIND_RET_EMPTY_FILE_LIST) { statusbar_message(tfs->bfwin, _( "no matching files found" ), 2000); } else if (tfs->retval & FIND_RET_NO_DIRECTORY_SPECIFIED) { statusbar_message(tfs->bfwin, _( "no directory specified" ), 2000); } if (destroy_win) { files_advanced_win_destroy(widget, tfs); } } static void files_advanced_win_cancel_clicked( GtkWidget * widget, Tfiles_advanced *tfs ) { files_advanced_win_destroy( widget, tfs ); } static void files_advanced_win_select_basedir_lcb( GtkWidget * widget, Tfiles_advanced *tfs ) { gchar * olddir; /* oldir = gtk_editable_get_chars( GTK_EDITABLE( tfs->basedir ), 0, -1 ); */ olddir = gtk_editable_get_chars( GTK_EDITABLE( GTK_COMBO(tfs->basedir)->entry ), 0, -1 ); /* concat a "/" to the end of the current directory. This fixes a bug where your current working directory was being parsed as /directory/file when you opened the dialog to browse for a directory */ gchar *tmpdir = g_strconcat( olddir, "/", NULL ); gchar *newdir = NULL; GtkWidget *dialog; dialog = file_chooser_dialog( tfs->bfwin, _( "Select basedir" ), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, TRUE, FALSE, NULL ); if ( gtk_dialog_run ( GTK_DIALOG ( dialog ) ) == GTK_RESPONSE_ACCEPT ) { newdir = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); } gtk_widget_destroy( dialog ); g_free( tmpdir ); if ( newdir ) { /* gtk_entry_set_text( GTK_ENTRY( tfs->basedir ), newdir ); */ gint position =0; gtk_editable_delete_text(GTK_EDITABLE( GTK_COMBO( tfs->basedir ) ->entry ),0,-1); gtk_editable_insert_text( GTK_EDITABLE( GTK_COMBO( tfs->basedir ) ->entry ), newdir, strlen(newdir), &position); gtk_editable_set_position (GTK_EDITABLE( GTK_COMBO( tfs->basedir ) ->entry), -1); g_free( newdir ); } g_free( olddir ); } static void files_advanced_win_set_sensitive (Tfiles_advanced *tfs) { gint type; gchar * c_find_pattern; c_find_pattern = gtk_editable_get_chars( GTK_EDITABLE( GTK_COMBO( tfs->find_pattern ) ->entry ), 0, -1 ); if (g_str_has_prefix(c_find_pattern, "<0: ") ) { type = FIND_IN_CURRENT_FILE; }else if ( g_str_has_prefix(c_find_pattern, "<1: ") ) { type = FIND_IN_ALL_OPENED_FILES; }else{ type = FIND_IN_DIRECTORY; } if ( !(type & FIND_IN_DIRECTORY) ) { gtk_widget_set_sensitive(tfs->basedir, FALSE); gtk_widget_set_sensitive(tfs->open_files, FALSE); gtk_widget_set_sensitive(tfs->recursive, FALSE); gtk_widget_set_sensitive(tfs->skipdir, FALSE); }else{ gtk_widget_set_sensitive(tfs->basedir, TRUE); gtk_widget_set_sensitive(tfs->open_files, TRUE); gtk_widget_set_sensitive(tfs->recursive, TRUE); gtk_widget_set_sensitive(tfs->skipdir, TRUE); } g_free(c_find_pattern); } static void find_pattern_changed_lcb(GtkWidget *widget, Tfiles_advanced *tfs) { files_advanced_win_set_sensitive(tfs); } static void files_advanced_win( Tfiles_advanced *tfs) { GtkWidget * vbox, *hbox, *but, *table; GList *list; if ( !tfs->basedir ) { gchar * curdir = g_get_current_dir(); /* tfs->basedir = entry_with_text( curdir, 255 ); */ tfs->basedir = combo_with_popdown(curdir,tfs->bfwin->project ? tfs->bfwin->project->session->recent_dirs : tfs->bfwin->session->recent_dirs, TRUE/*editable*/); g_free ( curdir ); } gtk_widget_set_size_request(tfs->basedir, 270,-1); tfs->win = window_full2( _( "Grep Function" ), GTK_WIN_POS_MOUSE, 12, G_CALLBACK( files_advanced_win_destroy ), tfs, TRUE, tfs->bfwin->main_window ); DEBUG_MSG( "func_grep: tfs->win=%p\n", tfs->win ); tfs->filenames_to_return = NULL; vbox = gtk_vbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( tfs->win ), vbox ); #define MAX_COLUMN 7 table = gtk_table_new( 13, MAX_COLUMN, FALSE ); gtk_table_set_row_spacings( GTK_TABLE( table ), 0 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 12 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, FALSE, 0 ); /* gtk_table_attach_defaults( GTK_TABLE( table ), gtk_label_new( _( "grep {contains} `find {basedir} -name '{file type}'`" ) ), 0, 7, 0, 1 ); */ /* gtk_table_attach_defaults( GTK_TABLE( table ), gtk_label_new( _( "left pattern blank == file listing" ) ), 0, MAX_COLUMN, 0, 1 ); gtk_table_attach_defaults( GTK_TABLE( table ), gtk_hseparator_new(), 0, MAX_COLUMN, 1, 2 ); */ /* filename part */ /* curdir should get a value */ bf_label_tad_with_markup( _( "General" ), 0, 0.5, table, 0, 3, 2, 3 ); bf_mnemonic_label_tad_with_alignment( _( "Base_dir:" ), tfs->basedir, 0, 0.5, table, 1, 2, 3, 4 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->basedir, 2, MAX_COLUMN-1, 3, 4 ); gtk_table_attach( GTK_TABLE( table ), bf_allbuttons_backend( _( "_Browse..." ), TRUE, 112, G_CALLBACK( files_advanced_win_select_basedir_lcb ), tfs ), MAX_COLUMN-1, MAX_COLUMN, 3, 4, GTK_SHRINK, GTK_SHRINK, 0, 0 ); list = NULL; list = g_list_append( list, _("<0: current file>") ); list = g_list_append( list, _("<1: all opened files>") ); list = g_list_append( list, "*.tex" ); list = g_list_append( list, "*.cls,*.dtx,*.sty,*.ins" ); list = g_list_append( list, "*.ind,*.bbl" ); list = g_list_append( list, "*.log,*.aux,*.idx,*.ilg,*.blg" ); list = g_list_append( list, "*.toc,*.lof,*.lot,*.thm" ); list = g_list_append( list, "*" ); if (open_files - 100) { tfs->find_pattern = combo_with_popdown("*.tex", list, 1 ); }else{ tfs->find_pattern = combo_with_popdown( _("<1: all opened files>"), list, 1 ); } bf_mnemonic_label_tad_with_alignment( _( "_File:" ), tfs->find_pattern, 0, 0.5, table, 1, 2, 4, 5 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->find_pattern, 2, MAX_COLUMN-1, 4, 5 ); g_signal_connect(G_OBJECT( GTK_ENTRY( GTK_COMBO( tfs->find_pattern )->entry) ), "changed", G_CALLBACK(find_pattern_changed_lcb), tfs); g_list_free( list ); tfs->recursive = checkbut_with_value( NULL, 1 ); bf_mnemonic_label_tad_with_alignment( _( "_Recursive:" ), tfs->recursive, 0, 0.5, table, 1, 2, 5, 6 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->recursive, 2, MAX_COLUMN-1, 5, 6 ); tfs->open_files = checkbut_with_value( NULL , (open_files-100) ); bf_mnemonic_label_tad_with_alignment( _( "_Open files:" ), tfs->open_files, 0, 0.5, table, 1, 2, 6, 7); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->open_files, 2, MAX_COLUMN-1, 6, 7 ); /* content */ gtk_table_set_row_spacing( GTK_TABLE( table ), 6, 10 ); bf_label_tad_with_markup( _( "Contains" ), 0, 0.5, table, 0, 3, 7, 8 ); { /* tfs->grep_pattern = entry_with_text( NULL, 255 ); */ gchar *buffer; GtkTextIter start, end; gtk_text_buffer_get_selection_bounds(tfs->bfwin->current_document->buffer, &start, &end); buffer = gtk_text_buffer_get_text(tfs->bfwin->current_document->buffer, &start, &end, FALSE); if (strchr(buffer,'\n')!=NULL) { /* a newline in the selection, we probably don't want this string as search string */ g_free(buffer); buffer = NULL; } /* put the selected text in the pattern textfield */ tfs->grep_pattern = combo_with_popdown(buffer?buffer:"", tfs->bfwin->project? tfs->bfwin->project->session->searchlist : tfs->bfwin->session->searchlist, TRUE/*editable*/); if (buffer) g_free(buffer); } bf_mnemonic_label_tad_with_alignment( _( "_Pattern:" ), tfs->grep_pattern, 0, 0.5, table, 1, 2, 8, 9 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->grep_pattern, 2, MAX_COLUMN-1, 8, 9 ); /* failed: gtk_tooltips_set_tip(main_v->tooltips, tfs->grep_pattern, _("left pattern blank == file listing..."),NULL); */ tfs->case_sensitive = checkbut_with_value( NULL, 1 ); bf_mnemonic_label_tad_with_alignment( _( "_Case sensitive:" ), tfs->case_sensitive, 0, 0.5, table, 1, 2, 9, 10 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->case_sensitive, 2, MAX_COLUMN-1, 9, 10 ); tfs->is_regex = checkbut_with_value( NULL, 0 ); bf_mnemonic_label_tad_with_alignment( _( "Is rege_x:" ), tfs->is_regex, 0, 0.5, table, 1, 2, 10, 11 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->is_regex, 2, MAX_COLUMN-1, 10, 11 ); gtk_table_set_row_spacing( GTK_TABLE( table ), 10, 10 ); bf_label_tad_with_markup( _( "Advanced" ), 0, 0.5, table, 0, 3, 11, 12 ); tfs->skipdir = checkbut_with_value( NULL, 1); bf_mnemonic_label_tad_with_alignment( _( "Skip _VCS dirs:" ), tfs->skipdir, 0, 0.5, table, 1, 2, 12, 13 ); gtk_table_attach_defaults( GTK_TABLE( table ), tfs->skipdir, 2, MAX_COLUMN-1, 12, 13 ); /* buttons */ hbox = gtk_hbox_new( FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), gtk_hseparator_new(), TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 12 ); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default( GTK_BUTTONBOX_END ); gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbox ), 12 ); but = bf_stock_cancel_button( G_CALLBACK( files_advanced_win_cancel_clicked ), tfs ); gtk_box_pack_start( GTK_BOX( hbox ), but , FALSE, FALSE, 0 ); but = bf_stock_ok_button( G_CALLBACK( files_advanced_win_ok_clicked ), tfs ); gtk_box_pack_start( GTK_BOX( hbox ), but , FALSE, FALSE, 0 ); gtk_window_set_default( GTK_WINDOW( tfs->win ), but ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); files_advanced_win_set_sensitive ( tfs ); gtk_widget_show_all( GTK_WIDGET( tfs->win ) ); /* gtk_grab_add(GTK_WIDGET(tfs->win)); gtk_widget_realize(GTK_WIDGET(tfs->win));*/ gtk_window_set_transient_for( GTK_WINDOW( tfs->win ), GTK_WINDOW( tfs->bfwin->main_window ) ); } static GList *return_files_advanced( Tbfwin *bfwin, gchar *tmppath) { Tfiles_advanced tfs = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, bfwin, FIND_RET_OK}; /* Tfiles_advanced *tfs; tfs = g_new0(Tfiles_advanced, 1); tfs->bfwin = bfwin; tfs->retval = FIND_RET_OK; */ if ( tmppath ) { GtkWidget * curdir = entry_with_text( tmppath, 255 ); tfs.basedir = curdir; } /* this is probably called different!! */ files_advanced_win( &tfs ); DEBUG_MSG( "func_grep: calling gtk_main()\n" ); gtk_main(); return tfs.filenames_to_return; } /***************************************************************/ void file_open_advanced_cb( Tbfwin *bfwin, gboolean v_open_files ) { if (open_files > 99 ) { /* prevent user from calling twice */ return; } GList * tmplist; open_files = 100 + v_open_files; tmplist = return_files_advanced( bfwin , NULL); if (open_files - 100) { if ( !tmplist ) { return ; } { gint len = g_list_length( tmplist ); gchar *message = g_strdup_printf( _( "loading %d file(s)..." ), len ); statusbar_message( bfwin, message, 2000 + len * 50 ); g_free( message ); flush_queue(); } docs_new_from_files( bfwin, tmplist, FALSE, -1 ); free_stringlist( tmplist ); } open_files = 0; } void open_advanced_from_filebrowser( Tbfwin *bfwin, gchar *path ) { GList * tmplist; tmplist = return_files_advanced ( bfwin, path); if ( !tmplist ) { return ; } { gint len = g_list_length( tmplist ); gchar *message = g_strdup_printf( _( "loading %d file(s)..." ), len ); statusbar_message( bfwin, message, 2000 + len * 50 ); g_free( message ); flush_queue(); } docs_new_from_files( bfwin, tmplist, FALSE, -1); free_stringlist( tmplist ); } void template_rescan_cb(Tbfwin *bfwin) { gchar *command; gchar *c_basedir; if (main_v->props.templates_dir && strlen(main_v->props.templates_dir) ){ c_basedir = g_strdup(main_v->props.templates_dir); }else{ c_basedir = g_strconcat(g_get_home_dir(),"/tex/templates/",NULL); } /* c_basedir = g_strdup("/home/users/kyanh/tex/templates/"); */ #ifdef HAVE_SED_XARGS command = g_strdup_printf("%s '%s' -type f \\( -name '*.tex' -o -name '*.sty' \\) %s | grep -v SCCS/ | grep -v CVS/ | grep -v .svn/ | %s -e 's/ /\\\\\\ /g' | %s %s -EnH '%%%%%%%%wf='", EXTERNAL_FIND, c_basedir, FUNC_GREP_RECURSIVE_MAX_DEPTH, EXTERNAL_SED, EXTERNAL_XARGS, EXTERNAL_GREP); #else command = g_strdup_printf("%s -EnH '%%%%%%%%wf=' `%s '%s' -type f \\( -name '*.tex' -o -name '*.sty' \\) %s | grep -v SCCS/ | grep -v CVS/ | grep -v .svn/`",EXTERNAL_GREP, EXTERNAL_FIND, c_basedir, FUNC_GREP_RECURSIVE_MAX_DEPTH); #endif /* SED_XARGS */ outputbox(bfwin, &bfwin->templatebox,_("template"), "^([^:]+):([0-9]+):(.*)", 1, 2, 3, command, 0); g_free(command); g_free(c_basedir); } #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ winefish-1.3.3/src/rcfile.h0000600000047200004720000000335410373411041014533 0ustar kyanhkyanh/* $Id: rcfile.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * rcfile.h - functions to load the config * * Copyright (C) 2001-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __RCFILE_H_ #define __RCFILE_H_ void rcfile_parse_main(void); void rcfile_parse_highlighting(void); void rcfile_parse_custom_menu(gboolean full_reset, gboolean load_new); void rcfile_check_directory(void); void rcfile_save_configfile_menu_cb(gpointer callback_data,guint action,GtkWidget *widget); void rcfile_save_all(void); gboolean rcfile_parse_project(Tproject *project, gchar *filename); gboolean rcfile_save_project(Tproject *project, gchar *filename); gboolean rcfile_save_global_session(void); gboolean rcfile_parse_global_session(void); /* kyanh, added, 20050310 */ gboolean rcfile_save_autotext(void); void rcfile_parse_autotext(void *autolist); gboolean rcfile_save_completion(void); void rcfile_parse_completion(void *autolist, void *autolist_s); #endif /* __RCFILE_H_ */ winefish-1.3.3/src/about.c0000600000047200004720000001133210377237511014403 0ustar kyanhkyanh/* $Id: about.c 2037 2006-02-23 04:51:21Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * about.c * * Copyright (C) 2004 Eugene Morenko(More) more@irpin.com * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include /* getopt() */ #include "bluefish.h" #include "about.h" #include "gtk_easy.h" #ifndef FUNC_GREP_RECURSIVE_MAX_DEPTH #define FUNC_GREP_RECURSIVE_MAX_DEPTH "none" #endif static GtkWidget *info; static void add_page(GtkNotebook * notebook, const gchar * name, const gchar * buf, gboolean hscrolling) { GtkWidget *textview, *label, *sw; label = gtk_label_new(name); sw = textview_buffer_in_scrolwin(&textview, -1, 150, buf, GTK_WRAP_WORD); gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE); gtk_notebook_append_page(notebook, sw, label); } static void about_dialog_close_lcb(GtkObject *object,GtkWidget *win) { window_destroy(win); } void about_dialog_create(gpointer * data, guint * callback_action, GtkWidget * widget) { GtkWidget *vbox, *vbox2, *hbox; GtkWidget *notebook; GtkWidget *info_ok_button; /* GdkColor color; */ gchar *INFO =g_strdup_printf( _(\ "Winefish LaTeX Editor (based on Bluefish)\n\ \n\ * home: http://winefish.berlios.de/\n\ * open source development project\n\ * released under the GPL license\n\ \n\ * version: %s\n\ * maximum length\n latex command: %d\n autotext command: %d\n\ * recursive grep: %s\n\ * delimiters:\n %s\n\ * configured:\n $%s\n"), VERSION, COMMAND_MAX_LENGTH, AUTOTEXT_MAX_LENGTH, FUNC_GREP_RECURSIVE_MAX_DEPTH, DELIMITERS, CONFIGURE_OPTIONS); gchar *AUTHORS = _(\ "developers:\n\ * kyanh \n\ \n\ translators:\n\ * French: Michèle Garoche \n\ * Italian: Daniele Medri \n\ * Vietnamese: kyanh \n\ \n\ THANKS to all who helped making this software available.\n\ "); info = window_full2(_("About Winefish"), GTK_WIN_POS_CENTER, 6 ,G_CALLBACK(about_dialog_close_lcb),NULL, TRUE, NULL); gtk_window_set_resizable(GTK_WINDOW(info), FALSE); gtk_widget_set_size_request(GTK_WIDGET(info), 345, -1); /* color.red = 65535; color.blue = 65535; color.green = 65535; gtk_widget_modify_bg(info, GTK_STATE_NORMAL,&color); */ vbox2 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(info), vbox2); { GError *error=NULL; GtkWidget *image; GdkPixbuf* pixbuf= gdk_pixbuf_new_from_file(WINEFISH_SPLASH_FILENAME,&error); if (error) { g_print("ERROR while loading splash screen: %s\n", error->message); g_error_free(error); } else if (pixbuf) { image = gtk_image_new_from_pixbuf(pixbuf); gtk_box_pack_start(GTK_BOX(vbox2), image, FALSE, FALSE, 0); g_object_unref(pixbuf); } } vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox2), vbox, TRUE, TRUE, 0); /* the notebook */ notebook = gtk_notebook_new(); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM); /* add pages */ /* I1 = g_strconcat(INFO, CONFIGURE_OPTIONS, NULL); */ add_page(GTK_NOTEBOOK(notebook), _("info"), INFO, TRUE); /* g_free(I1); */ g_free(INFO); add_page(GTK_NOTEBOOK(notebook), _("authors"), AUTHORS, TRUE); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); gtk_box_pack_start( GTK_BOX (vbox), hbox, FALSE, FALSE, 4); /*{ info_ok_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); GTK_WIDGET_SET_FLAGS(info_ok_button, GTK_CAN_DEFAULT); }*/ info_ok_button = bf_allbuttons_backend(_("oops..."), FALSE, 0, G_CALLBACK(about_dialog_close_lcb), info); gtk_box_pack_start(GTK_BOX(hbox), info_ok_button, FALSE, FALSE, 0); GTK_WIDGET_SET_FLAGS(info_ok_button, GTK_CAN_DEFAULT); gtk_widget_grab_default(info_ok_button); g_signal_connect(info_ok_button, "clicked", G_CALLBACK(about_dialog_close_lcb), info); gtk_widget_show_all(info); } winefish-1.3.3/src/highlight.h0000600000047200004720000000255310373411041015236 0ustar kyanhkyanh/* $Id: highlight.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * highlight.h - highlighting in gtk2 text widget * * Copyright (C) 2002-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __HIGHLIGHT_H_ #define __HIGHLIGHT_H_ void filetype_highlighting_rebuild(gboolean gui_errors); void hl_init(void); void doc_highlight_full(Tdocument *doc); void doc_highlight_region(Tdocument * doc, guint startof, guint endof); void doc_highlight_line(Tdocument *doc); void doc_remove_highlighting(Tdocument *doc); GtkTextTagTable *highlight_return_tagtable(); #endif /* __HIGHLIGHT_H_ */ winefish-1.3.3/src/func_grep.h0000600000047200004720000000062410367544226015253 0ustar kyanhkyanh/* $Id: func_grep.h 1747 2006-01-31 02:16:54Z kyanh $ */ #ifndef __FUNC_GREP_H_ #define __FUNC_GREP_H_ #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND void file_open_advanced_cb( Tbfwin *bfwin, gboolean open_files); void open_advanced_from_filebrowser( Tbfwin *bfwin, gchar *path ); void template_rescan_cb(Tbfwin *bfwin); #endif /* EXTERNAL_GREP */ #endif /* EXTERNAL_FIND */ #endif /* __FUNC_GREP_H_ */ winefish-1.3.3/src/about.h0000600000047200004720000000213510373411041014375 0ustar kyanhkyanh/* $Id: about.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * about.h * * Copyright (C) 2004 Eugene Morenko(More) more@irpin.com * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __ABOUT_H_ #define __ABOUT_H_ void about_dialog_create(gpointer * data, guint * callback_action, GtkWidget * widget); #endif /* __ABOUT_H_ */ winefish-1.3.3/src/outputbox_ka.c0000600000047200004720000002336010366106156016017 0ustar kyanhkyanh/* $Id: outputbox_ka.c 1665 2006-01-26 08:46:38Z kyanh $ */ /* Winefish LaTeX Editor * copyright (c) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "outputbox_cfg.h" #ifdef __KA_BACKEND__ #include #include #include /* kill() */ #include /* open() */ #include /* kyanh, open() */ /* kyanh, 20050301, Thanks to M. Garoche <...@easyconnect.fr> Move from to */ #include /* wait(), waitid() */ #include #include #include /* strlen() */ /* Using waitpid() to free child process's resources, we don't need anymore . Anyway, thanks to M. Garoche for reporting a problem with Mac OS */ #include "config.h" #include "bluefish.h" #include "document.h" #include "gtk_easy.h" #include "outputbox.h" #include "bf_lib.h" #include "outputbox_ka.h" #include "outputbox_filter.h" /* kyanh, added, 20050301 */ static void free_ob( Toutputbox *ob, gboolean have_retfile ) { DEBUG_MSG("free_ob: starting...\n"); if ( have_retfile ) { /* free temporarily file */ DEBUG_MSG( "free_ob: retfile=%s\n", ob->retfile ); remove_secure_dir_and_filename( ob->retfile ); /* g_free( ob->retfile ); */ } g_free( ob->basepath_cached ); ob->basepath_cached = NULL; g_free( ob->def->pattern ); regfree( &ob->def->preg ); g_free( ob->def->command ); g_free( ob->def ); ob->def = NULL; /* to be check for next using */ ob->pid = 0; DEBUG_MSG("free_ob: finished.\n"); } /* kyanh, 20050302, moved from continute_execute() */ void finish_execute( Toutputbox *ob ) { if (!(ob->OB_FETCHING == OB_IS_STOPPED)) { ob->OB_FETCHING = OB_IS_STOPPED; DEBUG_MSG("finish_execute: starting...\n"); /* menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), FALSE); */ outputbox_set_status(ob, FALSE, FALSE); g_io_channel_shutdown( ob->io_channel, FALSE, NULL); g_io_channel_unref( ob->io_channel ); g_source_remove ( ob->pollID ); DEBUG_MSG("finish_execute: kill the pid = %d\n", ob->pid); kill( ob->pid, SIGTERM ); waitpid( ob->pid, &child_exit_status, WNOHANG ); if ( WIFEXITED (child_exit_status) ){ gint exitcode = WEXITSTATUS( child_exit_status ); gchar *str_status = g_strdup_printf(_("Exit code: %d"), exitcode); outputbox_message( ob, str_status, "b" ); g_free( str_status ); }else{ outputbox_message( ob, _("the child process exited abnormally"), "b"); } gtk_tree_view_columns_autosize( GTK_TREE_VIEW( ob->lview ) ); free_ob( ob, 1 ); DEBUG_MSG("finish_execute: completed.\n"); } ob->OB_FETCHING = OB_IS_READY; } /* Idea taken from SciTTEGTK.cxx Modified by kyanh@o2.pl kyanh, version 2 (20050302): use g_io_channel() kyanh, version 2.1 (20050315): readline(), not readchars() */ static gboolean continue_execute( Toutputbox *ob ) { DEBUG_MSG("continue_execute: starting...\n"); switch (ob->OB_FETCHING) { case OB_GO_FETCHING: break; case OB_IS_FETCHING: /* never reach... see io_signal() and poll_tool() */ DEBUG_MSG("continue_execute: fetching. Return now.\n"); return FALSE; break; /* never reach here */ case OB_STOP_REQUEST: DEBUG_MSG("continue_execute: stop request. Call finish_execute()...\n"); finish_execute(ob); return FALSE; break; default: DEBUG_MSG("continue_execute: stoppped flag. Return...\n"); return FALSE; break; } gsize count = 0; GIOStatus io_status; GError *error = NULL; gchar *buf = NULL; gsize terminator_pos = 0; gboolean continued = TRUE; ob->OB_FETCHING = OB_IS_FETCHING; while ( (ob->OB_FETCHING == OB_IS_FETCHING) && continued ) { continued = FALSE; buf = NULL; io_status = g_io_channel_read_line( ob->io_channel, &buf, &count, &terminator_pos, &error ); switch ( io_status ) { case G_IO_STATUS_ERROR: DEBUG_MSG("continue_execute: G_IO_STATUS_ERROR\n"); { gchar * tmpstr; tmpstr = g_strdup_printf( _("IOChannel Error: %s"), error->message ); outputbox_message( ob, tmpstr, "b" ); g_free( tmpstr ); finish_execute( ob ); } break; case G_IO_STATUS_EOF: /* without this, we dump into an infinite loop */ DEBUG_MSG("continue_execute: G_IO_STATUS_EOF. Call finish_excute()\n"); finish_execute( ob ); break; case G_IO_STATUS_NORMAL: DEBUG_MSG("continue_execute: G_IO_STATUS_NORMAL. Get line from channel...\n"); continued = TRUE; if ( terminator_pos < count ) { buf[ terminator_pos ] = '\0'; } outputbox_filter_line( ob, buf ); break; default: DEBUG_MSG("continue_execute: G_IO_STATUS_???\n"); break; } } if (ob->OB_FETCHING == OB_IS_FETCHING) { ob->OB_FETCHING = OB_GO_FETCHING; } DEBUG_MSG("continue_execute: fetching = %d.\n", fetching); g_free( buf ); g_clear_error( &error ); DEBUG_MSG("continue_execute: finished.\n"); return FALSE; } /* continue to read data */ /* written by kyanh, 20050301 */ static gboolean io_signal( GIOChannel *source, GIOCondition condition, Toutputbox *ob ) { DEBUG_MSG("io_signal:\n"); if ( condition & (G_IO_NVAL|G_IO_ERR|G_IO_HUP) ) { ob->OB_FETCHING = OB_STOP_REQUEST; } if ( (ob->OB_FETCHING == OB_GO_FETCHING) || (ob->OB_FETCHING == OB_STOP_REQUEST) ) { return continue_execute( ob ); } #ifdef DEBUG else{ DEBUG_MSG("io_signal: do nothing\n"); return TRUE; } #endif return FALSE; } /* Taken from SciTTEGTK.cxx Detect if the tool has exited without producing any output */ static gboolean poll_tool( Toutputbox *ob ) { DEBUG_MSG("poll_tool:\n"); if ( (ob->OB_FETCHING == OB_GO_FETCHING) || (ob->OB_FETCHING == OB_STOP_REQUEST) ) { continue_execute( ob ); } #ifdef DEBUG else{ DEBUG_MSG("poll_tool: do nothing\n"); } #endif return FALSE; } /* Taken from SciTTEGTK.cxx kyanh: everything emitted from `running' will be captured [ 2>&1 ] */ static gint xsystem( const gchar *command, const gchar *outfile ) { gint pid = 0; /* fork(): create a child proccess the differs from the parent only in its PID and PPID; the resouce ultilisation are set to 0 */ if ( ( pid = fork() ) == 0 ) { close( 0 ); gint fh = open( outfile, O_WRONLY ); close( 1 ); dup( fh ); /* dup uses the lowest numbered unused descriptor for the new descriptor. */ close( 2 ); dup( fh ); execlp( "/bin/sh", "sh", "-c", command, NULL ); /* Functions that contain the letter l (execl, execlp, and execle) accept the argument list using the C language varargs mechanism. */ /* The execvp function returns only if an error occurs. */ exit( 127 ); } /* This is the parent process. */ return pid; } void run_command( Toutputbox *ob ) { DEBUG_MSG("run_command: starting...\n"); /* if ( ob->bfwin->current_document->filename ) { */ /* if the user clicked cancel at file_save -> return */ { gchar * tmpstring; if ( ob->bfwin->project && ( ob->bfwin->project->view_bars & PROJECT_MODE ) && ob->bfwin->project->basedir ) { tmpstring = g_strdup( ob->bfwin->project->basedir ); } else { if (ob->bfwin->current_document->filename) { tmpstring = g_path_get_dirname( ob->bfwin->current_document->filename ); }else{ tmpstring = g_strdup("."); } } /* outputbox_message(ob, g_strconcat("> working dir: ", tmpstring, NULL)); */ chdir( tmpstring ); g_free( tmpstring ); } gchar *command = convert_command( ob->bfwin, ob->def->command ); outputbox_message( ob, command, "b"); ob->retfile = create_secure_dir_return_filename(); gint fd = 1; if ( ob->retfile ) { DEBUG_MSG("run_command: retfile = %s\n", ob->retfile); fd = mkfifo( ob->retfile, S_IRUSR | S_IWUSR ); if ( fd == 0 ) { /* menuitem_set_sensitive(ob->bfwin->menubar, N_("/External/Stop..."), TRUE); */ outputbox_set_status(ob, TRUE, FALSE); ob->pid = xsystem( command, ob->retfile ); GError *error = NULL; ob->io_channel = g_io_channel_new_file( ob->retfile, "r", &error ); if ( ob->io_channel != NULL ) { ob->OB_FETCHING = OB_GO_FETCHING; /* Fix the BUG[200503]#20 */ g_io_channel_set_encoding( ob->io_channel, NULL, NULL ); g_io_add_watch( ob->io_channel, G_IO_IN|G_IO_PRI|G_IO_NVAL|G_IO_ERR|G_IO_HUP, ( GIOFunc ) io_signal, ob ); /* add a background task in case there is no output from the tool */ ob->pollID = g_timeout_add( 200, ( GSourceFunc ) poll_tool, ob ); } else { ob->OB_FETCHING = OB_ERROR; gchar *tmpstr; tmpstr = g_strdup_printf( _("Error: %s"), error->message ); outputbox_message( ob, tmpstr, "b" ); if ( error->code == G_FILE_ERROR_INTR ) { outputbox_message( ob, _("hint: you may call the tool again"), "i" ); } g_free( tmpstr ); outputbox_message( ob, _("tool finished."), "b" ); free_ob( ob, 1 ); } g_clear_error( &error ); } else { ob->OB_FETCHING = OB_ERROR; outputbox_message( ob, _("error: cannot create PIPE file."), "b" ); free_ob( ob, 1 ); } } else { ob->OB_FETCHING = OB_ERROR; outputbox_message( ob, _("error: cannot create temporarily file."), "b" ); free_ob( ob, 0 ); } g_free( command ); /* } else { ob->OB_FETCHING = OB_ERROR; outputbox_message( ob, _("tool canceled."), "b" ); free_ob( ob, 0 ); } */ DEBUG_MSG("run_command: finished.\n"); } #endif /* __KA_BACKEND__ */ winefish-1.3.3/src/html_diag.c0000600000047200004720000001265610366640206015230 0ustar kyanhkyanh/* $Id: html_diag.c 1712 2006-01-28 09:59:34Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * html_diag.c - general functions to create HTML dialogs * * Copyright (C) 2000-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include /* strrchr */ #include /* strtod */ /* #define DEBUG */ #include "bluefish.h" #include "html_diag.h" /* myself */ #include "gtk_easy.h" /* window_full() */ #include "bf_lib.h" #include "stringlist.h" /* add_to_stringlist */ #include "document.h" /* doc_save_selection */ /* kyanh, removed, 20050225 Trecent_attribs recent_attribs; */ /*****************************************/ /********** DIALOG FUNCTIONS *************/ /*****************************************/ void html_diag_destroy_cb(GtkWidget * widget, Thtml_diag *dg) { /* kyanh, removed, 20050225, dg->tobedestroyed = TRUE; */ if (dg->mark_ins) { gtk_text_buffer_delete_mark(dg->doc->buffer,dg->mark_ins); } if (dg->mark_sel) { gtk_text_buffer_delete_mark(dg->doc->buffer,dg->mark_sel); } window_destroy(dg->dialog); /* kyanh, from: gtk_easy.h */ DEBUG_MSG("html_diag_destroy_cb, about to free dg=%p\n",dg); g_free(dg); } void html_diag_cancel_clicked_cb(GtkWidget *widget, gpointer data) { html_diag_destroy_cb(NULL, data); } Thtml_diag *html_diag_new(Tbfwin *bfwin, gchar *title) { Thtml_diag *dg; dg = g_malloc(sizeof(Thtml_diag)); /* kyanh, removed, 20050225, dg->tobedestroyed = FALSE; */ DEBUG_MSG("html_diag_new, dg=%p\n",dg); dg->dialog = window_full2(title, GTK_WIN_POS_MOUSE, 12,G_CALLBACK(html_diag_destroy_cb), dg, TRUE/* escape key close the winow */, bfwin ? bfwin->main_window : NULL); gtk_window_set_type_hint(GTK_WINDOW(dg->dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_role(GTK_WINDOW(dg->dialog), "html_dialog"); dg->vbox = gtk_vbox_new(FALSE, 1); gtk_container_add(GTK_CONTAINER(dg->dialog), dg->vbox); { if (!gtk_text_buffer_get_mark(bfwin->current_document->buffer,"diag_ins")) { GtkTextIter iter; GtkTextMark* mark = gtk_text_buffer_get_mark(bfwin->current_document->buffer,"insert"); gtk_text_buffer_get_iter_at_mark(bfwin->current_document->buffer,&iter,mark); dg->mark_ins = gtk_text_buffer_create_mark(bfwin->current_document->buffer,"diag_ins",&iter,TRUE); mark = gtk_text_buffer_get_mark(bfwin->current_document->buffer,"selection_bound"); gtk_text_buffer_get_iter_at_mark(bfwin->current_document->buffer,&iter,mark); dg->mark_sel = gtk_text_buffer_create_mark(bfwin->current_document->buffer,"diag_sel",&iter,TRUE); } else { dg->mark_ins = dg->mark_sel = NULL; } } /* dg->range.pos = -1; dg->range.end = -1; */ if (main_v->props.view_bars & MODE_MAKE_LATEX_TRANSIENT) { /* must be set before realizing */ DEBUG_MSG("html_diag_finish, setting dg->dialog=%p transient!\n", dg->dialog); gtk_window_set_transient_for(GTK_WINDOW(dg->dialog), GTK_WINDOW(bfwin->main_window)); } gtk_widget_realize(dg->dialog); dg->bfwin = bfwin; dg->doc = bfwin->current_document; return dg; } GtkWidget *html_diag_table_in_vbox(Thtml_diag *dg, gint rows, gint cols) { GtkWidget *returnwidget = gtk_table_new(rows, cols, FALSE); gtk_table_set_row_spacings(GTK_TABLE(returnwidget), 12); gtk_table_set_col_spacings(GTK_TABLE(returnwidget), 12); gtk_box_pack_start(GTK_BOX(dg->vbox), returnwidget, FALSE, FALSE, 0); return returnwidget; } void html_diag_finish(Thtml_diag *dg, GtkSignalFunc ok_func) { GtkWidget *hbox; gtk_box_pack_start(GTK_BOX(dg->vbox), gtk_hseparator_new(), FALSE, FALSE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); dg->obut = bf_stock_ok_button(ok_func, dg); dg->cbut = bf_stock_cancel_button(G_CALLBACK(html_diag_cancel_clicked_cb), dg); gtk_box_pack_start(GTK_BOX(hbox),dg->cbut , FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox),dg->obut , FALSE, FALSE, 0); gtk_window_set_default(GTK_WINDOW(dg->dialog), dg->obut); gtk_box_pack_start(GTK_BOX(dg->vbox), hbox, FALSE, FALSE, 0); gtk_widget_show_all(GTK_WIDGET(dg->dialog)); } /*************************************************/ /********** HTML -> DIALOG FUNCTIONS *************/ /*************************************************/ /* TODO: removed this function */ void fill_dialogvalues(gchar *dialogitems[], gchar *dialogvalues[], gchar **custom, Ttagpopup *data, Thtml_diag *diag) { gint count=0; while (dialogitems[count]) { dialogvalues[count] = NULL; count++; } } GList *add_entry_to_stringlist(GList *which_list, GtkWidget *entry) { if (entry) { gchar *temp = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); which_list = add_to_stringlist(which_list, temp); g_free(temp); } return which_list; } /* END OF FILE */ winefish-1.3.3/src/outputbox_ka.h0000600000047200004720000000072710366105730016023 0ustar kyanhkyanh/* $Id: outputbox_ka.h 1663 2006-01-26 08:44:08Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish) * Copyright (C) 2006 kyanh */ #ifndef __OUTPUTBOX_KA_H_ #define __OUTPUTBOX_KA_H_ #include "outputbox_cfg.h" #ifdef __KA_BACKEND__ #include /* wait(), waitid() */ void run_command( Toutputbox *ob ); void finish_execute( Toutputbox *ob ); sig_atomic_t child_exit_status; #endif /* __KA_BACKEND__ */ #endif /* __OUTPUTBOX_KA_H_ */ winefish-1.3.3/src/msg_queue.c0000600000047200004720000004612110375350210015255 0ustar kyanhkyanh/* $Id: msg_queue.c 1984 2006-02-17 13:32:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * msg_queue.c - message queue handling * * Copyright (C) 2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include /* #define DEBUG */ #include "bluefish.h" #ifdef WITH_MSG_QUEUE #include #include /* msgsnd() */ #include /* msgsnd() */ #include #include /* errno */ #include /* getpid, getuid */ #include /* strncpy */ #include /* exit() */ #include "stringlist.h" #include "gtk_easy.h" /* *_dialog */ #include "gui.h" /* notebook_changed() */ #include "document.h" #include "project.h" #define BLUEFISH_MSG_QUEUE 9723475 #define MSQ_QUEUE_SIZE 1024 #define MSQ_QUEUE_SMALL_SIZE 7 #define MSQ_QUEUE_CHECK_TIME 300 /* miliseconds for gtk_timeout*/ /* send alive must have the highest number, because it is the only type that * should not be read by the master process. The sending processes reads this * to check if the queue is alive */ #define MSG_QUEUE_SEND_ALIVE 46064 #define MSG_QUEUE_OPENFILE 46063 #define MSG_QUEUE_OPENPROJECT 46062 #define MSG_QUEUE_OPENNEWWIN 46061 #define MSG_QUEUE_SETLINE 46060 /* from man msgrcv: 'the first message on the queue with the lowest type less * than or equal to the absolute value of msgtyp will be read' * that means the requestalive should have the lowest number, because * it has the highest priority */ #define MSG_QUEUE_ASK_ALIVE 46009 #define MSG_QUEUE_PER_DOCUMENT_TIMEOUT 20000000 /* nanoseconds */ /* the message queue system is quite easy: if there is no queue --> open it and start listening on a MSG_QUEUE_OPENFILE, open the file, on a MSG_QUEUE_ASK_ALIVE return the same data with type MSG_QUEUE_SEND_ALIVE (which we are not listening for) if there is a queue and there are files loaded on the commandline --> check the server (send a keepalive containing the pid) and send the files to the queue, after sending the files check if a MSG_QUEUE_SEND_ALIVE is received contaning the pid. If so, there is a server and we can quit. If not, we continue starting and load them if there is a queue and we do not have files loaded on the commandline we just start, but we don't listen to the queue! */ typedef struct { gboolean functional; gboolean server; int msgid; GList *file_error_list; gint linenumber; } Tmsg_queue; /******************************/ /* global var for this module */ /******************************/ Tmsg_queue msg_queue = { TRUE, FALSE, -1, NULL, -1}; /** * msg_queue_check_alive: * * checks the message queue for messages of type MSG_QUEUE_SEND_ALIVE * if we receive such a message, there must be another process * active on this message queue */ static gboolean msg_queue_check_alive(gboolean wait_first) { struct small_msgbuf { long mtype; char mtext[MSQ_QUEUE_SMALL_SIZE]; } small_msgp; gchar *pid_string = g_strdup_printf("%d", (int) getpid()); if (wait_first) { static struct timespec const req = { 0, MSQ_QUEUE_CHECK_TIME * 1000000}; static struct timespec rem; nanosleep(&req, &rem); } while (msgrcv (msg_queue.msgid, &small_msgp, MSQ_QUEUE_SMALL_SIZE * sizeof(char), MSG_QUEUE_SEND_ALIVE, IPC_NOWAIT) != -1) { DEBUG_MSG("msg_queue_check_alive, received a keepalive, mtext=%s!\n", small_msgp.mtext); if (strncmp(pid_string, small_msgp.mtext, MSQ_QUEUE_SMALL_SIZE - 1) == 0) { DEBUG_MSG("msg_queue_check_alive, keepalive matches request!\n"); /* we did receive a keepalive on our request !! */ g_free(pid_string); return TRUE; } else { DEBUG_MSG("msg_queue_check_alive, keepalive does NOT match request %s\n", pid_string); } } DEBUG_MSG("msg_queue_check_alive, errno=%d, error=%s\n", errno, g_strerror(errno)); g_free(pid_string); return FALSE; } /** * msg_queue_open: * * returns 1 if another process has the queue open already * returns 0 if we opened the queue */ static gboolean msg_queue_open(void) { DEBUG_MSG("msg_queue_open, started\n"); msg_queue.msgid = msgget((key_t) BLUEFISH_MSG_QUEUE + getuid(), 0666 | IPC_CREAT | IPC_EXCL); #ifdef DEBUG if (msg_queue.msgid == -1) { DEBUG_MSG("msg_queue_open, errno=%d, error=%s\n", errno, g_strerror(errno)); } #endif /* if msg_queue.msgid == -1 the message queue was already opened by another process */ DEBUG_MSG("msg_queue_open, msg_queue.msgid=%d\n", msg_queue.msgid); if (msg_queue.msgid == -1) { msg_queue.msgid = msgget((key_t) BLUEFISH_MSG_QUEUE + getuid(), 0666); DEBUG_MSG("msg_queue_open, connected to existing message queue, id=%d\n", msg_queue.msgid); /* now we want to avoid the situation where the message queue is full (because the server died) so we cannot send a keepalive, so we check if the queue is filled (assume when there are >5 messages) and the last completed msgrcv() call was > 5 seconds ago */ { struct msqid_ds msg_stat; gint timediff; /* check if there are messages on the queue, if so, check when the last msgrcv() call was on this queue */ msgctl(msg_queue.msgid, IPC_STAT, &msg_stat); if (msg_stat.msg_qnum > 5) { timediff = time(NULL) - msg_stat.msg_ctime; if (timediff > 2) { DEBUG_MSG("msg_queue_request_alive, more then 2 seconds no reads on message_queue, timediff=%d, deleting queue\n", timediff); msgctl(msg_queue.msgid, IPC_RMID, NULL); msg_queue.msgid = msgget((key_t) BLUEFISH_MSG_QUEUE + getuid(), 0666 | IPC_CREAT | IPC_EXCL); return FALSE; } } } if (msg_queue.msgid == -1) { DEBUG_MSG("msg_queue_open, errno=%d, error=%s\n", errno, g_strerror(errno)); msg_queue.functional = FALSE; } return TRUE; } return FALSE; } /** * msg_queue_check: * * checks the queue for any messages * this is called by the master program, usually by gtk_timeout_add() * the messages it will listen to are the types: * - MSG_QUEUE_ASK_ALIVE - we should respond with a type MSG_QUEUE_SEND_ALIVE * - MSG_QUEUE_OPENFILE - open a filename * - MSG_QUEUE_OPENPROJECT - open a filename as project * - MSG_QUEUE_OPENNEWWIN - open a new window */ static gboolean msg_queue_check(gint started_by_gtk_timeout) { struct msgbuf { long mtype; char mtext[MSQ_QUEUE_SIZE]; } msgp; gint retval; if (main_v->bfwinlist == NULL || BFWIN(main_v->bfwinlist->data)->documentlist == NULL) { DEBUG_MSG("msg_queue_check, no documentlist yet, so we do not continue\n"); return TRUE; } if (msg_queue.msgid == -1) { return FALSE; } retval = msgrcv(msg_queue.msgid, &msgp, MSQ_QUEUE_SIZE, -MSG_QUEUE_OPENFILE, IPC_NOWAIT); if (retval != -1) { DEBUG_MSG("msg_queue_check, found type %ld\n", msgp.mtype); if (msgp.mtype == MSG_QUEUE_ASK_ALIVE) { struct small_msgbuf { long mtype; char mtext[MSQ_QUEUE_SMALL_SIZE]; } small_msgp; DEBUG_MSG("msg_queue_check, a keepalive is asked from %s, sending!\n", msgp.mtext); small_msgp.mtype = MSG_QUEUE_SEND_ALIVE; strncpy(small_msgp.mtext, msgp.mtext, MSQ_QUEUE_SMALL_SIZE - 1); msgsnd(msg_queue.msgid, (void *) &small_msgp, MSQ_QUEUE_SMALL_SIZE * sizeof(char), IPC_NOWAIT); } else if (msgp.mtype == MSG_QUEUE_OPENFILE) { GList *lastlist = g_list_last(main_v->bfwinlist); DEBUG_MSG("msg_queue_check, a filename %s is received\n", msgp.mtext); Tdocument *tmpdoc = doc_new_with_file(BFWIN(lastlist->data),msgp.mtext, FALSE, TRUE); if (!tmpdoc) { msg_queue.file_error_list = g_list_append(msg_queue.file_error_list, g_strdup(msgp.mtext)); } else if (msg_queue.linenumber >=0) { doc_activate( tmpdoc ); doc_select_line( tmpdoc, msg_queue.linenumber, TRUE ); gtk_widget_grab_focus( GTK_WIDGET( tmpdoc->view ) ); } msg_queue_check(0); /* call myself again, there may have been multiple files */ if (started_by_gtk_timeout) { if (msg_queue.file_error_list) { gchar *message, *tmp; tmp = stringlist_to_string(msg_queue.file_error_list, "\n"); free_stringlist(msg_queue.file_error_list); msg_queue.file_error_list = NULL; message = g_strconcat(_("These files were not opened:\n"), tmp, NULL); g_free(tmp); warning_dialog(BFWIN(main_v->bfwinlist->data)->main_window,_("Unable to open file(s)\n"), message); g_free(message); } /* gtk_notebook_set_page(GTK_NOTEBOOK(main_v->notebook),g_list_length(main_v->documentlist) - 1); notebook_changed(-1);*/ } } else if (msgp.mtype == MSG_QUEUE_OPENPROJECT) { GList *lastlist = g_list_last(main_v->bfwinlist); DEBUG_MSG("msg_queue_check, a project %s is received\n", msgp.mtext); project_open_from_file(BFWIN(lastlist->data), msgp.mtext, msg_queue.linenumber); msg_queue_check(0); /* call myself again, there may have been multiple projects */ } else if (msgp.mtype == MSG_QUEUE_OPENNEWWIN) { /* now check if this is indeed send by another process if the message queue was dead during the startup of this process, it might be started by this very process */ int otherpid = atoi(msgp.mtext); DEBUG_MSG("msg_queue_check, a new window is requested by PID=%d\n",otherpid); if (otherpid != (int) getpid()) { DEBUG_MSG("msg_queue_check, the PID is not ours, opening new window\n"); gui_new_window(NULL, NULL); } } else if (msgp.mtype == MSG_QUEUE_SETLINE) { msg_queue.linenumber = strtoul(msgp.mtext, NULL,10); } #ifdef DEBUG else { DEBUG_MSG("msg_queue_check, unknown message queue type %ld\n", msgp.mtype); } #endif } else { #ifdef MSG_QUEUE_DEBUG DEBUG_MSG("msg_queue_check, found errno(%d)=%s\n", errno, g_strerror(errno)); #endif /* 43 = Identifier removed */ if (errno == 22 || errno == 43) { DEBUG_MSG("msg_queue_check, re-opening message queue ?!?!?\n"); /* the msg_queue was removed !?!?! */ if (msg_queue_open()) { DEBUG_MSG("msg_queue_check, another process has opened the message_queue, stopping server\n"); msg_queue.server = FALSE; return FALSE; } } } return TRUE; } /** * msg_queue_send_names: * * * returns FALSE if we never received a keepalive, so the server process seems to be non-responsive */ static gboolean msg_queue_send_names(gint send_with_id, GList * names, gboolean received_keepalive) { struct msgbuf { long mtype; char mtext[MSQ_QUEUE_SIZE]; } msgp; gint success = 1, check_keepalive_cnt = 0, send_failure_cnt = 0; GList *tmplist; /* we have a message queue now, opened by another bluefish process */ msgp.mtype = send_with_id; tmplist = g_list_first(names); while (tmplist && success) { gint retval; gint len = strlen((gchar *) tmplist->data); /* we start with checking for keepalives */ if (!received_keepalive) { if (msg_queue_check_alive(TRUE)) { received_keepalive = TRUE; DEBUG_MSG("msg_queue_send_files, received keepalive\n"); } else { check_keepalive_cnt++; DEBUG_MSG("msg_queue_send_files, no keepalive (try %d)\n", check_keepalive_cnt); } } if (len < MSQ_QUEUE_SIZE - 1) { strncpy(msgp.mtext, (gchar *) tmplist->data, MSQ_QUEUE_SIZE - 1); retval = msgsnd(msg_queue.msgid, (void *) &msgp, MSQ_QUEUE_SIZE * sizeof(char), IPC_NOWAIT); if (retval == -1) { DEBUG_MSG("msg_queue_send_files, failed sending, errno=%d\n", errno); if (errno == EAGAIN) { /* EAGAIN = 11 */ static struct timespec const req = { 0, MSG_QUEUE_PER_DOCUMENT_TIMEOUT}; static struct timespec rem; nanosleep(&req, &rem); send_failure_cnt++; } else { DEBUG_MSG("msg_queue_send_files, failing to send, errno=%d, aborting\n", errno); success = 0; } } else { if (!received_keepalive) { /* if we fill the message queue with loads of data, the server process doesn't even get a chance of reply-ing. So as long as we don't know a thing about it, we give it some time and check for a reply often */ if (msg_queue_check_alive(TRUE)) { received_keepalive = TRUE; DEBUG_MSG("msg_queue_send_files, received keepalive\n"); } else { check_keepalive_cnt++; DEBUG_MSG("msg_queue_send_files, no keepalive (try %d)\n", check_keepalive_cnt); } } DEBUG_MSG("msg_queue_send_files, sending %s succeeded\n", (gchar *) tmplist->data); send_failure_cnt = 0; tmplist = g_list_next(tmplist); } } else { DEBUG_MSG("msg_queue_send_files, failed sending, length increased message size\n"); success = 0; } if ((check_keepalive_cnt > 5) || (send_failure_cnt > 60)) { DEBUG_MSG ("msg_queue_send_files, to many tries, check_keepalive_cnt=%d, send_failure_cnt=%d\n", check_keepalive_cnt, send_failure_cnt); success = 0; } } if (success) { DEBUG_MSG ("msg_queue_send_files, sending filenames complete and successfull, received_keepalive=%d\n", received_keepalive); /* / * all filenames send to other process, test if it is alive * / if (received_keepalive) { exit(0); } else { / * the other process should have enough time to check the queue * / / * the macro is in milliseconds, usleep is microseconds * / if (msg_queue_check_alive(TRUE)) { / * we did receive a keep alive message! * / exit(0); } }*/ return received_keepalive; } return FALSE; } static gboolean msg_queue_send_files(GList * filenames, gboolean received_keepalive) { return msg_queue_send_names(MSG_QUEUE_OPENFILE, filenames, received_keepalive); } static gboolean msg_queue_send_projects(GList * filenames, gboolean received_keepalive) { return msg_queue_send_names(MSG_QUEUE_OPENPROJECT, filenames, received_keepalive); } /** * msg_queue_request_alive: * * sends a message of type MSG_QUEUE_ASK_ALIVE to the already existing queue * to check if the queue is alive */ static void msg_queue_request_alive(void) { gboolean ask_alive; struct small_msgbuf { long mtype; char mtext[MSQ_QUEUE_SMALL_SIZE]; } small_msgp; gchar *pid_string = g_strdup_printf("%d", (int) getpid()); DEBUG_MSG("msg_queue_request_alive, asking for keepalive, string %s\n", pid_string); small_msgp.mtype = MSG_QUEUE_ASK_ALIVE; strncpy(small_msgp.mtext, pid_string, MSQ_QUEUE_SMALL_SIZE - 1); ask_alive = msgsnd(msg_queue.msgid, (void *) &small_msgp, MSQ_QUEUE_SMALL_SIZE * sizeof(char), IPC_NOWAIT); g_free(pid_string); if (ask_alive == -1) { if (errno == 11) { /* the resource is temporary unavailable - perhaps the queue is full, this could mean a very busy message queue or a dead server */ struct msqid_ds msg_stat; gint timediff; /* check the last time a process listened to the queue */ msgctl(msg_queue.msgid, IPC_STAT, &msg_stat); timediff = time(NULL) - msg_stat.msg_rtime; if (timediff > 2) { DEBUG_MSG("msg_queue_request_alive, more then 2 seconds no reads on message_queue, timediff=%d, deleting queue\n", timediff); } } DEBUG_MSG("msg_queue_request_alive, errno=%d, error=%s\n", errno, g_strerror(errno)); msg_queue.functional = FALSE; } } static void msg_queue_send_new_window(void) { int retval; struct msgbuf { long mtype; char mtext[MSQ_QUEUE_SMALL_SIZE]; } small_msgp; /* perhaps we should first check if the queue is alive */ gchar *pid_string = g_strdup_printf("%d", (int) getpid()); DEBUG_MSG("msg_queue_send_new_window, requesting new window using our PID %s!\n",pid_string); small_msgp.mtype = MSG_QUEUE_OPENNEWWIN; strncpy(small_msgp.mtext, pid_string, MSQ_QUEUE_SMALL_SIZE - 1); retval = msgsnd(msg_queue.msgid,(void *) &small_msgp, MSQ_QUEUE_SMALL_SIZE * sizeof(char),IPC_NOWAIT); /* if (retval == -1) */ /* hmm an error, we have to do some error handling here */ } static void msg_queue_send_line_number(gint linenumber) { int retval; struct msgbuf { long mtype; char mtext[MSQ_QUEUE_SMALL_SIZE]; } small_msgp; /* perhaps we should first check if the queue is alive */ gchar *linestr = g_strdup_printf("%d", linenumber); DEBUG_MSG("msg_queue_send_line_number, requesting line number = %s!\n",linestr); small_msgp.mtype = MSG_QUEUE_SETLINE; strncpy(small_msgp.mtext, linestr, MSQ_QUEUE_SMALL_SIZE - 1); retval = msgsnd(msg_queue.msgid,(void *) &small_msgp, MSQ_QUEUE_SMALL_SIZE * sizeof(char),IPC_NOWAIT); } /* static struct timespec const req = { 0, 200000000}; static struct timespec rem; nanosleep(&req, &rem); */ void msg_queue_start(GList * filenames, GList *projectfiles, gint linenumber, gboolean open_new_window) { gboolean received_keepalive = FALSE; gboolean queue_already_open; DEBUG_MSG("msg_queue_start, open message queue\n"); queue_already_open = msg_queue_open(); if (queue_already_open && msg_queue.functional) { msg_queue_request_alive(); if (linenumber < 0) { linenumber = -1; } msg_queue_send_line_number(linenumber); if (open_new_window) { msg_queue_send_new_window(); } /* if we have filenames to open, we start sending them now, else we just check if we have to be master or not */ if (filenames || projectfiles) { if (filenames) { received_keepalive = msg_queue_send_files(filenames, received_keepalive); } if (projectfiles) { received_keepalive = msg_queue_send_projects(projectfiles, received_keepalive); } DEBUG_MSG("msg_queue_start, after sending files and projects, keepalive=%d\n",received_keepalive); } if (!received_keepalive) { gint check_keepalive_cnt = 0; /* if the message queue is still open and the process listening is killed we should be the server process --> we have to check if the process is still running */ while (!received_keepalive && check_keepalive_cnt < 10) { DEBUG_MSG("msg_queue_start, no keepalive yet, check_keepalive_cnt=%d\n", check_keepalive_cnt); if (msg_queue_check_alive(TRUE)) { received_keepalive = TRUE; } check_keepalive_cnt++; } if ((filenames || projectfiles || open_new_window) && received_keepalive) { DEBUG_MSG("msg_queue_start, we did send all our messages to an active queue, exiting!\n"); exit(0); } } else { DEBUG_MSG("msg_queue_start, we did send all our messages to an active queue, exiting!\n"); exit(0); } } /* if (queue_already_open) */ /* if we opened the queue, or we did not get a keepalive */ if (msg_queue.functional && (!queue_already_open || (queue_already_open && !received_keepalive))) { msg_queue.server = TRUE; DEBUG_MSG ("msg_queue_start, we opened the queue, or we didn't get a keepalive, we will be server!\n"); gtk_timeout_add(MSQ_QUEUE_CHECK_TIME, (GtkFunction)msg_queue_check, GINT_TO_POINTER(1)); } else { DEBUG_MSG("msg_queue_start, we didn't open the queue, and we received a keepalive, further ignoring the mssage queue\n"); } } void msg_queue_cleanup(void) { if (msg_queue.functional && msg_queue.server) { DEBUG_MSG("msg_queue_cleanup, removing msg_queue()\n"); msgctl(msg_queue.msgid, IPC_RMID, NULL); } } #endif /* WITH_MSG_QUEUE */ winefish-1.3.3/src/html_diag.h0000600000047200004720000000731510373411041015220 0ustar kyanhkyanh/* $Id: html_diag.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * html_diag.h - general functions to create HTML dialogs * * Copyright (C) 2000-2003 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __HTML_DIAG_H_ #define __HTML_DIAG_H_ typedef struct { gchar *item; gchar *value; } Ttagitem; typedef struct { GList *taglist; gint pos; gint end; } Ttagpopup; typedef struct { gint pos; gint end; } Treplacerange; /* the frame wizard uses dynamic widgets, this value should be lower then (number of combo's)/2 or lower then (number of clist's) else the dialog will segfault */ #define MAX_FRAMES_IN_FRAMEWIZARD 5 #include "bluefish.h" typedef struct { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *obut; GtkWidget *cbut; GtkWidget *entry[20]; GtkWidget *combo[11]; GtkWidget *radio[14]; GtkWidget *spin[8]; GtkWidget *check[8]; GtkWidget *clist[4]; GtkWidget *text[1]; /* kyanh, unused, 20050225, GtkWidget *attrwidget[20]; */ /* all attribute widgets should go in here */ /* Treplacerange range; */ /* cross buffer modification */ GtkTextMark *mark_ins; GtkTextMark *mark_sel; /* kyanh, removed, 20050224, Tphpvarins php_var_ins; GtkWidget *phpbutton; */ /* kyanh, removed, 20050225, gboolean tobedestroyed; */ /* this will be set to TRUE on destroy */ Tdocument *doc; Tbfwin *bfwin; } Thtml_diag; void html_diag_destroy_cb(GtkWidget * widget, Thtml_diag *dg); void html_diag_cancel_clicked_cb(GtkWidget *widget, gpointer data); Thtml_diag *html_diag_new(Tbfwin *bfwin,gchar *title); GtkWidget *html_diag_table_in_vbox(Thtml_diag *dg, gint rows, gint cols); void html_diag_finish(Thtml_diag *dg, GtkSignalFunc ok_func); /* kyanh, removed, 20050225, void parse_html_for_dialogvalues(gchar *dialogitems[], gchar *dialogvalues[] , gchar **custom, Ttagpopup *data); */ void fill_dialogvalues(gchar *dialogitems[], gchar *dialogvalues[] , gchar **custom, Ttagpopup *data, Thtml_diag *diag); /* kyanh, removed, 20050225 void parse_existence_for_dialog(gchar * valuestring, GtkWidget * checkbox); void parse_integer_for_dialog(gchar * valuestring, GtkWidget * spin, GtkWidget * entry, GtkWidget * checkbox); gchar *insert_string_if_entry(GtkWidget * entry, gchar * itemname, gchar * string2add2, gchar *defaultvalue); gchar *insert_integer_if_spin(GtkWidget * spin, gchar * itemname, gchar * string2add2, gboolean ispercentage, gint dontinsertonvalue); gchar *insert_attr_if_checkbox(GtkWidget * checkbox, gchar * itemname, gchar *string2add2); gchar *format_entry_into_string(GtkEntry * entry, gchar * formatstring); */ GList *add_entry_to_stringlist(GList *which_list, GtkWidget *entry); /* kyanh, removed, 20050225, GtkWidget *generic_table_inside_notebookframe(GtkWidget *notebook, const gchar *title, gint rows, gint cols); */ /* kyanh, removed, 20050220 void generic_class_id_style_section(Thtml_diag *dg, gint firstattrwidget, GtkWidget *table, gint firstrowintable, gchar **tagvalues, gint firsttagvalue); */ #endif /* __HTML_DIAG_H_ */ winefish-1.3.3/src/msg_queue.h0000600000047200004720000000027610373411041015261 0ustar kyanhkyanh/* $Id: msg_queue.h 1830 2006-02-11 16:34:41Z kyanh $ */ void msg_queue_start(GList * filenames, GList *projectfiles, gint linenumber, gboolean in_new_window); void msg_queue_cleanup(void); winefish-1.3.3/src/html.c0000600000047200004720000002277510373411041014236 0ustar kyanhkyanh/* $Id: html.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * html.c - menu/toolbar callbacks, inserting functions, and other cool stuff * * Copyright (C) * 1998 Olivier Sessink and Chris Mazuc * 1999-2002 Olivier Sessink * rewrite November 2000 (C) Olivier Sessink * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Changes by Antti-Juhani Kaijanaho on 1999-10-20 */ /*#define DEBUG*/ #include #include "bluefish.h" #include "html.h" /* myself */ #include "html_diag.h" /* the new html dialog stuff */ #include "bf_lib.h" /* bf_str_repeat() */ #include "document.h" /* doc_insert_two_strings() */ void general_html_menu_cb(Tbfwin* bfwin,guint callback_action, GtkWidget *widget) { switch (callback_action) { case 1: doc_insert_two_strings(bfwin->current_document, "\\textbf{", "}"); break; case 2: doc_insert_two_strings(bfwin->current_document, "\\textit{", "}"); break; case 3: doc_insert_two_strings(bfwin->current_document, "\\underline{", "}"); break; case 4: doc_insert_two_strings(bfwin->current_document, "{\\tiny ", "}"); break; case 5: doc_insert_two_strings(bfwin->current_document, "{\\scriptsize ", "}"); break; case 6: doc_insert_two_strings(bfwin->current_document, "{\\footnotesize ", "}"); break; case 7: doc_insert_two_strings(bfwin->current_document, "{\\small ", "}"); break; case 8: doc_insert_two_strings(bfwin->current_document, "{\\normalsize ", "}"); break; case 9: doc_insert_two_strings(bfwin->current_document, "{\\large ", "}"); break; case 10: doc_insert_two_strings(bfwin->current_document, "\\begin{center}\n", "\n\\end{center}"); break; case 11: doc_insert_two_strings(bfwin->current_document, "{\\Large ", "}"); break; case 12: doc_insert_two_strings(bfwin->current_document, "{\\huge ", "}"); break; case 13: doc_insert_two_strings(bfwin->current_document, "\\begin{verbatim}\n", "\n\\end{verbatim}"); break; case 14: doc_insert_two_strings(bfwin->current_document, "{\\Huge ", "}"); break; case 15: doc_insert_two_strings(bfwin->current_document, "\\begin{split}\n","\n\\end{split}"); break; case 16: doc_insert_two_strings(bfwin->current_document, "\\begin{cases}\n","\n\\end{cases}"); break; case 17: doc_insert_two_strings(bfwin->current_document, "\\emph{", "}"); break; case 18: doc_insert_two_strings(bfwin->current_document, "\\part{", "}\n"); break; case 19: doc_insert_two_strings(bfwin->current_document, "\\chapter{", "}\n"); break; case 20: doc_insert_two_strings(bfwin->current_document, "\\section{", "}\n"); break; case 21: doc_insert_two_strings(bfwin->current_document, "\\subsection{", "}\n"); break; case 22: doc_insert_two_strings(bfwin->current_document, "\\subsubsection{", "}\n"); break; case 23: doc_insert_two_strings(bfwin->current_document, "\\paragraph{", "}\n"); break; case 24: doc_insert_two_strings(bfwin->current_document, "\\begin{tabular}{", "}\n\n\\end{tabular}"); break; case 25: doc_insert_two_strings(bfwin->current_document, "\\begin{aligned}\n", "\n\\end{aligned}"); break; case 26: doc_insert_two_strings(bfwin->current_document, "\\begin{gathered}\n", "\n\\end{gathered}"); break; case 27: doc_insert_two_strings(bfwin->current_document, "\\begin{equation}\n", "\n\\end{equation}"); break; case 28: doc_insert_two_strings(bfwin->current_document, "\\begin{subequations}\n% \\renewcommand\\theequation{\\theparentequation \\roman{equation}}\n", "\n\\end{subequations}"); break; case 29: doc_insert_two_strings(bfwin->current_document, "\\begin{gather}\n", "\n\\end{gather}"); break; case 30: doc_insert_two_strings(bfwin->current_document, "\\begin{multline}\n", "\n\\end{multine}"); break; case 31: doc_insert_two_strings(bfwin->current_document, "\\begin{align}\n", "\n\\end{align}"); break; /* case 32: doc_insert_two_strings(bfwin->current_document, "\\begin{flalign}\n", "\n\\end{flalign}"); break; */ case 33: doc_insert_two_strings(bfwin->current_document, "\\begin{itemize}\n\\item", "\n\\item\n\\end{itemize}"); break; case 34: doc_insert_two_strings(bfwin->current_document, "\\begin{enumerate}\n\\item", "\n\\item\n\\end{enumerate}"); break; case 35: doc_insert_two_strings(bfwin->current_document, "\\item\n", ""); break; case 36: doc_insert_two_strings(bfwin->current_document, "\\item[", "]\n"); break; case 37: doc_insert_two_strings(bfwin->current_document, "\\begin{alignat}{", "}\n\n\\end{alignat}"); break; case 38: doc_insert_two_strings(bfwin->current_document, "\\begin{equation*}\n", "\n\\end{equation*}"); break; case 39: doc_insert_two_strings(bfwin->current_document, "\\begin{gather*}\n", "\n\\end{gather*}"); break; case 40: doc_insert_two_strings(bfwin->current_document, "\\begin{multline*}\n", "\n\\end{multline*}"); break; case 41: doc_insert_two_strings(bfwin->current_document, "\\begin{align*}\n", "\n\\end{align*}"); break; /* case 42: doc_insert_two_strings(bfwin->current_document, "\\begin{flalign*}\n", "\n\\end{flalign*}"); break; */ case 43: doc_insert_two_strings(bfwin->current_document, "\\begin{alignat*}{", "}\n\n\\end{alignat*}"); break; case 48: doc_insert_two_strings(bfwin->current_document, "\\begin{verse}\n", "\n\\end{verse}"); break; case 49: doc_insert_two_strings(bfwin->current_document, "\\begin{quote}\n", "\n\\end{quote}"); break; case 50: doc_insert_two_strings(bfwin->current_document, "\\begin{flushleft}\n", "\n\\end{flushleft}"); break; case 51: doc_insert_two_strings(bfwin->current_document, "\\begin{flushright}\n", "\n\\end{flushright}"); break; case 52: doc_insert_two_strings(bfwin->current_document, "\\begin{verbatim*}\n", "\n\\end{verbatim*}"); break; case 100: doc_insert_two_strings(bfwin->current_document, "\\subparagraph{", "}\n"); break; case 102: doc_insert_two_strings(bfwin->current_document, "\\begin{longtable}{", "}\n\n\\end{longtable}"); break; case 103: doc_insert_two_strings(bfwin->current_document, "\\begin{description}\n\\item[", "]\n\\item[]\n\\end{description}"); break; case 104: doc_insert_two_strings(bfwin->current_document, "\\begin{enumerate}[", "]\n\\item\n\\item\n\\end{enumerate}"); break; case 105: { gchar *tmpstr = g_strconcat("% ",bf_str_repeat("=",69),"\n",NULL); doc_insert_two_strings(bfwin->current_document, tmpstr, NULL); g_free(tmpstr); } break; case 108: doc_insert_two_strings(bfwin->current_document, "\\textsl{","}"); break; case 110: doc_insert_two_strings(bfwin->current_document, "\\texttt{","}"); break; case 111: doc_insert_two_strings(bfwin->current_document, "\\textsc{","}"); break; case 112: doc_insert_two_strings(bfwin->current_document, "\\part*{", "}\n\\addcontentsline{toc}{part}{}\n"); break; case 113: doc_insert_two_strings(bfwin->current_document, "\\chapter*{", "}\n\\addcontentsline{toc}{chapter}{}"); break; case 114: doc_insert_two_strings(bfwin->current_document, "\\section*{", "}\n\\addcontentsline{toc}{section}{}"); break; case 115: doc_insert_two_strings(bfwin->current_document, "\\subsection*{", "}\n\\addcontentsline{toc}{subsection}{}"); break; case 116: doc_insert_two_strings(bfwin->current_document, "\\subsubsection*{", "}\n\\addcontentsline{toc}{subsubsection}{}"); break; /* case 117: doc_insert_two_strings(bfwin->current_document, "\\mathrm{","}"); break; case 118: doc_insert_two_strings(bfwin->current_document, "\\mathit{","}"); break; case 119: doc_insert_two_strings(bfwin->current_document, "\\mathbf{","}"); break; case 120: doc_insert_two_strings(bfwin->current_document, "\\mathsf{","}"); break; case 121: doc_insert_two_strings(bfwin->current_document, "\\mathtt{","}"); break; case 122: doc_insert_two_strings(bfwin->current_document, "\\mathcal{","}"); break; case 123: doc_insert_two_strings(bfwin->current_document, "\\mathbb{","}"); break; case 124: doc_insert_two_strings(bfwin->current_document, "\\mathfrak{","}"); break; */ /* case 125: doc_insert_two_strings(bfwin->current_document, "\\thinspace ",""); break; case 126: doc_insert_two_strings(bfwin->current_document, "\\medspace ",""); break; case 127: doc_insert_two_strings(bfwin->current_document, "\\thickspace ",""); break; case 128: doc_insert_two_strings(bfwin->current_document, "\\quad ",""); break; case 129: doc_insert_two_strings(bfwin->current_document, "\\quadquad ",""); break; case 130: doc_insert_two_strings(bfwin->current_document, "\\negthinspace ",""); break; case 131: doc_insert_two_strings(bfwin->current_document, "\\negmedspace ",""); break; case 132: doc_insert_two_strings(bfwin->current_document, "\\negthickspace ",""); break; */ default: break; } } /************************************************************************/ /* END OF FILE */ winefish-1.3.3/src/bookmark.c0000600000047200004720000014323510373411041015072 0ustar kyanhkyanh/* $Id: bookmark.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) - bookmarks * * Copyright (C) 2003 Oskar Swida * modifications (C) 2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include #include #include #include #include #include #include "bluefish.h" #include "gtk_easy.h" #include "gui.h" #include "document.h" #include "stringlist.h" #include "bookmark.h" /* bookmarks will be loaded and saved to an arraylist (see stringlist.c). This is a double linked list (GList *) with pointers to string arrays (gchar **). To have the GUI work with them, we convert those arrays (gchar **) into a Tbmark struct. This struct will ahve a pointer to the array (gchar **) so on change it can directly change the array as well, without any need to look it up in the list. For the GUI, we store everything in a Gtktreestore. The treestore will have a pointer to a string with the name, and it will also have a pointer to the Tbmark. When the user clicks in the Gtktreeview widget, we can get immediately a pointer to the Tbmark, and that has the Gtktextmark, so that is very easy, and very fast! But now we have one problem: all normal windows do share the same bookmarks list. So it is probably the most logical to have them store the same Gtktreestore as well. The best way is to have the project functions create/destroy the gtktreestore when they convert a window (Tbfwin) into a project window. */ #define BMARK_SHOW_NUM_TEXT_CHARS 20 enum { NAME_COLUMN, /* bookmark name */ PTR_COLUMN, /* bookmark pointer */ N_COLUMNS }; enum { BMARK_ADD_PERM_DIALOG, BMARK_RENAME_TEMP_DIALOG, BMARK_RENAME_PERM_DIALOG }; typedef struct { GtkTextMark *mark; gchar *filepath; gint offset; Tdocument *doc; GtkTreeIter iter; /* for tree view */ gchar *description; gchar *text; gchar *name; gint len; /* file length for integrity check - perhaps some hash code is needed */ gboolean is_temp; gchar **strarr; /* this is a pointer to the location where this bookmark is stored in the sessionlist, so we can immediately change it _in_ the list */ } Tbmark; #define BMARK(var) ((Tbmark *)(var)) typedef struct { Tdocument *bevent_doc; /* last button event document */ gint bevent_charoffset; /* last button event location */ } Tbmarkdata; #define BMARKDATA(var) ((Tbmarkdata *)(var)) #define BM_FMODE_FULL 0 #define BM_FMODE_HOME 1 #define BM_FMODE_FILE 2 static gchar *bmark_display_text(gchar *name, gchar *text) { if (name && strlen(name) > 0) { return g_strconcat(name, " - ", text,NULL); } return g_strdup(text); } /* Free bookmark structure */ static void bmark_free(gpointer ptr) { Tbmark *m; if (ptr == NULL) return; m = BMARK(ptr); if (m->doc && m->mark) { DEBUG_MSG("bmark_free, deleting mark %p\n",m->mark); gtk_text_buffer_delete_mark(m->doc->buffer, m->mark); m->doc = NULL; } #ifdef DEBUG if (m->strarr) { DEBUG_MSG("bmark_free, NOT GOOD, strarr should be NULL here...\n"); } #endif g_free(m->filepath); g_free(m->text); g_free(m->name); g_free(m->description); g_free(m); } static void bmark_update_offset_from_textmark(Tbmark *b) { if (b->doc && b->mark) { GtkTextIter it; gtk_text_buffer_get_iter_at_mark(b->doc->buffer, &it, b->mark); b->offset = gtk_text_iter_get_offset(&it); } } /* * this function should use a smart sorting algorithm to find * the GtkTreeIter of the bookmark *before* the place where this * bookmark should be added, but the same function can be used to * find the bookmarks we have to check to detect double bookmarks * at the same line. * * returns the bookmark closest before 'offset', or the bookmark exactly at 'offset' * * returns NULL if we have to append this as first child to the parent * */ static Tbmark *bmark_find_bookmark_before_offset(Tbfwin *bfwin, guint offset, GtkTreeIter *parent) { gint jumpsize, num_children, child; GtkTreeIter iter; num_children = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(bfwin->bookmarkstore), parent); if (num_children == 0) { return NULL; } if (num_children == 1) { gint compare; Tbmark *b; gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(bfwin->bookmarkstore), &iter, parent, 0); gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore),&iter,PTR_COLUMN,&b, -1); bmark_update_offset_from_textmark(b); DEBUG_MSG("bmark_find_bookmark_before_offset, num_children=%d\n",num_children); compare = (offset - b->offset); if (compare <= 0) { return NULL; } else { return b; } } jumpsize = (num_children+2)/2; child = num_children + 1 - jumpsize; DEBUG_MSG("bmark_find_bookmark_before_offset, num_children=%d,jumpsize=%d,child=%d\n",num_children,jumpsize,child); while (jumpsize > 0) { gint compare; Tbmark *b; if (child > num_children) child = num_children; if (child < 1) child = 1; /* we request child-1, NOT child*/ gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(bfwin->bookmarkstore), &iter, parent, child-1); gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore),&iter,PTR_COLUMN,&b, -1); bmark_update_offset_from_textmark(b); compare = (offset - b->offset); DEBUG_MSG("in_loop: jumpsize=%2d, child=%2d, child offset=%3d, compare=%3d\n",jumpsize,child,b->offset,compare); if (compare == 0) { return b; } else if (compare < 0) { jumpsize = (jumpsize > 3) ? (jumpsize+1)/2 : jumpsize-1; if (jumpsize <= 0) { child--; /* we request child-1, NOT child*/ if (child >= 1 && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(bfwin->bookmarkstore), &iter, parent, child-1)) { gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore),&iter,PTR_COLUMN,&b, -1); bmark_update_offset_from_textmark(b); DEBUG_MSG("in_loop: returning bookmark (offset %d) for previous child %d\n",b->offset, child); return b; } else{ DEBUG_MSG("in_loop: no previous child, return NULL\n"); return NULL; } } child = child - jumpsize; } else { /* compare > 0 */ jumpsize = (jumpsize > 3) ? (jumpsize+1)/2 : jumpsize-1; if (jumpsize <= 0) { DEBUG_MSG("in_loop: return bookmark (offset %d) from child %d\n",b->offset, child); return b; } child = child + jumpsize; } } DEBUG_MSG("bmark_find_bookmark_before_offset, end-of-function, return NULL\n"); return NULL; } /* this function re-uses the b->strarr if possible, otherwise it will create a new one and append it to the list */ static void bmark_store(Tbfwin * bfwin, Tbmark * b) { gchar **strarr; if (b->is_temp) { DEBUG_MSG("bmark_store, called for temp bookmark %p ?!?! weird!!!! returning\n", b); return; } /* if there is a strarr already, we only update the fields, else we append a new one */ if (b->strarr == NULL) { DEBUG_MSG("bmark_store, creating new strarr for bookmark %p\n",b); strarr = g_malloc0(sizeof(gchar *) * 7); DEBUG_MSG("name=%s, description=%s, filepath=%s, text=%s\n", b->name, b->description, b->filepath, b->text); strarr[2] = g_strdup(b->filepath); strarr[4] = g_strdup(b->text); } else { DEBUG_MSG("bmark_store, bookmark %p has strarr at %p\n",b,b->strarr); strarr = b->strarr; /* free the ones we are going to update */ g_free(strarr[0]); g_free(strarr[1]); g_free(strarr[3]); g_free(strarr[5]); } strarr[0] = g_strdup(b->name); strarr[1] = g_strdup(b->description); if (b->doc) b->len = b->doc->statbuf.st_size; strarr[3] = g_strdup_printf("%d", b->offset); DEBUG_MSG("bmark_store, offset string=%s, offset int=%d\n",strarr[3],b->offset); strarr[5] = g_strdup_printf("%d", b->len); DEBUG_MSG("bmark_store, arracount=%d\n",count_array(strarr)); if (b->strarr == NULL) { bfwin->session->bmarks = g_list_append(bfwin->session->bmarks, strarr); DEBUG_MSG("added new (previously unstored) bookmark to session list, list length=%d\n", g_list_length(bfwin->session->bmarks)); b->strarr = strarr; } } /* when a users want to save the project, it's good to have updated bookmarks so this function will update all arrays (strarr**) */ void bmark_store_all(Tbfwin *bfwin) { /* we loop over all filename iters, and only for the ones that are opened we loop over the children (the ones that are not open cannot be changed) */ GtkTreeIter fileit; gboolean cont; cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &fileit,NULL); while (cont) { Tdocument *doc = NULL; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &fileit, PTR_COLUMN,&doc, -1); if (doc) { /* the document is open, so the offsets could be changed, store all permanent */ GtkTreeIter bmit; gboolean cont2 = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &bmit,&fileit); DEBUG_MSG("bmark_store_all, storing bookmarks for %s\n",doc->filename); while (cont2) { Tbmark *bmark; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &bmit, PTR_COLUMN,&bmark, -1); if (!bmark->is_temp) { bmark_update_offset_from_textmark(bmark); bmark_store(bfwin, bmark); } cont2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &bmit); } } else { DEBUG_MSG("doc not set, so not open...\n"); } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(bfwin)->bookmarkstore), &fileit); } /* cont */ } /* removes the bookmark from the session, removed the b->strarr pointer and frees it */ static void bmark_unstore(Tbfwin * bfwin, Tbmark * b) { if (bfwin->session->bmarks == NULL || b->strarr == NULL) return; DEBUG_MSG("bmark_remove, removing bookmark %p from sessionlist\n",b); bfwin->session->bmarks = g_list_remove(bfwin->session->bmarks, b->strarr); g_strfreev(b->strarr); b->strarr = NULL; } /* get value from pointer column */ static gpointer get_current_bmark(Tbfwin * bfwin) { if (bfwin->bmark) { GtkTreePath *path; GtkTreeViewColumn *col; gtk_tree_view_get_cursor(bfwin->bmark, &path, &col); if (path != NULL) { gpointer retval = NULL; GtkTreeIter iter; gtk_tree_model_get_iter(gtk_tree_view_get_model(bfwin->bmark), &iter, path); gtk_tree_model_get(gtk_tree_view_get_model(bfwin->bmark),&iter,1, &retval, -1); gtk_tree_path_free(path); DEBUG_MSG("get_current_bmark, returning %p\n",retval); return retval; } } return NULL; } /* void bmark_name_entry_changed(GtkEntry * entry, GtkDialog * dialog) { const gchar *string; string = gtk_entry_get_text(GTK_ENTRY(entry)); if (strlen(string) <= 0) gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, FALSE); else gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK, TRUE); }*/ void bmark_add_rename_dialog(Tbfwin * bfwin, gchar * dialogtitle) { GtkWidget *dlg, *name, *desc, *button, *table, *istemp; gint result; /* GtkTextMark *im; gchar *pstr; GtkTextIter it, sit, eit;*/ Tbmark *m = get_current_bmark(bfwin); if (!m) return; dlg = gtk_dialog_new_with_buttons(dialogtitle, GTK_WINDOW(bfwin->main_window), GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); button = gtk_button_new_from_stock(GTK_STOCK_OK); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_dialog_add_action_widget(GTK_DIALOG(dlg), button, GTK_RESPONSE_OK); /* gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);*/ table = gtk_table_new(2, 3, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), 12); gtk_table_set_row_spacings(GTK_TABLE(table), 6); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), table, FALSE, FALSE, 12); name = entry_with_text(m->name, 200); gtk_entry_set_activates_default(GTK_ENTRY(name), TRUE); bf_mnemonic_label_tad_with_alignment(_("_Name:"), name, 0, 0.5, table, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), name, 1, 2, 0, 1); /* g_signal_connect(G_OBJECT(name), "changed", G_CALLBACK(bmark_name_entry_changed), dlg);*/ desc = entry_with_text(m->description, 200); gtk_entry_set_activates_default(GTK_ENTRY(desc), TRUE); bf_mnemonic_label_tad_with_alignment(_("_Description:"), desc, 0, 0.5, table, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), desc, 1, 2, 1, 2); istemp = checkbut_with_value(_("Temporary"), m->is_temp); gtk_table_attach_defaults(GTK_TABLE(table), istemp, 0, 2, 2, 3); gtk_window_set_default(GTK_WINDOW(dlg), button); gtk_widget_show_all(dlg); result = gtk_dialog_run(GTK_DIALOG(dlg)); if (result == GTK_RESPONSE_OK) { gchar *tmpstr; /* check if name exists */ /* if (bmark_name_exists (DOCUMENT(bfwin->current_document), gtk_entry_get_text(GTK_ENTRY(name)))) { pstr = g_strdup_printf(_("You already have a bookmark named %s!"), gtk_entry_get_text(GTK_ENTRY(name))); if (dialogtype == BMARK_ADD_PERM_DIALOG) { info_dialog(bfwin->main_window, dialogtitle, pstr); } else { info_dialog(bfwin->main_window, dialogtitle, pstr); } g_free(pstr); gtk_widget_destroy(dlg); bmark_add_rename_dialog(bfwin, dialogtitle, dialogtype); return; } else */ /* if (dialogtype == BMARK_ADD_PERM_DIALOG) { m = g_new0(Tbmark, 1); m->doc = DOCUMENT(bfwin->current_document); if (!m->doc) return; im = gtk_text_buffer_get_insert(m->doc->buffer); gtk_text_buffer_get_iter_at_mark(m->doc->buffer, &it, im); m->mark = gtk_text_buffer_create_mark(m->doc->buffer, g_strdup(gtk_entry_get_text(GTK_ENTRY(name))), &it, TRUE); m->filepath = g_strdup(m->doc->filename); m->is_temp = FALSE; m->name = g_strdup(gtk_entry_get_text(GTK_ENTRY(name))); m->description = g_strdup(gtk_entry_get_text(GTK_ENTRY(desc))); sit = eit = it; gtk_text_iter_forward_to_line_end(&eit); gtk_text_iter_forward_chars(&sit, 10); if (!gtk_text_iter_in_range(&sit, &it, &eit)) sit = eit; m->text = g_strdup(gtk_text_iter_get_slice(&it, &sit)); bmark_get_iter_at_tree_position(bfwin, m); gtk_tree_store_set(bfwin->bookmarkstore, &m->iter, NAME_COLUMN, g_strdup_printf("[%s] --> %s", gtk_entry_get_text(GTK_ENTRY(name)), m->text), PTR_COLUMN, m, -1); gtk_tree_view_expand_all(bfwin->bmark); gtk_widget_grab_focus(bfwin->current_document->view); bmark_store(bfwin, m); } else {*/ g_free(m->name); m->name = g_strdup(gtk_entry_get_text(GTK_ENTRY(name))); g_free(m->description); m->description = g_strdup(gtk_entry_get_text(GTK_ENTRY(desc))); m->is_temp = GTK_TOGGLE_BUTTON(istemp)->active; if (m->name && strlen(m->name) > 0) { tmpstr = g_strconcat(m->name, " - ", m->text,NULL); } else { tmpstr = g_strdup(m->text); } gtk_tree_store_set(bfwin->bookmarkstore, &m->iter, NAME_COLUMN, tmpstr,-1); g_free(tmpstr); if (m->is_temp) { if (m->strarr) { /* hmm previously this was not a temporary bookmark */ bmark_unstore(bfwin, m); } } else { bmark_store(bfwin, m); } /* } */ } gtk_widget_destroy(dlg); } static void bmark_popup_menu_goto_lcb(GtkWidget * widget, gpointer user_data) { Tbmark *b; GtkTextIter it; if (!user_data) return; b = get_current_bmark(BFWIN(user_data)); if (!b) return; if (b->filepath && !b->doc) { /* check if that document _is_ open */ Tdocument *tmpdoc; GList *doclist = return_allwindows_documentlist(); tmpdoc = documentlist_return_document_from_filename(doclist, b->filepath); g_list_free(doclist); if (tmpdoc == NULL) { if (!g_file_test(b->filepath, G_FILE_TEST_EXISTS)) { gchar *string = g_strdup_printf(_("Could not find the file \"%s\"."), b->filepath); error_dialog(BFWIN(user_data)->main_window, string, _("This bookmark is set in a file that no longer exists.")); g_free(string); return; } tmpdoc = doc_new_with_file(BFWIN(user_data), b->filepath, FALSE, TRUE); } /* now I have to check all bookmarks */ bmark_set_for_doc(tmpdoc); } if (b->doc) { GdkRectangle visirect; GtkTextIter visi_so, visi_eo; gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(b->doc->view),&visirect); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(b->doc->view), &visi_so, visirect.x, visirect.y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(b->doc->view), &visi_eo, visirect.x + visirect.width, visirect.y + visirect.height); gtk_text_buffer_get_iter_at_mark(b->doc->buffer, &it, b->mark); gtk_text_buffer_place_cursor(b->doc->buffer, &it); if (!gtk_text_iter_in_range(&it,&visi_so,&visi_eo)) { DEBUG_MSG("bmark_popup_menu_goto_lcb, cursor NOT visible!\n"); /* gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(b->doc->view), b->mark); */ gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(b->doc->view),b->mark,0.0, TRUE,0.5,0.5); } if (b->doc != BFWIN(user_data)->current_document) switch_to_document_by_pointer(BFWIN(user_data), b->doc); gtk_widget_grab_focus(b->doc->view); } } /* * removes the bookmark from the treestore, and if it is the last remaining bookmark * for the document, it will remove the parent iter (the filename) from the treestore as well */ static void bmark_check_remove(Tbfwin *bfwin,Tbmark *b) { GtkTreeIter parent; if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(bfwin->bookmarkstore),&parent,&b->iter)) { gint numchild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(bfwin->bookmarkstore), &parent); DEBUG_MSG("bmark_check_remove, the parent of this bookmark has %d children\n", numchild); gtk_tree_store_remove(bfwin->bookmarkstore, &(b->iter)); if (numchild == 1) { gpointer ptr; DEBUG_MSG("bmark_check_remove, we removed the last child, now remove the parent\n"); gtk_tree_store_remove(bfwin->bookmarkstore,&parent); /* if the document is open, it should be removed from the hastable as well */ ptr = g_hash_table_lookup(bfwin->bmark_files,b->filepath); if (ptr) { DEBUG_MSG("bmark_check_remove, removing iter from hashtable\n"); g_hash_table_remove(bfwin->bmark_files,b->filepath); g_free(ptr); if (b->doc) b->doc->bmark_parent = NULL; } } } else { gchar *name; gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore), &b->iter, NAME_COLUMN,&name, -1); g_print("bmark_check_remove, very weird, bookmark %s for %s does not have a parent ?????\n",name,b->filepath); g_free(name); exit(123); } /* according to the gtk documentation this function is slow and should be used only for testing purposes if ( gtk_tree_store_iter_is_valid(bfwin->bookmarkstore, &(b->iter)) )*/ /* DEBUG_MSG("bmark_check_remove, removing bookmark %p from treestore\n",b); gtk_tree_store_remove(bfwin->bookmarkstore, &(b->iter)); if (bfwin->bmark_files) { ptr = g_hash_table_lookup(bfwin->bmark_files,b->filepath); if (ptr!=NULL) { DEBUG_MSG("bmark_check_remove, %s has an entry in the hashtable\n",b->filepath); if (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL(bfwin->bookmarkstore), (GtkTreeIter*)ptr)) { re = TRUE; DEBUG_MSG("bmark_check_remove, the entry in the hashtable does NOT have a child, re=%d\n", re); } else { DEBUG_MSG("bmark_check_remove, the entry in the hashtable does have a child\n"); } } } if (re) { / *if (gtk_tree_store_iter_is_valid(bfwin->bookmarkstore,(GtkTreeIter*)ptr))* / DEBUG_MSG("bmark_check_remove, removing the entry from the treestore\n"); gtk_tree_store_remove(bfwin->bookmarkstore,(GtkTreeIter*)ptr); DEBUG_MSG("bmark_check_remove, removing the entry from the hashtable\n"); g_hash_table_remove(bfwin->bmark_files,b->filepath); g_free(ptr); if (b->doc) b->doc->bmark_parent = NULL; }*/ DEBUG_MSG("bmark_check_remove, finished\n"); } static void bmark_del_children_backend(Tbfwin *bfwin, GtkTreeIter *parent) { GtkTreeIter tmpiter; while (gtk_tree_model_iter_children(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter, parent)) { Tbmark *b; gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter, PTR_COLUMN,&b,-1); if (b) { DEBUG_MSG("bmark_del_children_backend, found b=%p\n",b); bmark_check_remove(bfwin,b); if (!b->is_temp) bmark_unstore(bfwin, b); bmark_free(b); } else { DEBUG_MSG("bmark_del_children_backend, iter without bookmark ??? LOOP WARNING!\n"); } } } static void bmark_popup_menu_deldoc_lcb(GtkWidget * widget, Tbfwin *bfwin) { if (bfwin->bmark) { GtkTreePath *path; GtkTreeViewColumn *col; gtk_tree_view_get_cursor(bfwin->bmark, &path, &col); if (path != NULL) { gchar *name; gchar *pstr; gchar *btns[] = { GTK_STOCK_NO, GTK_STOCK_YES, NULL }; GtkTreeIter iter; gint depth, ret; depth = gtk_tree_path_get_depth(path); if (depth == 2) { /* go up to parent */ gtk_tree_path_up(path); } else if (depth != 1) { g_print("a bug in function bmark_popup_menu_deldoc_lcb()\n"); #ifdef DEVELOPMENT exit(124); #endif return; } gtk_tree_model_get_iter(gtk_tree_view_get_model(bfwin->bmark), &iter, path); gtk_tree_path_free(path); gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore), &iter, NAME_COLUMN,&name, -1); pstr = g_strdup_printf(_("Do you really want to delete all bookmarks for %s?"), name); ret = multi_query_dialog(bfwin->main_window, _("Delete bookmarks?"), pstr, 0, 0, btns); g_free(pstr); if (ret == 0) return; bmark_del_children_backend(bfwin, &iter); } } gtk_widget_grab_focus(bfwin->current_document->view); } static void bmark_popup_menu_del_lcb(GtkWidget * widget, gpointer user_data) { Tbmark *b; gint ret; gchar *pstr; gchar *btns[] = { GTK_STOCK_NO, GTK_STOCK_YES, NULL }; if (!user_data) return; b = get_current_bmark(BFWIN(user_data)); if (!b) return; /* check if it is temp mark */ if (b->is_temp) { /* gtk_tree_store_remove(BFWIN(user_data)->bookmarkstore, &(b->iter)); */ bmark_check_remove(BFWIN(user_data),b); /* check if we should remove a filename too */ /* bmark_unstore(BFWIN(user_data), b); */ bmark_free(b); } else { pstr = g_strdup_printf(_("Do you really want to delete %s?"), b->name); ret = multi_query_dialog(BFWIN(user_data)->main_window, _("Delete permanent bookmark."), pstr, 0, 0, btns); g_free(pstr); if (ret == 0) return; bmark_check_remove(BFWIN(user_data),b); /* check if we should remove a filename too */ bmark_unstore(BFWIN(user_data), b); bmark_free(b); } gtk_widget_grab_focus(BFWIN(user_data)->current_document->view); } static void bmark_popup_menu_rename_lcb(GtkWidget * widget, Tbfwin * bfwin) { Tbmark *m = get_current_bmark(bfwin); if (!m) return; bmark_add_rename_dialog(bfwin, _("Edit bookmark")); } static void bmark_popup_menu_delall_lcb(GtkWidget * widget, Tbfwin * bfwin) { bmark_del_all(bfwin,TRUE); } static GtkWidget *bmark_popup_menu(Tbfwin * bfwin, gboolean show_bmark_specific, gboolean show_file_specific) { GtkWidget *menu, *menu_item; menu = gtk_menu_new(); if (show_bmark_specific) { menu_item = gtk_menu_item_new_with_label(_("Goto bookmark")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(bmark_popup_menu_goto_lcb), bfwin); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_separator_menu_item_new(); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Edit")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(bmark_popup_menu_rename_lcb), bfwin); gtk_menu_append(GTK_MENU(menu), menu_item); menu_item = gtk_menu_item_new_with_label(_("Delete")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(bmark_popup_menu_del_lcb), bfwin); gtk_menu_append(GTK_MENU(menu), menu_item); } if (show_file_specific) { menu_item = gtk_menu_item_new_with_label(_("Delete all in document")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(bmark_popup_menu_deldoc_lcb), bfwin); gtk_menu_append(GTK_MENU(menu), menu_item); } menu_item = gtk_menu_item_new_with_label(_("Delete all")); g_signal_connect(GTK_OBJECT(menu_item), "activate", G_CALLBACK(bmark_popup_menu_delall_lcb), bfwin); gtk_menu_append(GTK_MENU(menu), menu_item); gtk_widget_show_all(menu); g_signal_connect_after(G_OBJECT(menu), "destroy", G_CALLBACK(destroy_disposable_menu_cb), menu); return menu; } /* right mouse click */ static gboolean bmark_event_mouseclick(GtkWidget * widget, GdkEventButton * event, Tbfwin * bfwin) { GtkTreePath *path; gboolean show_bmark_specific = FALSE, show_file_specific = FALSE; if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(bfwin->bmark), event->x, event->y, &path, NULL, NULL, NULL)) { if (path) { gint depth = gtk_tree_path_get_depth(path); gtk_tree_path_free(path); if (depth==2) { show_bmark_specific = TRUE; show_file_specific = TRUE; if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { /* double click */ bmark_popup_menu_goto_lcb(NULL, bfwin); return TRUE; } } else if (depth == 1) { show_file_specific = TRUE; } } } if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { /* right mouse click */ gtk_menu_popup(GTK_MENU(bmark_popup_menu(bfwin, show_bmark_specific, show_file_specific)), NULL, NULL, NULL, NULL, event->button, event->time); } return FALSE; } /* Initialize bookmarks gui for window */ GtkWidget *bmark_gui(Tbfwin * bfwin) { GtkWidget *vbox, *scroll; GtkCellRenderer *cell; GtkTreeViewColumn *column; DEBUG_MSG("bmark_gui, building gui for bfwin=%p\n",bfwin); /* Tree Store is in bfwin->bookmarkstore Tree View is in bfwin->bmark */ vbox = gtk_vbox_new(FALSE, 1); bfwin->bmark = gtk_tree_view_new_with_model(GTK_TREE_MODEL(bfwin->bookmarkstore)); cell = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("", cell, "text", NAME_COLUMN, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(bfwin->bmark), column); gtk_widget_show_all(bfwin->bmark); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(bfwin->bmark), FALSE); /*gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(bfwin->bmark), TRUE);*/ scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), bfwin->bmark); gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(bfwin->bmark), "button-press-event", G_CALLBACK(bmark_event_mouseclick), bfwin); gtk_tree_view_expand_all(bfwin->bmark); return vbox; } /** * bmark_get_iter_at_tree_position: * * determine bookmark's location in the tree and insert - result GtkTreeIter is stored in m->iter */ static void bmark_get_iter_at_tree_position(Tbfwin * bfwin, Tbmark * m) { GtkTreeIter *parent; gpointer ptr; DEBUG_MSG("bmark_get_iter_at_tree_position, started for filepath=%s\n",m->filepath); if (!bfwin->bmark_files) { DEBUG_MSG("bmark_get_iter_at_tree_position, creating hashtable for bfwin=%p\n",bfwin); bfwin->bmark_files = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); } ptr = g_hash_table_lookup(bfwin->bmark_files, m->filepath); if (ptr == NULL) { /* closed document or bookmarks never set */ gchar *title = NULL; parent = g_new0(GtkTreeIter, 1); gtk_tree_store_append(bfwin->bookmarkstore, parent, NULL); switch (main_v->props.bookmarks_filename_mode) { case BM_FMODE_FULL: g_strdup(m->filepath); break; case BM_FMODE_HOME: /* todo */ if (bfwin->project != NULL && bfwin->project->basedir && strlen(bfwin->project->basedir)) { gint baselen = strlen(bfwin->project->basedir); if (strncmp(m->filepath, bfwin->project->basedir, baselen)==0) { title = g_strdup(m->filepath + baselen); } } break; /* case BM_FMODE_FILE: title = g_path_get_basename(m->filepath); break;*/ } if (title == NULL) { title = g_path_get_basename(m->filepath); } gtk_tree_store_set(bfwin->bookmarkstore, parent, NAME_COLUMN, title, PTR_COLUMN, m->doc, -1); g_free (title); if (m->doc != NULL) { DEBUG_MSG("bmark_get_iter_at_tree_position, setting parent iter %p for doc%p\n",parent,m->doc); m->doc->bmark_parent = parent; } DEBUG_MSG("bmark_get_iter_at_tree_position, appending parent %p in hashtable for filepath=%s\n",parent, m->filepath); /* the hash table frees the key, but not the value, on destroy */ g_hash_table_insert(bfwin->bmark_files, g_strdup(m->filepath), parent); } else parent = (GtkTreeIter *) ptr; { Tbmark *bef = bmark_find_bookmark_before_offset(bfwin, m->offset, parent); if (bef == NULL) { gtk_tree_store_prepend(bfwin->bookmarkstore, &m->iter, parent); return; } else { gtk_tree_store_insert_after(GTK_TREE_STORE(bfwin->bookmarkstore),&m->iter,parent,&bef->iter); return; } } } /* because we don't store them in a hashtable anymore, it's no problem to have bookmarks with the same name static gboolean bmark_name_exists(Tdocument * doc, const gchar * name) { GtkTreeIter tmpiter; gboolean cont; if (doc->bmark_parent == NULL) return FALSE; cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, doc->bmark_parent); while (cont) { Tbmark *mark = NULL; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &mark, -1); if (mark) { if (strcmp(mark->name, name) == 0) return TRUE; } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter); } return FALSE; } */ /* * this function should create the global * main_v->bookmarkstore */ void bmark_init() { main_v->bookmarkstore = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER); DEBUG_MSG("bmark_init, created main_v->bookmarkstore at %p\n", main_v->bookmarkstore); main_v->bmarkdata = g_new0(Tbmarkdata, 1); } /* this function will load the bookmarks * from bfwin->session->bmarks and parse * them into treestore bfwin->bookmarkstore * * this function should ALSO check all dcouments that are * opened (bfwin->documentlist) if they have bookmarks !! */ void bmark_reload(Tbfwin * bfwin) { GList *tmplist = g_list_first(bfwin->session->bmarks); DEBUG_MSG("bmark_reload for bfwin %p\n",bfwin); if (bfwin->bmark_files != NULL) g_hash_table_destroy(bfwin->bmark_files); bfwin->bmark_files = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); while (tmplist) { gchar **items = (gchar **) tmplist->data; if (items && count_array(items) == 6) { gchar *ptr; Tbmark *b; b = g_new0(Tbmark, 1); b->name = g_strdup(items[0]); b->description = g_strdup(items[1]); b->filepath = g_strdup(items[2]); b->offset = atoi(items[3]); b->text = g_strdup(items[4]); b->len = atoi(items[5]); b->strarr = items; bmark_get_iter_at_tree_position(bfwin, b); if (b->name && strlen(b->name)>0) { ptr = g_strconcat(b->name, " - ", b->text, NULL); } else { ptr = g_strdup(b->text); } gtk_tree_store_set(bfwin->bookmarkstore, &(b->iter), NAME_COLUMN, ptr, PTR_COLUMN, b, -1); g_free(ptr); } tmplist = g_list_next(tmplist); } tmplist = g_list_first(bfwin->documentlist); while (tmplist) { DEBUG_MSG("bmark_reload, calling bmark_set_for_doc for doc=%p\n",tmplist->data); bmark_set_for_doc(DOCUMENT(tmplist->data)); bmark_check_length(bfwin, DOCUMENT(tmplist->data)); tmplist = g_list_next(tmplist); } } /* * this function will simply call * gtk_tree_view_set_model() to connect the treeview * to the new treestore, used in unloading and * loading of projects */ void bmark_set_store(Tbfwin * bfwin) { DEBUG_MSG("bmark_set_store set store %p for bfwin %p\n",bfwin->bookmarkstore,bfwin); if (bfwin->bookmarkstore && bfwin->bmark) { gtk_tree_view_set_model(bfwin->bmark, GTK_TREE_MODEL(bfwin->bookmarkstore)); } } void bmark_clean_for_doc(Tdocument * doc) { GtkTreeIter tmpiter; gboolean cont; if (doc->bmark_parent == NULL) return; DEBUG_MSG("bmark_clean_for_doc, getting children for parent_iter=%p\n",doc->bmark_parent); cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, doc->bmark_parent); while (cont) { Tbmark *b = NULL; DEBUG_MSG("bmark_clean_for_doc, getting bookmark for first child\n"); gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &b, -1); if (b) { bmark_update_offset_from_textmark(b); DEBUG_MSG("bmark_clean_for_doc, bookmark=%p, new offset=%d, now deleting GtkTextMark from TextBuffer\n",b,b->offset); gtk_text_buffer_delete_mark(doc->buffer, b->mark); b->mark = NULL; b->doc = NULL; if (!b->is_temp) { bmark_store(doc->bfwin, b); } } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter); } /* cont */ /* now unset the Tdocument* in the second column */ DEBUG_MSG("bmark_clean_for_doc, unsetting and freeing parent_iter %p for doc %p\n",doc->bmark_parent,doc); gtk_tree_store_set(GTK_TREE_STORE(BFWIN(doc->bfwin)->bookmarkstore), doc->bmark_parent, PTR_COLUMN, NULL, -1); /* remove the pointer from the hastable */ g_hash_table_remove(BFWIN(doc->bfwin)->bmark_files,doc->filename); g_free(doc->bmark_parent); doc->bmark_parent = NULL; } /* * this function will check is this document needs any bookmarks, and set the * doc->bmark_parent if needed */ void bmark_set_for_doc(Tdocument * doc) { GtkTreeIter tmpiter; GtkTextIter it; gboolean cont; if (!doc->filename) { DEBUG_MSG("bmark_set_for_doc, document %p does not have a filename, returning\n", doc); return; } DEBUG_MSG("bmark_set_for_doc, doc=%p, filename=%s\n",doc,doc->filename); /* if (!BFWIN(doc->bfwin)->bmark) { DEBUG_MSG("bmark_set_for_doc, no leftpanel, not implemented yet!!\n"); return; }*/ if (doc->bmark_parent) { DEBUG_MSG("this document (%p) already has a bmark_parent (%p) why is this function called?\n",doc,doc->bmark_parent); return; } cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, NULL); while (cont) { GtkTreeIter child; if (gtk_tree_model_iter_children (GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &child, &tmpiter)) { Tbmark *mark = NULL; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &child, PTR_COLUMN, &mark, -1); if (mark) { if (strcmp(mark->filepath, doc->filename) == 0) { /* this is it */ gboolean cont2; DEBUG_MSG("bmark_set_for_doc, we found a bookmark for document %s at offset=%d!\n",doc->filename,mark->offset); /* we will now first set the Tdocument * into the second column of the parent */ gtk_tree_store_set(GTK_TREE_STORE(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, doc, -1); mark->doc = doc; gtk_text_buffer_get_iter_at_offset(doc->buffer, &it, mark->offset); mark->mark = gtk_text_buffer_create_mark(doc->buffer, NULL, &it, TRUE); cont2 = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &child); while (cont2) { mark = NULL; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &child, PTR_COLUMN, &mark, -1); if (mark) { mark->doc = doc; DEBUG_MSG("bmark_set_for_doc, next bookmark at offset=%d!\n",mark->offset); gtk_text_buffer_get_iter_at_offset(doc->buffer, &it, mark->offset); mark->mark = gtk_text_buffer_create_mark(doc->buffer, NULL, &it, TRUE); } cont2 = gtk_tree_model_iter_next(GTK_TREE_MODEL (BFWIN(doc->bfwin)->bookmarkstore), &child); } doc->bmark_parent = g_memdup(&tmpiter, sizeof(GtkTreeIter)); DEBUG_MSG("bmark_set_for_doc, added parent_iter %p to doc %p\n",doc->bmark_parent,doc); return; } } } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter); } /* cont */ DEBUG_MSG("bmark_set_for_doc, no bookmarks found for document %s\n", doc->filename); } /** * bmark_get_bookmarked_lines: * @doc: Tdocument * * @ fromit: GtkTextIter * * @ toit: GtkTextIter * * * this function returns a hash table with all bookmarks between fromit and toit * * this function is called VERY OFTEN (might be 20X per second!!!!) by document.c * to redraw the bookmarks at the sides * so we obviously need to keep this function VERY FAST * * the function will return NULL if no bookmarks for this document are * known (this is faster then looking in an empty hash table) * * Return value: #GHashTable * pointer or NULL */ GHashTable *bmark_get_bookmarked_lines(Tdocument * doc, GtkTextIter *fromit, GtkTextIter *toit) { if (doc->bmark_parent) { gboolean cont = TRUE; guint offset; Tbmark *mark; GtkTreeIter tmpiter; GHashTable *ret = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); /* because the bookmarks are sorted by line number, we don't have to scan trough all bookmarks, we can start at the bookmark *before* fromit, and continue until the first bookmark > toit */ offset = gtk_text_iter_get_offset(fromit); mark = bmark_find_bookmark_before_offset(BFWIN(doc->bfwin), offset, doc->bmark_parent); if (mark) { tmpiter = mark->iter; } else { cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, doc->bmark_parent); } while (cont) { Tbmark *mark; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &mark, -1); if (mark && mark->mark) { GtkTextIter it; gint *iaux; gtk_text_buffer_get_iter_at_mark(doc->buffer, &it, mark->mark); if (gtk_text_iter_compare(toit,&it) < 0) { break; } else if (gtk_text_iter_compare(fromit,&it) < 0) { iaux = g_new(gint, 1); *iaux = gtk_text_iter_get_line(&it); g_hash_table_insert(ret, iaux, g_strdup(mark->is_temp ? "1" : "0")); } } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter); } /* cont */ return ret; } return NULL; } /* this function will simply add the bookmark as defined in the arguments * * will use offset if itoffset is NULL * will use itoffset if not NULL */ static void bmark_add_backend(Tdocument *doc, GtkTextIter *itoffset, gint offset, const gchar *name, const gchar *text, gboolean is_temp) { Tbmark *m; gchar *displaytext = NULL; GtkTextIter it; m = g_new0(Tbmark, 1); m->doc = doc; if (itoffset) { it = *itoffset; m->offset = gtk_text_iter_get_offset(&it); } else { gtk_text_buffer_get_iter_at_offset(doc->buffer,&it,offset); m->offset = offset; } m->mark = gtk_text_buffer_create_mark(doc->buffer, NULL, &it, TRUE); m->filepath = g_strdup(doc->filename); m->is_temp = is_temp; m->text = g_strdup(text); m->name = (name) ? g_strdup(name) : g_strdup(""); m->description = g_strdup(""); /* insert into tree */ bmark_get_iter_at_tree_position(doc->bfwin, m); displaytext = bmark_display_text(m->name, m->text); gtk_tree_store_set(BFWIN(doc->bfwin)->bookmarkstore, &m->iter, NAME_COLUMN, displaytext, PTR_COLUMN, m, -1); g_free (displaytext); /* and store */ if (!m->is_temp) { bmark_store(BFWIN(doc->bfwin), m); } } /** * bmark_text_for_offset: * * will use offset if itoffset is NULL * will use itoffset if not NULL */ static gchar *bmark_text_for_offset(Tdocument *doc, GtkTextIter *itoffset, gint offset) { GtkTextIter it, eit, sit; if (itoffset) { it = *itoffset; } else { gtk_text_buffer_get_iter_at_offset(doc->buffer,&it,offset); } sit = eit = it; gtk_text_iter_forward_to_line_end(&eit); gtk_text_iter_forward_chars(&sit, BMARK_SHOW_NUM_TEXT_CHARS); if (!gtk_text_iter_in_range(&sit, &it, &eit)) sit = eit; #ifdef DEBUG { gchar *tmp = gtk_text_iter_get_text(&it, &sit); DEBUG_MSG("bmark_text_for_offset, text=%s\n",tmp); g_free(tmp); } #endif return gtk_text_iter_get_text(&it, &sit); } /* this function will add a bookmark to the current document at current cursor / selection */ static void bmark_add_current_doc_backend(Tbfwin *bfwin, const gchar *name, gint offset, gboolean is_temp) { GtkTextIter it, eit, sit; DEBUG_MSG("bmark_add_backend, adding bookmark at offset=%d for bfwin=%p\n",offset,bfwin); /* create bookmark */ gtk_text_buffer_get_iter_at_offset(DOCUMENT(bfwin->current_document)->buffer,&it,offset); /* if there is a selection, and the offset is within the selection, we'll use it as text content */ if (gtk_text_buffer_get_selection_bounds(DOCUMENT(bfwin->current_document)->buffer,&sit,&eit) && gtk_text_iter_in_range(&it,&sit,&eit)) { gchar *text = gtk_text_iter_get_text(&sit, &eit); bmark_add_backend(DOCUMENT(bfwin->current_document), &sit, offset, name, text, is_temp); g_free(text); } else { gchar *text; text = bmark_text_for_offset(DOCUMENT(bfwin->current_document), &it, offset); bmark_add_backend(DOCUMENT(bfwin->current_document), &it, offset, name, text, is_temp); g_free(text); } if (bfwin->bmark) { /* only if there is a left panel we should do this */ gtk_tree_view_expand_all(bfwin->bmark); gtk_widget_grab_focus(bfwin->current_document->view); } } /* TODO: can we make this function faster? when adding bookmarks from a search this function uses a lot of time, perhaps that can be improved */ static Tbmark *bmark_get_bmark_at_line(Tdocument *doc, gint offset) { GtkTextIter sit, eit; GtkTreeIter tmpiter; gint linenum; gtk_text_buffer_get_iter_at_offset(doc->buffer,&sit,offset); linenum = gtk_text_iter_get_line(&sit); eit = sit; gtk_text_iter_set_line_offset(&sit, 0); gtk_text_iter_forward_to_line_end(&eit); #ifdef DEBUG { gchar *tmp = gtk_text_buffer_get_text(doc->buffer, &sit,&eit,FALSE); DEBUG_MSG("bmark_get_bmark_at_line, searching bookmarks at line %d between offsets %d - %d --> '%s'\n",linenum,gtk_text_iter_get_offset(&sit),gtk_text_iter_get_offset(&eit),tmp); g_free(tmp); } #endif /* check for existing bookmark in this place */ if (DOCUMENT(doc)->bmark_parent) { GtkTextIter testit; Tbmark *m, *m2; m = bmark_find_bookmark_before_offset(BFWIN(doc->bfwin), offset, doc->bmark_parent); if (m == NULL) { DEBUG_MSG("bmark_get_bmark_at_line, m=NULL, get first child\n"); if (gtk_tree_model_iter_children(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter,doc->bmark_parent)) { gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &m2, -1); gtk_text_buffer_get_iter_at_mark(doc->buffer, &testit,m2->mark); if (gtk_text_iter_get_line(&testit) == linenum) { return m2; } } } else { gtk_text_buffer_get_iter_at_mark(doc->buffer, &testit,m->mark); DEBUG_MSG("bmark_get_bmark_at_line, m=%p, has linenum=%d\n",m,gtk_text_iter_get_line(&testit)); if (gtk_text_iter_get_line(&testit) == linenum) { return m; } tmpiter = m->iter; if (gtk_tree_model_iter_next(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore),&tmpiter)) { gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &m2, -1); gtk_text_buffer_get_iter_at_mark(doc->buffer, &testit,m2->mark); if (gtk_text_iter_get_line(&testit) == linenum) { return m2; } } } DEBUG_MSG("bmark_get_bmark_at_line, nothing found at this line, return NULL\n"); return NULL; } DEBUG_MSG("bmark_get_bmark_at_line, no existing bookmark found, return NULL\n"); return NULL; } /** * bmark_add_extern * @doc: a #Tdocument* with the document * @offset: the character position where to set the bookmark * @name: a name to set for the bookmark, or NULL for no name * @text: the text for the bookmark, or NULL to have it set automatically * * Code in bluefish that want to set a bookmark, not related to * the cursor location or a mouse position should use * this function. */ void bmark_add_extern(Tdocument *doc, gint offset, const gchar *name, const gchar *text, gboolean is_temp) { DEBUG_MSG("adding bookmark at offset %d with name %s\n",offset,name); /* dummy */ if (!bmark_get_bmark_at_line(doc, offset)) { if (text) { bmark_add_backend(doc, NULL, offset, (name) ? name : "", text, is_temp); } else { gchar *tmp = bmark_text_for_offset(doc, NULL, offset); bmark_add_backend(doc, NULL, offset, (name) ? name : "", tmp, is_temp); g_free(tmp); } } } void bmark_add(Tbfwin * bfwin) { GtkTextMark *im; GtkTextIter it; gint offset; /* check for unnamed document */ if (!DOCUMENT(bfwin->current_document)->filename) { error_dialog(bfwin->main_window, _("Add bookmark"), _("Cannot add bookmarks in unnamed files.")); /*\nPlease save the file first. A Save button in this dialog would be cool -- Alastair*/ return; } /* if the left panel is disabled, we simply should add the bookmark to the list, and do nothing else */ /* if (bfwin->bmark == NULL) { DEBUG_MSG("no left panel, this is not implemented yet\n"); } else */ { gboolean has_mark; im = gtk_text_buffer_get_insert(DOCUMENT(bfwin->current_document)->buffer); gtk_text_buffer_get_iter_at_mark(DOCUMENT(bfwin->current_document)->buffer, &it, im); offset = gtk_text_iter_get_offset(&it); /* check for existing bookmark in this place */ has_mark = (bmark_get_bmark_at_line(DOCUMENT(bfwin->current_document), offset) != NULL); if (has_mark) { info_dialog(bfwin->main_window, _("Add bookmark"), _("You already have a bookmark here!")); {/* delete bookmark stuff */ } return; } bmark_add_current_doc_backend(bfwin, "", offset, !main_v->props.bookmarks_default_store); } } gboolean bmark_have_bookmark_at_stored_bevent(Tdocument * doc) { if (BMARKDATA(main_v->bmarkdata)->bevent_doc == doc) { return (bmark_get_bmark_at_line(doc, BMARKDATA(main_v->bmarkdata)->bevent_charoffset) != NULL); } return FALSE; } void bmark_store_bevent_location(Tdocument * doc, gint charoffset) { DEBUG_MSG("bmark_store_bevent_location, storing offset=%d for doc=%p\n",charoffset,doc); BMARKDATA(main_v->bmarkdata)->bevent_doc = doc; BMARKDATA(main_v->bmarkdata)->bevent_charoffset = charoffset; } void bmark_del_at_bevent(Tdocument *doc) { if (BMARKDATA(main_v->bmarkdata)->bevent_doc == doc) { Tbmark *b = bmark_get_bmark_at_line(doc, BMARKDATA(main_v->bmarkdata)->bevent_charoffset); if (b) { DEBUG_MSG("bmark_del_at_bevent, deleting bookmark %p\n",b); bmark_check_remove(BFWIN(doc->bfwin),b); /* check if we should remove a filename too */ bmark_unstore(BFWIN(doc->bfwin), b); bmark_free(b); } } } void bmark_add_at_bevent(Tdocument *doc) { /* check for unnamed document */ if (!doc->filename) { error_dialog(BFWIN(doc->bfwin)->main_window, _("Add bookmark"), _("Cannot add bookmarks in unnamed files.")); return; } if (BMARKDATA(main_v->bmarkdata)->bevent_doc == doc) { gint offset = BMARKDATA(main_v->bmarkdata)->bevent_charoffset; /* we have the location */ /*if (BFWIN(doc->bfwin)->bmark == NULL) { DEBUG_MSG("adding bookmarks without left panel is not implemented yet\n"); } else */ { bmark_add_current_doc_backend(doc->bfwin, "", offset, !main_v->props.bookmarks_default_store); } } } /* not used yet void bmark_del_for_filename(Tbfwin *bfwin, gchar *filename) { GtkTreeIter *parent = (GtkTreeIter *)g_hash_table_lookup(bfwin->bmark_files,filename); if (parent) { bmark_del_children_backend(bfwin, parent); } } */ void bmark_del_for_document(Tbfwin *bfwin, Tdocument *doc) { if (doc->bmark_parent) { bmark_del_children_backend(bfwin, doc->bmark_parent); } } void bmark_del_all(Tbfwin *bfwin,gboolean ask) { gint ret; gchar *btns[]={GTK_STOCK_NO,GTK_STOCK_YES,NULL}; GtkTreeIter tmpiter; if (bfwin==NULL) return; if (ask) { ret = multi_query_dialog(bfwin->main_window,_("Delete all bookmarks."), _("Are you sure?"), 0, 0, btns); if (ret==0) return; } DEBUG_MSG("bmark_del_all, deleting all bookmarks!\n"); while (gtk_tree_model_iter_children(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter, NULL) ) { #ifdef DEBUG gchar *name; gtk_tree_model_get(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter, NAME_COLUMN,&name, -1); DEBUG_MSG("bmark_del_all, the toplevel has child '%s'\n", name); #endif bmark_del_children_backend(bfwin, &tmpiter); } gtk_widget_grab_focus(bfwin->current_document->view); } void bmark_check_length(Tbfwin * bfwin, Tdocument * doc) { GtkTreeIter tmpiter; gboolean cont; if (!doc || !doc->bmark_parent) { DEBUG_MSG("bmark_check_length, no bmark_parent iter => no bookmarks, returning\n"); return; } DEBUG_MSG("bmark_check_length, doc %p, filename %s\n\n", doc, doc->filename); cont = gtk_tree_model_iter_children(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter, doc->bmark_parent); while (cont) { Tbmark *mark = NULL; gtk_tree_model_get(GTK_TREE_MODEL(BFWIN(doc->bfwin)->bookmarkstore), &tmpiter, PTR_COLUMN, &mark, -1); if (mark) { glong size; size = doc->statbuf.st_size; DEBUG_MSG("bmark_check_length, bmark has %d, file has %ld\n",mark->len, size); if (mark->len != size) { gint ret; gchar *btns[]={GTK_STOCK_NO,GTK_STOCK_YES,NULL}; gchar *str; str = g_strconcat(_("File size changed in file\n"),doc->filename,NULL); ret = multi_query_dialog(bfwin->main_window,_("Bookmarks positions could be incorrect. Delete bookmarks?"), str, 0, 0, btns); if (ret==1) { bmark_del_for_document(bfwin, doc); } return; } } else { DEBUG_MSG("bmark_check_length, NOT GOOD no mark in the treestore??\n"); } cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(bfwin->bookmarkstore), &tmpiter); } DEBUG_MSG("bmark_check_length, all bookmarks OK, returning\n"); } void bmark_cleanup(Tbfwin * bfwin) { DEBUG_MSG("bmark_cleanup, cleanup for bfwin=%p\n",bfwin); /* we are not destroying a store, so let's not destroy tree positions, it seems, they are recovered from store - Oskar */ /* if (bfwin->bmark_files) g_hash_table_destroy(bfwin->bmark_files); bfwin->bmark_files = NULL; */ bfwin->bmark = NULL; } winefish-1.3.3/src/bluefish.h0000600000047200004720000003344410411546042015076 0ustar kyanhkyanh/* $Id: bluefish.h 2231 2006-03-26 17:15:14Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * bluefish.h - global prototypes * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* if you define DEBUG here you will get debug output from all Bluefish parts */ /* #define DEBUG */ #ifndef __BLUEFISH_H_ #define __BLUEFISH_H_ #include "config.h" #define WINEFISH_SPLASH_FILENAME PKGDATADIR"winefish_splash.png" #ifdef HAVE_SYS_MSG_H #define WITH_MSG_QUEUE #endif #ifdef DEBUG #define DEBUG_MSG g_print #else /* not DEBUG */ #ifdef __GNUC__ #define DEBUG_MSG(args...) /**/ #else/* notdef __GNUC__ */ extern void g_none(gchar *first, ...); #define DEBUG_MSG g_none #endif /* __GNUC__ */ #endif /* DEBUG */ #ifdef ENABLE_NLS #include #define _(String) gettext (String) #define N_(String) (String) #else #define _(String)(String) #define N_(String)(String) #endif #define DIRSTR "/" #define DIRCHR '/' #include #include #include #include #include #include /*********************/ /* undo/redo structs */ /*********************/ typedef enum { UndoDelete = 1, UndoInsert } undo_op_t; typedef struct { GList *entries; /* the list of entries that should be undone in one action */ gint changed; /* doc changed status at this undo node */ } unregroup_t; typedef struct { GList *first; GList *last; unregroup_t *current; gint num_groups; GList *redofirst; } unre_t; /************************/ /* filetype struct */ /************************/ typedef struct { gchar *type; gchar **extensions; GdkPixbuf *icon; gchar *update_chars; GList *highlightlist; gboolean editable; /* this a type that can be edited by Bluefish */ gint autoclosingtag; /* 0=off, 1=xml mode, 2=html mode */ gchar *content_regex; /* a regex pattern to test the filetype using the content */ } Tfiletype; /* brace_finder */ typedef struct { GtkTextMark *mark_left; GtkTextMark *mark_mid; GtkTextMark *mark_right; GtkTextTag *tag; guint16 last_status; } Tbracefinder; #define BRACEFINDER(var)((Tbracefinder *)(var)) /*******************/ /* document struct */ /*******************/ #define BFWIN(var) ((Tbfwin *)(var)) #define DOCUMENT(var) ((Tdocument *)(var)) typedef struct { gchar *filename; /* this is the UTF-8 encoded filename, before you use it on disk you need convert to disk-encoding! */ gchar *encoding; gint modified; /* time_t mtime; */ /* from stat() */ struct stat statbuf; gint is_symlink; /* file is a symbolic link */ gulong del_txt_id; /* text delete signal */ gulong ins_txt_id; /* text insert signal */ gulong ins_aft_txt_id; /* text insert-after signal, for auto-indenting */ unre_t unre; GtkWidget *view; GtkWidget *tab_label; GtkWidget *tab_eventbox; GtkWidget *tab_menu; GtkTextBuffer *buffer; gpointer paste_operation; gint last_rbutton_event; /* index of last 3rd button click */ Tfiletype *hl; /* filetype & highlighting set to use for this document */ gint need_highlighting; /* if you open 10+ documents you don't need immediate highlighting, just set this var, and notebook_switch() will trigger the actual highlighting when needed */ guint32 view_bars; gpointer floatingview; /* a 2nd textview widget that has its own window */ gpointer bfwin; GtkTreeIter *bmark_parent; /* if NULL this document doesn't have bookmarks, if it does have bookmarks they are children of this GtkTreeIter */ gpointer brace_finder; } Tdocument; typedef struct { gint filebrowser_show_hidden_files; gint filebrowser_show_backup_files; /* gint filebrowser_two_pane_view; *//* have one or two panes in the filebrowser */ gint filebrowser_focus_follow; /* have the directory of the current document in focus */ gchar *filebrowser_unknown_icon; gchar *filebrowser_dir_icon; gchar *editor_font_string; /* editor font */ gint editor_tab_width; /* editor tabwidth */ /* gint editor_indent_wspaces; *//* indent with spaces, not tabs */ gchar *tab_font_string; /* notebook tabs font */ GList *browsers; /* browsers array */ GList *external_commands; /* external commands array */ GList *cust_menu; /* DEPRECATED entries in the custom menu */ GList *cmenu_insert; /* custom menu inserts */ GList *cmenu_replace; /* custom menu replaces */ gint highlight_num_lines_count; /* number of lines to highlight in continous highlighting */ GList *filetypes; /* filetypes for highlighting and filtering */ gint numcharsforfiletype; /* maximum number of characters in the file to use to find the filetype */ GList *filefilters; /* filebrowser.c filtering */ gchar *last_filefilter; /* last filelist filter type */ GList *highlight_patterns; /* the highlight patterns */ gint left_panel_width; /* width of filelist */ gint left_panel_left; /* 1 = left, 0 = right */ gint max_recent_files; /* length of Open Recent list */ gint max_dir_history; /* length of directory history */ gchar *backup_filestring; /* the string to append to the backup file */ gint backup_abort_action;/* if the backup fails, continue save, abort save, or ask the user */ gint modified_check_type; /* 0=no check, 1=by mtime and size, 2=by mtime, 3=by size, 4,5,...not implemented (md5sum?) */ gint num_undo_levels; /* number of undo levels per document */ gchar *newfile_default_encoding; /* if you open a new file, what encoding will it use */ GList *encodings; /* all encodings you can choose from */ GList *outputbox; /* all outputbox commands */ GList *reference_files; /* all reference files */ gint bookmarks_default_store; /* 0= temporary by default, 1= permanent by default */ gint bookmarks_filename_mode; /* 0=FULLPATH, 1=DIR FROM BASE 2=BASENAME */ gint document_tabposition; gint leftpanel_tabposition; gchar *default_basedir; gchar *project_suffix; #ifdef HAVE_LIBASPELL gchar *spell_default_lang; #endif /* HAVE_LIBASPELL */ GCompletion *completion; GCompletion *completion_s; GHashTable *autotext_hashtable; /* a hash table with (key,form) = (string,integer) */ GPtrArray *autotext_array; /* an array contains (start string, end string) */ guint32 view_bars; #ifdef EXTERNAL_GREP #ifdef EXTERNAL_FIND gchar *templates_dir; #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ #ifdef ENABLE_COLUMN_MARKER gint marker_i; gint marker_ii; gint marker_iii; #endif /* ENABLE_COLUMN_MARKER */ } Tproperties; /* the Tglobalsession contains all settings that can change over every time you run Winefish, so things that *need* to be saved after every run! */ typedef struct { GList *quickbar_items; /* items in the quickbar toolbar */ gint main_window_h; /* main window height */ gint main_window_w; /* main window width */ gint two_pane_filebrowser_height; /* position of the pane separater on the two paned file browser */ gint fref_ldoubleclick_action; /* left doubleclick in the function reference */ gint fref_info_type; /* type of info shown in a small function reference window */ gint lasttime_cust_menu; /* the last time the defaultfile was checked for new entries */ gint lasttime_highlighting; /* see above */ gint lasttime_filetypes; /* see above */ gint lasttime_encodings; /* see above */ GList *recent_projects; } Tglobalsession; typedef struct { GList *classlist; GList *colorlist; GList *targetlist; /* GList *urllist; */ /* kyanh, removed, 20050309 */ GList *fontlist; /* GList *dtd_cblist; */ /* is this used ?? */ /* GList *headerlist; */ /* is this used ?? */ /* GList *positionlist; */ /* is this used ?? */ GList *searchlist; /* used in snr2 */ GList *replacelist; /* used in snr2 */ GList *bmarks; GList *recent_files; GList *recent_dirs; gchar *opendir; gchar *savedir; guint32 view_bars; } Tsessionvars; typedef struct { gchar *filename; gchar *name; GList *files; gchar *basedir; gchar *basefile; gchar *template; gpointer editor; guint32 view_bars; gint word_wrap; Tsessionvars *session; GtkTreeStore *bookmarkstore; /* project bookmarks */ } Tproject; typedef struct { Tsessionvars *session; /* points to the global session, or to the project session */ Tdocument *current_document; /* one object out of the documentlist, the current visible document */ GList *documentlist; /* document.c and others: all Tdocument objects */ Tdocument *last_activated_doc; Tproject *project; /* might be NULL for a default project */ GtkWidget *main_window; GtkWidget *menubar; gint last_notebook_page; /* a check to see if the notebook changed to a new page */ gulong notebook_switch_signal; GtkWidget *notebook; GtkWidget *notebook_fake; GtkWidget *notebook_box; /* Container for notebook and notebook_fake */ GtkWidget *middlebox; /* we need this to show/hide the filebrowser */ GtkWidget *hpane; /* we need this to show/hide the filebrowser */ GtkWidget *statusbar; GtkWidget *statusbar_lncol; /* where we have the line number */ GtkWidget *statusbar_insovr; /* insert/overwrite indicator */ GtkWidget *statusbar_editmode; /* editor mode and doc encoding */ /* the following list contains toolbar widgets we like to reference later on */ /* GtkWidget *toolbar_undo; */ /* GtkWidget *toolbar_redo; */ /* GtkWidget *toolbar_quickbar; *//* the quickbar widget */ /*GList *toolbar_quickbar_children;*/ /* this list is needed to remove widgets from the quickbar */ /* following widgets are used to show/hide stuff */ /* GtkWidget *main_toolbar_hb; GtkWidget *html_toolbar_hb; */ guint32 view_bars; GtkWidget *custom_menu_hb; /* handle box for custom menu */ GtkWidget *output_box; GtkWidget *leftpanel_notebook; /* following are lists with dynamic menu entries */ GList *menu_recent_files; GList *menu_recent_projects; GList *menu_external; GList *menu_encodings; GList *menu_outputbox; GList *menu_windows; GtkWidget *menu_cmenu; GList *menu_cmenu_entries; GList *menu_filetypes; GtkWidget *vpane; gpointer outputbox; /* a outputbox */ #ifdef EXTERNAL_FIND #ifdef EXTERNAL_GREP gpointer grepbox; /* a grep box */ gpointer templatebox; /* box for templates */ #endif /* EXTERNAL_FIND */ #endif /* EXTERNAL_GREP */ #ifdef HAVE_VTE_TERMINAL GtkWidget *terminal; #endif /* HAVE_VTE_TERMINAL */ GtkWidget *ob_notebook; /* notebook of outputboxes */ GtkWidget *ob_hbox; /* hbox to save all ob_boxes */ gpointer bfspell; gpointer filebrowser; gpointer snr2; gpointer fref; gpointer bmark; GtkTreeStore *bookmarkstore; /* this is a link to project->bookmarkstore OR main_v->bookmarkstore and it is only here for convenience !!!! */ GHashTable *bmark_files; /* no way, I have to have list of file iters. Other way I cannot properly load bmarks for closed files */ } Tbfwin; typedef struct { GtkWidget *window; /* popup window */ GtkWidget *treeview; /* we hold it so we scroll */ gint show; /* 1: show; 0: hide; */ gchar *cache; /* temporary buffer */ gpointer bfwin; } Tcompletionwin; typedef struct { Tproperties props; /* preferences */ Tglobalsession globses; /* global session */ GList *filetypelist; /* highlighting.c: a list of all filetypes with their icons and highlighting sets */ GList *bfwinlist; GList *recent_directories; /* a stringlist with the most recently used directories */ Tsessionvars *session; /* holds all session variables for non-project windows */ gpointer filebrowserconfig; gpointer frefdata; gpointer bmarkdata; GtkTreeStore *bookmarkstore; /* the global bookmarks from the global session */ gint num_untitled_documents; GtkTooltips *tooltips; GdkEvent *last_kevent; #ifdef BUG84 guint16 lastkp_hardware_keycode; /* for the autoclosing, we need to know the last pressed key, in the key release callback, */ guint lastkp_keyval; /* this is different if the modifier key is not pressed anymore during the key-release */ #endif pcre *autoclosingtag_regc; /* the regular expression to check for a valid tag in tag autoclosing*/ pcre *autoclosingtag_be_regc; /* for context \start...\stop and plain text \begin...\end */ pcre *anycommand_regc; Tcompletionwin completion; /* a popup window for completion */ guint snooper; /* snooper */ } Tmain; extern Tmain *main_v; #define SET_BIT(var,bit,value) (var & ~bit)|(value*bit) #define GET_BIT(var,bit) ((var &bit) != 0) enum { VIEW_LEFT_PANEL = 1<<0, VIEW_LINE_NUMBER =1<<1, VIEW_CUSTOM_MENU = 1<<2, VIEW_COLORIZED = 1<<3, MODE_WRAP = 1<<4, MODE_PROJECT = 1<<5, MODE_OVERWRITE=1<<6, MODE_AUTO_COMPLETE=1<<7, MODE_INDENT_WITH_SPACES=1<<8, MODE_AUTO_INDENT=1<<9, MODE_REUSE_WINDOW=1<<10, MODE_ALLOW_MULTIPLE_INSTANCE=1<<11, MODE_CLEAR_UNDO_HISTORY_ON_SAVE=1<<12, MODE_MAKE_PERMANENT=1<<13, MODE_CREATE_BACKUP_ON_SAVE=1<<14, MODE_REMOVE_BACKUP_ON_CLOSE=1<<15, MODE_SEPERATE_FILE_DIR_VIEW=1<<16, MODE_RESTORE_DIMENSION=1<<17, MODE_MAKE_LATEX_TRANSIENT=1<<18, MODE_FILE_BROWSERS_TWO_VIEW=1<<19, MODE_AUTO_BRACE_FINDER=1<<20 }; #define MODE_DEFAULT \ MODE_AUTO_INDENT \ + MODE_REUSE_WINDOW \ + VIEW_COLORIZED \ + MODE_MAKE_LATEX_TRANSIENT \ + MODE_RESTORE_DIMENSION \ + MODE_CREATE_BACKUP_ON_SAVE \ + MODE_FILE_BROWSERS_TWO_VIEW \ + MODE_AUTO_COMPLETE /* Note: VIEW_LINE_NUMBER is session variable; adding it to MODE_DEFAULT takes no effect. */ /* public functions from winefish.c */ void bluefish_exit_request(); #endif /* __BLUEFISH_H_ */ winefish-1.3.3/src/gtk_easy.c0000600000047200004720000017121710366640206015105 0ustar kyanhkyanh/* $Id: gtk_easy.c 1712 2006-01-28 09:59:34Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* strtod() */ #include /* strlen() */ #include /* GDK_Return */ #include "bluefish.h" #include "gtk_easy.h" #include "bf_lib.h" #include "pixmap.h" #include "gui.h" /* statusbar_message() */ #include "char_table.h" /* xml_escape() */ #ifdef WIN32 #define DIRSTR "\\" #define DIRCHR 92 #else #define DIRSTR "/" #define DIRCHR '/' #endif /** * flush_queue: * * handles the gtk and gdk queue * * Return value: void **/ void flush_queue(void) { /* gint i=0; g_print("\n***["); */ while(g_main_context_pending(NULL)) { g_main_context_iteration (NULL, TRUE); /* i++; g_print(" %d",i); */ } /*g_print("]***");*/ } /** * widget_get_string_size: * @widget: #GtkWidget* to put the string on * @string: #ghcar* with the string * * This function will calculate the width in pixels from the * string passed to it in string, using the font from widget * * Return value: #gint pixels */ gint widget_get_string_size(GtkWidget *widget, gchar *string) { PangoLayout *layout; gint retval = -1; layout = gtk_widget_create_pango_layout(widget,string); if (layout != NULL) { pango_layout_get_pixel_size(layout, &retval, NULL); g_object_unref(G_OBJECT (layout)); } return retval; } void widget_set_visible(GtkWidget *widget, gboolean visible) { if (visible) { gtk_widget_show(widget); } else { gtk_widget_hide(widget); } } /** * window_destroy: * @windowname: a #GtkWidget pointer to the window * * Remove grab and signals and then destroy window * * Return value: void **/ void window_destroy(GtkWidget * windowname) { DEBUG_MSG("window_destroy, windowname=%p, first the signal handlers\n", windowname); g_signal_handlers_destroy(G_OBJECT(windowname)); DEBUG_MSG("window_destroy, then remove the grab\n"); gtk_grab_remove(windowname); DEBUG_MSG("window_destroy, then destroy the widget\n"); gtk_widget_destroy(windowname); DEBUG_MSG("window_destroy, done\n"); } /** * window_close_by_widget_cb: * @widget: #GtkWidget the parent window of this widget will be destroyed * @data: gpointer, ignored * * destroy the toplevel window for widget * * Return value: void */ void window_close_by_widget_cb(GtkWidget * widget, gpointer data) { DEBUG_MSG("window_close_by_widget_cb, widget=%p\n", widget); window_destroy(gtk_widget_get_toplevel(widget)); } /** * window_close_by_data_cb: * @widget: #GtkWidget, ignored * @data: #gpointer to a gtk-window which will be detroyed * * destroy a window using the gpointer data * * Return value: void */ void window_close_by_data_cb(GtkWidget * widget, gpointer data) { DEBUG_MSG("window_close_by_data_cb, data=%p\n", data); window_destroy(GTK_WIDGET(data)); } /** * setup_toggle_item: * @ifactory: #GtkItemFactory * the itemfactory where the toggle item is in defined * @path: #gchar * the path in the itemfactory to find the toggle item * @state: #gint the state to put it in (0 or 1) * * change the setting of a toggle item in a menu to state * * Return value: void */ void setup_toggle_item(GtkItemFactory * ifactory, gchar * path, gint state) { GtkWidget *toggle; toggle = gtk_item_factory_get_widget(ifactory, path); if (!toggle) { g_print("warning, menuitem \"%s\" does NOT exist! check the translation!\n", path); return; } DEBUG_MSG("setting path %s to %d\n",path,state); if ((GTK_CHECK_MENU_ITEM(toggle)->active) && state == 0) { GTK_CHECK_MENU_ITEM(toggle)->active = state; return; } if ((!GTK_CHECK_MENU_ITEM(toggle)->active) && state) { GTK_CHECK_MENU_ITEM(toggle)->active = 1; return; } } /** * string_apply: * @config_var: # gchar **, a pointer to a gchar pointer with where the content should be placed * @entry: the entry #GtkWidget * to read * * free the old string in **config_var, and replaces it with the new string from entry * * Return value: void */ void string_apply(gchar ** config_var, GtkWidget * entry) { gchar *tmpstring; DEBUG_MSG("string_apply, start\n"); tmpstring = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); DEBUG_MSG("string_apply, tmpstring(%p)=%s\n", tmpstring, tmpstring); if (tmpstring) { if (config_var != NULL) { g_free(*config_var); } *config_var = tmpstring; } #ifdef DEBUG else { DEBUG_MSG("string_apply, ***** tmpstring == NULL *****\n"); } #endif } /** * string_apply: * @config_var: #gint*, a pointer to a gint with where the content should be placed * @entry: the spinbutton or checkbox #GtkWidget * to read * @is_checkbox: a gboolean, TRUE if entry is a checkbox * * sets the content from the widget to the variable pointed to by the config_var pointer * * Return value: void */ void integer_apply(gint *config_var, GtkWidget * widget, gboolean is_checkbox) { if (is_checkbox) { *config_var = (GTK_TOGGLE_BUTTON(widget)->active); } else { *config_var = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); } DEBUG_MSG("integer_apply, config_var(%p)=%i\n", config_var, *config_var); } /* added kyanh 20060127 */ void bitwise_apply(guint32 *config_var, GtkWidget * widget, gboolean is_checkbox, guint32 BIT) { guint32 tmp_val; if (is_checkbox) { tmp_val = (GTK_TOGGLE_BUTTON(widget)->active); } else { tmp_val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); } *config_var = SET_BIT(*config_var, BIT, tmp_val); DEBUG_MSG("bitwise_apply, config_var(%p)=%d\n", config_var, *config_var & BIT); } /** * combo_with_popdown: * @setstring: #gchar* to set in textbox, if NULL it will be set "" * @which_list: #GList* to set in popdown widget * @editable: #gint if the combo should be editable (1 or 0) * * Create new combo and preset some values * * Return value: #GtkWidget* pointer to created combo */ GtkWidget *combo_with_popdown(const gchar * setstring, GList * which_list, gint editable) { GtkWidget *returnwidget; returnwidget = gtk_combo_new(); gtk_combo_set_case_sensitive(GTK_COMBO(returnwidget),TRUE); if (which_list != NULL) { gtk_combo_set_popdown_strings(GTK_COMBO(returnwidget), which_list); } if (setstring != NULL) { gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(returnwidget)->entry), setstring); } else { gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(returnwidget)->entry), ""); } if (editable == 0) { gtk_editable_set_editable(GTK_EDITABLE(GTK_ENTRY(GTK_COMBO(returnwidget)->entry)), FALSE); } gtk_combo_disable_activate(GTK_COMBO(returnwidget)); gtk_entry_set_activates_default (GTK_ENTRY (GTK_COMBO (returnwidget)->entry), TRUE); return returnwidget; } /** * boxed_combo_with_popdown: * @setstring: #gchar* to set in textbox, if NULL it will be set "" * @which_list: #GList* to set in popdown widget * @editable: #gint if the combo should be editable (1 or 0) * @box: the #GtkWidget* box widget to add the combo to * * create a new combo with presets like in combo_with_popdown() * and add it to the box * * Return value: #GtkWidget* pointer to created combo */ GtkWidget *boxed_combo_with_popdown(const gchar * setstring, GList * which_list, gint editable, GtkWidget *box) { GtkWidget *returnwidget; returnwidget = combo_with_popdown(setstring, which_list, editable); gtk_box_pack_start(GTK_BOX(box), returnwidget, TRUE, TRUE, 3); return returnwidget; } /** * combo_with_popdown_sized: * @setstring: #gchar* to set in textbox, if NULL it will be set "" * @which_list: #GList* to set in popdown widget * @editable: #gint if the combo should be editable (1 or 0) * @width: #gint with the width in pixels the widget should be * * Create new combo and preset some values, with a horizontal size * * Return value: #GtkWidget* pointer to created combo */ GtkWidget *combo_with_popdown_sized(const gchar * setstring, GList * which_list, gint editable, gint width) { GtkWidget *returnwidget; returnwidget = combo_with_popdown(setstring, which_list, editable); gtk_widget_set_size_request(returnwidget, width , -1); return returnwidget; } /** * entry_with_text: * @setstring: #const gchar* if not NULL set this text * @max_lenght: #gint max. characters in the entry * * Create new entry with some preset values * * Return value: #GtkWidget* pointer to the new entry widget */ GtkWidget *entry_with_text(const gchar * setstring, gint max_lenght) { GtkWidget *returnwidget; if (max_lenght) { returnwidget = gtk_entry_new_with_max_length(max_lenght); } else { returnwidget = gtk_entry_new(); } if (setstring) { gtk_entry_set_text(GTK_ENTRY(returnwidget), setstring); } gtk_entry_set_activates_default(GTK_ENTRY(returnwidget), TRUE); return returnwidget; } /** * boxed_entry_with_text: * @setstring: #const gchar* if not NULL set this text * @max_lenght: #gint max. characters in the entry * @box: the #GtkWidget* box widget to add the entry to * * Create new entry with some preset values, and add it to a box * * Return value: #GtkWidget* pointer to the new entry widget */ GtkWidget *boxed_entry_with_text(const gchar * setstring, gint max_lenght, GtkWidget *box) { GtkWidget *returnwidget; returnwidget = entry_with_text(setstring, max_lenght); gtk_box_pack_start(GTK_BOX(box), returnwidget, TRUE, TRUE, 0); return returnwidget; } /** * boxed_full_entry: * @labeltest: #const gchar * with the text for the label * @setstring: #const gchar* if not NULL set this text * @max_lenght: #gint max. characters in the entry * @box: the #GtkWidget* box widget to add the entry to * * Create new entry with some preset values, and add together * with a label to a hbox, and add that hbox to * the box pointer * * Return value: #GtkWidget* pointer to the new entry widget */ GtkWidget *boxed_full_entry(const gchar * labeltext, gchar * setstring,gint max_lenght, GtkWidget * box) { GtkWidget *hbox, *return_widget, *label; hbox = gtk_hbox_new(FALSE,3); label = gtk_label_new_with_mnemonic(labeltext); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 3); return_widget = boxed_entry_with_text(setstring, max_lenght, hbox); gtk_label_set_mnemonic_widget(GTK_LABEL(label), return_widget); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 3); return return_widget; } /** * checkbut_with_value: * @labeltest: #const gchar * with the text for the label * @which_config_int: #gint whether or not to set the checkbutton active * * Create new checkbutton with some value * * Return value: #GtkWidget* pointer to the new checkbutton widget */ GtkWidget *checkbut_with_value(gchar *labeltext, gint which_config_int) { GtkWidget *returnwidget; returnwidget = gtk_check_button_new_with_mnemonic(labeltext); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(returnwidget), which_config_int); return returnwidget; } /** * boxed_checkbut_with_value: * @labeltest: #const gchar * with the text for the label * @which_config_int: #gint whether or not to set the checkbutton active * @box: the #GtkWidget* box widget to add the entry to * * Create new checkbutton with some value, and add it to box * * Return value: #GtkWidget* pointer to the new checkbutton widget */ GtkWidget *boxed_checkbut_with_value(gchar *labeltext, gint which_config_int, GtkWidget * box) { GtkWidget *returnwidget; returnwidget = checkbut_with_value(labeltext, which_config_int); gtk_box_pack_start(GTK_BOX(box), returnwidget, FALSE, FALSE, 3); return returnwidget; } /** * radiobut_with_value: * @labeltest: #const gchar * with the text for the label * @enabled: #gint if the radiobutton is enabled or not * @prevbut: #GtkRadioButton* pointer to the first button or NULL if none * * Create new radiobutton with some value, and if there is a first button * for this group, add this button to that group * * Return value: #GtkWidget* pointer to the new radiobutton widget */ GtkWidget *radiobut_with_value(gchar *labeltext, gint enabled, GtkRadioButton *prevbut) { GtkWidget *returnwidget; GSList *group=NULL; if (prevbut) { group = gtk_radio_button_group(prevbut); } returnwidget = gtk_radio_button_new_with_mnemonic(group, labeltext); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(returnwidget), enabled); return returnwidget; } /** * boxed_radiobut_with_value: * @labeltest: #const gchar * with the text for the label * @enabled: #gint if the radiobutton is enabled or not * @prevbut: #GtkRadioButton* pointer to the first button or NULL if none * @box: the #GtkWidget* box widget to add the entry to * * Create new radiobutton with some value, and if there is a first button * for this group, add this button to that group, and this button to box * * Return value: #GtkWidget* pointer to the new radiobutton widget */ GtkWidget *boxed_radiobut_with_value(gchar *labeltext, gint enabled, GtkRadioButton *prevbut, GtkWidget *box) { GtkWidget *returnwidget; returnwidget = radiobut_with_value(labeltext, enabled, prevbut); gtk_box_pack_start(GTK_BOX(box), returnwidget, FALSE, FALSE, 0); return returnwidget; } static gint is_int(gfloat testval) { DEBUG_MSG("is_int, (int)testval=%d\n", (int)testval); if ((gfloat)(((int) testval) - ((gfloat) testval )) == 0) { DEBUG_MSG("is_int, %f int!\n", testval); return 1; } else { DEBUG_MSG("is_int, %f float!\n", testval); return 0; } } /** * spinbut_with_value: * @value: #const gchar * with the value as string for the spinbut * @lower: a #gfloat with the lower value for the range * @upper: a #gfloat with the upper value for the range * @step_increment: a #gfloat with the stepsize for the spinbutton * @page_increment: a #gfloat with the pagesize (pgup/pgdn) for the spinbutton * * Create new spinbutton with the specified value and range * * Return value: #GtkWidget* pointer to the new spinbutton widget */ GtkWidget *spinbut_with_value(gchar *value, gfloat lower, gfloat upper, gfloat step_increment, gfloat page_increment) { GtkAdjustment *adj; GtkWidget *returnwidget; guint digits; double fvalue=0; if (value) { fvalue = strtod(value, NULL); } adj = (GtkAdjustment *) gtk_adjustment_new((gfloat)fvalue, (gfloat)lower, (gfloat)upper, step_increment, page_increment, 0.0); digits = (is_int(lower) ? 0 : 2); returnwidget = gtk_spin_button_new(adj, step_increment, digits); /* g_object_set(G_OBJECT(returnwidget), "numeric", TRUE, NULL);*/ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(returnwidget), FALSE); gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(returnwidget), FALSE); /* gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(returnwidget), GTK_UPDATE_IF_VALID);*/ if (!value) { gtk_entry_set_text(GTK_ENTRY(GTK_SPIN_BUTTON(returnwidget)), ""); } return returnwidget; } /* THIS ONE IS NEVERUSED GtkWidget *boxed_spinbut_with_value(gchar *value, gfloat lower, gfloat upper, gfloat step_increment, gfloat page_increment, GtkWidget *box) { GtkWidget *returnwidget; returnwidget = spinbut_with_value(value, lower, upper, step_increment, page_increment); gtk_box_pack_start(GTK_BOX(box), returnwidget, FALSE, FALSE, 0); return returnwidget; } */ /** * optionmenu_with_value: * @options: a #gchar** NULL terminated array with option strings * @curval: a #gint with the current selected item * * Create new popupmenu from options, and set the selected index from curval * * Return value: #GtkWidget* pointer to the new menu widget * Created by: Rubén Dorta */ GtkWidget *optionmenu_with_value(gchar **options, gint curval) { GtkWidget *returnwidget; GtkWidget *menu, *menuitem; gchar **str; returnwidget = gtk_option_menu_new(); menu = gtk_menu_new(); str = options; while (*str) { DEBUG_MSG("prefs_optionmenu, adding %s to optionmenu\n", *str); menuitem = gtk_menu_item_new_with_label(_(*str)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); str++; } gtk_option_menu_set_menu(GTK_OPTION_MENU(returnwidget), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(returnwidget), curval); return returnwidget; } /** * boxed_optionmenu_with_value: * @labeltext: a #const gchar* with the text for the label * @curval: a #gint with the current selected item * @box: a #GtkWidget* with the box to add this to * @options: a #gchar** NULL terminated array with option strings * * Create a new horizontal box with a labeltext and a new popupmenu using the options array * setting the selected index from curval * * Return value: #GtkWidget* pointer to the new menu widget * Modified by: Rubén Dorta */ GtkWidget *boxed_optionmenu_with_value(const gchar *labeltext, gint curval, GtkWidget *box, gchar **options) { GtkWidget *returnwidget; GtkWidget *hbox; hbox = gtk_hbox_new(FALSE,3); gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(labeltext), FALSE, FALSE, 3); returnwidget = optionmenu_with_value(options, curval); gtk_box_pack_start(GTK_BOX(hbox), returnwidget, FALSE, FALSE, 3); return returnwidget; } /** * window_with_title: * @title: #gchar* the title string * @position: the gtk window position * @type: the gtk window type * * Create new window with title and some more settings * * Return value: #GtkWidget* pointer to created window */ GtkWidget *window_with_title(const gchar * title, GtkWindowPosition position, gint borderwidth) { GtkWidget *returnwidget; returnwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (title) { gtk_window_set_title(GTK_WINDOW(returnwidget), title); } if (borderwidth) { gtk_container_set_border_width(GTK_CONTAINER(returnwidget), borderwidth); } if (position) { gtk_window_set_position(GTK_WINDOW(returnwidget), position); } #ifdef DEBUG else { g_print("window_with_title, **NOT** setting position!!\n"); } #endif return returnwidget; } /* GtkWindowPosition can be GTK_WIN_POS_NONE GTK_WIN_POS_CENTER GTK_WIN_POS_MOUSE */ static gboolean window_full_key_press_event_lcb(GtkWidget *widget,GdkEventKey *event,GtkWidget *win) { DEBUG_MSG("window_full_key_press_event_lcb, started\n"); if (event->keyval == GDK_Escape) { DEBUG_MSG("window_full_key_press_event_lcb, emit delete_event on %p\n", win); /* g_signal_emit_by_name(G_OBJECT(win), "delete_event");*/ gtk_widget_destroy(win); DEBUG_MSG("window_full_key_press_event_lcb, DESTROYED %p\n", win); return TRUE; } return FALSE; } /** * window_full2: * @title: #gchar* the title string * @position: #gint the gtk window position GTK_WIN_POS_NONE, GTK_WIN_POS_CENTER, GTK_WIN_POS_MOUSE * @borderwidth: #gint border width * @close_func: #GCallback the callback function when closing the window * @close_data: #gpointer data passed to the closefunc, or NULL to pass the widget pointer as close data * @delete_on_escape: #gboolean if the escape key should close the dialog * @transientforparent: #GtkWidget* with the window to set this transient for, or NULL * * Create new window with title, callback functions, some more settings * and if needed set a callback so the window will be closed on escape press * and set it if needed transient for another window * * the close_func should have the form * void close_func(GtkObject *object,gpointer user_data); * * Return value: #GtkWidget* pointer to created window */ GtkWidget *window_full2(const gchar * title, GtkWindowPosition position , gint borderwidth, GCallback close_func , gpointer close_data , gboolean delete_on_escape, GtkWidget *transientforparent) { GtkWidget *returnwidget; returnwidget = window_with_title(title, position, borderwidth); /* g_signal_connect(G_OBJECT(returnwidget), "delete_event", close_func, close_data);*/ /* use "destroy" and not "destroy_event", 'cause that doesn't work */ if (close_data == NULL) close_data = returnwidget; g_signal_connect(G_OBJECT(returnwidget), "destroy", close_func, close_data); DEBUG_MSG("window_full, close_data=%p\n",close_data); if (transientforparent) { gtk_window_set_transient_for(GTK_WINDOW(returnwidget), GTK_WINDOW(transientforparent)); } if (delete_on_escape) { g_signal_connect(G_OBJECT(returnwidget), "key_press_event", G_CALLBACK(window_full_key_press_event_lcb), returnwidget); /* for these windows it is also convenient if they destroy when their parent is destroyed */ gtk_window_set_destroy_with_parent(GTK_WINDOW(returnwidget), TRUE); } DEBUG_MSG("window_full, return %p\n", returnwidget); return returnwidget; } /** * textview_buffer_in_scrolwin: * @textview: #GtkWidget** will be filled with the textview widget pointer * @width: #gint the width of the scrolwin, -1 if default required * @height: #gint the height of the scrolwin, -1 if default required * @contents: #gchar* the initial contents of the textbox * @wrapmode: #GtkWrapMode the wrapmode for the TextView GTK_WRAP_NONE,GTK_WRAP_CHAR,GTK_WRAP_WORD * * creates a textbuffer, a textview widget (stored in the textview pointer), * puts that inside a scrolwin, adds the content and sets the size and returns * the scrolwin * * Return value: #GtkWidget* to the scolwin */ GtkWidget *textview_buffer_in_scrolwin(GtkWidget **textview, gint width, gint height, const gchar *contents, GtkWrapMode wrapmode) { GtkWidget *scrolwin; GtkTextBuffer *textbuf; textbuf = gtk_text_buffer_new(NULL); *textview = gtk_text_view_new_with_buffer(textbuf); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(*textview), wrapmode); scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolwin), *textview); gtk_widget_set_size_request(scrolwin, width, height); if (contents) { gtk_text_buffer_set_text(textbuf, contents, -1); } return scrolwin; } /** * apply_font_style: * @this_widget: #GtkWidget* the widget to apply the new fontstyle * @fontstring: #gchar* the fontset which will be loaded * * Change the font of a widget with a certain font from a string * * Return value: #GtkWidget* to this_widget */ GtkWidget *apply_font_style(GtkWidget * this_widget, gchar * fontstring) { if (fontstring) { PangoFontDescription *font_desc; font_desc = pango_font_description_from_string(fontstring); gtk_widget_modify_font(this_widget, font_desc); pango_font_description_free(font_desc); } return this_widget; } /** * hbox_with_pix_and_text: * @label: #const gchar* with the text * @pixmap_type: #gint with a pixmap type known by new_pixmap() from pixmap.h * * constructs a hbox with a pixmap and text. The pixmap type should be known * to the new_pixmap() function from pixmap.c * This function is very useful to create a button with text and a pixmap * * Return value: #GtkWidget* to the hbox */ GtkWidget *hbox_with_pix_and_text(const gchar *label, gint bf_pixmaptype, gboolean w_mnemonic) { GtkWidget *hbox = gtk_hbox_new(FALSE, 0); /* gtk_box_pack_start(GTK_BOX(hbox), new_pixmap(bf_pixmaptype), FALSE, FALSE, 1); */ gtk_box_pack_start(GTK_BOX(hbox), ((w_mnemonic) ? gtk_label_new_with_mnemonic(label) : gtk_label_new(label)), TRUE, TRUE, 1); gtk_widget_show_all(hbox); return hbox; } GtkWidget *bf_allbuttons_backend(const gchar *label, gboolean w_mnemonic, gint bf_pixmaptype, GCallback func, gpointer func_data) { GtkWidget *button; #ifdef USE_IMAGE_BUTTON if (bf_pixmaptype == -1) { #endif /* there is no image needed, only text */ if (w_mnemonic) { button = gtk_button_new_with_mnemonic(label); } else { button = gtk_button_new_with_label(label); } #if USE_IMAGE_BUTTON } else { /* there is an image needed */ button = gtk_button_new(); if (label) { /* both a pixmap and text */ gtk_container_set_border_width(GTK_CONTAINER(button), 0); gtk_container_add(GTK_CONTAINER(button), hbox_with_pix_and_text(label, bf_pixmaptype, w_mnemonic)); } else { /* only pixmap */ gtk_container_add(GTK_CONTAINER(button), new_pixmap(bf_pixmaptype)); } } #endif GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); g_signal_connect(G_OBJECT(button), "clicked", func, func_data); return button; } /** * bf_generic_button_with_image: * @label: #const gchar* button string with '_' for the mnemonic, or NULL * @pixmap_type: #gint image to display on button know to new_pixmap() from pixmap.c * @func: #GCallback pointer to signal handler * @func_data: #gpointer data for signal handler * * Create new button with an image and connect the "clicked" signal to func * if the label is NULL there will be only an image in the button * * Return value: #GtkWidget* pointer to created button */ /* GtkWidget *bf_generic_button_with_image(const gchar *label, gint pixmap_type, GCallback func, gpointer func_data) { GtkWidget *button; button = gtk_button_new(); gtk_container_set_border_width(GTK_CONTAINER(button), 0); if (label) { gtk_container_add(GTK_CONTAINER(button), hbox_with_pix_and_text(label, pixmap_type)); } else { gtk_container_add(GTK_CONTAINER(button), new_pixmap(pixmap_type)); } GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); g_return_val_if_fail(button, NULL); g_signal_connect(G_OBJECT(button), "clicked", func, func_data); return button; } */ /** * bf_generic_mnemonic_button: * @Text: #const gchar* button string, using '_' for the mnemonic * @func: #GCallback pointer to signal handler * @func_data: #gpointer data for signal handler * * Create new button with mnemonic and connect the "clicked" signal to func * * Return value: pointer to created button */ /* GtkWidget *bf_generic_mnemonic_button(const gchar * Text, GCallback func, gpointer func_data) { GtkWidget *button; button = gtk_button_new_with_mnemonic(Text); g_return_val_if_fail(button, NULL); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); g_signal_connect(G_OBJECT(button), "clicked", func, func_data); DEBUG_MSG("bf_generic_mnemonic_button, func_data=%p\n", func_data); return button; } */ /** * bf_gtkstock_button: * @stock_id: #const gchar* wioth the GTK stock icon ID * @func: #GCallback pointer to signal handler * @func_data: #gpointer data for signal handler * * Create new button from the GTK stock icons * * Return value: pointer to created button */ GtkWidget *bf_gtkstock_button(const gchar * stock_id, GCallback func, gpointer func_data) { GtkWidget *button = gtk_button_new_from_stock(stock_id); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); g_signal_connect(G_OBJECT(button), "clicked", func, func_data); return button; } /** * bf_generic_frame_new: * @label: #const gchar* label string. Set to NULL for no label * @shadowtype: #GtkShadowType border type * @borderwidth: #gint outside border width * * create a generic frame with shadow type and border * * Return value: #GtkWidget* pointer to created frame */ GtkWidget *bf_generic_frame_new(const gchar *label, GtkShadowType shadowtype, gint borderwidth) { GtkWidget *frame; frame = gtk_frame_new(label); gtk_frame_set_shadow_type(GTK_FRAME(frame), shadowtype); gtk_container_set_border_width(GTK_CONTAINER(frame), borderwidth); return frame; } /** * bf_mnemonic_label_tad_with_alignment: * @labeltext: #const gchar* label string * @m_widget: #GtkWidget* widget accessed by the label mnemonic * @xalign: #gfloat label horizontal alignment * @yalign: #gfloat label vertical alignment * @table: #GtkWidget table label is packed into * @left_attach: #gint column number to attach the left side of the label to * @right_atach: #gint: column number to attach the right side of a label to * @top_attach: #gint: row number to attach the top of a label to * @bottom_attach: #gint: row number to attach the bottom of a label to * * create a label with a mnemonic, align it, and attach it to a table * * Return value: void */ void bf_mnemonic_label_tad_with_alignment(const gchar *labeltext, GtkWidget *m_widget, float xalign, gfloat yalign, GtkWidget *table, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach) { GtkWidget *label; label = gtk_label_new_with_mnemonic(labeltext); gtk_misc_set_alignment(GTK_MISC(label), xalign, yalign); gtk_table_attach(GTK_TABLE(table), label, left_attach, right_attach, top_attach, bottom_attach, GTK_FILL, GTK_FILL, 0, 0); if (m_widget != NULL) { if (GTK_IS_COMBO(m_widget)) { gtk_label_set_mnemonic_widget(GTK_LABEL(label), (GTK_COMBO(m_widget)->entry)); gtk_entry_set_activates_default(GTK_ENTRY(GTK_COMBO(m_widget)->entry), TRUE); } else gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_widget); } } /** * bf_label_with_markup: * @labeltext: #const gchar* labeltext string */ GtkWidget *bf_label_with_markup(const gchar *labeltext) { GtkWidget *label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), labeltext); return label; } /** * bf_label_tad_with_markup: * @labeltext: #const gchar* label string * @xalign: #gfloat label horizontal alignment * @yalign: #gfloat label vertical alignment * @table: #GtkWidget* table label is packed into * @left_attach: #guint column number to attach the left side of the label to * @right_atach: #guint column number to attach the right side of a label to * @top_attach: #guint row number to attach the top of a label to * @bottom_attach: #guint row number to attach the bottom of a label to * * create a label with markup, align it, and attach it to a table * using the table defaults * * Return value: void */ void bf_label_tad_with_markup(const gchar *labeltext, gfloat xalign, gfloat yalign, GtkWidget *table, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach) { GtkWidget *label; label = bf_label_with_markup(labeltext); gtk_misc_set_alignment(GTK_MISC(label), xalign, yalign); gtk_table_attach_defaults(GTK_TABLE(table), label, left_attach, right_attach, top_attach, bottom_attach); } #ifdef NOTYETUSED typedef struct { GtkWidget *win; GtkWidget *entry[10]; gpointer data; } Tmultientrywidget; static void multi_entry_destroy(GtkObject *object, Tmultientrywidget *mew) { g_free(mew); } static void multi_entry_cancel_clicked(GtkWidget *widget, Tmultientrywidget *mew) { gtk_widget_destroy(mew->win); } Tmultientrywidget *build_multi_entry_window(gchar *title,GCallback ok_func ,gpointer data, const gchar **labelarr) { gint arrlen,i; GtkWidget *table,*hbox,*but; arrlen = count_array(labelarr); if (arrlen >10) arrlen = 10; Tmultientrywidget *mew = g_new0(Tmultientrywidget,1); mew->data = data; mew->win = window_full2(title, GTK_WIN_POS_MOUSE, 10, multi_entry_destroy,mew, TRUE, NULL); table = gtk_table_new(arrlen+2,2,FALSE); gtk_table_set_row_spacings(GTK_TABLE(table),6); gtk_table_set_col_spacings(GTK_TABLE(table),6); gtk_container_add(GTK_CONTAINER(mew->win),table); for (i=0;ientry[i] = entry_with_text(NULL, 255); gtk_table_attach_defaults(GTK_TABLE(table), mew->entry[i], 1, 2, i, i+1); } gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(), 0, 2, i, i+1); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 12); but = bf_stock_cancel_button(G_CALLBACK(multi_entry_cancel_clicked), NULL); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 0); but = bf_stock_ok_button(G_CALLBACK(ok_func), mew); gtk_box_pack_start(GTK_BOX(hbox),but, FALSE, FALSE, 0); gtk_table_attach_defaults(GTK_TABLE(table), hbox, 0, 2, i+1, i+2); gtk_widget_show_all(mew->win); } #endif /**************************************************************************/ /*********************** BUTTON DIALOG FUNCTIONS ************************/ /**************************************************************************/ /* If this code doesn't work, blame Christian */ /* Emit a delete-event to the appropriate dialog, to detect a user bailing through escape. */ static gboolean dialog_key_press_event_lcb(GtkWidget *widget,GdkEventKey *event,GtkWidget *dialog) { DEBUG_MSG("dialog_key_press_event_lcb, started, widget is %p and dialog is %p\n", widget, dialog); if (event->keyval == GDK_Escape) { DEBUG_MSG("dialog_key_press_event_lcb, emit delete_event on %p\n", dialog); /* g_signal_emit_by_name(G_OBJECT(dialog), "delete_event"); */ gtk_widget_destroy(dialog); return TRUE; } return FALSE; } /* This function is called from single_button_dialog_backend() and multiple_button_dialog_backend() * The dialog passed is made HIG-compliant. * * A HiG-dialog is consists of a GtkDialog, with a 2-cell vbox. The top * vbox contains an hbox, with an image and a label. The label has a primary * (strong && larger) message and an additional, more descriptive message. * It is not resizeable, has no title, placement is selected by the wm. */ static void hig_dialog_backend (GtkDialog *dialog, gchar *primary, gchar *secondary, gchar *icon) { GtkWidget *vbox, *hbox, *image, *label; gchar *message; gchar *spanstart = ""; gchar *spanend = "\n\n"; gchar *msgend = "\n"; gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); vbox = GTK_DIALOG (dialog)->vbox; hbox = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0); if(icon) { image = gtk_image_new_from_stock (icon , GTK_ICON_SIZE_DIALOG); /* icon unknown ==> "broken image" displayed. */ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (image), 0, 0); } if(secondary) { /* Creates label-content. */ gchar *str1, *str2; str1 = xml_escape(primary); str2 = xml_escape(secondary); message = g_strconcat(spanstart, str1, spanend, str2, msgend, NULL); } else { gchar *str1; str1 = xml_escape(primary); message = g_strconcat(spanstart, str1, spanend, NULL); } label = gtk_label_new (message); g_free(message); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); } /** * multi_button_dialog_backend: * @win: #GtkWidget* with the parent window for this dialog * @primary: #gchar* containing primary dialog message. * @secondary: #gchar* containing more explanatory message. Set to NULL if unused. * @icon: #gchar* Your stock GTK image, i.e. GTK_STOCK_DIALOG_WARNING. * @defval: #gint default index when user press ENTER. * @cancelval: #gint: default index when user press ESCAPE. Should be something non-fatal. If this value is -1, the escape-button will be disabled. * @buttons: #gchar** array of buttons. NULL-terminated!! Must contain at least one button. * * create a modal dialog with several buttons, returning the index of the clicked button * * Return value: #gint the index num of the button label which was clicked so 0 for the first, 1 for the 2nd etc. */ gint multi_button_dialog_backend(GtkWidget *win, gchar *primary, gchar *secondary, gchar *icon, gint defval, gint cancelval, gchar **buttons) { GtkWidget *dialog; int i, retval; dialog = gtk_dialog_new_with_buttons (NULL, /* Note that no title is being set. */ GTK_WINDOW(win), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, *buttons, 0, NULL); DEBUG_MSG ("multi_button_dialog_backend: dialog=%p, primary=%s\n", dialog, primary); /* Add buttons. The index must be correct! */ for (i = 1; *++buttons; i++) { /* Walk through the button-list until one reaches NULL. */ DEBUG_MSG ("multi_button_dialog_backend: Adding button '%s', ID=%d\n", *buttons, i); gtk_dialog_add_button (GTK_DIALOG (dialog), *buttons, i); } gtk_dialog_set_default_response (GTK_DIALOG (dialog), defval); /* enter-default*/ if(cancelval != -1)/* enable escape ? */ g_signal_connect(G_OBJECT(dialog), "key_press_event", G_CALLBACK(dialog_key_press_event_lcb), dialog); /* kill when escape is hit */ hig_dialog_backend (GTK_DIALOG (dialog), primary, secondary, icon); gtk_widget_show_all (dialog); retval = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); DEBUG_MSG("multi_button_dialog_backend: got %d\n", retval); return (retval == GTK_RESPONSE_DELETE_EVENT) ? cancelval : retval; /* When user hits escape -- give cancelval. */ } /** * single_button_dialog_backend: * @primary #gchar* containing primary dialog message. * @secondary #gchar* containing more explanatory message. Set to NULL if unused. * @icon #gchar* Your stock GTK image, i.e. GTK_STOCK_DIALOG_WARNING. * * Create and display a single-button message-dialog - HiG-style. **/ void single_button_dialog_backend(GtkWidget *win,gchar * primary, gchar * secondary, gchar * icon) { gchar *buttons[] = {GTK_STOCK_OK, NULL}; multi_button_dialog_backend(win,primary, secondary, icon, 0, 0, buttons); } /** * error_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * * Display an error dialog, Gnome HiG style * * Return value: void */ void error_dialog(GtkWidget *win,gchar * primary, gchar * secondary) { single_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_ERROR); } /** * info_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * * Display an informational dialog, Gnome HiG style * * Return value: void */ void info_dialog(GtkWidget *win,gchar * primary, gchar * secondary) { single_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_INFO); } /** * warning_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * * Display a warning dialog, Gnome HiG style * * Return value: void */ void warning_dialog(GtkWidget *win,gchar * primary, gchar * secondary) { single_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_WARNING); } /* multi_button_dialog and multi_stockbutton_dialog was here */ /** * multi_error_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * @defval: #gint default index when user press ENTER. * @cancelval: #gint: default index when user press ESCAPE. Should be something non-fatal. If this value is -1, the escape-button will be disabled. * @buttons: #gchar** NULL terminated array of strings with button labels * * Create a modal error-dialog with several buttons, returning the index of the clicked button * * Return value: #gint the index num of the button label which was clicked so 0 for the first, 1 for the 2nd etc. */ gint multi_error_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons) { return multi_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_ERROR, defval, cancelval, buttons); } /** * multi_warning_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * @defval: #gint default index when user press ENTER. * @cancelval: #gint: default index when user press ESCAPE. Should be something non-fatal. If this value is -1, the escape-button will be disabled. * @buttons: #gchar** NULL terminated array of strings with button labels * * Create a modal warning-dialog with several buttons, returning the index of the clicked button * * Return value: #gint the index num of the button label which was clicked so 0 for the first, 1 for the 2nd etc. */ gint multi_warning_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons) { return multi_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_WARNING, defval, cancelval, buttons); } /** * multi_error_dialog: * @primary: #gchar* the primary error-description * @secondary: #gchar* the secondary description of the error or NULL. * @defval: #gint default index when user press ENTER. * @cancelval: #gint: default index when user press ESCAPE. Should be something non-fatal. If this value is -1, the escape-button will be disabled. * @buttons: #gchar** NULL terminated array of strings with button labels * * Create a modal question-dialog with several buttons, returning the index of the clicked button * * Return value: #gint the index num of the button label which was clicked so 0 for the first, 1 for the 2nd etc. */ gint multi_query_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons) { return multi_button_dialog_backend(win,primary, secondary, GTK_STOCK_DIALOG_QUESTION, defval, cancelval, buttons); } /************************************************************************/ /*********************** PROGRESS-BAR FUNCTIONS *************************/ /************************************************************************/ /* Progress-bar-inspiration from the gtk-tutorial.. */ typedef struct _Tprogress { GtkWidget *bar; gboolean active; /* if FALSE, the bar is set to "confused-mode". */ gboolean show_text; /* TRUE: String added to bar: text " " value " of " maxvalue'*/ gchar *text; /* Optional text to be displayed. */ guint value; /* The current value. */ guint maxvalue; /* The maximum value. Used to calculate a fraction between 0 and 1. */ GtkWidget *owner; /* The widget to be destroyed when the bar is finished. */ guint timer; /* keep track of the timer */ } Tprogress; void progress_destroy(gpointer gp) { if(gp) { Tprogress *p = (Tprogress *) gp; /* bar is destroyed when owner is destroyed. */ if(p->owner) gtk_widget_destroy (p->owner); else gtk_widget_destroy(p->bar); gtk_timeout_remove(p->timer); p->timer = 0; g_free(p); } } static gboolean progress_update(gpointer data) { gchar *msg; Tprogress *p = (Tprogress *) data; gdouble frac = (gdouble) p->value / (gdouble) p->maxvalue; DEBUG_MSG("Entering: progress_update()\n"); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (p->bar), frac); msg = g_strdup_printf (_("%d of %d"), p->value, p->maxvalue); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (p->bar), msg); g_free (msg); if (p->value < p->maxvalue) { /* flush_queue ();*/ return TRUE; /* Yes! Call me again! GIMMI! */ } else { /* We're done! Signal that we're maxed now. */ return FALSE; } } /** * progress_set: * @p The Tprogress struct assigned by a progress-creator. (i.e. progress_popup). * @value a #guint between 0 and p->maxvalue. * * Set a new value for the progressbar-value. Does not actually update the progress-bar. **/ void progress_set(gpointer gp, guint value) { Tprogress *p = (Tprogress *) gp; p->value = value; } /** * progress_popup: * * Creates a popup containing a progress-bar. The dialog disappears when value = maxvalue. * 'text' must be freeed after use! * * Returns: #gpointer camouflaged pointer to struct Tprogress, a data-structure passed to progress_update. **/ gpointer progress_popup(GtkWidget *win,gchar *title, guint maxvalue) { Tprogress *p; p = g_malloc (sizeof (Tprogress)); p->bar = gtk_progress_bar_new (); p->value = 0; p->maxvalue = maxvalue; /* other parameters */ p->active = TRUE; p->show_text = TRUE; p->value = 0; p->maxvalue = maxvalue; p->owner = gtk_dialog_new(); gtk_window_set_modal (GTK_WINDOW (p->owner), TRUE); gtk_window_set_transient_for (GTK_WINDOW (p->owner), GTK_WINDOW(win)); /* Label, if applicable. Append pretty icon! */ hig_dialog_backend(GTK_DIALOG (p->owner), title, NULL, GTK_STOCK_DIALOG_INFO); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (p->owner)->vbox), p->bar, TRUE, TRUE, 12); p->timer = gtk_timeout_add (500, progress_update, p); gtk_widget_show_all (p->owner); return (gpointer) p; } /************************************************************************/ /************************ file_but_* FUNCTIONS **************************/ /************************************************************************/ typedef struct { GtkWidget *entry; Tbfwin *bfwin; gboolean fullpath; } Tfilebut; static void file_but_clicked_lcb(GtkWidget * widget, Tfilebut *fb) { gchar *tmpstring=NULL, /* *tmp2string, */ *setfile; DEBUG_MSG("file_but_clicked_lcb, started, which_entry=%p\n",fb->entry); setfile = gtk_editable_get_chars(GTK_EDITABLE(GTK_ENTRY(fb->entry)),0,-1); /* if setfile is empty we should probably use the current document basedir ? right? */ if (!setfile || strlen(setfile)==0) { if (fb->bfwin->current_document->filename && strlen(fb->bfwin->current_document->filename)) { if (setfile) g_free(setfile); setfile = path_get_dirname_with_ending_slash(fb->bfwin->current_document->filename); } } else if (setfile && strchr(setfile, '/') == NULL && fb->bfwin->current_document->filename) { /* if setfile is a relative name, we should try to make it a full path. relative names have no slashes in the name */ gchar *basedir, *oldsetfile; oldsetfile = setfile; basedir = path_get_dirname_with_ending_slash(fb->bfwin->current_document->filename); setfile = create_full_path(oldsetfile, basedir); g_free(oldsetfile); g_free(basedir); } #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; gchar *tmp2string; dialog = file_chooser_dialog(NULL, _("Select File"), GTK_FILE_CHOOSER_ACTION_OPEN, setfile, TRUE /* local only */, FALSE, NULL); gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(fb->entry))); if ( g_path_is_absolute(setfile) ) {/* valid setfile, BUG#37 */ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),setfile); } if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { tmp2string = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); tmpstring = create_full_path(tmp2string, NULL); g_free(tmp2string); } gtk_widget_destroy(dialog); } #else tmpstring = return_file(setfile); #endif g_free(setfile); DEBUG_MSG("file_but_clicked_lcb, return_file returned %s\n",tmpstring); if (tmpstring) { if (!fb->fullpath/*&& fb->bfwin*/) { tmpstring = g_path_get_basename(tmpstring); } gtk_entry_set_text(GTK_ENTRY(fb->entry), tmpstring); /* perhaps I break something by commenting-out this call, but otherwise the dialog is sometimes started again after the signal is emmitted gtk_signal_emit_by_name(GTK_OBJECT(which_entry), "activate"); g_free(tmp2string); */ } } static void file_but_destroy(GtkObject *object, Tfilebut *fb) { g_free(fb); } /** * file_but_new: * @which_entry: #GtkWidget* GTK_ENTRY where to put the filename * @win: #GtkWidget* the GTK_WINDOW where the button is placed * @full_pathname: #gint 1 or 0, if you want the full path or a relative path * #bfwin: #Tbfwin, only required if you want a relative pathname * * Create new "open file" button, that will put the string into an entry * * Return value: #GtkWidget* pointer to file button */ GtkWidget *file_but_new(GtkWidget * which_entry, gint full_pathname, Tbfwin *bfwin) { GtkWidget *file_but; Tfilebut *fb; fb = g_new(Tfilebut,1); fb->entry = which_entry; fb->bfwin = bfwin; fb->fullpath = full_pathname; file_but = gtk_button_new(); g_signal_connect(G_OBJECT(file_but), "destroy", G_CALLBACK(file_but_destroy), fb); DEBUG_MSG("file_but_new, entry=%p, button=%p\n",which_entry,file_but); gtk_container_add(GTK_CONTAINER(file_but), hbox_with_pix_and_text(_("_Browse..."), 112,TRUE)); g_signal_connect(G_OBJECT(file_but), "clicked", G_CALLBACK(file_but_clicked_lcb), fb); gtk_widget_show(file_but); return file_but; } /************************************************************************/ /************ FILE SELECTION FUNCTIONS ******************************/ /************************************************************************/ #ifdef HAVE_ATLEAST_GTK_2_4 static void viewlocal_toggled_lcb(GtkToggleButton *togglebutton,GtkWidget *dialog) { g_object_set(G_OBJECT(dialog), "show-hidden", togglebutton->active, NULL); } static void file_chooser_set_current_dir(GtkWidget *dialog, gchar *dir) { if (dir) { if (dir[0] == '/') gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),dir); else gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(dialog),dir); } } GtkWidget * file_chooser_dialog(Tbfwin *bfwin, gchar *title, GtkFileChooserAction action, gchar *set, gboolean localonly, gboolean multiple, const gchar *filter) { GtkWidget *vbox, *hbox, *dialog, *viewlocal; /* kyanh, removed, 20050619 dialog = gtk_file_chooser_dialog_new_with_backend(title,bfwin ? GTK_WINDOW(bfwin->main_window) : NULL, action,"gnome-vfs", GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, (action == GTK_FILE_CHOOSER_ACTION_SAVE) ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); */ dialog = gtk_file_chooser_dialog_new(title,bfwin ? GTK_WINDOW(bfwin->main_window) : NULL, action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, (action == GTK_FILE_CHOOSER_ACTION_SAVE) ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); if (set && strlen(set)) { DEBUG_MSG("file_chooser_dialog, set=%s,localonly=%d\n",set,localonly); if (localonly || strchr(set,':')==NULL) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),set); } else { gtk_file_chooser_set_uri(GTK_FILE_CHOOSER(dialog),set); } } else if (!localonly && bfwin) { /* localonly is used for the project files */ if (action == GTK_FILE_CHOOSER_ACTION_SAVE) { DEBUG_MSG("file_chooser_dialog, opendir=%s, savedir=%s\n",bfwin->session->opendir,bfwin->session->savedir); if (bfwin->session->savedir) file_chooser_set_current_dir(dialog,bfwin->session->savedir); else if (bfwin->session->opendir) file_chooser_set_current_dir(dialog,bfwin->session->opendir); } else { DEBUG_MSG("file_chooser_dialog, opendir=%s\n",bfwin->session->opendir); file_chooser_set_current_dir(dialog,bfwin->session->opendir); } } #ifdef DEBUG DEBUG_MSG("file_chooser_dialog, current_folder_uri=%s\n", gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(dialog))); #endif gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog),localonly); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), multiple); vbox = gtk_vbox_new(FALSE, 5); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); viewlocal = boxed_checkbut_with_value(_("Show hidden"), 0, hbox); g_signal_connect(G_OBJECT(viewlocal), "toggled", G_CALLBACK(viewlocal_toggled_lcb), dialog); gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog),vbox); if (action == GTK_FILE_CHOOSER_ACTION_OPEN || action == GTK_FILE_CHOOSER_ACTION_SAVE){ GList *tmplist; GtkFileFilter* ff; ff = gtk_file_filter_new(); gtk_file_filter_set_name(ff,_("All files")); gtk_file_filter_add_pattern(ff, "*"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), ff); if (filter == NULL) { gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), ff); } tmplist = g_list_first(main_v->filetypelist); while (tmplist) { gchar **tmp; Tfiletype *ft = (Tfiletype *)tmplist->data; if ((strcmp(ft->type, "objectfile") != 0) && ft->extensions && *ft->extensions) { ff = gtk_file_filter_new(); gtk_file_filter_set_name(ff,ft->type); DEBUG_MSG("file_chooser_dialog, adding filter '%s'\n", ft->type); tmp = ft->extensions; while (*tmp) { gchar *pattern; pattern = g_strconcat("*", *tmp, NULL); gtk_file_filter_add_pattern(ff, pattern); DEBUG_MSG("file_chooser_dialog, adding pattern '%s' to '%s'\n", pattern, ft->type); g_free(pattern); tmp++; } gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), ff); if (filter && strcmp(filter, ft->type) == 0) gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), ff); } tmplist = g_list_next(tmplist); } } gtk_widget_show_all(vbox); return dialog; } #else typedef struct { gboolean select_dir; gint multipleselect; gchar *filename_to_return; GList *filenames_to_return; GtkWidget *fs; } Tfileselect; static void fs_ok_clicked_lcb(GtkWidget * widget, Tfileselect *fileselect) { gchar *dirname, *selected_file; selected_file = get_utf8filename_from_on_disk_encoding(gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselect->fs))); if (g_file_test(selected_file, G_FILE_TEST_IS_DIR)) { DEBUG_MSG("fs_ok_clicked_lcb,file_is_dir said %s is a dir!!!!\n", selected_file); if (fileselect->select_dir) { fileselect->filename_to_return = g_path_get_dirname(selected_file); g_free(selected_file); gtk_main_quit(); window_destroy(GTK_WIDGET(fileselect->fs)); return; } else { dirname = ending_slash(selected_file); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselect->fs), dirname); gtk_entry_set_text(GTK_ENTRY(GTK_FILE_SELECTION(fileselect->fs)->selection_entry), ""); g_free(dirname); g_free(selected_file); return; } } else { DEBUG_MSG("fs_ok_clicked_lcb,file_is_dir said %s is NOT a dir.\n", selected_file); } if (fileselect->multipleselect) { gchar **filenames, **orig; /* multiple files allowed --> scan trough the list for selections */ orig = filenames = gtk_file_selection_get_selections(GTK_FILE_SELECTION(fileselect->fs)); if (filenames) { while (*filenames) { fileselect->filenames_to_return = g_list_append(fileselect->filenames_to_return, get_utf8filename_from_on_disk_encoding(*filenames)); filenames++; } g_strfreev(orig); } } else { /* NO multiple files allowed --> return just one file */ if (fileselect->select_dir) { fileselect->filename_to_return = g_path_get_dirname(selected_file); } else { fileselect->filename_to_return = g_strdup(selected_file); } } if ((fileselect->multipleselect && (g_list_length(fileselect->filenames_to_return) < 1)) || (!fileselect->multipleselect && strlen(fileselect->filename_to_return) < 1)){ /* statusbar_message(_("No file to insert."), 2000);*/ } g_free(selected_file); gtk_main_quit(); window_destroy(GTK_WIDGET(fileselect->fs)); } void close_modal_window_lcb(GtkWidget * widget, gpointer window) { DEBUG_MSG("close_modal_window_lcb, widget=%p, window=%p\n", widget, window); gtk_main_quit(); window_destroy(window); } static void fs_history_pulldown_activate_lcb(GtkWidget *menuitem,Tfileselect *fileselect) { const gchar *filename = gtk_entry_get_text(GTK_ENTRY(GTK_FILE_SELECTION(fileselect->fs)->selection_entry)); gchar *dirname = ending_slash(gtk_label_get_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menuitem))))); gchar *fullpath = g_strconcat(dirname, filename, NULL); g_free(dirname); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselect->fs), fullpath); g_free(fullpath); } static void fs_history_pulldown_changed(GtkOptionMenu *optionmenu,Tfileselect *fileselect) { GtkWidget *menuitem, *menu; GList *tmplist; DEBUG_MSG("fs_history_pulldown_changed\n"); menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optionmenu)); tmplist = g_list_first(main_v->recent_directories); while (tmplist) { menuitem = gtk_menu_item_new_with_label((gchar *)tmplist->data); g_signal_connect(G_OBJECT(menuitem),"activate",G_CALLBACK(fs_history_pulldown_activate_lcb),fileselect); gtk_widget_show(menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); tmplist = g_list_next(tmplist); } } static void fileselectwin(gchar *setfile, Tfileselect *fileselect, gchar *title) { fileselect->fs = gtk_file_selection_new(title); DEBUG_MSG("fileselectwin, started, fileselect->fs=%p\n", fileselect->fs); gtk_file_selection_show_fileop_buttons(GTK_FILE_SELECTION(fileselect->fs)); /*gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(fileselect->fs));*/ g_signal_connect(G_OBJECT(fileselect->fs), "destroy", G_CALLBACK(close_modal_window_lcb), fileselect->fs); g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileselect->fs)->cancel_button), "clicked", G_CALLBACK(close_modal_window_lcb), fileselect->fs); g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileselect->fs)->ok_button), "clicked", G_CALLBACK(fs_ok_clicked_lcb), fileselect); g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileselect->fs)->history_pulldown), "changed", G_CALLBACK(fs_history_pulldown_changed), fileselect); if (fileselect->multipleselect) { gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(fileselect->fs), TRUE); } if (setfile) { gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselect->fs), setfile); } gtk_window_set_role(GTK_WINDOW(fileselect->fs), "fileselect"); gtk_widget_show(fileselect->fs); /* gtk_grab_add(GTK_WIDGET(fileselect->fs));*/ gtk_widget_realize(GTK_WIDGET(fileselect->fs)); if (setfile) { /* this only has effect after the widget is shown */ gtk_editable_select_region(GTK_EDITABLE(GTK_FILE_SELECTION(fileselect->fs)->selection_entry),0,-1); } /* When you closed the the file selector dialog focus always returned to the bluefish main window changed to use gtk_widget_get_parent so focus returns to the dialog that opened the file selector */ DEBUG_MSG("gtk_widget_fet_parent returns %p\n",gtk_widget_get_parent(fileselect->fs)); { GtkWidget *parent = gtk_widget_get_parent(fileselect->fs); if (parent) { gtk_window_set_transient_for(GTK_WINDOW(fileselect->fs), GTK_WINDOW(parent)); } } } /** * return_file_w_title: * @setfile: #gchar* the file to intitially set the dialog with * @title: #gchar* with the dialog title * * makes a modal dialog with title that will return a file * * Return value: #gchar* with the selected filename */ gchar *return_file_w_title(gchar * setfile, gchar *title) { Tfileselect fileselect={FALSE, 0, NULL, NULL, NULL}; fileselectwin(setfile, &fileselect, title); gtk_main(); return fileselect.filename_to_return; } /** * return_file: * @setfile: #gchar* the file to intitially set the dialog with * * makes a modal dialog that will return a file * * Return value: #gchar* with the selected filename */ gchar *return_file(gchar * setfile) { return return_file_w_title(setfile, _("Select file")); } /** * return_files_w_title: * @setfile: #gchar* the file to intitially set the dialog with * @title: #gchar* with the dialog title * * makes a modal dialog that will return multiple files * * Return value: #GList* containing a stringlist with all selected files */ GList *return_files_w_title(gchar * setfile, gchar *title) { Tfileselect fileselect={FALSE, 1, NULL, NULL, NULL}; fileselectwin(setfile, &fileselect, title); gtk_main(); return fileselect.filenames_to_return; } /** * return_files: * @setfile: #gchar* the file to intitially set the dialog with * * makes a modal dialog that will return multiple files * * Return value: #GList* containing a stringlist with all selected files */ GList *return_files(gchar * setfile) { return return_files_w_title(setfile, _("Select files")); } /** * return_dir: * @setdir: #gchar* the dir to intitially set the dialog with * @title: #gchar* with the dialog title * * makes a modal dialog that will return a directory * * Return value: #gchar* with the selected directory */ gchar *return_dir(gchar *setdir, gchar *title) { Tfileselect fileselect={TRUE, 0, NULL, NULL, NULL}; fileselectwin(setdir, &fileselect, title); gtk_main(); return fileselect.filename_to_return; } #endif /* HAVE_ATLEAST_GTK_2_4 */ /************************************************************************/ static void ungroupradoiitems(GtkWidget *menu) { GList *tmplist = g_list_first(GTK_MENU_SHELL(menu)->children); while (tmplist) { GtkWidget *sub; DEBUG_MSG("ungroupradiomenuitems, another item\n"); if (GTK_IS_RADIO_MENU_ITEM(tmplist->data)) { DEBUG_MSG("%p is a radiomenu item, ungrouped!\n",tmplist->data); gtk_radio_menu_item_set_group(tmplist->data,NULL); } sub = gtk_menu_item_get_submenu(tmplist->data); if (sub) ungroupradoiitems(sub); tmplist = g_list_next(tmplist); } } void destroy_disposable_menu_cb(GtkWidget *widget, GtkWidget *menu) { ungroupradoiitems(menu); gtk_widget_destroy(GTK_WIDGET(menu)); } /*********************************************************************** * workarounds for gtk-2.0 * these functions are not needed with gtk-2.2 */ #ifndef HAVE_ATLEAST_GTK_2_2 static GtkTreePath *gtktreepath_up_multi(GtkTreePath *path, gint num) { while (num > 0) { gtk_tree_path_up(path); num--; } return path; } void gtktreepath_expand_to_root(GtkWidget *tree, const GtkTreePath *this_path) { gint num = gtk_tree_path_get_depth((GtkTreePath *)this_path); while (num >= 0) { GtkTreePath *path = gtk_tree_path_copy(this_path); path = gtktreepath_up_multi(path, num); /* g_signal_handlers_block_matched(G_OBJECT(tree), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, row_expanded_lcb, NULL);*/ gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path, FALSE); /* g_signal_handlers_unblock_matched(G_OBJECT(tree), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, row_expanded_lcb, NULL);*/ gtk_tree_path_free(path); num--; } } #endif /* ifndef HAVE_ATLEAST_GTK_2_2 */ winefish-1.3.3/src/html.h0000600000047200004720000000230510373411041014226 0ustar kyanhkyanh/* $Id: html.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * html.h - menu/toolbar callback prototypes * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __HTML_H_ #define __HTML_H_ /* void insert_char_cb(Tbfwin* bfwin,guint callback_action, GtkWidget *widget); */ void general_html_menu_cb(Tbfwin* bfwin,guint callback_action, GtkWidget *widget); #endif /* __HTML_H_ */ winefish-1.3.3/src/bookmark.h0000600000047200004720000000405210373411041015070 0ustar kyanhkyanh/* $Id: bookmark.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) - bookmarks * * Copyright (C) 2003 Oskar Swida * modifications (C) 2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __BOOKMARK_H__ #define __BOOKMARK_H__ void bmark_store_all(Tbfwin *bfwin); GtkWidget *bmark_gui(Tbfwin *bfwin); /* used in gui.c to build the bookmark panel */ void bmark_init(void); /* only used once from bluefish.c */ void bmark_reload(Tbfwin *bfwin); void bmark_set_store(Tbfwin *bfwin); void bmark_clean_for_doc(Tdocument *doc); /* set bookmark's doc to NULL when closing file */ void bmark_set_for_doc(Tdocument *doc); /* set bookmark's doc to proper doc when opening file */ GHashTable *bmark_get_bookmarked_lines(Tdocument * doc, GtkTextIter *fromit, GtkTextIter *toit); void bmark_add_extern(Tdocument *doc, gint offset, const gchar *name, const gchar *text, gboolean is_temp); void bmark_add(Tbfwin *bfwin); gboolean bmark_have_bookmark_at_stored_bevent(Tdocument * doc); void bmark_store_bevent_location(Tdocument * doc, gint charoffset); void bmark_del_at_bevent(Tdocument *doc); void bmark_add_at_bevent(Tdocument *doc); void bmark_del_all(Tbfwin *bfwin,gboolean ask); void bmark_check_length(Tbfwin *bfwin,Tdocument *doc); void bmark_cleanup(Tbfwin *bfwin); #endif /* __BOOKMARK_H__ */ winefish-1.3.3/src/gtk_easy.h0000600000047200004720000001566410366640206015115 0ustar kyanhkyanh/* $Id: gtk_easy.h 1712 2006-01-28 09:59:34Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __GTK_EASY_H_ #define __GTK_EASY_H_ #define FILE_CHOOSER_USE_VFS(dialog) (g_object_set_data(G_OBJECT(dialog),"GnomeFileSelectorEnableVFS",GINT_TO_POINTER(1))) /* GtkWindowPosition can be GTK_WIN_POS_NONE GTK_WIN_POS_CENTER GTK_WIN_POS_MOUSE */ typedef enum { none, file, font } Textra_but; void flush_queue(void); gint widget_get_string_size(GtkWidget *widget, gchar *string); void widget_set_visible(GtkWidget *widget, gboolean visible); /* Single-button dialogs*/ void single_button_dialog_backend(GtkWidget *win,gchar * primary, gchar * secondary, gchar * icon); void error_dialog(GtkWidget *win,gchar * primary, gchar * secondary); void warning_dialog(GtkWidget *win,gchar * primary, gchar * secondary); void info_dialog(GtkWidget *win,gchar * primary, gchar * secondary); /* Multi-button dialogs */ gint multi_error_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons); gint multi_warning_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons); gint multi_query_dialog(GtkWidget *win,gchar *primary, gchar *secondary, gint defval, gint cancelval, gchar **buttons); /* Progress bar */ void progress_set(gpointer gp, guint value); gpointer progress_popup(GtkWidget *win,gchar *title, guint maxvalue); void progress_destroy(gpointer gp); void setup_toggle_item(GtkItemFactory * ifactory, gchar * path, gint state); #define setup_toggle_item_from_widget(var1, var2, var3) setup_toggle_item(gtk_item_factory_from_widget(var1), var2, var3) #define menuitem_set_sensitive(menubar, path, state) gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtk_item_factory_from_widget(menubar), path), state) void string_apply(gchar ** config_var, GtkWidget * entry); void integer_apply(gint *config_var, GtkWidget * widget, gboolean is_checkbox); void bitwise_apply(guint32 *config_var, GtkWidget * widget, gboolean is_checkbox, guint32 BIT); GtkWidget *combo_with_popdown(const gchar * setstring, GList * which_list, gint editable); GtkWidget *boxed_combo_with_popdown(const gchar * setstring, GList * which_list, gint editable, GtkWidget *box); GtkWidget *combo_with_popdown_sized(const gchar * setstring, GList * which_list, gint editable, gint width); GtkWidget *entry_with_text(const gchar * setstring, gint max_lenght); GtkWidget *boxed_entry_with_text(const gchar * setstring, gint max_lenght, GtkWidget *box); GtkWidget *boxed_full_entry(const gchar * labeltext, gchar * setstring,gint max_lenght, GtkWidget * box); GtkWidget *checkbut_with_value(gchar *labeltext, gint which_config_int); GtkWidget *boxed_checkbut_with_value(gchar *labeltext, gint which_config_int, GtkWidget * box); GtkWidget *radiobut_with_value(gchar *labeltext, gint enabled, GtkRadioButton *prevbut); GtkWidget *boxed_radiobut_with_value(gchar *labeltext, gint enabled, GtkRadioButton *prevbut, GtkWidget *box); GtkWidget *spinbut_with_value(gchar *value, gfloat lower, gfloat upper, gfloat step_increment, gfloat page_increment); GtkWidget *optionmenu_with_value(gchar **options, gint curval); GtkWidget *boxed_optionmenu_with_value(const gchar *labeltext, gint curval, GtkWidget *box, gchar **options); GtkWidget *window_with_title(const gchar * title, GtkWindowPosition position, gint borderwidth); #define window_full(title,position,borderwidth,close_func,close_data,delete_on_escape) window_full2(title,position,borderwidth,close_func,close_data,delete_on_escape,NULL) GtkWidget *window_full2(const gchar * title, GtkWindowPosition position, gint borderwidth, GCallback close_func, gpointer close_data, gboolean delete_on_escape, GtkWidget *transientforparent); GtkWidget *textview_buffer_in_scrolwin(GtkWidget **textview, gint width, gint height, const gchar *contents, GtkWrapMode wrapmode); void window_destroy(GtkWidget * windowname); void window_close_by_widget_cb(GtkWidget * widget, gpointer data); void window_close_by_data_cb(GtkWidget * widget, gpointer data); GtkWidget *apply_font_style(GtkWidget * this_widget, gchar * fontstring); GtkWidget *hbox_with_pix_and_text(const gchar *label, gint bf_pixmaptype, gboolean w_mnemonic); GtkWidget *bf_allbuttons_backend(const gchar *label, gboolean w_mnemonic, gint bf_pixmaptype , GCallback func, gpointer func_data ); #define bf_generic_button_with_image(label,pixmap_type,func,func_data) bf_allbuttons_backend(label,FALSE,pixmap_type,func,func_data) #define bf_generic_mnemonic_button(label,func,func_data) bf_allbuttons_backend(label,TRUE,-1,func,func_data) GtkWidget *bf_gtkstock_button(const gchar * stock_id, GCallback func, gpointer func_data); #define bf_stock_ok_button(func, data) bf_gtkstock_button(GTK_STOCK_OK, func, data) #define bf_stock_cancel_button(func, data) bf_gtkstock_button(GTK_STOCK_CANCEL, func, data) GtkWidget *bf_generic_frame_new(const gchar *label, GtkShadowType shadowtype, gint borderwidth); void bf_mnemonic_label_tad_with_alignment(const gchar *labeltext, GtkWidget *m_widget, gfloat xalign, gfloat yalign, GtkWidget *table, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach); GtkWidget *bf_label_with_markup(const gchar *labeltext); void bf_label_tad_with_markup(const gchar *labeltext, gfloat xalign, gfloat yalign, GtkWidget *table, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach); GtkWidget *file_but_new(GtkWidget * which_entry, gint full_pathname, Tbfwin *bfwin); #ifdef HAVE_ATLEAST_GTK_2_4 GtkWidget * file_chooser_dialog(Tbfwin *bfwin, gchar *title, GtkFileChooserAction action, gchar *set, gboolean localonly, gboolean multiple, const gchar *filter); #else void close_modal_window_lcb(GtkWidget * widget, gpointer window); gchar *return_file_w_title(gchar * setfile, gchar *title); gchar *return_file(gchar * setfile); GList *return_files_w_title(gchar * setfile, gchar *title); GList *return_files(gchar * setfile); gchar *return_dir(gchar *setdir, gchar *title); #endif void destroy_disposable_menu_cb(GtkWidget *widget, GtkWidget *menu); #ifndef HAVE_ATLEAST_GTK_2_2 void gtktreepath_expand_to_root(GtkWidget *tree, const GtkTreePath *this_path); #endif #endif winefish-1.3.3/src/winefish.c0000600000047200004720000002531010375350210015074 0ustar kyanhkyanh/* $Id: winefish.c 1984 2006-02-17 13:32:56Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * * Original File: bluefish.c - the main function * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include /* getopt() */ #include /* getopt() exit() and abort() on Solaris */ #include /* nanosleep */ #include /* strcmp */ #include "bluefish.h" #ifdef HAVE_ATLEAST_GNOMEUI_2_6 #include #endif #ifdef ENABLE_NLS #include #endif #include "document.h" /* */ #include "gui.h" /* gui_create_main() */ #include "fref.h" /* fref_init() */ #include "bookmark.h" /* bmark_init() */ #include "rcfile.h" /* rcfile_parse_main() */ #include "bf_lib.h" /* create_full_path() */ #include "highlight.h" /* hl_init() */ #include "msg_queue.h" /* msg_queue_start()*/ #include "stringlist.h" /* put_stringlist(), get_stringlist() */ #include "gtk_easy.h" /* flush_queue() */ #include "filebrowser.h" /* filters_rebuild() */ #include "project.h" /* kyanh, removed, 20050309 */ /*#include "authen.h" *//* set_authen_callbacks() */ #include "autox.h" /* kyanh, completion */ #include "snooper.h" /* snooper_install() */ /*********************************************/ /* this var is global for all bluefish files */ /*********************************************/ Tmain *main_v; /********************************/ /* functions used in bluefish.c */ /********************************/ #ifndef __GNUC__ void g_none(gchar *first, ...) { return; } #endif static gint parse_commandline(int argc, char **argv , gboolean *root_override , GList **load_filenames , GList **load_projects , gboolean *open_in_new_win , gint *linenumber ) { int c; gchar *tmpname; opterr = 0; DEBUG_MSG("parse_commandline, started\n"); while ((c = getopt(argc, argv, "hsvn:l:p:?")) != -1) { switch (c) { case 's': *root_override = 1; break; case 'v': g_print(CURRENT_VERSION_NAME); g_print("\n"); exit(1); break; case 'p': tmpname = create_full_path(optarg, NULL); *load_projects = g_list_append(*load_projects, tmpname); break; case 'l': *linenumber = strtoul(optarg, NULL,10); break; case 'h': case '?': g_print(CURRENT_VERSION_NAME); g_print(_("\nUsage: %s [options] [filenames ...]\n"), argv[0]); g_print(_("\nCurrently accepted options are:\n")); g_print(_("-s skip root check\n")); g_print(_("-v current version\n")); g_print(_("-n 0|1 open new window (1) or not (0)\n")); g_print(_("-p filename open project\n")); g_print(_("-l number set line. Negative value takes no effect.\n")); g_print(_("-h this help screen\n")); exit(1); break; case 'n': if (strncmp(optarg,"0",1)==0) { *open_in_new_win = 0; }else{ *open_in_new_win = 1; } break; default: DEBUG_MSG("parse_commandline, abort ?!?\n"); abort(); } } DEBUG_MSG("parse_commandline, optind=%d, argc=%d\n", optind, argc); while (optind < argc) { /* related to BUG#93 */ /*if (file_exists_and_readable(argv[optind])){*/ tmpname = create_full_path(argv[optind], NULL); DEBUG_MSG("parse_commandline, argv[%d]=%s, tmpname=%s\n", optind, argv[optind], tmpname); *load_filenames = g_list_append(*load_filenames, tmpname); /*}else{ g_print("winefish: file '%s' is unreadable\n", argv[optind]); }*/ optind++; } DEBUG_MSG("parse_commandline, finished, num files=%d, num projects=%d\n" , g_list_length(*load_filenames), g_list_length(*load_projects)); return 0; } /*********************/ /* the main function */ /*********************/ int main(int argc, char *argv[]) { gboolean root_override=FALSE, open_in_new_window = FALSE; GList *filenames = NULL, *projectfiles=NULL; gint linenumber = -1; Tbfwin *firstbfwin; #ifndef NOSPLASH GtkWidget *splash_window; #endif /* #ifndef NOSPLASH */ #ifdef ENABLE_NLS setlocale(LC_ALL,""); bindtextdomain(PACKAGE,LOCALEDIR); DEBUG_MSG("set bindtextdomain for %s to %s\n",PACKAGE,LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #endif #ifdef HAVE_ATLEAST_GNOMEUI_2_6 gnome_init(PACKAGE, VERSION, argc, argv); #else gtk_init(&argc, &argv); #endif /* HAVE_ATLEAST_GNOMEUI_2_6 */ main_v = g_new0(Tmain, 1); main_v->session = g_new0(Tsessionvars,1); DEBUG_MSG("main, main_v is at %p\n", main_v); rcfile_check_directory(); rcfile_parse_main(); parse_commandline(argc, argv, &root_override, &filenames, &projectfiles, &open_in_new_window, &linenumber); #ifdef WITH_MSG_QUEUE if (((filenames || projectfiles) && (main_v->props.view_bars & MODE_REUSE_WINDOW)) || open_in_new_window) { msg_queue_start(filenames, projectfiles, linenumber, open_in_new_window); } #endif /* WITH_MSG_QUEUE */ #ifndef NOSPLASH /* start splash screen somewhere here */ splash_window = start_splash_screen(); splash_screen_set_label(_("parsing highlighting file...")); #endif /* #ifndef NOSPLASH */ { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/dir_history", NULL); main_v->recent_directories = get_stringlist(filename, NULL); g_free(filename); } rcfile_parse_global_session(); rcfile_parse_highlighting(); #ifndef NOSPLASH splash_screen_set_label(_("compiling highlighting patterns...")); #endif /* #ifndef NOSPLASH */ hl_init(); #ifndef NOSPLASH splash_screen_set_label(_("initialize some other things...")); #endif /* #ifndef NOSPLASH */ filebrowserconfig_init(); filebrowser_filters_rebuild(); autoclosing_init(); #ifndef NOSPLASH splash_screen_set_label(_("parsing autotext and words file...")); #endif /* #ifndef NOSPLASH */ autotext_init(); completion_init(); #ifndef NOSPLASH splash_screen_set_label(_("parsing custom menu file...")); #endif /* #ifndef NOSPLASH */ rcfile_parse_custom_menu(FALSE,FALSE); main_v->tooltips = gtk_tooltips_new(); /* initialize the completion window */ main_v->completion.window = NULL; fref_init(); bmark_init(); #ifdef WITH_MSG_QUEUE if (!filenames && !projectfiles && (main_v->props.view_bars & MODE_REUSE_WINDOW)) { msg_queue_start(NULL, NULL, -1, open_in_new_window); } #endif /* WITH_MSG_QUEUE */ #ifndef NOSPLASH splash_screen_set_label(_("creating main gui...")); #endif /* #ifndef NOSPLASH */ /* create the first window */ firstbfwin = g_new0(Tbfwin,1); firstbfwin->session = main_v->session; firstbfwin->bookmarkstore = main_v->bookmarkstore; main_v->bfwinlist = g_list_append(NULL, firstbfwin); gui_create_main(firstbfwin, filenames, linenumber); bmark_reload(firstbfwin); #ifndef NOSPLASH splash_screen_set_label(_("showing main gui...")); #endif /* #ifndef NOSPLASH */ /* set GTK settings, must be AFTER the menu is created */ { gchar *shortcutfilename; GtkSettings* gtksettings = gtk_settings_get_default(); g_object_set(G_OBJECT(gtksettings), "gtk-can-change-accels", TRUE, NULL); shortcutfilename = g_strconcat(g_get_home_dir(), "/.winefish/menudump_2", NULL); gtk_accel_map_load(shortcutfilename); g_free(shortcutfilename); } gui_show_main(firstbfwin); /* if (main_v->props.view_html_toolbar && main_v->globses.quickbar_items == NULL) { info_dialog(firstbfwin->main_window, _("Winefish tip:"), _("This message is shown since you DONOT have any items in the QuickBar.\n\nIf you right-click a button in the Standard toolbars you can add buttons to the Quickbar.")); } */ if (projectfiles) { GList *tmplist = g_list_first(projectfiles); while (tmplist) { project_open_from_file(firstbfwin, tmplist->data, linenumber); tmplist = g_list_next(tmplist); } } #ifndef NOSPLASH DEBUG_MSG("destroy splash\n"); flush_queue(); { static struct timespec const req = { 0, 10000000}; nanosleep(&req, NULL); } gtk_widget_destroy(splash_window); #endif /* #ifndef NOSPLASH */ /* snooper must be installed after the main gui has shown; otherwise the program may be aborted */ snooper_install(); DEBUG_MSG("main, before gtk_main()\n"); gtk_main(); DEBUG_MSG("main, after gtk_main()\n"); #ifdef WITH_MSG_QUEUE /* do the cleanup */ msg_queue_cleanup(); #endif /* WITH_MSG_QUEUE */ DEBUG_MSG("Winefish: exiting cleanly\n"); return 0; } void bluefish_exit_request() { GList *tmplist; gboolean tmpb; DEBUG_MSG("winefish_exit_request, started\n"); /* if we have modified documents we have to do something, file_close_all_cb() does exactly want we want to do */ tmplist = return_allwindows_documentlist(); tmpb = (tmplist && test_docs_modified(tmplist)); g_list_free(tmplist); tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { /* if there is a project, we anyway want to save & close the project */ if (BFWIN(tmplist->data)->project) { if (!project_save_and_close(BFWIN(tmplist->data))) { /* cancelled or error! */ DEBUG_MSG("winefish_exit_request, project_save_and_close returned FALSE\n"); return; } } if (tmpb) { file_close_all_cb(NULL, BFWIN(tmplist->data)); } tmplist = g_list_next(tmplist); } /* if we still have modified documents we don't do a thing, if we don't have them we can quit */ if (tmpb) { tmplist = return_allwindows_documentlist(); tmpb = (tmplist && test_docs_modified(tmplist)); g_list_free(tmplist); if (tmpb) { return; } } /* gtk_widget_hide(main_v->main_window);*/ tmplist = g_list_first(gtk_window_list_toplevels()); gchar *role=NULL; while (tmplist) { /* BUG#38 */ if (GTK_IS_WIDGET(tmplist->data)) { role = g_strdup(gtk_window_get_role ((GtkWindow*)tmplist->data)); gtk_widget_hide(GTK_WIDGET(tmplist->data)); if (role && strncmp(role,"html_dialog",11) ==0) { window_destroy(GTK_WIDGET(tmplist->data)); } } /* g_print("type = %s, role=%s\n", GTK_OBJECT_TYPE_NAME((GtkObject*) tmplist->data), role); */ tmplist = g_list_next(tmplist); } g_free(role); flush_queue(); rcfile_save_all(); { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/dir_history", NULL); put_stringlist_limited(filename, main_v->recent_directories, main_v->props.max_dir_history); g_free(filename); } gtk_main_quit(); } winefish-1.3.3/src/document.c0000600000047200004720000052724410411777630015125 0ustar kyanhkyanh/* $Id: document.c 2250 2006-03-27 15:07:04Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * document.c - the document * * Copyright (C) 1998-2004 Olivier Sessink * Copyright (C) 1998 Chris Mazuc * Some additions Copyright (C) 2004 Eugene Morenko(More) * * Modified for Winefish (C) 2005 2006 kyanh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* this is needed for Solaris to comply with the latest POSIX standard * regarding the ctime_r() function * the problem is that it generates a compiler warning on Linux, lstat() undefined.. */ /* Michèle Garoche, 20060208 */ #ifdef PLATFORM_SOLARIS #define _POSIX_C_SOURCE 200312L #endif /* PLATFORM_SOLARIS */ #include #include /* for the keyboard event codes */ #include /* stat() */ #include /* stat() */ #include /* stat() */ #include /* fopen() */ #include /* strchr() */ #include /* regcomp() */ #include /* system() */ #include /* ctime_r() */ #include /* #define DEBUG */ #ifdef DEBUGPROFILING #include #endif #include "bluefish.h" #include "document.h" #include "highlight.h" /* all highlight functions */ #include "gui.h" /* statusbar_message() */ #include "bf_lib.h" #include "menu.h" /* add_to_recent_list */ #include "stringlist.h" /* free_stringlist() */ #include "gtk_easy.h" /* *_dialog() */ #include "undo_redo.h" /* doc_unre_init() */ #include "char_table.h" /* convert_utf8...() */ #include "pixmap.h" #include "snr2.h" /* snr2_run_extern_replace */ #include "filebrowser.h" #include "bookmark.h" #include "autox.h" /* autotext_done() */ #include "snooper.h" #include "brace_finder.h" /* VALID_BRACE */ #include "func_grep.h" #ifndef DELIMITERS #define DELIMITERS " `1234567890-=~!@#$%^&*()_+[]{};':\",./<>?\\|" /* TODO: @ for latex package writer */ #endif /* DELIMITERS */ #ifndef COMMAND_MAX_LENGTH #define COMMAND_MAX_LENGTH 15 #endif /* COMMAND_MAX_LENGTH */ #ifndef AUTOTEXT_MAX_LENGTH #define AUTOTEXT_MAX_LENGTH 15 #endif /* AUTOTEXT_MAX_LENGTH */ typedef struct { GtkWidget *textview; GtkWidget *window; } Tfloatingview; #define FLOATINGVIEW(var) ((Tfloatingview *)(var)) typedef struct { gint so; gint eo; } Tpasteoperation; #define PASTEOPERATION(var) ((Tpasteoperation *)(var)) void autoclosing_init( void ) { const char * error; int erroffset; main_v->autoclosingtag_regc = pcre_compile( "\\\\begin{([a-zA-Z]+\\*{0,1})?}$", PCRE_DOLLAR_ENDONLY, &error, &erroffset, NULL ); #ifdef DEBUG if ( !main_v->autoclosingtag_regc ) { DEBUG_MSG( "autoclosing_init, ERROR, %s\n", error ); } #endif #ifdef HAVE_CONTEXT main_v->autoclosingtag_be_regc = pcre_compile("\\\\(begin|start)([a-zA-Z]+)$", 0, &error, &erroffset, NULL ); #else main_v->autoclosingtag_be_regc = pcre_compile("\\\\(begin)([a-zA-Z]+)$", 0, &error, &erroffset, NULL ); #endif main_v->anycommand_regc = pcre_compile("\\\\[a-z]+$", PCRE_CASELESS|PCRE_DOLLAR_ENDONLY, &error, &erroffset, NULL ); } /** * return_allwindows_documentlist: * * returns a documentlist with all documents in all windows, the list should be freed, the Tdocuments obviously not * * Return value: #GList* with all documents */ GList *return_allwindows_documentlist() { GList * newdoclist = NULL, *bflist, *tmplist = NULL; bflist = g_list_first( main_v->bfwinlist ); DEBUG_MSG( "return_allwindows_documentlist, bfwinlist length=%d\n", g_list_length( main_v->bfwinlist ) ); while ( bflist ) { DEBUG_MSG( "return_allwindows_documentlist, current bfwin doclist length=%d\n", g_list_length( BFWIN( bflist->data ) ->documentlist ) ); tmplist = g_list_first( BFWIN( bflist->data ) ->documentlist ); while ( tmplist ) { newdoclist = g_list_append( newdoclist, tmplist->data ); tmplist = g_list_next( tmplist ); } bflist = g_list_next( bflist ); } DEBUG_MSG( "return_allwindows_documentlist, returning list length %d\n", g_list_length( newdoclist ) ); return newdoclist; } /** * return_filenamestringlist_from_doclist: * @doclist: #GList* * * Returns a stringlist with filenames given a * list with documents (#Tdocument*) * * Return value: #GList* stringlist with filenames */ GList *return_filenamestringlist_from_doclist( GList *doclist ) { GList * newlist = NULL, *tmplist; DEBUG_MSG( "return_filenamestringlist_from_doclist, started for doclist %p, len=%d\n", doclist, g_list_length( doclist ) ); tmplist = g_list_first( doclist ); while ( tmplist ) { if ( DOCUMENT( tmplist->data ) ->filename ) { DEBUG_MSG( "return_filenamestringlist_from_doclist, adding filename %s\n", DOCUMENT( tmplist->data ) ->filename ); newlist = g_list_append( newlist, g_strdup( DOCUMENT( tmplist->data ) ->filename ) ); } tmplist = g_list_next( tmplist ); } return newlist; } /* * return_num_untitled_documents: * @doclist: #GList* with documents * * returns the number of untitled documents * opened in Bluefish * * Return value: #gint with number * gint return_num_untitled_documents(GList *doclist) { gint retval = 0; GList *tmplist = g_list_first(doclist); while (tmplist) { if (DOCUMENT(tmplist->data)->filename == NULL) retval++; tmplist = g_list_next(tmplist); } return retval; }*/ /** * add_filename_to_history: * @bfwin: #Tbfwin* * @filename: a #gchar * * adds a filename to the recently opened files list * will not add it to the menu, only to the list and the file **/ void add_filename_to_history( Tbfwin *bfwin, gchar *filename ) { gchar * dirname; add_to_recent_list( bfwin, filename, 0, FALSE ); /* the recent menu */ dirname = g_path_get_dirname( filename ); DEBUG_MSG( "add_filename_to_history, adding %s\n", dirname ); main_v->recent_directories = add_to_history_stringlist( main_v->recent_directories, dirname, FALSE, TRUE ); g_free( dirname ); } /** * documentlist_return_index_from_filename: * @doclist: #GList* with the documents to search in * @filename: a #gchar * * if the file is open, it returns the index in the documentlist * which is also the index in the notebook * if the file is not open it returns -1 * * Return value: the index number on success, -1 if the file is not open **/ gint documentlist_return_index_from_filename( GList *doclist, gchar *filename ) { GList * tmplist; gint count = 0; if ( !filename ) { return -1; } tmplist = g_list_first( doclist ); while ( tmplist ) { if ( ( ( Tdocument * ) tmplist->data ) ->filename && ( strcmp( filename, ( ( Tdocument * ) tmplist->data ) ->filename ) == 0 ) ) { return count; } count++; tmplist = g_list_next( tmplist ); } return -1; } /** * documentlist_return_index_from_filename: * @param doclist: #GList* with the documents to search in * @param filename: a #gchar * * if the file is open, it returns the Tdocument* in the documentlist * if the file is not open it returns NULL * * Return value: #Tdocument* or NULL if not open **/ Tdocument *documentlist_return_document_from_filename( GList *doclist, gchar *filename ) { /* BUG#10 */ GList * tmplist; gchar *ondiskencoding; struct stat statbuf; gint inode; if (!filename) { DEBUG_MSG( "documentlist_return_document_from_filename, no filename. returning\n" ); return NULL; } ondiskencoding = get_filename_on_disk_encoding(filename); if ( stat(ondiskencoding,&statbuf) != 0 ) { DEBUG_MSG( "documentlist_return_document_from_filename, error calling `stat'! returning\n" ); return NULL; } inode = statbuf.st_ino; g_free(ondiskencoding); DEBUG_MSG( "documentlist_return_document_from_filename, filename=%s\n", filename ); tmplist = g_list_first( doclist ); while ( tmplist ) { DEBUG_MSG( "documentlist_return_document_from_filename, comparing with %s\n", filename ); ondiskencoding = get_filename_on_disk_encoding(DOCUMENT( tmplist->data ) ->filename); if ( DOCUMENT( tmplist->data ) ->filename && ( (stat( ondiskencoding , &statbuf) ==0) && (statbuf.st_ino == inode) ) /* && ( strcmp( filename, DOCUMENT( tmplist->data ) ->filename ) == 0 ) */ ) { g_free(ondiskencoding); DEBUG_MSG( "documentlist_return_document_from_filename, found, returning %p\n", tmplist->data ); return DOCUMENT( tmplist->data ); } /* g_print("check %s, inode1=%d, inode2=%d\n",DOCUMENT( tmplist->data ) ->filename, inode, statbuf.st_ino); */ tmplist = g_list_next( tmplist ); g_free(ondiskencoding); } DEBUG_MSG( "documentlist_return_document_from_filename, not found, returning NULL\n" ); return NULL; } /** * documentlist_return_document_from_index: * @doclist: #GList* with the documents to search in * @index: a #gint, index in the documentlist. * * If the index is valid, it returns the appropriate Tdocument. * * Return value: Pointer to Tdocument on success, NULL on invalid index. **/ Tdocument *documentlist_return_document_from_index( GList *doclist, gint index ) { return ( Tdocument * ) g_list_nth_data( doclist, index ); } /** * doc_update_highlighting: * @bfwin: #Tbfwin* with the window * @callback_action: #guint ignored * @widget: a #GtkWidget* ignored * * this function works on the current document * if highlighting is disabled, this enables the highlighting * the highlighting is also refreshed for the full document * * Return value: void **/ void doc_update_highlighting( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if ( !bfwin->current_document ) return ; DEBUG_MSG( "doc_update_highlighting, curdoc=%p, highlightstate=%d\n", bfwin->current_document, bfwin->current_document->view_bars & VIEW_COLORIZED ); if ( !(bfwin->current_document->view_bars & VIEW_COLORIZED) ) { setup_toggle_item( gtk_item_factory_from_widget( bfwin->menubar ), _( "/Document/Highlight Syntax" ), TRUE ); DEBUG_MSG( "doc_update_highlighting, calling doc_toggle_highlighting_cb\n" ); doc_toggle_highlighting_cb( bfwin, 0, NULL ); } else { doc_highlight_full( bfwin->current_document ); } } /** * doc_set_wrap: * @doc: a #Tdocument * * this function will synchronise doc->wrapstate with the textview widget * if doc->wrapstate TRUE it will set the textview to GTK_WRAP_WORD * else (FALSE) it will set the textview to GTK_WRAP_NONE * * Return value: void **/ void doc_set_wrap( Tdocument * doc ) { if ( doc->view_bars & MODE_WRAP ) { gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( doc->view ), GTK_WRAP_WORD ); } else { gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( doc->view ), GTK_WRAP_NONE ); } } /** * doc_set_filetype: * @doc: a #Tdocument * @ft: a #Tfiletype with the new filetype * * this function will compare the filetype from the document and the new filetype * and if they are different it will remove the old highlighting, set the newfiletype * and set the filetype widget, it will return TRUE if the type was changed * * Return value: #gboolean if the value was changed **/ gboolean doc_set_filetype( Tdocument *doc, Tfiletype *ft ) { if ( ft != doc->hl ) { doc_remove_highlighting( doc ); doc->hl = ft; doc->need_highlighting = TRUE; doc->view_bars = SET_BIT( doc->view_bars, MODE_AUTO_COMPLETE, (main_v->props.view_bars & MODE_AUTO_COMPLETE) && ( ft->autoclosingtag > 0 )); DEBUG_MSG("doc_set_filetype: autoclosingtag = %d, view_bar bitwise = %d\n", ft->autoclosingtag , GET_BIT(doc->view_bars, MODE_AUTO_COMPLETE)); gui_set_document_widgets( doc ); return TRUE; } return FALSE; } /** * get_filetype_by_name: * @name: a #gchar* with the filetype name * * returns the Tfiletype* for corresponding to name * * Return value: Tfiletype* **/ Tfiletype *get_filetype_by_name( gchar * name ) { GList * tmplist; tmplist = g_list_first( main_v->filetypelist ); while ( tmplist ) { if ( strcmp( ( ( Tfiletype * ) tmplist->data ) ->type, name ) == 0 ) { return ( Tfiletype * ) tmplist->data; } tmplist = g_list_next( tmplist ); } return NULL; } /** * get_filetype_by_filename_and_content: * @filename: a #gchar* with the filename or NULL * @buf: a #gchar* with the contents to search for with the Tfiletype->content_regex or NULL * * returns the Tfiletype* for corresponding to filename, using the file extension. If * nothing is found using the file extension or filename==NULL it will start matching * the contents in buf with Tfiletype->content_regex * * if no filetype is found it will return NULL * * Return value: #Tfiletype* or NULL **/ Tfiletype *get_filetype_by_filename_and_content( gchar *filename, gchar *buf ) { GList * tmplist; if ( buf ) { tmplist = g_list_first( main_v->filetypelist ); while ( tmplist ) { Tfiletype * ft = ( Tfiletype * ) tmplist->data; if ( strlen( ft->content_regex ) ) { pcre * pcreg; const char *err = NULL; int erroffset = 0; DEBUG_MSG( "get_filetype_by_filename_and_content, compiling pattern %s\n", ft->content_regex ); pcreg = pcre_compile( ft->content_regex, PCRE_DOTALL | PCRE_MULTILINE, &err, &erroffset, NULL ); if ( err ) { DEBUG_MSG( "while testing for filetype '%s', pattern '%s' resulted in error '%s' at position %d\n", ft->type, ft->content_regex, err, erroffset ); } if ( pcreg ) { int ovector[ 30 ]; int retval = pcre_exec( pcreg, NULL, buf, strlen( buf ), 0, 0, ovector, 30 ); DEBUG_MSG( "get_filetype_by_filename_and_content, buf='%s'\n", buf ); DEBUG_MSG( "get_filetype_by_filename_and_content, pcre_exec retval=%d\n", retval ); if ( retval > 0 ) { /* we have a match!! */ pcre_free( pcreg ); return ft; } pcre_free( pcreg ); } } else { DEBUG_MSG( "get_filetype_by_filename_and_content, type %s does not have a pattern (%s)\n", ft->type, ft->content_regex ); } tmplist = g_list_next( tmplist ); } } if ( filename ) { tmplist = g_list_first( main_v->filetypelist ); while ( tmplist ) { if ( filename_test_extensions( ( ( Tfiletype * ) tmplist->data ) ->extensions, filename ) ) { return ( Tfiletype * ) tmplist->data; } tmplist = g_list_next( tmplist ); } } return NULL; } /** * doc_reset_filetype: * @doc: #Tdocument to reset * @newfilename: a #gchar* with the new filename * @buf: a #gchar* with the contents of the file, or NULL if the function should get that from the TextBuffer * * sets the new filetype based on newfilename and content, updates the widgets and highlighting * (using doc_set_filetype()) * * Return value: void **/ void doc_reset_filetype( Tdocument * doc, gchar * newfilename, gchar *buf ) { DEBUG_MSG("doc_reset_filetype: entering...\n"); Tfiletype * ft; if ( buf ) { ft = get_filetype_by_filename_and_content( newfilename, buf ); } else { gchar *tmp = doc_get_chars( doc, 0, main_v->props.numcharsforfiletype ); ft = get_filetype_by_filename_and_content( newfilename, tmp ); g_free( tmp ); } if ( !ft ) { GList * tmplist; /* if none found return first set (is default set) */ tmplist = g_list_first( main_v->filetypelist ); if ( !tmplist ) { DEBUG_MSG( "doc_reset_filetype, no default filetype? huh?\n" ); return ; } ft = ( Tfiletype * ) tmplist->data; } doc_set_filetype( doc, ft ); } /** * doc_set_font: * @doc: a #Tdocument * @fontstring: a #gchar describing the font * * this function will set the textview from doc to use the font * described by fontstring * * Return value: void **/ #ifdef __GNUC__ __inline__ #endif void doc_set_font( Tdocument *doc, gchar *fontstring ) { if ( fontstring ) { apply_font_style( doc->view, fontstring ); } else { apply_font_style( doc->view, main_v->props.editor_font_string ); } } /** * This function is taken from gtksourceview * Copyright (C) 2001 * Mikael Hermansson * Chris Phelps */ static gint textview_calculate_real_tab_width( GtkWidget *textview, gint tab_size ) { gchar * tab_string; gint counter = 0; gint tab_width = 0; if ( tab_size <= 0 ) return 0; tab_string = g_malloc ( tab_size + 1 ); while ( counter < tab_size ) { tab_string[ counter ] = ' '; counter++; } tab_string[ tab_size ] = '\0'; tab_width = widget_get_string_size( textview, tab_string ); g_free( tab_string ); /* if (tab_width < 0) tab_width = 0;*/ return tab_width; } /** * doc_set_tabsize: * @doc: a #Tdocument * @tabsize: a #gint with the tab size * * this function will set the textview from doc to use the tabsize * described by tabsize * * Return value: void **/ void doc_set_tabsize( Tdocument *doc, gint tabsize ) { PangoTabArray * tab_array; gint pixels = textview_calculate_real_tab_width( GTK_WIDGET( doc->view ), tabsize ); DEBUG_MSG( "doc_set_tabsize, tabsize=%d, pixels=%d\n", tabsize, pixels ); tab_array = pango_tab_array_new ( 1, TRUE ); pango_tab_array_set_tab ( tab_array, 0, PANGO_TAB_LEFT, pixels ); gtk_text_view_set_tabs ( GTK_TEXT_VIEW ( doc->view ), tab_array ); pango_tab_array_free( tab_array ); } /** * gui_change_tabsize: * @bfwin: #Tbfwin* with the window * @action: a #guint, if 1 increase the tabsize, if 0 decrease * @widget: a #GtkWidget, ignored * * this function is the callback for the menu, based on action * it will increase or decrease the tabsize by one * for ALL DOCUMENTS (BUG: currently only all documents in the same window) * * Return value: void **/ void gui_change_tabsize( Tbfwin *bfwin, guint action, GtkWidget *widget ) { GList * tmplist; PangoTabArray *tab_array; gint pixels; if ( action == 1 ) { main_v->props.editor_tab_width++; } else { main_v->props.editor_tab_width--; } { gchar *message = g_strdup_printf( "Setting tabsize to %d", main_v->props.editor_tab_width ); statusbar_message( bfwin, message, 2000 ); g_free( message ); } /* this should eventually be the total documentlist, not only for this window */ tmplist = g_list_first( bfwin->documentlist ); pixels = textview_calculate_real_tab_width( GTK_WIDGET( ( ( Tdocument * ) tmplist->data ) ->view ), main_v->props.editor_tab_width ); tab_array = pango_tab_array_new ( 1, TRUE ); pango_tab_array_set_tab ( tab_array, 0, PANGO_TAB_LEFT, pixels ); while ( tmplist ) { gtk_text_view_set_tabs ( GTK_TEXT_VIEW( ( ( Tdocument * ) tmplist->data ) ->view ), tab_array ); tmplist = g_list_next( tmplist ); } pango_tab_array_free( tab_array ); } /** * doc_is_empty_non_modified_and_nameless: * @doc: a #Tdocument * * this function returns TRUE if the document pointer to by doc * is an empty, nameless and non-modified document * * Return value: gboolean, TRUE if doc is empty, non-modified and nameless **/ gboolean doc_is_empty_non_modified_and_nameless( Tdocument *doc ) { if ( !doc ) { return FALSE; } if ( doc->modified || doc->filename ) { return FALSE; } if ( gtk_text_buffer_get_char_count( doc->buffer ) > 0 ) { return FALSE; } return TRUE; } /* gboolean test_docs_modified(GList *doclist) * if doclist is NULL it will use main_v->documentlist as doclist * returns TRUE if there are any modified documents in doclist * returns FALSE if there are no modified documents in doclist */ /** * test_docs_modified: * @doclist: a #GList with documents * * this function will test if any documents in doclist are modified * * Return value: gboolean **/ gboolean test_docs_modified( GList *doclist ) { GList * tmplist; Tdocument *tmpdoc; if ( doclist ) { tmplist = g_list_first( doclist ); } else { g_print( "test_docs_modified, calling without a doclist is deprecated, aborting\n" ); exit( 144 ); } while ( tmplist ) { tmpdoc = ( Tdocument * ) tmplist->data; #ifdef DEBUG g_assert( tmpdoc ); #endif if ( tmpdoc->modified ) { return TRUE; } tmplist = g_list_next( tmplist ); } return FALSE; } /** * test_only_empty_doc_left: * @doclist: #GList* with all documents to test in * * returns TRUE if there is only 1 document open, and that document * is not modified and 0 bytes long and without filename * returns FALSE if there are multiple documents open, or * a modified document is open, or a > 0 bytes document is open * or a document with filename is open * * Return value: void **/ gboolean test_only_empty_doc_left( GList *doclist ) { if ( g_list_length( doclist ) > 1 ) { return FALSE; } else { Tdocument *tmpdoc; GList *tmplist = g_list_first( doclist ); if ( tmplist ) { #ifdef DEBUG g_assert( tmplist->data ); #endif tmpdoc = tmplist->data; if ( !doc_is_empty_non_modified_and_nameless( tmpdoc ) ) { return FALSE; } } } return TRUE; } /** * doc_move_to_window: * @doc: #Tdocument* * @newwin: #Tbfwin* * * detaches the document from it's old window (doc->bfwin) and attaches * it to the window newwin * * Return value: void, ignored */ void doc_move_to_window( Tdocument *doc, Tbfwin *newwin ) { Tbfwin * oldwin = BFWIN( doc->bfwin ); GtkWidget *tab_widget, *scroll, *tab_menu; DEBUG_MSG( "doc_move_to_window, oldwin=%p, newwin=%p, doc=%p\n", oldwin, newwin, doc ); /* FIXED: Major BUG#54 */ /* (doc_new): tab_label -> tab_eventbox -> hbox So we need parent->parent; */ tab_widget = doc->tab_label->parent->parent; scroll = doc->view->parent; tab_menu = doc->tab_menu; gtk_widget_ref( scroll ); gtk_widget_ref( tab_widget ); gtk_widget_ref( tab_menu ); /* DEBUG_MSG( "doc_move_to_window, first:\n\tdoc->tab_label=%p, tab_label=%p\n", doc->tab_label, tab_label ); */ gtk_notebook_remove_page( GTK_NOTEBOOK( oldwin->notebook ), g_list_index( oldwin->documentlist, doc ) ); oldwin->documentlist = g_list_remove( oldwin->documentlist, doc ); DEBUG_MSG( "doc_move_to_window, removed doc=%p from oldwin %p\n", doc, oldwin ); doc->bfwin = newwin; newwin->documentlist = g_list_append( newwin->documentlist, doc ); gtk_notebook_append_page_menu( GTK_NOTEBOOK( newwin->notebook ), scroll, tab_widget, tab_menu ); DEBUG_MSG( "doc_move_to_window, appended doc=%p to newwin %p\n", doc, newwin ); gtk_widget_unref( scroll ); gtk_widget_unref( tab_widget ); gtk_widget_unref( tab_menu ); gtk_widget_show_all( scroll ); gtk_widget_show_all( tab_widget ); gtk_widget_show ( tab_menu ); if ( NULL == oldwin->documentlist ) { file_new_cb( NULL, oldwin ); } } /** * doc_has_selection: * @doc: a #Tdocument * * returns TRUE if the document has a selection * returns FALSE if it does not * * Return value: gboolean **/ gboolean doc_has_selection( Tdocument *doc ) { return gtk_text_buffer_get_selection_bounds( doc->buffer, NULL, NULL ); } /** * doc_set_tooltip: * @doc: #Tdocument* * * will set the tooltip on the notebook tab eventbox * * Return value: void */ static void doc_set_tooltip( Tdocument *doc ) { gchar * text, *tmp; gchar mtimestr[ 128 ], *modestr = NULL, *sizestr = NULL; mtimestr[ 0 ] = '\0'; if ( doc->statbuf.st_mode != 0 || doc->statbuf.st_size != 0 ) { modestr = filemode_to_string( doc->statbuf.st_mode ); ctime_r( &doc->statbuf.st_mtime, mtimestr ); /* sizestr = g_strdup_printf( "%ld", doc->statbuf.st_size ); */ /* Michèle Garoche, 20060208 */ if (sizeof(off_t) == sizeof(unsigned long long int)) { sizestr = g_strdup_printf("%llu", (unsigned long long int )doc->statbuf.st_size); } else { sizestr = g_strdup_printf("%lu", doc->statbuf.st_size); } } tmp = text = g_strconcat( _( "name: " ), gtk_label_get_text( GTK_LABEL( doc->tab_menu ) ) , _( "\ntype: " ), doc->hl->type , _( "\nencoding: " ), ( doc->encoding != NULL ) ? doc->encoding : main_v->props.newfile_default_encoding , NULL ); if ( sizestr ) { text = g_strconcat( text, _( "\nsize (on disk): " ), sizestr, _( " bytes" ), NULL ); g_free( tmp ); g_free( sizestr ); tmp = text; } if ( modestr ) { text = g_strconcat( text, _( "\npermissions: " ), modestr, NULL ); g_free( tmp ); g_free( modestr ); tmp = text; } if ( mtimestr[ 0 ] != '\0' ) { trunc_on_char( mtimestr, '\n' ); text = g_strconcat( text, _( "\nlast modified: " ), mtimestr, NULL ); g_free( tmp ); tmp = text; } gtk_tooltips_set_tip( main_v->tooltips, doc->tab_eventbox, text, "" ); g_free( text ); } /** * doc_set_title: * @doc: #Tdocument* * * will set the notebook tab label and the notebook tab menu label * and if this document->bfwin == document->bfwin->current_document * it will update the bfwin title * it will also call doc_set_tooltip() to reflect the changes in the tooltip * * Return value: void */ static void doc_set_title( Tdocument *doc ) { gchar * label_string, *tabmenu_string; if ( doc->filename ) { label_string = g_path_get_basename( doc->filename ); tabmenu_string = g_strdup( doc->filename ); } else { label_string = g_strdup_printf( _( "Untitled %d" ), main_v->num_untitled_documents ); tabmenu_string = g_strdup( label_string ); main_v->num_untitled_documents++; } gtk_label_set( GTK_LABEL( doc->tab_menu ), tabmenu_string ); gtk_label_set( GTK_LABEL( doc->tab_label ), label_string ); doc_set_tooltip( doc ); g_free( label_string ); g_free( tabmenu_string ); if ( doc->bfwin == BFWIN( doc->bfwin ) ->current_document ) { gui_set_title( doc->bfwin, doc ); } } /** * doc_set_modified: * @doc: a #Tdocument * @value: a gint TRUE or FALSE * * sets the doc->modified to value * if it already has this value, do nothing * if it does not have this value, it will do some action * * if the document pointed to by doc == the current document * it will update the toolbar and menu undo/redo items * * if value is TRUE, it will make the notebook and notebook-menu * label red, if value is FALSE it will set them to black * * Return value: void **/ void doc_set_modified( Tdocument *doc, gint value ) { DEBUG_MSG( "doc_set_modified, started, doc=%p, value=%d\n", doc, value ); if ( doc->modified != value ) { GdkColor colorred = {0, 0,0, 65535}; GdkColor colorblack = {0, 0, 0, 0}; doc->modified = value; if ( doc->modified ) { gtk_widget_modify_fg( doc->tab_menu, GTK_STATE_NORMAL, &colorred ); gtk_widget_modify_fg( doc->tab_menu, GTK_STATE_PRELIGHT, &colorred ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_NORMAL, &colorred ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_PRELIGHT, &colorred ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_ACTIVE, &colorred ); } else { gtk_widget_modify_fg( doc->tab_menu, GTK_STATE_NORMAL, &colorblack ); gtk_widget_modify_fg( doc->tab_menu, GTK_STATE_PRELIGHT, &colorblack ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_NORMAL, &colorblack ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_PRELIGHT, &colorblack ); gtk_widget_modify_fg( doc->tab_label, GTK_STATE_ACTIVE, &colorblack ); } } #ifdef DEBUG else { DEBUG_MSG( "doc_set_modified, doc %p did have value %d already\n", doc, value ); } #endif /* only when this is the current document we have to change these */ DEBUG_MSG( "doc=%p, doc->bfwin=%p\n", doc, doc->bfwin ); if ( doc == BFWIN( doc->bfwin ) ->current_document ) { gui_set_undo_redo_widgets( BFWIN( doc->bfwin ), doc_has_undo_list( doc ), doc_has_redo_list( doc ) ); } } /* returns 1 if the file is modified on disk, returns 0 if the file is modified by another process, returns 0 if there was no previous mtime information available if newstatbuf is not NULL, it will be filled with the new statbuf from the file IF IT WAS CHANGED!!! leave NULL if you do not need this information, if the file is not changed, this field will not be set!! */ static gboolean doc_check_modified_on_disk( Tdocument *doc, struct stat *newstatbuf ) { if ( main_v->props.modified_check_type == 0 || !doc->filename || doc->statbuf.st_mtime == 0 || doc->statbuf.st_size == 0 ) { return FALSE; } else if ( main_v->props.modified_check_type < 4 ) { struct stat statbuf; gchar *ondiskencoding = get_filename_on_disk_encoding( doc->filename ); if ( stat( ondiskencoding, &statbuf ) == 0 ) { g_free( ondiskencoding ); *newstatbuf = statbuf; if ( main_v->props.modified_check_type == 1 || main_v->props.modified_check_type == 2 ) { if ( doc->statbuf.st_mtime < statbuf.st_mtime ) { return TRUE; } } if ( main_v->props.modified_check_type == 1 || main_v->props.modified_check_type == 3 ) { if ( doc->statbuf.st_size != statbuf.st_size ) { return TRUE; } } } else g_free( ondiskencoding ); } else { DEBUG_MSG( "doc_check_mtime, type %d checking not yet implemented\n", main_v->props.modified_check_type ); } return FALSE; } /* doc_set_stat_info() includes setting the mtime field, so there is no need to call doc_update_mtime() as well */ static void doc_set_stat_info( Tdocument *doc ) { if ( doc->filename ) { gchar * ondiskencoding = get_filename_on_disk_encoding( doc->filename ); struct stat statbuf; if ( lstat( ondiskencoding, &statbuf ) == 0 ) { if ( S_ISLNK( statbuf.st_mode ) ) { doc->is_symlink = 1; stat( ondiskencoding, &statbuf ); } else { doc->is_symlink = 0; } doc->statbuf = statbuf; } g_free( ondiskencoding ); doc_set_tooltip( doc ); } } /** * doc_scroll_to_cursor: * @doc: a #Tdocument * * scolls the document pointer to by doc to its cursor position, * making the cursor visible * * Return value: void **/ void doc_scroll_to_cursor( Tdocument *doc ) { GtkTextMark * mark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW( doc->view ), mark, 0.25, FALSE, 0.5, 0.5 ); } /** * doc_get_chars: * @doc: a #Tdocument * @start: a #gint, the start position * @end: a #gint, the end position * * returns all characters (NOT BYTES!!) from start to end from the document * pointer to by doc. end may be -1 to point to the end of the document * * Return value: gchar * with the requested characters **/ gchar *doc_get_chars( Tdocument *doc, gint start, gint end ) { GtkTextIter itstart, itend; gchar *string; gtk_text_buffer_get_iter_at_offset( doc->buffer, &itstart, start ); if ( end >= 0 ) { gtk_text_buffer_get_iter_at_offset( doc->buffer, &itend, end ); } else if ( end == -1 ) { gtk_text_buffer_get_end_iter( doc->buffer, &itend ); } else { DEBUG_MSG( "doc_get_chars, end < -1, returning NULL\n" ); return NULL; } DEBUG_MSG( "doc_get_chars, retrieving string, start=%d, end=%d\n", start, end ); string = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); DEBUG_MSG( "doc_get_chars, retrieved string (%p)\n", string ); return string; } /** * doc_get_max_offset: * @doc: a #Tdocument * * returns the number of characters (NOT BYTES!!) in this document * * Return value: gint with the number of characters **/ gint doc_get_max_offset( Tdocument *doc ) { return gtk_text_buffer_get_char_count( doc->buffer ); } /** * doc_select_region: * @doc: a #Tdocument * @start: a #gint with the start of selection * @end: a #gint with the end of the selection * @do_scroll: a #gboolean, if we should scroll to the selection * * selects from start to end in the doc, and if do_scroll is set it will make * sure the selection is visible to the user * * Return value: void **/ void doc_select_region( Tdocument *doc, gint start, gint end, gboolean do_scroll ) { GtkTextIter itstart, itend; gtk_text_buffer_get_iter_at_offset( doc->buffer, &itstart, start ); gtk_text_buffer_get_iter_at_offset( doc->buffer, &itend, end ); gtk_text_buffer_move_mark_by_name( doc->buffer, "insert", &itstart ); gtk_text_buffer_move_mark_by_name( doc->buffer, "selection_bound", &itend ); if ( do_scroll ) { gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( doc->view ), &itstart, 0.25, FALSE, 0.5, 0.5 ); } } /** * doc_select_line: * @doc: a #Tdocument * @line: a #gint with the line number to select * @do_scroll: a #gboolean, if we should scroll to the selection * * selects the line in doc, and if do_scroll is set it will make * sure the selection is visible to the user * the line number starts at line 1, not at line 0!! * * Return value: void **/ void doc_select_line( Tdocument *doc, gint line, gboolean do_scroll ) { GtkTextIter itstart; gtk_text_buffer_get_iter_at_line( doc->buffer, &itstart, line - 1 ); #ifdef SELECT_LINE GtkTextIter itend = itstart; /* do the section */ gtk_text_iter_forward_to_line_end( &itend ); gtk_text_buffer_move_mark_by_name( doc->buffer, "insert", &itstart ); gtk_text_buffer_move_mark_by_name( doc->buffer, "selection_bound", &itend ); if ( do_scroll ) { gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( doc->view ), &itstart, 0.25, FALSE, 0.5, 0.5 ); /* GtkTextMark *tmpmark = gtk_text_buffer_get_mark( doc->buffer, "insert" ); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW( doc->view ), tmpmark, 0.25, FALSE, 0.5, 0.5 ); */ } #else gtk_text_buffer_move_mark_by_name( doc->buffer, "insert", &itstart ); gtk_text_buffer_move_mark_by_name( doc->buffer, "selection_bound", &itstart ); if ( do_scroll ) { gtk_text_view_scroll_to_iter( GTK_TEXT_VIEW( doc->view ), &itstart, 0.25, FALSE, 0.5, 0.5 ); } #endif /* SELECT_LINE */ } /** * doc_get_selection: * @doc: a #Tdocument * @start: a #gint * to store the start * @end: a #gint * to store the end * * returns FALSE if there is no selection * returns TRUE if there is a selection, and start and end will be set * to the current selection * * Return value: gboolean if there is a selection **/ gboolean doc_get_selection( Tdocument *doc, gint *start, gint *end ) { GtkTextIter itstart, itend; GtkTextMark *mark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itstart, mark ); mark = gtk_text_buffer_get_selection_bound( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, mark ); *start = gtk_text_iter_get_offset( &itstart ); *end = gtk_text_iter_get_offset( &itend ); DEBUG_MSG( "doc_get_selection, start=%d, end=%d\n", *start, *end ); if ( *start == *end ) { return FALSE; } if ( *start > *end ) { gint tmp = *start; *start = *end; *end = tmp; } return TRUE; } /** * doc_get_cursor_position: * @doc: a #Tdocument * * returns the cursor position in doc as character offset * * Return value: gint with the character offset of the cursor **/ gint doc_get_cursor_position( Tdocument *doc ) { GtkTextIter iter; GtkTextMark *mark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, mark ); return gtk_text_iter_get_offset( &iter ); } /** * doc_set_statusbar_lncol: * @doc: a #Tdocument * * Return value: void **/ static void doc_set_statusbar_lncol( Tdocument *doc ) { gchar * msg; gint line; gint col = 0; GtkTextIter iter, start; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); line = gtk_text_iter_get_line( &iter ); start = iter; gtk_text_iter_set_line_offset( &start, 0 ); while ( !gtk_text_iter_equal( &start, &iter ) ) { if ( gtk_text_iter_get_char( &start ) == '\t' ) { col += ( main_v->props.editor_tab_width - ( col % main_v->props.editor_tab_width ) ); } else ++col; gtk_text_iter_forward_char( &start ); } msg = g_strdup_printf( "%d,%d", line + 1, col + 1 ); gtk_statusbar_pop( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_lncol ), 0 ); gtk_statusbar_push( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_lncol ), 0, msg ); g_free( msg ); } /** * doc_set_statusbar_insovr: * @doc: a #Tdocument * * * * Return value: void **/ void doc_set_statusbar_insovr( Tdocument *doc ) { gtk_statusbar_pop( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_insovr ), 0 ); gtk_statusbar_push( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_insovr ), 0, ( doc->view_bars & MODE_OVERWRITE ? "OVR" : "INS" ) ); } /** * doc_set_statusbar_editmode_encoding: * @doc: a #Tdocument * * * * * Return value: void **/ void doc_set_statusbar_editmode_encoding( Tdocument *doc ) { gchar * msg; if ( doc->hl == NULL ) msg = g_strdup_printf( "%s, %s", "text", doc->encoding ); else msg = g_strdup_printf( "%s, %s", doc->hl->type, doc->encoding ); gtk_statusbar_pop( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_editmode ), 0 ); gtk_statusbar_push( GTK_STATUSBAR( BFWIN( doc->bfwin ) ->statusbar_editmode ), 0, msg ); g_free( msg ); } /** * doc_replace_text_backend: * @doc: a #Tdocument * @newstring: a #const char * with the new string * @start: a gint with the start character position * @end: a gint with the end character position * * unbinds all signals so there will be no call to a highlighting * update or anything else * deletes the text in the region between start and end * registers that text to the undo/redo functionality * inserts newstring at that same position * registers this to the undo/redo functionality * marks the document as modified and marks it as needing highlighting * binds the signals again to their callbacks * * multiple calls to doc_replace_text_backend will all be in the same undo/redo group * * Return value: void **/ void doc_replace_text_backend( Tdocument *doc, const gchar * newstring, gint start, gint end ) { doc_unbind_signals( doc ); /* delete region, and add that to undo/redo list */ { gchar *buf; GtkTextIter itstart, itend; DEBUG_MSG( "doc_replace_text_backend, get iters at start %d and end %d\n", start, end ); gtk_text_buffer_get_iter_at_offset( doc->buffer, &itstart, start ); gtk_text_buffer_get_iter_at_offset( doc->buffer, &itend, end ); buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); gtk_text_buffer_delete( doc->buffer, &itstart, &itend ); DEBUG_MSG( "doc_replace_text_backend, calling doc_unre_add for buf=%s, start=%d and end=%d\n", buf, start, end ); doc_unre_add( doc, buf, start, end, UndoDelete ); g_free( buf ); DEBUG_MSG( "doc_replace_text_backend, text deleted from %d to %d\n", start, end ); } /* add new text to this region, the buffer is changed so re-calculate itstart */ { GtkTextIter itstart; gint insert = ( end > start ) ? start : end; DEBUG_MSG( "doc_replace_text_backend, set insert pos to %d\n", insert ); gtk_text_buffer_get_iter_at_offset( doc->buffer, &itstart, insert ); gtk_text_buffer_insert( doc->buffer, &itstart, newstring, -1 ); doc_unre_add( doc, newstring, insert, insert + g_utf8_strlen( newstring, -1 ), UndoInsert ); } doc_bind_signals( doc ); doc_set_modified( doc, 1 ); doc->need_highlighting = TRUE; } /** * doc_replace_text: * @doc: a #Tdocument * @newstring: a #const char * with the new string * @start: a gint with the start character position * @end: a gint with the end character position * * identical to doc_replace_text_backend, with one difference, multiple calls to * doc_replace_text will be all be in a different undo/redo group * * Return value: void **/ void doc_replace_text( Tdocument * doc, const gchar * newstring, gint start, gint end ) { doc_unre_new_group( doc ); doc_replace_text_backend( doc, newstring, start, end ); doc_unre_new_group( doc ); } /* kyanh, removed, 20050303 */ static void doc_convert_chars_to_entities(Tdocument *doc, gint start, gint end, gboolean ascii, gboolean iso) { gchar *string; DEBUG_MSG("doc_convert_chars_to_entities, start=%d, end=%d\n", start,end); string = doc_get_chars(doc, start, end); if (string) { gchar *newstring = convert_string_utf8_to_html(string, ascii, iso); g_free(string); if (newstring) { doc_replace_text(doc, newstring, start, end); g_free(newstring); } #ifdef DEBUG else { DEBUG_MSG("doc_convert_chars_to_entities, newstring=NULL\n"); } #endif } #ifdef DEBUG else { DEBUG_MSG("doc_convert_chars_to_entities, string=NULL\n"); } #endif } /* kyanh, removed, 20050303 */ static void doc_convert_chars_to_entities_in_selection(Tdocument *doc, gboolean ascii, gboolean iso) { gint start, end; if (doc_get_selection(doc, &start, &end)) { DEBUG_MSG("doc_convert_chars_to_entities_in_selection, start=%d, end=%d\n", start, end); doc_convert_chars_to_entities(doc, start, end, ascii, iso); } } static void doc_convert_case_in_selection( Tdocument *doc, gboolean toUpper ) { gint start, end; if ( doc_get_selection( doc, &start, &end ) ) { gchar * string = doc_get_chars( doc, start, end ); if ( string ) { gchar * newstring = ( toUpper & 1/* menu.c */ ) ? g_utf8_strup( string, -1 ) : g_utf8_strdown( string, -1 ); g_free( string ); if ( newstring ) { doc_replace_text( doc, newstring, start, end ); g_free( newstring ); } } } } /** * doc_insert_two_strings: * @doc: a #Tdocument * @before_str: a #const char * with the first string * @after_str: a #const char * with the second string * * if the marks 'diag_ins' and 'diag_sel' exist, they will be used * as pos1 and pos2 * if a selection exists, the selection start and end will be pos1 and pos2 * if both not exist the cursor position will be both pos1 and pos2 * * inserts the first string at pos1 and the second at pos2 in doc * it does not unbind any signal, so the insert callback will have to do * do the undo/redo, modified and highlighting stuff * * multiple calls to this function will be in separate undo/redo groups * * Return value: void **/ /* */ void doc_insert_two_strings( Tdocument *doc, const gchar *before_str, const gchar *after_str ) { /* indent the content -- if the content starts by * \begin{} * \start{} */ if (main_v->props.view_bars & MODE_AUTO_INDENT/* && g_str_has_prefix(before_str, "\\begin{") */) { gchar *indent=NULL; GtkTextMark* imark; GtkTextIter itstart, itend; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, imark ); itstart = itend; /* set to the beginning of current line */ gtk_text_iter_set_line_index( &itstart, 0 ); indent = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); if ( indent ) { /* now count the number of spaces in this line */ gchar *indenting = indent; while ( *indenting == '\t' || *indenting == ' ' ) { indenting++; } /* ending search, non-whitespace found, so terminate at this position */ *indenting = '\0'; if ( strlen( indent ) ) { /* add indent to before_str and after_str */ gchar **output = NULL; gchar **tmpchar; gint count; if (before_str) { output = g_strsplit(before_str, "\n", 0); count=0; tmpchar=output; if (tmpchar) { while (*tmpchar != NULL) { if (count==0) { before_str = g_strdup(output[0]); }else{ /* add indent for the lines with the index >= 2 */ before_str = g_strconcat(before_str, "\n", indent, output[count], NULL); } count++; tmpchar++; } } } if (after_str) { /* for after_str */ output = g_strsplit(after_str, "\n", 0); count=0; tmpchar=output; if (tmpchar) { while (*tmpchar != NULL) { if (count) { after_str = g_strconcat(after_str, "\n", indent, output[count], NULL); } else { /* hi hi i donnot know why... but i have to count this case. */ after_str = g_strdup(output[0]); } count++; tmpchar++; } } /* alternative: use split then join; but this is*NOT* always good; */ } g_free(indent); g_strfreev(output); } } } GtkTextIter itinsert, itselect; GtkTextMark *insert, *select; gboolean have_diag_marks = FALSE; /* kyanh, removed, 20050312 */ insert = gtk_text_buffer_get_mark( doc->buffer, "diag_ins" ); if ( insert ) { select = gtk_text_buffer_get_mark( doc->buffer, "diag_sel" ); have_diag_marks = TRUE; } else { insert = gtk_text_buffer_get_insert( doc->buffer ); select = gtk_text_buffer_get_selection_bound( doc->buffer ); } gtk_text_buffer_get_iter_at_mark( doc->buffer, &itinsert, insert ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itselect, select ); #ifdef DEBUG DEBUG_MSG( "doc_insert_two_strings, current marks: itinsert=%d, itselect=%d\n", gtk_text_iter_get_offset( &itinsert ), gtk_text_iter_get_offset( &itselect ) ); #endif if ( gtk_text_iter_equal( &itinsert, &itselect ) ) { /* no selection */ gchar * double_str = g_strconcat( before_str, after_str, NULL ); gtk_text_buffer_insert( doc->buffer, &itinsert, double_str, -1 ); g_free( double_str ); if ( after_str && strlen( after_str ) ) { /* the buffer has changed, but gtk_text_buffer_insert makes sure */ /* that itinsert points to the end of the inserted text. */ /* thus, no need to get a new one. */ gtk_text_iter_backward_chars( &itinsert, g_utf8_strlen( after_str, -1 ) ); gtk_text_buffer_place_cursor( doc->buffer, &itinsert ); gtk_widget_grab_focus( doc->view ); } } else { /* there is a selection */ GtkTextMark *marktoresetto; GtkTextIter firstiter; if ( gtk_text_iter_compare( &itinsert, &itselect ) < 0 ) { /* select backward */ firstiter = itinsert; marktoresetto = ( have_diag_marks ) ? gtk_text_buffer_get_selection_bound( doc->buffer ) : select; /* marktoresetto = select; */ } else { /* select forward */ firstiter = itselect; marktoresetto = ( have_diag_marks ) ? gtk_text_buffer_get_insert( doc->buffer ) : insert; } /* there is a selection */ gtk_text_buffer_insert( doc->buffer, &firstiter, before_str, -1 ); if ( after_str && strlen( after_str ) ) { /* the buffer is changed, reset the select iterator */ gtk_text_buffer_get_iter_at_mark( doc->buffer, &itselect, marktoresetto ); gtk_text_buffer_insert( doc->buffer, &itselect, after_str, -1 ); /* now the only thing left is to move the selection and insert mark back to their correct places to preserve the users selection */ gtk_text_buffer_get_iter_at_mark( doc->buffer, &itselect, marktoresetto ); gtk_text_iter_backward_chars( &itselect, g_utf8_strlen( after_str, -1 ) ); gtk_text_buffer_move_mark( doc->buffer, marktoresetto, &itselect ); } } doc_unre_new_group( doc ); DEBUG_MSG( "doc_insert_two_strings, finished\n" ); } static void add_encoding_to_list( gchar *encoding ) { gchar **enc = g_new0( gchar *, 3 ); enc[ 0 ] = g_strdup( encoding ); if ( !arraylist_value_exists( main_v->props.encodings, enc, 1, FALSE ) ) { GList * tmplist; enc[ 1 ] = g_strdup( encoding ); main_v->props.encodings = g_list_insert( main_v->props.encodings, enc, 1 ); tmplist = g_list_first( main_v->bfwinlist ); while ( tmplist ) { encoding_menu_rebuild( BFWIN( tmplist->data ) ); tmplist = g_list_next( tmplist ); } } else { g_free( enc[ 0 ] ); g_free( enc ); } } static gchar *get_buffer_from_filename( Tbfwin *bfwin, gchar *filename, int *returnsize ) { gboolean result; gchar *buffer; GError *error = NULL; gsize length; gchar *ondiskencoding = get_filename_on_disk_encoding( filename ); result = g_file_get_contents( ondiskencoding, &buffer, &length, &error ); g_free( ondiskencoding ); if ( result == FALSE ) { gchar * errmessage = g_strconcat( _( "Could not read file:\n" ), filename, NULL ); warning_dialog( bfwin->main_window, errmessage, NULL ); g_free( errmessage ); return NULL; } *returnsize = length; return buffer; } /** * doc_file_to_textbox: * @doc: The #Tdocument target. * @filename: Filename to read in. * @enable_undo: #gboolean * @delay: Whether to delay GUI-calls. * * Open and read in a file to the doc buffer. * The data is inserted starting at the current cursor position. * Charset is detected, and highlighting performed (if applicable). * * Return value: A #gboolean, TRUE if successful, FALSE on error. **/ gboolean doc_file_to_textbox( Tdocument * doc, gchar * filename, gboolean enable_undo, gboolean delay ) { gchar * message; gint cursor_offset; int document_size = 0; if ( !enable_undo ) { doc_unbind_signals( doc ); } message = g_strconcat( _( "Opening file " ), filename, NULL ); statusbar_message( BFWIN( doc->bfwin ), message, 1000 ); g_free( message ); /* now get the current cursor position */ { GtkTextMark* insert; GtkTextIter iter; insert = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, insert ); cursor_offset = gtk_text_iter_get_offset( &iter ); } /* This opens the contents of a file to a textbox */ { gchar *encoding = NULL; gchar *newbuf = NULL; gsize wsize; gchar *buffer = get_buffer_from_filename( BFWIN( doc->bfwin ), filename, &document_size ); if ( !buffer ) { DEBUG_MSG( "doc_file_to_textbox, buffer==NULL, returning\n" ); return FALSE; } if ( !newbuf ) { DEBUG_MSG( "doc_file_to_textbox, trying newfile default encoding %s\n", main_v->props.newfile_default_encoding ); newbuf = g_convert( buffer, -1, "UTF-8", main_v->props.newfile_default_encoding, NULL, &wsize, NULL ); if ( newbuf ) { DEBUG_MSG( "doc_file_to_textbox, file is in default encoding: %s\n", main_v->props.newfile_default_encoding ); encoding = g_strdup( main_v->props.newfile_default_encoding ); } } if ( !newbuf ) { DEBUG_MSG( "doc_file_to_textbox, file is not in UTF-8, trying encoding from locale\n" ); newbuf = g_locale_to_utf8( buffer, -1, NULL, &wsize, NULL ); if ( newbuf ) { const gchar * tmpencoding = NULL; g_get_charset( &tmpencoding ); DEBUG_MSG( "doc_file_to_textbox, file is in locale encoding: %s\n", tmpencoding ); encoding = g_strdup( tmpencoding ); } } if ( !newbuf ) { DEBUG_MSG( "doc_file_to_textbox, file NOT is converted yet, trying UTF-8 encoding\n" ); if ( g_utf8_validate( buffer, -1, NULL ) ) { encoding = g_strdup( "UTF-8" ); } } if ( !newbuf ) { GList * tmplist; DEBUG_MSG( "doc_file_to_textbox, tried the most obvious encodings, nothing found.. go trough list\n" ); tmplist = g_list_first( main_v->props.encodings ); while ( tmplist ) { gchar **enc = tmplist->data; DEBUG_MSG( "doc_file_to_textbox, trying encoding %s\n", enc[ 1 ] ); newbuf = g_convert( buffer, -1, "UTF-8", enc[ 1 ], NULL, &wsize, NULL ); if ( newbuf ) { encoding = g_strdup( enc[ 1 ] ); tmplist = NULL; } else { DEBUG_MSG( "doc_file_to_textbox, no newbuf, next in list\n" ); tmplist = g_list_next( tmplist ); } } } if ( !newbuf ) { error_dialog( BFWIN( doc->bfwin ) ->main_window, _( "Cannot display file, unknown characters found." ), NULL ); } else { g_free( buffer ); buffer = newbuf; if ( doc->encoding ) g_free( doc->encoding ); doc->encoding = encoding; add_encoding_to_list( encoding ); } if ( buffer ) { gtk_text_buffer_insert_at_cursor( doc->buffer, buffer, -1 ); g_free( buffer ); } } if ( doc->view_bars & VIEW_COLORIZED ) { doc->need_highlighting = TRUE; DEBUG_MSG( "doc_file_to_textbox, highlightstate=%d, need_highlighting=%d, delay=%d\n", doc->view_bars & VIEW_COLORIZED, doc->need_highlighting, delay ); if ( !delay ) { #ifdef DEBUG g_print( "doc_file_to_textbox, doc->hlset=%p\n", doc->hl ); if ( doc->hl ) { g_print( "doc_file_to_textbox, doc->hlset->highlightlist=%p\n", doc->hl->highlightlist ); } #endif doc_highlight_full( doc ); } } if ( !enable_undo ) { doc_bind_signals( doc ); } { /* set the cursor position back */ GtkTextIter iter; gtk_text_buffer_get_iter_at_offset( doc->buffer, &iter, cursor_offset ); gtk_text_buffer_place_cursor( doc->buffer, &iter ); if ( !delay ) { gtk_text_view_place_cursor_onscreen( GTK_TEXT_VIEW( doc->view ) ); } /* gtk_notebook_set_page(GTK_NOTEBOOK(main_v->notebook),g_list_length(main_v->documentlist) - 1); notebook_changed(-1);*/ } return TRUE; } /** * doc_check_backup: * @doc: #Tdocument* * * creates a backup, depending on the configuration * returns 1 on success, 0 on failure * if no backup is required, or no filename known, 1 is returned * * Return value: #gint 1 on success or 0 on failure */ static gint doc_check_backup( Tdocument *doc ) { gint res = 1; if ( (main_v->props.view_bars & MODE_CREATE_BACKUP_ON_SAVE) && strlen(main_v->props.backup_filestring) && doc->filename && file_exists_and_readable( doc->filename ) ) { gchar * backupfilename, *ondiskencoding; backupfilename = g_strconcat( doc->filename, main_v->props.backup_filestring, NULL ); ondiskencoding = get_filename_on_disk_encoding( backupfilename ); res = file_copy( doc->filename, backupfilename ); if ( doc->statbuf.st_uid != -1 && !doc->is_symlink ) { chmod( ondiskencoding, doc->statbuf.st_mode ); chown( ondiskencoding, doc->statbuf.st_uid, doc->statbuf.st_gid ); } g_free( ondiskencoding ); g_free( backupfilename ); } return res; } static void doc_buffer_insert_text_lcb( GtkTextBuffer *textbuffer, GtkTextIter * iter, gchar * string, gint len, Tdocument * doc ) { gint pos = gtk_text_iter_get_offset( iter ); gint clen = g_utf8_strlen( string, len ); DEBUG_MSG( "doc_buffer_insert_text_lcb, started, string='%s', len=%d, clen=%d\n", string, len, clen ); /* the 'len' seems to be the number of bytes and not the number of characters.. */ if ( doc->paste_operation ) { if ( ( pos + clen ) > PASTEOPERATION( doc->paste_operation ) ->eo ) PASTEOPERATION( doc->paste_operation ) ->eo = pos + clen; if ( pos < PASTEOPERATION( doc->paste_operation ) ->so || PASTEOPERATION( doc->paste_operation ) ->so == -1 ) PASTEOPERATION( doc->paste_operation ) ->so = pos; } else if ( len == 1 ) { /* undo_redo stuff */ if ( !doc_unre_test_last_entry( doc, UndoInsert, -1, pos ) || string[ 0 ] == ' ' || string[ 0 ] == '\n' || string[ 0 ] == '\t' || string[ 0 ] == '\r' ) { DEBUG_MSG( "doc_buffer_insert_text_lcb, need a new undogroup\n" ); doc_unre_new_group( doc ); } } /* we do not call doc_unre_new_group() for multi character inserts, these are from paste, and edit_paste_cb groups them already */ /* else if (clen != 1) { doc_unre_new_group(doc); } */ doc_unre_add( doc, string, pos, pos + clen, UndoInsert ); doc_set_modified( doc, 1 ); DEBUG_MSG( "doc_buffer_insert_text_lcb, done\n" ); } static gboolean find_char( gunichar ch, gchar *data ) { #ifdef DEBUG if ( ch < 127 ) { DEBUG_MSG( "find_char, looking at character %c, searching for '%s', returning %d\n", ch, data, ( strchr( data, ch ) != NULL ) ); } else { DEBUG_MSG( "find_char, looking at character code %d, searching for '%s', returning %d\n", ch, data, ( strchr( data, ch ) != NULL ) ); } #endif return ( strchr( data, ch ) != NULL ); } static void doc_buffer_insert_text_after_lcb( GtkTextBuffer *textbuffer, GtkTextIter * iter, gchar * string, gint len, Tdocument * doc ) { DEBUG_MSG( "doc_buffer_insert_text_after_lcb, started for string '%s'\n", string ); if ( !doc->paste_operation ) { /* highlighting stuff */ if ( (doc->view_bars & VIEW_COLORIZED) && string && doc->hl ) { gboolean do_highlighting = FALSE; if ( doc->hl->update_chars[ 0 ] == '\0' ) { do_highlighting = TRUE; } else { gint i = 0; while ( string[ i ] != '\0' ) { if ( strchr( doc->hl->update_chars, string[ i ] ) ) { do_highlighting = TRUE; break; } i++; } } if ( do_highlighting ) { doc_highlight_line( doc ); } } } #ifdef DEBUG else { DEBUG_MSG( "doc_buffer_insert_text_after_lcb, paste_operation, NOT DOING ANYTHING\n" ); } #endif } static void completion_popup_menu_init() { #ifdef SHOW_SNOOPER g_print("completion_popup_menu: call init function\n"); #endif main_v->completion.window = gtk_window_new( GTK_WINDOW_POPUP ); main_v->completion.treeview = gtk_tree_view_new(); /* add column */ { GtkCellRenderer *renderer; GtkTreeViewColumn *column; renderer = gtk_cell_renderer_text_new (); /* g_object_set(renderer, "background", "#ADD8E6", NULL); */ column = gtk_tree_view_column_new_with_attributes ("", renderer, "text", 0, NULL); gtk_tree_view_column_set_min_width(column,100); gtk_tree_view_append_column (GTK_TREE_VIEW(main_v->completion.treeview), column); } /* add scroll */ GtkWidget *scrolwin; scrolwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolwin),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC); /* setting for this treeview */ gtk_tree_view_set_enable_search( GTK_TREE_VIEW(main_v->completion.treeview), FALSE ); gtk_tree_view_set_headers_visible ( GTK_TREE_VIEW(main_v->completion.treeview), FALSE ); /* add the treeview to scroll window */ gtk_container_add(GTK_CONTAINER(scrolwin), main_v->completion.treeview); /* TODO: better size handler */ gtk_widget_set_size_request(scrolwin, -1, 100); GtkWidget *frame; frame = gtk_frame_new(NULL); gtk_container_add( GTK_CONTAINER( frame ), scrolwin ); gtk_container_add( GTK_CONTAINER( main_v->completion.window ), frame ); } /** * kyanh * add user command to autocompletion list. * this causes the list be sorted again ==> slower performance */ static void gap_command( GtkWidget *widget, GdkEventKey *kevent, Tdocument *doc ) { guint32 character = gdk_keyval_to_unicode( kevent->keyval ); DEBUG_MSG( "gap_command: keyval=%d (or %X), character=%d, string=%s, state=%d, hw_keycode=%d\n", kevent->keyval, kevent->keyval, character, kevent->string, kevent->state, kevent->hardware_keycode ); /* SHIFT + DELIMITER ==> 2 keys release event and we move remove one */ if ( (kevent->keyval != GDK_Return) && (character==0 || !strstr(DELIMITERS, kevent->string)) ) { return; } gchar *buf=NULL; GtkTextMark * imark; GtkTextIter itstart, iter, maxsearch; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); itstart = iter; gtk_text_iter_backward_chars(&itstart, 1); /* buf = gtk_text_buffer_get_text(doc->buffer, &itstart, &iter, FALSE); */ /* if ( strlen(buf)==1 && strstr(DELIMITERS, buf) ) { */ iter = itstart; maxsearch = itstart; gtk_text_iter_backward_chars( &maxsearch, COMMAND_MAX_LENGTH ); if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate ) find_char, GINT_TO_POINTER( "\\" ), &maxsearch ) ) { int ovector[ 3 ], ret; maxsearch = iter; /* reuse maxsearch */ buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE ); ret = pcre_exec( main_v->anycommand_regc, NULL, buf, strlen( buf ), 0, PCRE_ANCHORED, ovector, 3 ); /*if (ret <=0) { ret = pcre_exec( main_v->autoclosingtag_regc, NULL, buf, strlen( buf ), 0, PCRE_ANCHORED, ovector, 12 ); }*/ if ( ret > 0 ) { /* buf is now the user command */ DEBUG_MSG("gap_command: found command = [%s]\n", buf); GList *tmplist = NULL; tmplist = g_list_find_custom(main_v->props.completion->items, buf, (GCompareFunc)strcmp); /* g_completion_complete(main_v->props.completion, buf, NULL); */ if ( !tmplist ) { tmplist = g_list_find_custom(main_v->props.completion_s->items, buf, (GCompareFunc)strcmp); /* g_completion_complete(main_v->props.completion_s, buf, NULL); */ if (!tmplist) { DEBUG_MSG("gap_command: new command = [%s]\n", buf); gchar *tmpstr = g_strdup(buf); tmplist = g_list_append(tmplist, tmpstr); /* Cannot use: g_list_append(tmplist, buf); as buf is freed. See below. */ g_completion_add_items(main_v->props.completion_s, tmplist); DEBUG_MSG("gap_command: completion_s data = %s\n", (gchar *)main_v->props.completion_s->items->data); g_list_free(tmplist); } } } } /*}*/ g_free(buf); } static gboolean completion_popup_menu( GtkWidget *widget, GdkEventKey *kevent, Tdocument *doc ) { if ( !main_v->completion.window ) { completion_popup_menu_init(); } /* store the window pointer */ main_v->completion.bfwin = BFWIN(doc->bfwin)->current_document; /* reset the popup content */ GtkTreeModel *model; { gchar *buf = NULL;/* gap_command(widget, kevent, doc); */ {/* get text at doc's iterator */ GtkTextMark * imark; GtkTextIter itstart, iter, maxsearch; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); itstart = iter; maxsearch = iter; gtk_text_iter_backward_chars( &maxsearch, 50 ); /* 50 chars... may it be too long? */ if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate ) find_char, GINT_TO_POINTER( "\\" ), &maxsearch ) ) { maxsearch = iter; /* re-use maxsearch */ buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE ); } } #ifdef SHOW_SNOOPER g_print("completion: found command '%s'\n", buf); #endif /* SHOW_SNOOPER */ if (!buf || ( (main_v->completion.show != COMPLETION_FIRST_CALL) && (strlen(buf) < 3)) ) { /* we require \xy */ return FALSE; } GList *completion_list_0 = NULL; GList *completion_list_1 = NULL; GList *completion_list = NULL; completion_list_0 = g_completion_complete(main_v->props.completion, buf, NULL); if (completion_list_0) { completion_list = g_list_copy(completion_list_0); completion_list_1 = g_completion_complete(main_v->props.completion_s, buf, NULL); if (completion_list_1) { completion_list = g_list_concat(completion_list, g_list_copy(completion_list_1)); g_list_sort(completion_list, (GCompareFunc)strcmp); } }else { completion_list_1 = g_completion_complete(main_v->props.completion_s, buf, NULL); if (completion_list_1) { completion_list = g_list_copy(completion_list_1); g_list_sort(completion_list, (GCompareFunc)strcmp); }else{ return FALSE; } } /* shouldnot remove completion_list_i after using it */ /* Adds the second GList onto the end of the first GList. Note that the elements of the second GList are not copied. They are used directly. */ /* there is *ONLY* one word and the user reach end of this word */ if ( (main_v->completion.show != COMPLETION_FIRST_CALL) && g_list_length(completion_list) ==1 && strlen (completion_list->data) == strlen(buf) ) { return FALSE; } main_v->completion.cache = buf; GtkListStore *store; GtkTreeIter iter; /* create list of completion words */ DEBUG_MSG("completion_popup_menu: rebuild the word list\n"); store = gtk_list_store_new (1, G_TYPE_STRING); GList *item; item = g_list_first(completion_list); while (item) { gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, (gchar *)item->data, -1); item = g_list_next(item); } g_list_free(completion_list); model = GTK_TREE_MODEL(store); } /* the old model will be ignored */ gtk_tree_view_set_model(GTK_TREE_VIEW(main_v->completion.treeview), model); g_object_unref(model); /* Moving the popup window */ gint root_x, x, root_y, y; GdkWindow *win; { GdkRectangle rect; GtkTextIter iter; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); gtk_text_view_get_iter_location( GTK_TEXT_VIEW(widget), &iter, &rect); gtk_text_view_buffer_to_window_coords( GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_WIDGET, rect.x, rect.y, &x, &y ); } gtk_window_get_position(GTK_WINDOW(BFWIN(doc->bfwin)->main_window), &root_x, &root_y); x += root_x; y += root_y; win = gtk_text_view_get_window(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_WIDGET); if (win) { /* get the position of text view window relative to its parents */ gdk_window_get_geometry(win, &root_x, &root_y, NULL, NULL, NULL); x += root_x; y += root_y; } else {/* when does this case take place ?*/ g_print("completion_popup_menu: not a window\n"); return FALSE; } /* gdouble tx, ty; if (gdk_event_get_coords((GdkEvent *)kevent, &tx, &ty)) { g_print("old algorithm: (%d, %d); gdk_get_coords: (%f, %f)\n", x, y, tx, ty); } */ gtk_window_move (GTK_WINDOW(main_v->completion.window), x+16, y); {/* select the first item; need*not* for the first time */ GtkTreePath *treepath = gtk_tree_path_new_from_string("0"); if (treepath) { gtk_tree_view_set_cursor(GTK_TREE_VIEW(main_v->completion.treeview), treepath, NULL, FALSE); gtk_tree_path_free(treepath); } } gtk_widget_show_all(main_v->completion.window); #ifdef SHOW_SNOOPER g_print("completion_popup_menu: window has been created\n"); #endif return TRUE; } static gboolean doc_view_key_press_lcb( GtkWidget *widget, GdkEventKey *kevent, Tdocument *doc ) { #ifdef SHOW_SNOOPER g_print("doc: got key pressed\n"); #endif if ( ! ( (kevent->state & GDK_CONTROL_MASK) && ( (kevent->keyval == GDK_bracketleft) || (kevent->keyval == GDK_bracketright) ) ) ) { brace_finder(doc->buffer, doc->brace_finder, 0, -1); } if (!(doc->view_bars & MODE_AUTO_COMPLETE)) { return FALSE; } if (main_v->completion.show == COMPLETION_DELETE ) { DEBUG_MSG("doc: delete item from popup\n"); /* delete stuff: - get current position/command - hide the popup window - delete the selected item. this alters `main_v->props.completion(_s)->items' (GCompletion) - rebuild the popup - recaculate: completion_popup_menu(widget, kevent, doc) */ /* get current selection */ GtkTreePath *treepath = NULL; GtkTreeModel *model; model = gtk_tree_view_get_model(GTK_TREE_VIEW(main_v->completion.treeview)); gtk_tree_view_get_cursor(GTK_TREE_VIEW(main_v->completion.treeview), &treepath, NULL); gchar *user_selection = NULL; if (treepath) { GtkTreeIter iter; GValue *val = NULL; gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_path_free(treepath); val = g_new0(GValue, 1); gtk_tree_model_get_value(model, &iter, 0, val); user_selection = g_strdup((gchar *) (g_value_peek_pointer(val))); g_value_unset (val); g_free (val); DEBUG_MSG("completion: user selected '%s'\n", user_selection); } if (user_selection) { /* hide the windows */ gtk_widget_hide_all( main_v->completion.window ); /* now delete */ DEBUG_MSG("completion: delete an item '%s'\n", user_selection); GList *tmp; GList *first_word = NULL; gboolean word_removed = FALSE; /* --- how to remove an item `foobar' --- we first have a list prefixed by `foobar'. get the first item of this list and remove the item from the main list by `g_list_remove_link'. finally, remove the item from the main list. */ if (!word_removed) { tmp = g_completion_complete(main_v->props.completion,user_selection,NULL); if (tmp) { first_word = g_list_first(tmp); if (strcmp((gchar*)first_word->data, user_selection) == 0 ) { g_list_remove_link(tmp,first_word); DEBUG_MSG("completion: first word : %s\n",(gchar*)first_word->data); g_completion_remove_items(main_v->props.completion, first_word); DEBUG_MSG("completion: ...item deleted from global list\n"); word_removed = TRUE; } } } if (!word_removed) { tmp = g_completion_complete(main_v->props.completion_s,user_selection,NULL); /* note the session list wasnot sorted. if we remove an item, add it again to the session list (by `gap_command', the list is unordered. so we have to search through the session_list. we donot use the g_list_find_custom as tmp is *GCompletion --- !!!! */ /* TODO: optimized */ first_word = g_list_last(tmp); gint count=0; while (first_word && (strcmp((gchar*)first_word->data, user_selection) != 0)) { first_word = first_word->prev; count ++; } DEBUG_MSG("completion: passed %d words\n",count); /* we must ensure the the first item == user_selection */ if ( first_word ) { g_list_remove_link(tmp,first_word); DEBUG_MSG("completion: first word : %s\n",(gchar*)first_word->data); g_completion_remove_items(main_v->props.completion_s, first_word); DEBUG_MSG("completion: ...item deleted from session list\n"); word_removed = TRUE; } } if(word_removed) { gchar *tmpstr = g_strdup_printf(_("deleted '%s'"), user_selection); statusbar_message(doc->bfwin, tmpstr, 2000); g_free(tmpstr); } g_free(user_selection); main_v->completion.show = COMPLETION_AUTO_CALL; }else{ main_v->completion.show = COMPLETION_WINDOW_HIDE; } return TRUE; } if (main_v->completion.show == COMPLETION_WINDOW_UP || main_v->completion.show == COMPLETION_WINDOW_DOWN || main_v->completion.show == COMPLETION_WINDOW_PAGE_DOWN || main_v->completion.show == COMPLETION_WINDOW_PAGE_UP){ GtkTreeModel *model; gint maxnode, index; model = gtk_tree_view_get_model(GTK_TREE_VIEW(main_v->completion.treeview)); maxnode = gtk_tree_model_iter_n_children(model, NULL); if (maxnode ==1) { gtk_widget_hide( GTK_WIDGET( main_v->completion.window )); main_v->completion.show = COMPLETION_WINDOW_HIDE; return TRUE; } GtkTreePath *treepath = NULL; gtk_tree_view_get_cursor(GTK_TREE_VIEW(main_v->completion.treeview), &treepath, NULL); /* TODO: remove this check */ if (treepath) { { gchar *path; path = gtk_tree_path_to_string(treepath); index = atoi(path); g_free(path); } if (main_v->completion.show == COMPLETION_WINDOW_UP) { index --; } else if (main_v->completion.show == COMPLETION_WINDOW_PAGE_UP) { index = index - 5; } else if (main_v->completion.show == COMPLETION_WINDOW_DOWN) { index ++; } else { index = index + 5; } if (index < 0) { index = 0; } else if (index >= maxnode) { index = maxnode -1; } { gchar *tmpstr = g_strdup_printf("%d", index); treepath = gtk_tree_path_new_from_string(tmpstr); g_free(tmpstr); } gtk_tree_view_set_cursor(GTK_TREE_VIEW(main_v->completion.treeview), treepath, NULL, FALSE); gtk_tree_path_free(treepath); } main_v->completion.show = COMPLETION_WINDOW_SHOW; return TRUE; } else if ( main_v->completion.show == COMPLETION_FIRST_CALL ) { if (!completion_popup_menu(widget, kevent, doc)) { #ifdef SHOW_SNOOPER g_print("doc: completion returns NULL. popup willnot be shown\n"); #endif main_v->completion.show = COMPLETION_WINDOW_HIDE; }else{ main_v->completion.show = COMPLETION_WINDOW_SHOW; } } else if (main_v->completion.show == COMPLETION_WINDOW_HIDE) { #ifdef SHOW_SNOOPER g_print("...hide popup window\n"); #endif gtk_widget_hide_all( main_v->completion.window ); } /* moved to snooper.c :: completion_snooper() main_v->lastkp_keyval = kevent->keyval; main_v->lastkp_hardware_keycode = kevent->hardware_keycode; */ return FALSE; /* we didn't handle all of the event */ } static gboolean doc_view_key_release_lcb( GtkWidget *widget, GdkEventKey *kevent, Tdocument *doc ) { #ifdef SHOW_SNOOPER g_print("doc: got key released\n"); #endif /* never reach: if ( (kevent->keyval == GDK_space) && (kevent->state & GDK_CONTROL_MASK ))*/ /* complete the word */ if (doc->view_bars & MODE_AUTO_COMPLETE) { if (main_v->completion.show == COMPLETION_WINDOW_ACCEPT) { #ifdef SHOW_SNOOPER g_print("...autotcompletion accepted\n"); #endif gtk_widget_hide_all( main_v->completion.window ); main_v->completion.show = COMPLETION_WINDOW_HIDE; if ( main_v->completion.bfwin != BFWIN(doc->bfwin)->current_document ) { #ifdef SHOW_SNOOPER /* TODO: hide the popup when window changed */ g_print("completion: accepted, but window changed. Ingore it.\n"); #endif return TRUE; } /* inserting staff */ #ifdef SHOW_SNOOPER g_print("completion: cached ='%s'\n", main_v->completion.cache); #endif { /* get user's selection */ /* get path and iter */ GtkTreePath *treepath = NULL; GtkTreeModel *model; model = gtk_tree_view_get_model(GTK_TREE_VIEW(main_v->completion.treeview)); /* lucky, model is*NOT* NULL -- we skip a check :) */ gtk_tree_view_get_cursor(GTK_TREE_VIEW(main_v->completion.treeview), &treepath, NULL); if (treepath) { GtkTreeIter iter; gchar *user_selection = NULL; GValue *val = NULL; gint i, len, cache_len; gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_path_free(treepath); #ifdef ENABLE_FIX_UNIKEY_GTK GtkTextIter cursor_iter, tmp_iter; GtkTextMark *imark; gchar *test_buf; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &cursor_iter, imark ); tmp_iter = cursor_iter; gtk_text_iter_backward_chars(&tmp_iter, 1); test_buf = gtk_text_buffer_get_text(doc->buffer, &tmp_iter, &cursor_iter, FALSE); if (test_buf[0] == ' ') { gtk_text_buffer_delete( doc->buffer, &tmp_iter, &cursor_iter); } #endif /* ENABLE_FIX_UNIKEY_GTK */ val = g_new0(GValue, 1); gtk_tree_model_get_value(model, &iter, 0, val); user_selection = g_strdup((gchar *) (g_value_peek_pointer(val))); g_value_unset (val); g_free (val); #ifdef SHOW_SNOOPER g_print("completion: user selected '%s'\n", user_selection); #endif /* inserting */ cache_len = strlen(main_v->completion.cache); len = strlen(user_selection); if ( len == cache_len ) { return TRUE; } else if (len > cache_len ){ len = len - cache_len; gchar *retval = g_malloc((len+1) * sizeof(char)); for (i=0; i< len; i++) { retval[i] = user_selection[cache_len + i]; } retval[len] = '\0'; #ifdef SHOW_SNOOPER g_print("completion: will add '%s' (%d chars)\n", retval, len); #endif GtkTextIter iter; GtkTextMark *imark; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); gtk_text_buffer_insert( doc->buffer, &iter, retval, -1 ); g_free(retval); } g_free(user_selection); } } return TRUE; } else if ( main_v->completion.show == COMPLETION_WINDOW_SHOW || main_v->completion.show == COMPLETION_AUTO_CALL ) { if (!completion_popup_menu(widget, kevent, doc)) { #ifdef SHOW_SNOOPER g_print("doc: completion returns NULL. popup willnot be shown\n"); #endif gtk_widget_hide_all( main_v->completion.window ); main_v->completion.show = COMPLETION_WINDOW_HIDE; } else { main_v->completion.show = COMPLETION_WINDOW_SHOW; } } } gap_command( widget, kevent, doc); /* shift> = ]*/ /* if the shift key is released before the '>' key, we get a key release not for '>' but for '.'. We, therefore have set that in the key_press event, and check if the same hardware keycode was released */ /* complete environment */ if ( ! ( (kevent->state & GDK_CONTROL_MASK) && ( (kevent->keyval == GDK_bracketleft) || (kevent->keyval == GDK_bracketright) ) ) ) { brace_finder(doc->buffer,doc->brace_finder,BR_AUTO_FIND, BRACE_FINDER_MAX_LINES); } if ( ( kevent->keyval == GDK_braceright ) || (main_v->last_kevent && ( kevent->hardware_keycode == ((GdkEventKey *)main_v->last_kevent)->hardware_keycode && ((GdkEventKey *)main_v->last_kevent)->keyval == GDK_braceright )) ) { /* autoclose environment for LaTeX */ if ( doc->view_bars & MODE_AUTO_COMPLETE ) { GtkTextMark * imark; GtkTextIter itstart, iter, maxsearch; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); itstart = iter; maxsearch = iter; DEBUG_MSG( "doc_view_key_release_lcb, autocomplete, started at %d\n", gtk_text_iter_get_offset( &itstart ) ); gtk_text_iter_backward_chars( &maxsearch, 30 ); /* \begin{flushleft} */ if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate ) find_char, GINT_TO_POINTER( "\\" ), &maxsearch ) ) { /* we use a regular expression to check if the tag is valid, AND to parse the tagname from the string */ gchar * buf; int ovector[ 12 ], ret; DEBUG_MSG( "doc_view_key_release_lcb, we found a '<'\n" ); maxsearch = iter; /* re-use maxsearch */ buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE ); DEBUG_MSG( "doc_view_key_release_lcb, buf='%s'\n", buf ); ret = pcre_exec( main_v->autoclosingtag_regc, NULL, buf, strlen( buf ), 0, PCRE_ANCHORED, ovector, 12 ); if ( ret > 0 ) { gchar * tagname, *toinsert, *indent = NULL; DEBUG_MSG( "doc_view_key_release_lcb, autoclosing, we have a tag, ret=%d, starts at ovector[2]=%d, ovector[3]=%d\n", ret, ovector[ 2 ], ovector[ 3 ] ); tagname = g_strndup( &buf[ ovector[ 2 ] ], ovector[ 3 ] - ovector[ 2 ] ); DEBUG_MSG( "doc_view_key_release_lcb, autoclosing, tagname='%s'\n", tagname ); /* add to the completion lisst */ /* TODO: move this to gap_command */ { gchar *tmpstr = g_strconcat("\\begin{",tagname,NULL); GList *search = NULL; search = g_list_find_custom(main_v->props.completion->items,tmpstr, (GCompareFunc)strcmp); if (!search) { search = g_list_find_custom(main_v->props.completion_s->items,tmpstr, (GCompareFunc)strcmp); if (!search) { DEBUG_MSG("doc: new environment captured: %s\n", tmpstr); GList *tmplist = NULL; tmplist = g_list_append(tmplist, tmpstr); g_completion_add_items(main_v->props.completion_s,tmplist); g_list_free(tmplist); } } /* search cannot be freed */ } /* count the autoindent */ if (main_v->props.view_bars & MODE_AUTO_INDENT) { itstart = iter; gtk_text_iter_set_line_index(&itstart, 0); indent = gtk_text_buffer_get_text(doc->buffer, &itstart, &iter, FALSE); if (indent) { gchar *indenting = indent; while (*indenting == '\t' || *indenting == ' ' ) { indenting++; } *indenting = '\0'; if (strlen( indent )) { toinsert = g_strconcat( "\n", indent, "\n", indent, "\\end{", tagname, "}", NULL); }else{ toinsert = g_strconcat( "\n\n\\end{", tagname, "}", NULL ); } }else{ toinsert = g_strconcat( "\n\n\\end{", tagname, "}", NULL ); } }else{ toinsert = g_strconcat( "\n\n\\end{", tagname, "}", NULL ); } if ( toinsert ) { /* we re-use the maxsearch iter now */ gtk_text_buffer_insert( doc->buffer, &maxsearch, toinsert, -1 ); /* now we set the cursor back to its previous location, re-using itstart */ gtk_text_buffer_get_iter_at_mark( doc->buffer, &itstart, gtk_text_buffer_get_insert( doc->buffer ) ); gint tmpint = strlen( tagname ) + 7; /* NOTE: utf8 tagname ==> use g_utf8_strlen */ if (indent) { gtk_text_iter_backward_chars( &itstart, tmpint + strlen(indent)); g_free(indent); }else{ gtk_text_iter_backward_chars( &itstart, tmpint); } /* gint startoffset = gtk_text_iter_get_offset(&itstart); */ gtk_text_buffer_place_cursor( doc->buffer, &itstart ); /* doc_unre_add(doc, toinsert, startoffset, startoffset+tmpint, UndoInsert); */ g_free( toinsert ); } #ifdef DEBUG else { DEBUG_MSG( "doc_view_key_release_lcb, no match!! '%s' is not a valid tag\n", buf ); } #endif g_free( tagname ); } #ifdef DEBUG else { DEBUG_MSG( "doc_view_key_release_lcb, ret=%d\n", ret ); DEBUG_MSG( "document: key_release_lcb: [%s]\n", buf ); } #endif /* cleanup and return */ g_free( buf ); } #ifdef DEBUG else { DEBUG_MSG( "doc_view_key_release_lcb, did not find a '\\' character\n" ); } #endif } /* autoindent */ } else if ( ( kevent->keyval == GDK_Return || kevent->keyval == GDK_KP_Enter ) && !( kevent->state & GDK_SHIFT_MASK || kevent->state & GDK_CONTROL_MASK || kevent->state & GDK_MOD1_MASK ) ) { /* find the \startFOO. TODO: \bFOO */ gchar *tagname = NULL; gchar *endtag = NULL; if ( doc->view_bars & MODE_AUTO_COMPLETE ) { GtkTextMark * imark; GtkTextIter itstart, iter, maxsearch; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); itstart = iter; maxsearch = iter; DEBUG_MSG( "doc_view_key_release_lcb, autocomplete, started at %d\n", gtk_text_iter_get_offset( &itstart ) ); gtk_text_iter_backward_chars( &maxsearch, 30 ); /* \begin{flushleft} */ if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate ) find_char, GINT_TO_POINTER( "\\" ), &maxsearch ) ) { /* we use a regular expression to check if the tag is valid, AND to parse the tagname from the string */ gchar * buf; int ovector[ 9 ], ret; DEBUG_MSG( "doc_view_key_release_lcb, we found a '<'\n" ); maxsearch = iter; /* re-use maxsearch */ buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE ); DEBUG_MSG( "doc_view_key_release_lcb, buf='%s'\n", buf ); ret = pcre_exec( main_v->autoclosingtag_be_regc, NULL, buf, strlen( buf ), 0, PCRE_ANCHORED, ovector, 9 ); if ( ret > 0 ) { tagname = g_strndup( &buf[ ovector[ 3 ] ], ovector[ 1 ] - ovector[ 3 ] ); endtag = g_strndup( &buf[ ovector[ 2 ] ], ovector[ 3 ] - ovector[ 2 ] ); } g_free( buf ); } } GtkTextIter itend; gchar *string = NULL; /* badname */ if ( main_v->props.view_bars & MODE_AUTO_INDENT ) { gchar *indenting; GtkTextMark* imark; GtkTextIter itstart; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, imark ); itstart = itend; /* set to the beginning of the previous line */ gtk_text_iter_backward_line( &itstart ); gtk_text_iter_set_line_index( &itstart, 0 ); string = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); if ( string ) { /* now count the indenting in this string */ indenting = string; while ( *indenting == '\t' || *indenting == ' ' ) { indenting++; } /* ending search, non-whitespace found, so terminate at this position */ *indenting = '\0'; if ( strlen( string ) ) { DEBUG_MSG( "doc_buffer_insert_text_lcb, inserting indenting\n" ); gtk_text_buffer_insert( doc->buffer, &itend, string, -1 ); } } } /* insert \endFOO */ if ( tagname ) { /* so endtag != NULL ; */ gint tmpint=0; gchar *toinsert; #ifdef HAVE_CONTEXT if (strncmp(endtag,"begin",5) ==0 ) { endtag = g_strdup("\\end"); tmpint += 5; /* 5 = strlen (endtag) +1 */ }else{ endtag = g_strdup("\\stop"); tmpint += 6; } #else endtag = g_strdup("\\end"); tmpint += 5; #endif if ( string && (tmpint += strlen(string)) ) { toinsert = g_strconcat("\n", string, endtag, tagname, NULL); }else{ toinsert = g_strconcat("\n", endtag, tagname, NULL); } g_free(endtag); g_free( string ); gtk_text_buffer_insert( doc->buffer, &itend, toinsert, -1 ); g_free(toinsert); tmpint += strlen(tagname); gtk_text_iter_backward_chars( &itend, tmpint); gtk_text_buffer_place_cursor( doc->buffer, &itend ); g_free(tagname); } /* autobrace. TODO: confused with \begin{asdf} */ /* }else if ( ( kevent->keyval == GDK_braceleft ) || ( kevent->hardware_keycode == main_v->lastkp_hardware_keycode && main_v->lastkp_keyval == GDK_braceleft ) ) { GtkTextMark * imark; GtkTextIter iter; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); gtk_text_buffer_insert( doc->buffer, &iter, "}", -1 ); gtk_text_iter_backward_chars( &iter, 1); gtk_text_buffer_place_cursor( doc->buffer, &iter ); */ /* autotext */ } else if ( ( kevent->state & GDK_SHIFT_MASK ) && !( kevent->state & GDK_CONTROL_MASK ) && ( kevent->keyval == GDK_space ) ) { /* kyanh, added, 20050302 */ /* User must press SHIFT + SPACE to start autotext */ GtkTextMark * imark; GtkTextIter itstart, iter, maxsearch; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, imark ); itstart = iter; maxsearch = iter; gtk_text_iter_backward_chars( &maxsearch, AUTOTEXT_MAX_LENGTH ); if ( gtk_text_iter_backward_find_char( &itstart, ( GtkTextCharPredicate ) find_char, GINT_TO_POINTER( "/" ), &maxsearch ) ) { gchar * buf; maxsearch = iter; /* re-use maxsearch */ gtk_text_iter_backward_chars( &maxsearch, 1 ); /* skip the space */ buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &maxsearch, FALSE ); if ( strlen( buf ) > 2 ) { /* NOTE: why >2 ? i forgot the reason :) */ gchar **tmp = autotext_done( buf ); if ( tmp ) { gtk_text_iter_forward_chars( &maxsearch, 1 ); /* kill the space */ gtk_text_buffer_delete( doc->buffer, &maxsearch, &itstart ); gtk_text_iter_set_line_index(&maxsearch, 0); gchar *indent=NULL; if (main_v->props.view_bars & MODE_AUTO_INDENT ) { indent = gtk_text_buffer_get_text( doc->buffer, &maxsearch, &itstart, FALSE); if (indent) { gchar *indenting = indent; while ( *indenting == '\t' || *indenting == ' ' ) { indenting++; } *indenting = '\0'; } } gchar **output=NULL, **tmpchar; gchar *result=NULL; gint count; if ( strlen( tmp[ 0 ] ) ) { if (indent) { output = g_strsplit(tmp[0],"\n",0); count=0; tmpchar = output; while (*tmpchar != NULL ) { if (count) { result = g_strconcat(result, "\n", indent, output[count], NULL); }else{ result = g_strdup(output[0]); } count++; tmpchar++; } gtk_text_buffer_insert( doc->buffer, &itstart, result, -1 ); }else{ gtk_text_buffer_insert( doc->buffer, &itstart, tmp[ 0 ], -1 ); } } if ( strlen( tmp[ 1 ] ) ) { if (indent) { output = g_strsplit(tmp[1], "\n",0); count = 0; tmpchar = output; while (*tmpchar != NULL) { if (count) { result = g_strconcat(result, "\n", indent, output[count], NULL); }else{ result = g_strdup(output[0]); } count++; tmpchar++; } }else{ result = g_strdup(tmp[1]); } gtk_text_buffer_insert( doc->buffer, &itstart, result, -1 ); gtk_text_iter_backward_chars( &itstart, g_utf8_strlen( result, -1 ) ); gtk_text_buffer_place_cursor( doc->buffer, &itstart ); gtk_widget_grab_focus( doc->view ); } g_free(indent); g_free(result); g_strfreev(output); /* donot free tmp :) */ } } g_free( buf ); } } /* TODO: */ /* { GtkTextIter cursor_iter, tmp_iter; GtkTextMark *imark; gchar *buf; imark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &cursor_iter, imark ); tmp_iter = cursor_iter; gtk_text_iter_backward_chars(&tmp_iter, 1); buf = gtk_text_buffer_get_text(doc->buffer, &tmp_iter, &cursor_iter, FALSE); if (buf && (strcmp(buf,"}")==0)) { / * searching backward for { * / g_print("find }\n"); } } */ return FALSE; /* we didn't handle all of the event */ } static void doc_buffer_delete_range_lcb( GtkTextBuffer *textbuffer, GtkTextIter * itstart, GtkTextIter * itend, Tdocument * doc ) { gchar * string; gboolean do_highlighting = FALSE; string = gtk_text_buffer_get_text( doc->buffer, itstart, itend, FALSE ); /*DEBUG_MSG( "doc_buffer_delete_range_lcb, string='%s'\n", string );*/ if ( string ) { /* highlighting stuff */ if ( (doc->view_bars & VIEW_COLORIZED) && string && doc->hl ) { if ( strlen( doc->hl->update_chars ) == 0 ) { do_highlighting = TRUE; } else { gint i = 0; while ( string[ i ] != '\0' ) { if ( strchr( doc->hl->update_chars, string[ i ] ) ) { do_highlighting = TRUE; break; } i++; } } if ( do_highlighting ) { doc_highlight_line( doc ); } } /* undo_redo stuff */ { gint start, end, len; start = gtk_text_iter_get_offset( itstart ); end = gtk_text_iter_get_offset( itend ); len = end - start; /* DEBUG_MSG( "doc_buffer_delete_range_lcb, start=%d, end=%d, len=%d, string='%s'\n", start, end, len, string ); */ if ( len == 1 ) { if ( ( !doc_unre_test_last_entry( doc, UndoDelete, start, -1 ) /* delete */ && !doc_unre_test_last_entry( doc, UndoDelete, end, -1 ) ) /* backspace */ || string[ 0 ] == ' ' || string[ 0 ] == '\n' || string[ 0 ] == '\t' || string[ 0 ] == '\r' ) { /* DEBUG_MSG( "doc_buffer_delete_range_lcb, need a new undogroup\n" ); */ doc_unre_new_group( doc ); } } else { doc_unre_new_group( doc ); } doc_unre_add( doc, string, start, end, UndoDelete ); } g_free( string ); } doc_set_modified( doc, 1 ); } static gboolean doc_view_button_release_lcb( GtkWidget *widget, GdkEventButton *bevent, Tdocument *doc ) { DEBUG_MSG( "doc_view_button_release_lcb, button %d\n", bevent->button ); if (bevent->button == 1) { brace_finder(doc->buffer, doc->brace_finder, BR_AUTO_FIND, BRACE_FINDER_MAX_LINES); } if ( bevent->button == 2 ) { /* end of paste */ if ( doc->paste_operation ) { if ( PASTEOPERATION( doc->paste_operation ) ->eo > PASTEOPERATION( doc->paste_operation ) ->so ) { DEBUG_MSG( "doc_view_button_release_lcb, start doc-highlight_region for so=%d, eo=%d\n", PASTEOPERATION( doc->paste_operation ) ->so, PASTEOPERATION( doc->paste_operation ) ->eo ); doc_highlight_region( doc, PASTEOPERATION( doc->paste_operation ) ->so, PASTEOPERATION( doc->paste_operation ) ->eo ); } g_free( doc->paste_operation ); doc->paste_operation = NULL; } /* now we should update the highlighting for the pasted text, but how long is the pasted text ?? */ } /* if (bevent->button == 3) { GtkWidget *menuitem; GtkWidget *submenu; GtkWidget *menu = gtk_menu_new (); gboolean tag_found; tag_found = doc_bevent_in_html_tag(doc, bevent); menuitem = gtk_menu_item_new_with_label(_("Edit tag")); g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(rpopup_edit_tag_cb), doc); if (!tag_found) { gtk_widget_set_sensitive(menuitem, FALSE); } gtk_widget_show (menuitem); gtk_menu_append(GTK_MENU(menu), menuitem); menuitem = gtk_menu_item_new(); gtk_widget_show (menuitem); gtk_menu_append(GTK_MENU(menu), menuitem); menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods")); gtk_widget_show (menuitem); submenu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (GTK_TEXT_VIEW(doc->view)->im_context), GTK_MENU_SHELL (submenu)); gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, doc->view, 0, gtk_get_current_event_time ()); } */ return FALSE; } static void doc_get_iter_at_bevent( Tdocument *doc, GdkEventButton *bevent, GtkTextIter *iter ) { gint xpos, ypos; GtkTextWindowType wintype; wintype = gtk_text_view_get_window_type( GTK_TEXT_VIEW( doc->view ), doc->view->window ); gtk_text_view_window_to_buffer_coords( GTK_TEXT_VIEW( doc->view ), wintype, bevent->x, bevent->y, &xpos, &ypos ); xpos += gtk_text_view_get_border_window_size( GTK_TEXT_VIEW( doc->view ), GTK_TEXT_WINDOW_LEFT ); gtk_text_view_get_iter_at_location( GTK_TEXT_VIEW( doc->view ), iter, xpos, ypos ); } static gboolean doc_view_button_press_lcb( GtkWidget *widget, GdkEventButton *bevent, Tdocument *doc ) { DEBUG_MSG( "doc_view_button_press_lcb, button %d\n", bevent->button ); if (bevent->button==1) { brace_finder(doc->buffer, doc->brace_finder, 0, -1); } if ( bevent->button == 2 && !doc->paste_operation ) { doc->paste_operation = g_new( Tpasteoperation, 1 ); PASTEOPERATION( doc->paste_operation ) ->so = -1; PASTEOPERATION( doc->paste_operation ) ->eo = -1; } if ( bevent->button == 3 ) { GtkTextIter iter; doc_get_iter_at_bevent( doc, bevent, &iter ); /* kyanh, removed, 20050219, rpopup_bevent_in_html_code(doc, &iter); */ bmark_store_bevent_location( doc, gtk_text_iter_get_offset( &iter ) ); } return FALSE; } static void rpopup_add_bookmark_lcb( GtkWidget *widget, Tdocument *doc ) { bmark_add_at_bevent( doc ); } static void rpopup_del_bookmark_lcb( GtkWidget *widget, Tdocument *doc ) { bmark_del_at_bevent( doc ); } static void doc_view_populate_popup_lcb( GtkTextView *textview, GtkMenu *menu, Tdocument *doc ) { GtkWidget * menuitem; /* I found no way to connect an item-factory to this menu widget, so we have to do it in the manual way... */ gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( gtk_menu_item_new() ) ); menuitem = gtk_menu_item_new_with_label( _( "Replace" ) ); g_signal_connect( menuitem, "activate", G_CALLBACK( replace_cb ), doc->bfwin ); /* gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( menuitem ), gtk_image_new_from_stock( GTK_STOCK_FIND_AND_REPLACE, GTK_ICON_SIZE_MENU ) ); */ gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( menuitem ) ); menuitem = gtk_menu_item_new_with_label(_("Find"));/* gtk_image_menu_item_new_with_label( _( "Find" ) ); */ g_signal_connect( menuitem, "activate", G_CALLBACK( search_cb ), doc->bfwin ); /* gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM( menuitem ), gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_MENU ) ); */ gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( menuitem ) ); gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( gtk_menu_item_new() ) ); if ( bmark_have_bookmark_at_stored_bevent( doc ) ) { menuitem = gtk_menu_item_new_with_label( _( "Delete bookmark" ) ); g_signal_connect( menuitem, "activate", G_CALLBACK( rpopup_del_bookmark_lcb ), doc ); gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( menuitem ) ); } else { menuitem = gtk_menu_item_new_with_label( _( "Add bookmark" ) ); g_signal_connect( menuitem, "activate", G_CALLBACK( rpopup_add_bookmark_lcb ), doc ); gtk_menu_shell_prepend( GTK_MENU_SHELL( menu ), GTK_WIDGET( menuitem ) ); } /* menuitem = gtk_menu_item_new_with_label(_("Add permanent bookmark")); g_signal_connect(menuitem, "activate", G_CALLBACK(rpopup_permanent_bookmark_lcb), doc->bfwin); gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(menuitem)); menuitem = gtk_menu_item_new_with_label(_("Add temporary bookmark")); g_signal_connect(menuitem, "activate", G_CALLBACK(rpopup_temporary_bookmark_lcb), doc->bfwin); gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(menuitem)); */ /* kyanh, removed, 20050219 gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(gtk_menu_item_new())); menuitem = gtk_image_menu_item_new_with_label(_("Edit color")); gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(menuitem)); if (rpopup_doc_located_color(doc)) { g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(rpopup_edit_color_cb), doc); } else { gtk_widget_set_sensitive(menuitem, FALSE); } menuitem = gtk_image_menu_item_new_with_label(_("Edit tag")); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),new_pixmap(113)); gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), GTK_WIDGET(menuitem)); if (rpopup_doc_located_tag(doc)) { g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(rpopup_edit_tag_cb), doc); } else { gtk_widget_set_sensitive(menuitem, FALSE); } */ gtk_widget_show_all( GTK_WIDGET( menu ) ); } static void doc_buffer_mark_set_lcb( GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextMark *set_mark, Tdocument *doc ) { doc_set_statusbar_lncol( doc ); } static void doc_buffer_changed_lcb( GtkTextBuffer *textbuffer, Tdocument*doc ) { doc_set_statusbar_lncol( doc ); } static void doc_view_toggle_overwrite_lcb( GtkTextView *view, Tdocument *doc ) { doc->view_bars = SET_BIT(doc->view_bars, MODE_OVERWRITE,!GET_BIT(doc->view_bars,MODE_OVERWRITE)); doc_set_statusbar_insovr( doc ); } /** * doc_bind_signals: * @doc: a #Tdocument * * Bind signals related to the doc's buffer: * "insert-text", "delete-range" and "insert-text" for autoindent * * Return value: void **/ void doc_bind_signals( Tdocument *doc ) { doc->ins_txt_id = g_signal_connect( G_OBJECT( doc->buffer ), "insert-text", G_CALLBACK( doc_buffer_insert_text_lcb ), doc ); doc->del_txt_id = g_signal_connect( G_OBJECT( doc->buffer ), "delete-range", G_CALLBACK( doc_buffer_delete_range_lcb ), doc ); doc->ins_aft_txt_id = g_signal_connect_after( G_OBJECT( doc->buffer ), "insert-text", G_CALLBACK( doc_buffer_insert_text_after_lcb ), doc ); } /** * doc_unbind_signals: * @doc: a #Tdocument * * Unbind signals related to the doc's buffer: * "insert-text", "delete-range" and "insert-text" for autoindent. * This function checks if each individual signal has been bound before unbinding. * * Return value: void **/ void doc_unbind_signals( Tdocument *doc ) { /* g_print("doc_unbind_signals, before unbind ins=%lu, del=%lu\n", doc->ins_txt_id, doc->del_txt_id);*/ if ( doc->ins_txt_id != 0 ) { g_signal_handler_disconnect( G_OBJECT( doc->buffer ), doc->ins_txt_id ); doc->ins_txt_id = 0; } if ( doc->del_txt_id != 0 ) { g_signal_handler_disconnect( G_OBJECT( doc->buffer ), doc->del_txt_id ); doc->del_txt_id = 0; } if ( doc->ins_aft_txt_id != 0 ) { g_signal_handler_disconnect( G_OBJECT( doc->buffer ), doc->ins_aft_txt_id ); doc->ins_txt_id = 0; } } gboolean buffer_to_file( Tbfwin *bfwin, gchar *buffer, gchar *filename ) { FILE * fd; gchar *ondiskencoding = get_filename_on_disk_encoding( filename ); fd = fopen( ondiskencoding, "w" ); g_free( ondiskencoding ); if ( fd == NULL ) { DEBUG_MSG( "buffer_to_file, cannot open file %s\n", filename ); return FALSE; } fputs( buffer, fd ); fclose( fd ); return TRUE; } /** * gint doc_textbox_to_file * @doc: a #Tdocument* * @filename: a #gchar* * @window_closing: a #gboolean if the window is closing, we should supress any statusbar messages then * * If applicable, backup existing file, * possibly update meta-tags (HTML), * and finally write the document to the specified file. * * Return value: #gint set to * 1: on success * 2: on success but the backup failed * -1: if the backup failed and save was aborted * -2: if the file could not be opened or written * -3: if the backup failed and save was aborted by the user * -4: if the charset encoding conversion failed and the save was aborted by the user **/ gint doc_textbox_to_file( Tdocument * doc, gchar * filename, gboolean window_closing ) { gint backup_retval; gint write_retval; gchar *buffer; GtkTextIter itstart, itend; if ( !window_closing ) statusbar_message( BFWIN( doc->bfwin ), _( "saving file" ), 1000 ); /* kyanh, removed, 20020220 if (main_v->props.auto_update_meta) { const gchar *realname = g_get_real_name(); if (realname && strlen(realname) > 0) { gchar *tmp; Tsearch_result res = doc_search_run_extern(doc,"",1,0); if (res.end > 0) { snr2_run_extern_replace(doc,"",0,1,0,"", FALSE); } tmp = g_strconcat("",NULL); snr2_run_extern_replace(doc,"",0,1,0,tmp,FALSE); g_free(tmp); } } */ /* This writes the contents of a textbox to a file */ backup_retval = doc_check_backup( doc ); if ( !backup_retval ) { if ( main_v->props.backup_abort_action == DOCUMENT_BACKUP_ABORT_ABORT ) { DEBUG_MSG( "doc_textbox_to_file, backup failure, abort!\n" ); return -1; } else if ( main_v->props.backup_abort_action == DOCUMENT_BACKUP_ABORT_ASK ) { gchar * options[] = {_( "_Abort save" ), _( "_Continue save" ), NULL}; gint retval; gchar *tmpstr = g_strdup_printf( _( "A backupfile for %s could not be created. If you continue, this file will be overwritten." ), filename ); retval = multi_warning_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File backup failure" ), tmpstr, 1, 0, options ); g_free( tmpstr ); if ( retval == 0 ) { DEBUG_MSG( "doc_textbox_to_file, backup failure, user aborted!\n" ); return -3; } } } gtk_text_buffer_get_bounds( doc->buffer, &itstart, &itend ); buffer = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); if ( doc->encoding ) { gchar * newbuf; gsize bytes_written = 0, bytes_read = 0; DEBUG_MSG( "doc_textbox_to_file, converting from UTF-8 to %s\n", doc->encoding ); newbuf = g_convert( buffer, -1, doc->encoding, "UTF-8", &bytes_read, &bytes_written, NULL ); if ( newbuf ) { g_free( buffer ); buffer = newbuf; } else { gchar *options[] = {_( "_Abort save" ), _( "_Continue save in UTF-8" ), NULL}; gint retval, line, column; glong position; gchar *tmpstr, failed[ 6 ]; GtkTextIter iter; position = g_utf8_pointer_to_offset( buffer, buffer + bytes_read ); gtk_text_buffer_get_iter_at_offset( doc->buffer, &iter, position ); line = gtk_text_iter_get_line( &iter ); column = gtk_text_iter_get_line_offset( &iter ); failed[ 0 ] = '\0'; g_utf8_strncpy( failed, buffer + bytes_read, 1 ); tmpstr = g_strdup_printf( _( "Failed to convert %s to character encoding %s. Encoding failed on character '%s' at line %d column %d\n\nContinue saving in UTF-8 encoding?" ), filename, doc->encoding, failed, line + 1, column + 1 ); retval = multi_warning_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File encoding conversion failure" ), tmpstr, 1, 0, options ); g_free( tmpstr ); if ( retval == 0 ) { DEBUG_MSG( "doc_textbox_to_file, character set conversion failed, user aborted!\n" ); return -4; } else { /* continue in UTF-8 */ /* update_encoding_meta_in_file(doc, "UTF-8"); */ g_free( buffer ); gtk_text_buffer_get_bounds( doc->buffer, &itstart, &itend ); buffer = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); } } } write_retval = buffer_to_file( BFWIN( doc->bfwin ), buffer, filename ); DEBUG_MSG( "doc_textbox_to_file, write_retval=%d\n", write_retval ); g_free( buffer ); if ( !write_retval ) { return -2; } if ( main_v->props.view_bars & MODE_CLEAR_UNDO_HISTORY_ON_SAVE ) { doc_unre_clear_all( doc ); } DEBUG_MSG( "doc_textbox_to_file, calling doc_set_modified(doc, 0)\n" ); doc_set_modified( doc, 0 ); if ( !backup_retval ) { return 2; } else { return 1; } } /** * doc_destroy: * @doc: a #Tdocument * @delay_activation: #gboolean whether to delay gui-updates. * * Performs all actions neccessary to remove an open document from the fish: * Adds filename to recent-list, * removes the document from the documentlist and notebook, * change notebook-focus (if !delay_activation), * delete backupfile if required by pref, * free all related memory. * * Return value: void **/ void doc_destroy( Tdocument * doc, gboolean delay_activation ) { Tbfwin * bfwin = BFWIN( doc->bfwin ); DEBUG_MSG( "wf: doc_destroy, calling bmark_clean_for_doc(%p)\n", doc ); bmark_clean_for_doc( doc ); /* bmark_adjust_visible(bfwin); */ if ( doc->filename ) { add_to_recent_list( doc->bfwin, doc->filename, 1, FALSE ); } gui_notebook_unbind_signals( BFWIN( doc->bfwin ) ); /* to make this go really quick, we first only destroy the notebook page and run flush_queue(), after the document is gone from the GUI we complete the destroy, to destroy only the notebook page we ref+ the scrolthingie, remove the page, and unref it again */ /* related to BUG#63 . Lines added by kyanh */ GtkTextIter start, end; DEBUG_MSG("doc_destroy: finding start and end iter\n"); gtk_text_buffer_get_bounds(doc->buffer, &start, &end); DEBUG_MSG("doc_destroy: found start and end iter\n"); /* kyanh, 20050723, related to BUG#63 for long document, we need remove all tags before deleting the buffer. Why? Keeping the tags will take a very long time to delete the buffer. */ gtk_text_buffer_remove_all_tags(doc->buffer, &start, &end); gtk_text_buffer_delete(doc->buffer, &start, &end); DEBUG_MSG("doc_destroy: destroyed text buffer\n"); /* >> */ g_free(doc->brace_finder); /* free the brace finder */ g_object_ref( doc->view->parent ); if ( doc->floatingview ) { gtk_widget_destroy( FLOATINGVIEW( doc->floatingview ) ->window ); doc->floatingview = NULL; } /* now we remove the document from the document list */ bfwin->documentlist = g_list_remove( bfwin->documentlist, doc ); DEBUG_MSG( "removed %p from documentlist, list %p length=%d\n", doc , bfwin->documentlist , g_list_length( bfwin->documentlist ) ); if ( bfwin->current_document == doc ) { bfwin->current_document = NULL; } /* then we remove the page from the notebook */ DEBUG_MSG( "about to remove widget from notebook (doc=%p, current_document=%p)\n", doc, bfwin->current_document ); /* gtk_widget_destroy(doc->tab_label->parent); */ gtk_notebook_remove_page( GTK_NOTEBOOK( bfwin->notebook ), gtk_notebook_page_num( GTK_NOTEBOOK( bfwin->notebook ), doc->view->parent ) ); DEBUG_MSG( "doc_destroy, removed widget from notebook (doc=%p), delay_activation=%d\n", doc, delay_activation ); DEBUG_MSG( "doc_destroy, (doc=%p) about to bind notebook signals...\n", doc ); gui_notebook_bind_signals( BFWIN( doc->bfwin ) ); if ( !delay_activation ) { notebook_changed( BFWIN( doc->bfwin ), -1 ); } DEBUG_MSG( "doc_destroy, (doc=%p) after calling notebook_changed()\n", doc ); /* now we really start to destroy the document */ /* kyanh, 20050226, the program terminates with SEGEMENT FAULT here */ gtk_object_sink( GTK_OBJECT( doc->view->parent ) ); /* g_object_unref(doc->view->parent); */ /* kyanh, 20050225, 15:30: WOH, doc->view is a GtkTextView, it is a GtkObject. That's mean that it can be 'sink'. I try to remove the using g_object_unref by gtk_object_sink() and thing went well, at least at this point :)) CHEERS BUG[200502]#7 */ if ( doc->filename ) { if ( (main_v->props.view_bars & MODE_REMOVE_BACKUP_ON_CLOSE) && strlen(main_v->props.backup_filestring) ) { gchar * backupfile = g_strconcat( doc->filename, main_v->props.backup_filestring, NULL ); DEBUG_MSG( "unlinking %s, doc->filename=%s\n", backupfile, doc->filename ); unlink( backupfile ); g_free( backupfile ); } g_free( doc->filename ); } if ( doc->encoding ) g_free( doc->encoding ); g_object_unref( doc->buffer ); doc_unre_destroy( doc ); DEBUG_MSG( "doc_destroy, finished for %p\n", doc ); g_free( doc ); } /** * document_unset_filename: * @document: #Tdocument* * * this function is called if some other document is saved with a filename * equal to this files filename, or when this file is deleted in the filebrowser * * return value: void, ignored */ void document_unset_filename( Tdocument *doc ) { if ( doc->filename ) { gchar * tmpstr2, *tmpstr3; gchar *tmpstr, *oldfilename = doc->filename; doc->filename = NULL; doc_set_title( doc ); tmpstr2 = g_path_get_basename( oldfilename ); tmpstr3 = get_utf8filename_from_on_disk_encoding( tmpstr2 ); tmpstr = g_strconcat( _( "Previously: " ), tmpstr3, NULL ); g_free( tmpstr2 ); g_free( tmpstr3 ); gtk_label_set( GTK_LABEL( doc->tab_label ), tmpstr ); g_free( tmpstr ); g_free( oldfilename ); } } /** * ask_new_filename: * @bfwin: #Tbfwin* mainly used to set the dialog transient * @oldfilename: #gchar* with the old filename * @gui_name: #const gchar* with the name of the file used in the GUI * @is_move: #gboolean if the title should be move or save as * * returns a newly allocated string with a new filename * * if a file with the selected name name was * open already it will ask the user what to do, return NULL if * the user wants to abort, or will remove the name of the other file if the user wants * to continue * * Return value: gchar* with newly allocated string, or NULL on failure or abort **/ gchar *ask_new_filename( Tbfwin *bfwin, gchar *oldfilename, const gchar *gui_name, gboolean is_move ) { Tdocument * exdoc; GList *alldocs; gchar *ondisk = get_filename_on_disk_encoding( oldfilename ); gchar *newfilename = NULL; gchar *dialogtext; dialogtext = g_strdup_printf( ( is_move ) ? _( "Move/rename %s to" ) : _( "Save %s as" ), gui_name ); #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; dialog = file_chooser_dialog( bfwin, dialogtext, GTK_FILE_CHOOSER_ACTION_SAVE, oldfilename, TRUE, FALSE, NULL ); if ( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_ACCEPT ) { newfilename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); } gtk_widget_destroy( dialog ); } #else newfilename = return_file_w_title( ondisk, dialogtext ); #endif g_free( ondisk ); g_free( dialogtext ); if ( !newfilename ) { return NULL; }else{ /* ondisk = get_filename_on_disk_encoding(newfilename); */ if (g_file_test(newfilename, G_FILE_TEST_EXISTS)) { struct stat statbuf; gint inode; gint l_retval =1; ondisk = get_filename_on_disk_encoding(newfilename); if ( stat(ondisk,&statbuf) != 0 ) { DEBUG_MSG("ask_new_filename: stat newfile [%s] failed\n", newfilename); l_retval = 0; }else if (oldfilename) { inode = statbuf.st_ino; g_free(ondisk); ondisk = get_filename_on_disk_encoding(oldfilename); if ( stat(ondisk, &statbuf) !=0 ) { DEBUG_MSG("ask_new_filename: stat oldfile [%s] failed\n", oldfilename); l_retval = 0; }else if (l_retval && (statbuf.st_ino == inode) ) { l_retval = 0; } } g_free(ondisk); if (l_retval ==0) { DEBUG_MSG("ask_new_filename: stat failed or new file == old file. return NULL\n"); g_free( newfilename ); return NULL; } } } /* make a full path, re-use the ondisk variable */ ondisk = newfilename; newfilename = create_full_path( ondisk, NULL ); g_free( ondisk ); alldocs = return_allwindows_documentlist(); exdoc = documentlist_return_document_from_filename( alldocs, newfilename ); g_list_free( alldocs ); DEBUG_MSG( "ask_new_filename, exdoc=%p, newfilename=%s\n", exdoc, newfilename ); if ( exdoc ) { gchar * tmpstr; gint retval; gchar *options[] = {_( "_Cancel" ), _( "_Overwrite" ), NULL}; tmpstr = g_strdup_printf( _( "File %s exists and is opened, overwrite?" ), newfilename ); retval = multi_warning_dialog( bfwin->main_window, tmpstr, _( "The file you have selected is being edited in Winefish." ), 1, 0, options ); g_free( tmpstr ); if ( retval == 0 ) { g_free( newfilename ); return NULL; } else { document_unset_filename( exdoc ); } } else { /* gchar *ondiskencoding = get_filename_on_disk_encoding( newfilename ); */ if ( g_file_test( newfilename, G_FILE_TEST_EXISTS ) ) { gchar * tmpstr; gint retval; gchar *options[] = {_( "_Cancel" ), _( "_Overwrite" ), NULL}; tmpstr = g_strdup_printf( _( "A file named \"%s\" already exists." ), newfilename ); retval = multi_warning_dialog( bfwin->main_window, tmpstr, _( "Do you want to replace the existing file?" ), 1, 0, options ); g_free( tmpstr ); if ( retval == 0 ) { g_free( newfilename ); /* g_free( ondiskencoding ); */ return NULL; } } /* g_free( ondiskencoding ); */ } return newfilename; } /** * doc_save: * @doc: the #Tdocument to save * @do_save_as: #gboolean set to 1 if "save as" * @do_move: #gboolean set to 1 if moving the file. * @window_closing: #gboolean if the window is closing, should suppress statusbar messages then * * Performs all neccessary actions to save an open document. * Warns the user of problems, and asks for a filename if neccessary. * * Return value: #gint set to * 1: on success * 2: on success but the backup failed * 3: on user abort * -1: if the backup failed and save was aborted * -2: if the file pointer could not be opened * -3: if the backup failed and save was aborted by the user * -4: if there is no filename, after asking one from the user * -5: if another process modified the file, and the user chose cancel **/ enum { DOC_SAVE_RET_OK = 1, DOC_SAVE_RET_OK_BUT_BACKUP = 2, DOC_SAVE_RET_USER_ABORT = 3, DOC_SAVE_RET_BACKUP_FAILED_SAVE_ABORT =-1, DOC_SAVE_RET_COULD_NOT_OPEN_FILE =-2, DOC_SAVE_RET_BACKUP_FAILED_SAVE_USER_ABORT =-3, DOC_SAVE_RET_NO_FILENAME =-4, DOC_SAVE_RET_FILE_MODIFIED_USER_ABORT =-5 }; gint doc_save( Tdocument * doc, gboolean do_save_as, gboolean do_move, gboolean window_closing ) { gint retval = 0; gchar *old_name = NULL; #ifdef DEBUG g_assert( doc ); #endif DEBUG_MSG( "doc_save, doc=%p, save_as=%d, do_move=%d\n", doc, do_save_as, do_move ); if ( doc->filename == NULL ) { do_save_as = 1; } if ( do_move ) { do_save_as = 1; if ( doc->filename == NULL ) { do_move = FALSE; } } if ( do_save_as ) { DEBUG_MSG("doc_save: do save as...\n"); gchar * newfilename = NULL; if ( !window_closing ) statusbar_message( BFWIN( doc->bfwin ), _( "save as..." ), 1 ); newfilename = ask_new_filename( BFWIN( doc->bfwin ), doc->filename, gtk_label_get_text( GTK_LABEL( doc->tab_label ) ), do_move ); if ( !newfilename ) { DEBUG_MSG("doc_save: user abort\n"); return DOC_SAVE_RET_USER_ABORT; } #ifdef UNFIX_BUG_92 /*if ( doc->filename ) { */ if ( do_move ) { gchar * ondiskencoding = get_filename_on_disk_encoding( doc->filename ); unlink( ondiskencoding ); g_free( ondiskencoding ); } #endif /* UNFIX_BUG_92 */ /*}*/ if (do_move) { old_name = g_strdup(doc->filename); } g_free( doc->filename ); doc->filename = newfilename; /* TODO: should feed the contents to the function too !! */ doc_reset_filetype( doc, doc->filename, NULL ); doc_set_title( doc ); if ( doc == BFWIN( doc->bfwin ) ->current_document ) { gui_set_title( BFWIN( doc->bfwin ), doc ); } } else /* (!do_save_as) */ { gboolean modified; time_t oldmtime, newmtime; struct stat statbuf; modified = doc_check_modified_on_disk( doc, &statbuf ); newmtime = statbuf.st_mtime; oldmtime = doc->statbuf.st_mtime; if ( modified ) { gchar * tmpstr, oldtimestr[ 128 ], newtimestr[ 128 ]; /* according to 'man ctime_r' this should be at least 26, so 128 should do ;-)*/ gint retval; gchar *options[] = {_( "_Cancel" ), _( "_Overwrite" ), NULL}; ctime_r( &newmtime, newtimestr ); ctime_r( &oldmtime, oldtimestr ); tmpstr = g_strdup_printf( _( "File: %s\n\nNew modification time: %s\nOld modification time: %s" ), doc->filename, newtimestr, oldtimestr ); retval = multi_warning_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File has been modified by another process." ), tmpstr, 1, 0, options ); g_free( tmpstr ); if ( retval == 0 ) { return DOC_SAVE_RET_FILE_MODIFIED_USER_ABORT; } } } DEBUG_MSG( "doc_save, returned file %s\n", doc->filename ); /* if (do_save_as && oldfilename && main_v->props.link_management) { update_filenames_in_file(doc, oldfilename, doc->filename, 1); }*/ { gchar *tmp = g_strdup_printf( _( "Saving %s" ), doc->filename ); if ( !window_closing ) statusbar_message( BFWIN( doc->bfwin ), tmp, 1 ); g_free( tmp ); /* re-use tmp */ tmp = g_path_get_dirname( doc->filename ); if ( BFWIN( doc->bfwin ) ->session->savedir ) g_free( BFWIN( doc->bfwin ) ->session->savedir ); BFWIN( doc->bfwin ) ->session->savedir = tmp; } retval = doc_textbox_to_file( doc, doc->filename, window_closing ); switch ( retval ) { gchar * errmessage; case DOC_SAVE_RET_BACKUP_FAILED_SAVE_ABORT: /* backup failed and aborted */ errmessage = g_strconcat( _( "Could not backup file:\n\"" ), doc->filename, "\"", NULL ); error_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File save aborted.\n" ), errmessage ); g_free( errmessage ); break; case DOC_SAVE_RET_COULD_NOT_OPEN_FILE: /* could not open the file pointer */ errmessage = g_strconcat( _( "Could not write file:\n\"" ), doc->filename, "\"", NULL ); error_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File save error" ), errmessage ); g_free( errmessage ); break; case DOC_SAVE_RET_BACKUP_FAILED_SAVE_USER_ABORT: case DOC_SAVE_RET_NO_FILENAME: /* do nothing, the save is aborted by the user */ break; default: doc_set_stat_info( doc ); { gchar *tmp = path_get_dirname_with_ending_slash( doc->filename ); bfwin_filebrowser_refresh_dir( BFWIN( doc->bfwin ), tmp ); g_free( tmp ); /* BUG#92. only move file after saving is okay. */ if ( do_move ) { DEBUG_MSG("remove the old file =%s\n", old_name); gchar * ondiskencoding = get_filename_on_disk_encoding( old_name ); unlink( ondiskencoding ); g_free( ondiskencoding ); g_free(old_name); } } DEBUG_MSG( "doc_save, received return value %d from doc_textbox_to_file\n", retval ); break; } return retval; } /** * doc_close: * @doc: The #Tdocument to clase. * @warn_only: a #gint set to 1 if the document shouldn't actually be destroyed. * * Get confirmation when closing an unsaved file, save it if neccessary, * and destroy the file unless aborted by user. * * Return value: #gint set to 0 (when cancelled/aborted) or 1 (when closed or saved&closed) **/ gint doc_close( Tdocument * doc, gint warn_only ) { gchar * text; gint retval; #ifdef DEBUG if ( !doc ) { DEBUG_MSG( "doc_close, returning because doc=NULL\n" ); return 0; } #endif if ( doc_is_empty_non_modified_and_nameless( doc ) && g_list_length( BFWIN( doc->bfwin ) ->documentlist ) == 1 ) { /* no need to close this doc, it's an Untitled empty document */ DEBUG_MSG( "doc_close, 1 untitled empty non-modified document, returning\n" ); return 0; } if ( doc->modified ) { /*if (doc->tab_label) {*/ text = g_strdup_printf( _( "Save changes to \"%s\" before closing?." ), gtk_label_get_text ( GTK_LABEL ( doc->tab_label ) ) ); /*} else { text = g_strdup(_("Save changes to this untitled file before closing?")); }*/ { gchar *buttons[] = {_( "Do_n't save" ), GTK_STOCK_CANCEL, GTK_STOCK_SAVE, NULL}; retval = multi_query_dialog( BFWIN( doc->bfwin ) ->main_window, text, _( "If you don't save your changes they will be lost." ), 2, 1, buttons ); } g_free( text ); switch ( retval ) { case 1: DEBUG_MSG( "doc_close, retval=2 (cancel) , returning\n" ); return 2; break; case 2: doc_save( doc, FALSE, FALSE, FALSE ); if ( doc->modified == 1 ) { /* something went wrong it's still not saved */ return 0; } if ( !warn_only ) { doc_destroy( doc, FALSE ); } break; case 0: if ( !warn_only ) { doc_destroy( doc, FALSE ); } break; default: return 0; /* something went wrong */ break; } } else { if ( !warn_only ) { DEBUG_MSG( "doc_close, starting doc_destroy for doc=%p\n", doc ); doc_destroy( doc, FALSE ); } } DEBUG_MSG( "doc_close, finished\n" ); /* notebook_changed();*/ return 1; } static void doc_close_but_clicked_lcb( GtkWidget *wid, gpointer data ) { doc_close( data, 0 ); } /* contributed by Oskar Swida , with help from the gedit source */ static gboolean doc_textview_expose_event_lcb( GtkWidget * widget, GdkEventExpose * event, gpointer doc ) { GtkTextView * view = ( GtkTextView* ) widget; GdkRectangle rect; GdkWindow *win; GtkTextIter l_start, l_end, it; gint l_top1, l_top2; PangoLayout *l; gchar *pomstr; gint numlines, w, i; GHashTable *temp_tab; gint text_width; win = gtk_text_view_get_window( view, GTK_TEXT_WINDOW_LEFT ); if ( win != event->window ) { if ( event->window == gtk_text_view_get_window(view, GTK_TEXT_WINDOW_TEXT) ) { {/* current line hilighting */ #ifdef HILIGHT_THE_WHOLE_LINE_IN_WRAP_MODE gint w2; GtkTextBuffer *buf = gtk_text_view_get_buffer(view); gtk_text_buffer_get_iter_at_mark(buf, &it, gtk_text_buffer_get_insert(buf)); gtk_text_view_get_visible_rect(view, &rect); gtk_text_view_get_line_yrange(view, &it, &w, &w2); gtk_text_view_buffer_to_window_coords(view, GTK_TEXT_WINDOW_TEXT, rect.x, rect.y, &rect.x, &rect.y); gtk_text_view_buffer_to_window_coords(view, GTK_TEXT_WINDOW_TEXT, 0, w, NULL, &w); gdk_draw_rectangle(event->window, widget->style->bg_gc[GTK_WIDGET_STATE(widget)], TRUE,rect.x, w, rect.width, w2); #else GdkRectangle iter_rect; GtkTextBuffer *buf = gtk_text_view_get_buffer(view); gtk_text_buffer_get_iter_at_mark(buf, &it, gtk_text_buffer_get_insert(buf)); gtk_text_view_get_visible_rect(view, &rect); gtk_text_view_get_iter_location(view, &it, &iter_rect); gtk_text_view_buffer_to_window_coords(view, GTK_TEXT_WINDOW_TEXT, rect.x, rect.y, &rect.x, &rect.y); gtk_text_view_buffer_to_window_coords(view, GTK_TEXT_WINDOW_TEXT, 0, iter_rect.y, NULL, &iter_rect.y); gdk_draw_rectangle(event->window, widget->style->bg_gc[GTK_WIDGET_STATE(widget)], TRUE,rect.x, iter_rect.y, rect.width, iter_rect.height); #endif /* HILIGHT_THE_WHOLE_LINE_IN_WRAP_MODE */ } #ifdef ENABLE_COLUMN_MARKER if (main_v->props.marker_ii || main_v->props.marker_iii || main_v->props.marker_i) {/* column marker */ GdkRectangle visible_rect; GdkRectangle redraw_rect; gint tab_width_i=0, tab_width_ii=0, tab_width_iii=0; gchar *tab_string; if (main_v->props.marker_i) { tab_string = g_strnfill (main_v->props.marker_i, '_'); tab_width_i = widget_get_string_size(widget, tab_string); /* use tab_size ;( tab_width_i = 2 * textview_calculate_real_tab_width( GTK_WIDGET( ( ( Tdocument * ) doc ) ->view ), main_v->props.editor_tab_width ); */ g_free(tab_string); } if (main_v->props.marker_ii && (main_v->props.marker_ii != main_v->props.marker_i)) { tab_string = g_strnfill (main_v->props.marker_ii, '_'); tab_width_ii = widget_get_string_size(widget, tab_string); g_free(tab_string); } if (main_v->props.marker_iii && (main_v->props.marker_iii != main_v->props.marker_i) && (main_v->props.marker_iii != main_v->props.marker_ii)) { tab_string = g_strnfill (main_v->props.marker_iii, '_'); tab_width_iii = widget_get_string_size(widget, tab_string); g_free(tab_string); } gtk_text_view_get_visible_rect (view, &visible_rect); gtk_text_view_buffer_to_window_coords (view,GTK_TEXT_WINDOW_TEXT, visible_rect.x,visible_rect.y, &redraw_rect.x,&redraw_rect.y); redraw_rect.width = visible_rect.width; redraw_rect.height = visible_rect.height; if (tab_width_i) { gtk_paint_vline(widget->style,event->window,GTK_WIDGET_STATE (widget), &redraw_rect,widget,"marker", redraw_rect.y, redraw_rect.y + redraw_rect.height, tab_width_i - visible_rect.x + redraw_rect.x + gtk_text_view_get_left_margin (view)); } if (tab_width_ii) { gtk_paint_vline(widget->style,event->window,GTK_WIDGET_STATE (widget), &redraw_rect,widget,"marker", redraw_rect.y, redraw_rect.y + redraw_rect.height, tab_width_ii - visible_rect.x + redraw_rect.x + gtk_text_view_get_left_margin (view)); } if (tab_width_iii) { gtk_paint_vline(widget->style,event->window,GTK_WIDGET_STATE (widget), &redraw_rect,widget,"marker", redraw_rect.y, redraw_rect.y + redraw_rect.height, tab_width_iii - visible_rect.x + redraw_rect.x + gtk_text_view_get_left_margin (view)); } } #endif /* ENABLE_COLUMN_MARKER */ } return FALSE; } gtk_text_view_get_visible_rect( view, &rect ); gtk_text_view_get_line_at_y( view, &l_start, rect.y, &l_top1 ); gtk_text_view_get_line_at_y( view, &l_end, rect.y + rect.height, &l_top2 ); numlines = gtk_text_buffer_get_line_count( gtk_text_view_get_buffer( view ) ); pomstr = g_strdup_printf( "%d", MAX( 99, numlines ) ); l = gtk_widget_create_pango_layout( widget, pomstr ); g_free( pomstr ); pango_layout_get_pixel_size( l, &text_width, NULL ); pango_layout_set_width (l,text_width); pango_layout_set_alignment (l, PANGO_ALIGN_RIGHT); gtk_text_view_set_border_window_size( view, GTK_TEXT_WINDOW_LEFT, text_width + 4 ); it = l_start; temp_tab = bmark_get_bookmarked_lines( DOCUMENT( doc ), &l_start, &l_end ); for ( i = gtk_text_iter_get_line( &l_start );i <= gtk_text_iter_get_line( &l_end );i++ ) { gchar* val; gtk_text_iter_set_line( &it, i ); gtk_text_view_get_line_yrange( view, &it, &w, NULL ); gtk_text_view_buffer_to_window_coords( view, GTK_TEXT_WINDOW_LEFT, 0, w, NULL, &w ); pomstr = NULL; if ( temp_tab ) { val = g_hash_table_lookup( temp_tab, &i ); if ( val ) { pomstr = g_strdup_printf( "%d", val[ 0 ] == '0' ? "#768BEA" : "#62CB7F", i + 1 ); } } if ( pomstr == NULL ) { pomstr = g_strdup_printf( "%d", i + 1 ); } pango_layout_set_markup( l, pomstr, -1 ); gtk_paint_layout( widget->style, win, GTK_WIDGET_STATE( widget ), FALSE, NULL, widget, NULL, text_width + 2, w, l ); g_free( pomstr ); } g_object_unref( G_OBJECT( l ) ); if ( temp_tab ) g_hash_table_destroy( temp_tab ); return TRUE; } /** * document_set_line_numbers: * @doc: a #Tdocument* * @value: a #gboolean * * Show or hide linenumbers (at the left of the main GtkTextView). * * Return value: void **/ void document_set_line_numbers( Tdocument *doc, gboolean value ) { if ( value ) { gtk_text_view_set_left_margin( GTK_TEXT_VIEW( doc->view ), 2 ); gtk_text_view_set_border_window_size( GTK_TEXT_VIEW( doc->view ), GTK_TEXT_WINDOW_LEFT, 20 ); g_signal_connect( G_OBJECT( doc->view ), "expose-event", G_CALLBACK( doc_textview_expose_event_lcb ), doc ); } else { gtk_text_view_set_left_margin( GTK_TEXT_VIEW( doc->view ), 0 ); gtk_text_view_set_border_window_size( GTK_TEXT_VIEW( doc->view ), GTK_TEXT_WINDOW_LEFT, 0 ); } } static void doc_view_drag_end_lcb( GtkWidget *widget, GdkDragContext *drag_context, Tdocument *doc ) { if ( doc->paste_operation ) { if ( PASTEOPERATION( doc->paste_operation ) ->eo > PASTEOPERATION( doc->paste_operation ) ->so ) { doc_highlight_region( doc, PASTEOPERATION( doc->paste_operation ) ->so, PASTEOPERATION( doc->paste_operation ) ->eo ); } g_free( doc->paste_operation ); doc->paste_operation = NULL; } } static void doc_view_drag_begin_lcb( GtkWidget *widget, GdkDragContext *drag_context, Tdocument *doc ) { if ( !doc->paste_operation ) { doc->paste_operation = g_new( Tpasteoperation, 1 ); PASTEOPERATION( doc->paste_operation ) ->so = -1; PASTEOPERATION( doc->paste_operation ) ->eo = -1; } } /** * doc_new: * @bfwin: #Tbfwin* with the window to open the document in * @delay_activate: Whether to perform GUI-calls and flush_queue(). Set to TRUE when loading several documents at once. * * Create a new document, related structures and a nice little textview to display the document in. * Finally, add a new tab to the notebook. * The GtkTextView is not actually gtk_widget_shown() if delay_activate == TRUE. This is done by doc_activate() instead. * * Return value: a #Tdocument* pointer to the just created document. **/ Tdocument *doc_new( Tbfwin* bfwin, gboolean delay_activate ) { GtkWidget * scroll; Tdocument *newdoc = g_new0( Tdocument, 1 ); DEBUG_MSG( "doc_new, main_v is at %p, bfwin at %p, newdoc at %p\n", main_v, bfwin, newdoc ); newdoc->bfwin = ( gpointer ) bfwin; newdoc->hl = ( Tfiletype * ) ( ( GList * ) g_list_first( main_v->filetypelist ) ) ->data; /* * VIEW_BARS settings * */ /* so stupid ;) ~~~> BUG#81 newdoc->view_bars = SET_BIT(newdoc->view_bars, VIEW_COLORIZED, (main_v->props.view_bars & VIEW_COLORIZED ) && ( newdoc->hl->autoclosingtag > 0 )); */ if ( (main_v->props.view_bars & MODE_AUTO_COMPLETE) && (newdoc->hl->autoclosingtag>0) ) { newdoc->view_bars = SET_BIT(newdoc->view_bars, MODE_AUTO_COMPLETE, 1); } DEBUG_MSG("doc_new, autocompletion: main=%d, filetype=%d, current=%d\n", main_v->props.view_bars & MODE_AUTO_COMPLETE, (newdoc->hl->autoclosingtag > 0), newdoc->view_bars & MODE_AUTO_COMPLETE); /* use project's settings if there's; otherwise use global properties */ newdoc->view_bars = SET_BIT(newdoc->view_bars, MODE_WRAP, ( bfwin->project ) ? GET_BIT(bfwin->project->view_bars,MODE_WRAP) : GET_BIT(main_v->props.view_bars,MODE_WRAP) ); newdoc->view_bars = SET_BIT(newdoc->view_bars, MODE_OVERWRITE, FALSE); newdoc->view_bars = SET_BIT(newdoc->view_bars, VIEW_COLORIZED, GET_BIT(main_v->props.view_bars,VIEW_COLORIZED)); /* use session value */ newdoc->view_bars = SET_BIT(newdoc->view_bars, VIEW_LINE_NUMBER, GET_BIT(main_v->session->view_bars,VIEW_LINE_NUMBER)); /* * End VIEW_BARS settings * */ newdoc->buffer = gtk_text_buffer_new( highlight_return_tagtable() ); newdoc->brace_finder =g_new0( Tbracefinder, 1); BRACEFINDER(newdoc->brace_finder)->tag = gtk_text_buffer_create_tag (newdoc->buffer, NULL,"background", "yellow", "foreground", "black", NULL); GtkTextIter iter; gtk_text_buffer_get_start_iter(newdoc->buffer,&iter); BRACEFINDER(newdoc->brace_finder)->mark_left = gtk_text_buffer_create_mark(newdoc->buffer,NULL,&iter,FALSE); BRACEFINDER(newdoc->brace_finder)->mark_mid = gtk_text_buffer_create_mark(newdoc->buffer,NULL,&iter,FALSE); BRACEFINDER(newdoc->brace_finder)->mark_right = gtk_text_buffer_create_mark(newdoc->buffer,NULL,&iter,FALSE); BRACEFINDER(newdoc->brace_finder)->last_status = 0; newdoc->view = gtk_text_view_new_with_buffer( newdoc->buffer ); scroll = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW ( scroll ), GTK_SHADOW_IN ); gtk_container_add( GTK_CONTAINER( scroll ), newdoc->view ); newdoc->tab_label = gtk_label_new( NULL ); GTK_WIDGET_UNSET_FLAGS( newdoc->tab_label, GTK_CAN_FOCUS ); if ( strlen( main_v->props.tab_font_string ) ) { apply_font_style( newdoc->tab_label, main_v->props.tab_font_string ); } newdoc->tab_menu = gtk_label_new( NULL ); newdoc->tab_eventbox = gtk_event_box_new(); gtk_misc_set_alignment( GTK_MISC( newdoc->tab_menu ), 0, 0 ); doc_unre_init( newdoc ); doc_set_font( newdoc, NULL ); doc_set_wrap( newdoc ); /* newdoc->modified = 0; */ doc_set_title( newdoc ); /*newdoc->filename = NULL;*/ newdoc->need_highlighting = 0; newdoc->statbuf.st_mtime = 0; newdoc->statbuf.st_size = 0; newdoc->statbuf.st_uid = -1; newdoc->statbuf.st_gid = -1; newdoc->is_symlink = 0; newdoc->encoding = g_strdup( main_v->props.newfile_default_encoding ); doc_bind_signals( newdoc ); g_signal_connect( G_OBJECT( newdoc->view ), "button-release-event", G_CALLBACK( doc_view_button_release_lcb ), newdoc ); g_signal_connect( G_OBJECT( newdoc->view ), "button-press-event", G_CALLBACK( doc_view_button_press_lcb ), newdoc ); g_signal_connect( G_OBJECT( newdoc->buffer ), "changed", G_CALLBACK( doc_buffer_changed_lcb ), newdoc ); g_signal_connect( G_OBJECT( newdoc->buffer ), "mark-set", G_CALLBACK( doc_buffer_mark_set_lcb ), newdoc ); g_signal_connect( G_OBJECT( newdoc->view ), "toggle-overwrite", G_CALLBACK( doc_view_toggle_overwrite_lcb ), newdoc ); /* g_signal_connect(G_OBJECT(newdoc->view), "paste-clipboard", G_CALLBACK(doc_paste_clipboard_lcb), newdoc); g_signal_connect_after(G_OBJECT(newdoc->view), "button-release-event", G_CALLBACK(doc_view_button_release_after_lcb), newdoc);*/ g_signal_connect_after( G_OBJECT( newdoc->view ), "drag-end", G_CALLBACK( doc_view_drag_end_lcb ), newdoc ); g_signal_connect_after( G_OBJECT( newdoc->view ), "drag-begin", G_CALLBACK( doc_view_drag_begin_lcb ), newdoc ); g_signal_connect_after( G_OBJECT( newdoc->view ), "key-release-event", G_CALLBACK( doc_view_key_release_lcb ), newdoc ); g_signal_connect( G_OBJECT( newdoc->view ), "key-press-event", G_CALLBACK( doc_view_key_press_lcb ), newdoc ); g_signal_connect_after( G_OBJECT( newdoc->view ), "populate-popup", G_CALLBACK( doc_view_populate_popup_lcb ), newdoc ); bfwin->documentlist = g_list_append( bfwin->documentlist, newdoc ); if ( !delay_activate ) gtk_widget_show( newdoc->view ); /* Delay _show() if neccessary */ gtk_widget_show( newdoc->tab_label ); gtk_widget_show( scroll ); DEBUG_MSG( "doc_new, appending doc to notebook\n" ); { GtkWidget *hbox, *but, *image; hbox = gtk_hbox_new( FALSE, 0 ); but = gtk_button_new(); image = new_pixmap( 101 ); gtk_container_add( GTK_CONTAINER( but ), image ); gtk_container_set_border_width( GTK_CONTAINER( but ), 0 ); gtk_widget_set_size_request( but, 12, 12 ); gtk_button_set_relief( GTK_BUTTON( but ), GTK_RELIEF_NONE ); g_signal_connect( G_OBJECT( but ), "clicked", G_CALLBACK( doc_close_but_clicked_lcb ), newdoc ); gtk_container_add( GTK_CONTAINER( newdoc->tab_eventbox ), newdoc->tab_label ); gtk_box_pack_start( GTK_BOX( hbox ), newdoc->tab_eventbox, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), but, FALSE, FALSE, 0 ); gtk_widget_show_all( hbox ); gtk_notebook_append_page_menu( GTK_NOTEBOOK( bfwin->notebook ), scroll , hbox, newdoc->tab_menu ); } /* why don't we move document_set_line_numbers() to gui_set_document_widgets() ? */ document_set_line_numbers( newdoc, GET_BIT(newdoc->view_bars, VIEW_LINE_NUMBER ) ); /* for some reason it only works after the document is appended to the notebook */ doc_set_tabsize( newdoc, main_v->props.editor_tab_width ); /* newdoc->view_bars = SET_BIT(newdoc->view_bars, VIEW_COLORIZED, GET_BIT(main_v->props.view_bars,VIEW_COLORIZED)); */ #ifdef DONE_IN_GUI_SET_DOCUMENT_WIDGETS /* BUG#77 */ if (newdoc->view_bars & VIEW_COLORIZED) { setup_toggle_item( gtk_item_factory_from_widget( bfwin->menubar ), _( "/Document/Highlight Syntax" ), TRUE ); } if (newdoc->view_bars & VIEW_LINE_NUMBER) { setup_toggle_item( gtk_item_factory_from_widget( bfwin->menubar ), _( "/Document/Line Numbers" ), TRUE ); } if (newdoc->view_bars & MODE_AUTO_COMPLETE) { setup_toggle_item( gtk_item_factory_from_widget( bfwin->menubar ), _( "/Document/AutoCompletion" ), TRUE ); } g_print( "doc_new, autocomplete =%d \n", newdoc->view_bars & MODE_AUTO_COMPLETE), DEBUG_MSG( "doc_new, need_highlighting=%d, highlightstate=%d, global higlight = %d\n", newdoc->need_highlighting, GET_BIT(newdoc->view_bars,VIEW_COLORIZED), GET_BIT(main_v->props.view_bars,VIEW_COLORIZED) ); #endif /* DONE_IN_GUI_SET_DOCUMENT_WIDGETS */ /* these lines should not be here since notebook_changed() calls flush_queue() that means that this document can be closed during notebook_changed(), and functions like open_file rely on the fact that this function returns an existing document (and not a closed one!!) if (!delay_activate) { DEBUG_MSG("doc_new, notebook current page=%d, newdoc is on page %d\n",gtk_notebook_get_current_page(GTK_NOTEBOOK(main_v->notebook)),gtk_notebook_page_num(GTK_NOTEBOOK(main_v->notebook),scroll)); DEBUG_MSG("doc_new, setting notebook page to %d\n", g_list_length(main_v->documentlist) - 1); gtk_notebook_set_current_page(GTK_NOTEBOOK(main_v->notebook),g_list_length(main_v->documentlist) - 1); if (bfwin->current_document != newdoc) { notebook_changed(-1); }*/ /* doc_activate() will be called by notebook_changed() and it will grab the focus gtk_widget_grab_focus(newdoc->view); */ /* }*/ return newdoc; } /** * doc_new_with_new_file: * @bfwin: #Tbfwin* * @new_filename: #gchar* filename to give document. * * Create a new document, name it by new_filename, and create the file. * * Return value: void **/ void doc_new_with_new_file( Tbfwin *bfwin, gchar * new_filename ) { Tdocument * doc; Tfiletype *ft; if ( new_filename == NULL ) { statusbar_message( bfwin, _( "No filename" ), 2 ); return ; } if ( !(main_v->props.view_bars & MODE_ALLOW_MULTIPLE_INSTANCE)) { gboolean res; res = switch_to_document_by_filename( bfwin, new_filename ); if ( res ) { return ; } } DEBUG_MSG( "doc_new_with_new_file, new_filename=%s\n", new_filename ); add_filename_to_history( bfwin, new_filename ); doc = doc_new( bfwin, FALSE ); doc->filename = g_strdup( new_filename ); if ( bfwin->project && bfwin->project->template && strlen( bfwin->project->template ) > 2 ) { doc_file_to_textbox( doc, bfwin->project->template , FALSE, FALSE ) ; } /* may be related to BUG#93 (doc_file_to_textbox) does the hilight if found ft->hilight; why the have to check this after? */ ft = get_filetype_by_filename_and_content( doc->filename, NULL ); if ( ft ) doc->hl = ft; /* doc->modified = 1;*/ doc_set_title( doc ); doc_save( doc, FALSE, FALSE, FALSE ); doc_set_stat_info( doc ); /* also sets mtime field */ switch_to_document_by_pointer( bfwin, doc ); doc_activate( doc ); } /** * doc_new_with_file: * @bfwin: #Tbfwin* with the window to open the document in * @filename: #gchar* with filename to load. * @delay_activate: #gboolean if GUI calls are wanted. * @move_to_this_win: #gboolean if the file should be moved to this window if already open * * Create a new document and read in a file. * Errors are not propagated to user in any other way than returning a pointer or NULL * * Return value: #Tdocument*, or NULL on error **/ Tdocument * doc_new_with_file( Tbfwin *bfwin, gchar * filename, gboolean delay_activate, gboolean move_to_this_win ) { Tdocument * doc; gboolean opening_in_existing_doc = FALSE; gchar *fullfilename; DEBUG_MSG( "doc_new_with_file, called for %s\n", filename ); if ( ( filename == NULL ) || ( !file_exists_and_readable( filename ) ) ) { DEBUG_MSG( "doc_new_with_file, file %s !file_exists or readable\n", filename ); return NULL; } fullfilename = create_full_path( filename, NULL ); if ( bfwin ) { gchar * tmpstring = g_path_get_dirname( fullfilename ); if ( bfwin->session->opendir ) g_free( bfwin->session->opendir ); bfwin->session->opendir = tmpstring; } /* BUG#78 */ if ( !(main_v->props.view_bars & MODE_ALLOW_MULTIPLE_INSTANCE) ) { GList * alldocs = return_allwindows_documentlist(); Tdocument *tmpdoc = documentlist_return_document_from_filename( alldocs, fullfilename ); DEBUG_MSG( "doc_new_with_file, fullfilename=%s, tmpdoc=%p\n", fullfilename, tmpdoc ); g_list_free( alldocs ); if ( tmpdoc ) { DEBUG_MSG( "doc_new_with_file, %s is already open %p\n", filename, tmpdoc ); if ( move_to_this_win && documentlist_return_document_from_filename( bfwin->documentlist, fullfilename ) == NULL ) { doc_move_to_window( tmpdoc, bfwin ); } else { if ( !delay_activate ) { switch_to_document_by_pointer( BFWIN( tmpdoc->bfwin ), tmpdoc ); /* related to BUG#44 */ /* if ( bfwin != tmpdoc->bfwin ) { */ gtk_window_present( GTK_WINDOW( BFWIN( tmpdoc->bfwin ) ->main_window ) ); /*}*/ } } g_free( fullfilename ); return tmpdoc; } } DEBUG_MSG( "doc_new_with_file, fullfilename=%s, filename=%s\n", fullfilename, filename ); add_filename_to_history( bfwin, fullfilename ); if ( /*g_list_length( bfwin->documentlist ) == 1 && */doc_is_empty_non_modified_and_nameless( bfwin->current_document ) ) { doc = bfwin->current_document; opening_in_existing_doc = TRUE; bfwin->last_activated_doc = NULL; } else { doc = doc_new( bfwin, delay_activate ); } /* we do not need to free fullfilename anymore now */ doc->filename = fullfilename; DEBUG_MSG( "doc_new_with_file, hl is resetted to filename, about to load file\n" ); doc_file_to_textbox( doc, doc->filename, FALSE, delay_activate ); /* after the textbuffer is filled the filetype can be found */ doc_reset_filetype( doc, doc->filename, NULL ); /* hey, this should be done by doc_activate menu_current_document_set_toggle_wo_activate(NULL, doc->encoding);*/ doc_set_stat_info( doc ); /* also sets mtime field */ doc_set_title( doc ); /* sets the tooltip as well, so it should be called *after* doc_set_stat_info() */ if ( !delay_activate ) { if ( opening_in_existing_doc ) { doc_activate( doc ); } switch_to_document_by_pointer( bfwin, doc ); doc_activate( doc ); /*filebrowser_open_dir(BFWIN(doc->bfwin),fullfilename); is already called by doc_activate() */ } bmark_set_for_doc( doc ); bmark_check_length( bfwin, doc ); /* bmark_adjust_visible(bfwin); */ return doc; } /** * docs_new_from_files: * @bfwin: #Tbfwin* with the window to open the document in * @file_list: #GList with filenames to open. * @move_to_this_win: #gboolean if the file needs to be moved to this window if it is open already * * Open a number of new documents from files in stringlist file_list. * If a file is open already in another window, it might be moved to this window, else * nothing is done for this file * Report files with problems to user. * If more than 8 files are opened at once, a modal progressbar is shown while loading. * * Return value: void **/ void docs_new_from_files( Tbfwin *bfwin, GList * file_list, gboolean move_to_this_win, gint linenumber ) { GList * tmplist, *errorlist = NULL; gboolean delay = ( g_list_length( file_list ) > 1 ); gpointer pbar = NULL; gint i = 0; gint num_files_opened=0; DEBUG_MSG( "docs_new_from_files, lenght=%d\n", g_list_length( file_list ) ); /* Hide the notebook and show a progressbar while * adding several files. */ if ( g_list_length( file_list ) > 8 ) { notebook_hide( bfwin ); pbar = progress_popup( bfwin->main_window, _( "Loading files..." ), g_list_length( file_list ) ); } tmplist = g_list_first( file_list ); Tdocument *tmpdoc = NULL; while ( tmplist ) { DEBUG_MSG( "docs_new_from_files, about to open %s, delay=%d\n", ( gchar * ) tmplist->data, delay ); tmpdoc = doc_new_with_file( bfwin, ( gchar * ) tmplist->data, delay, move_to_this_win ); if ( !tmpdoc ) { errorlist = g_list_append( errorlist, g_strdup( ( gchar * ) tmplist->data ) ); } else { num_files_opened ++; if (linenumber >=0) { doc_activate( tmpdoc ); doc_select_line( tmpdoc, linenumber, TRUE ); gtk_widget_grab_focus( GTK_WIDGET( tmpdoc->view ) ); } } if ( pbar ) { progress_set( pbar, ++i ); flush_queue(); } tmplist = g_list_next( tmplist ); } if ( errorlist ) { gchar * message, *tmp; tmp = stringlist_to_string( errorlist, "\n" ); message = g_strconcat( _( "These files could not opened:\n\n" ), tmp, NULL ); g_free( tmp ); warning_dialog( bfwin->main_window, _( "Unable to open file(s)\n" ), message ); g_free( message ); } free_stringlist( errorlist ); if ( num_files_opened >= 1 /*delay */) { DEBUG_MSG( "since we delayed the highlighting, we set the notebook and filebrowser page now\n" ); /* Destroy the progressbar and show the notebook when finished. */ progress_destroy( pbar ); notebook_show( bfwin ); gtk_notebook_set_page( GTK_NOTEBOOK( bfwin->notebook ), g_list_length( bfwin->documentlist ) - 1 ); notebook_changed( bfwin, -1 ); /* num_files_opened so we not not to check... if ( bfwin->current_document && bfwin->current_document->filename ) { */ /*filebrowser_open_dir(bfwin,bfwin->current_document->filename); is called by doc_activate() */ doc_activate( bfwin->current_document ); /*}*/ gui_set_title( bfwin, bfwin->current_document ); if (num_files_opened ==1) { DEBUG_MSG("docs_new_from_files: num_files_opened =%d\n", num_files_opened); if (DOCUMENT(bfwin->current_document)->need_highlighting) { doc_highlight_full(bfwin->current_document); } } } /* related to BUG#93 */ #ifdef CODE_MOVED_UP if (bfwin->current_document) { gui_set_title( bfwin, bfwin->current_document ); } #endif /* CODE_MOVED_UP */ } /** * doc_reload: * @doc: a #Tdocument * * Revert to file on disk. * * Return value: void **/ void doc_reload( Tdocument *doc ) { if ( ( doc->filename == NULL ) || ( !file_exists_and_readable( doc->filename ) ) ) { statusbar_message( BFWIN( doc->bfwin ), _( "unable to open file" ), 2000 ); return ; } gint lineindex; { GtkTextIter itstart, itend, itercur; gtk_text_buffer_get_selection_bounds(doc->buffer, &itercur, NULL); lineindex = gtk_text_iter_get_line(&itercur); DEBUG_MSG("doc_reload: current lineindex %d\n", lineindex); gtk_text_buffer_get_bounds( doc->buffer, &itstart, &itend ); gtk_text_buffer_delete( doc->buffer, &itstart, &itend ); } doc_file_to_textbox( doc, doc->filename, FALSE, FALSE ); doc_unre_clear_all( doc ); doc_set_modified( doc, 0 ); doc_set_stat_info( doc ); /* also sets mtime field */ doc_select_line(doc, lineindex, TRUE); } /** * doc_activate: * @doc: a #Tdocument * * Perform actions neccessary when a document is focused. I.e. called from the notebook. * * Show textview, warn if the file on disk has been changed, * update line-numbers etc and highlighting. * * Return value: void **/ void doc_activate( Tdocument *doc ) { gboolean modified; time_t oldmtime, newmtime; #ifdef DEBUG if ( !doc ) { DEBUG_MSG( "doc_activate, doc=NULL!!! ABORTING!!\n" ); exit( 44 ); } #endif if ( doc == NULL || doc == BFWIN( doc->bfwin ) ->last_activated_doc ) { return ; } BFWIN( doc->bfwin ) ->last_activated_doc = doc; gtk_widget_show( doc->view ); /* This might be the first time this document is activated. */ { struct stat statbuf; modified = doc_check_modified_on_disk( doc, &statbuf ); newmtime = statbuf.st_mtime; oldmtime = doc->statbuf.st_mtime; } if ( modified ) { gchar * tmpstr, oldtimestr[ 128 ], newtimestr[ 128 ]; /* according to 'man ctime_r' this should be at least 26, so 128 should do ;-)*/ gint retval; gchar *options[] = {_( "_Reload" ), _( "_Ignore" ), NULL}; ctime_r( &newmtime, newtimestr ); ctime_r( &oldmtime, oldtimestr ); tmpstr = g_strdup_printf( _( "Filename: %s\n\nNew modification time is: %s\nOld modification time is: %s" ), doc->filename, newtimestr, oldtimestr ); retval = multi_warning_dialog( BFWIN( doc->bfwin ) ->main_window, _( "File has been modified by another process\n" ), tmpstr, 0, 1, options ); g_free( tmpstr ); if ( retval == 1 ) { doc_set_stat_info( doc ); } else { doc_reload( doc ); } } DEBUG_MSG( "doc_activate, calling gui_set_document_widgets()\n" ); gui_set_document_widgets( doc ); gui_set_title( BFWIN( doc->bfwin ), doc ); doc_set_statusbar_lncol( doc ); doc_set_statusbar_insovr( doc ); doc_set_statusbar_editmode_encoding( doc ); /* if highlighting is needed for this document do this now !! */ if ( doc->need_highlighting && (doc->view_bars & VIEW_COLORIZED) ) { doc_highlight_full( doc ); DEBUG_MSG( "doc_activate, doc=%p, after doc_highlight_full, need_highlighting=%d\n", doc, doc->need_highlighting ); } /* doc_scroll_to_cursor(doc);*/ if ( doc->filename ) { gchar * dir1 = g_path_get_dirname( doc->filename ); gchar *dir2 = ending_slash( dir1 ); if ( dir2[ 0 ] == '/' ) { chdir( dir2 ); } if ( main_v->props.filebrowser_focus_follow ) { DEBUG_MSG( "doc_activate, call filebrowser_open_dir() for %s\n", dir2 ); filebrowser_open_dir( BFWIN( doc->bfwin ), dir2 ); } g_free( dir1 ); g_free( dir2 ); } DEBUG_MSG( "doc_activate, doc=%p, about to grab focus\n", doc ); gtk_widget_grab_focus( GTK_WIDGET( doc->view ) ); DEBUG_MSG( "doc_activate, doc=%p, finished\n", doc ); } void doc_force_activate( Tdocument *doc ) { BFWIN( doc->bfwin ) ->last_activated_doc = NULL; doc_activate( doc ); } void file_open_from_selection( Tbfwin *bfwin ) { gchar * string; GtkClipboard* cb; cb = gtk_clipboard_get( GDK_SELECTION_PRIMARY ); string = gtk_clipboard_wait_for_text( cb ); if ( string ) { DEBUG_MSG( "file_open_from_selection, opening %s\n", string ); if ( NULL == strchr( string, '/' ) && bfwin->current_document->filename ) { /* now we should look in the directory of the current file */ gchar * dir, *tmp; dir = g_path_get_dirname( bfwin->current_document->filename ); tmp = g_strconcat( dir, "/", string, NULL ); DEBUG_MSG( "file_open_from_selection, trying %s\n", tmp ); doc_new_with_file( bfwin, tmp, FALSE, FALSE ); g_free( dir ); g_free( tmp ); } else { doc_new_with_file( bfwin, string, FALSE, FALSE ); } g_free( string ); } } /** * file_save_cb: * @widget: unused #GtkWidget * @bfwin: #Tbfwin* with the current window * * Save the current document. * * Return value: void **/ void file_save_cb( GtkWidget * widget, Tbfwin *bfwin ) { doc_save( bfwin->current_document, FALSE, FALSE, FALSE ); } /** * file_save_as_cb: * @widget: unused #GtkWidget * @bfwin: #Tbfwin* with the current window * * Save current document, let user choose filename. * * Return value: void **/ void file_save_as_cb( GtkWidget * widget, Tbfwin *bfwin ) { doc_save( bfwin->current_document, TRUE, FALSE, FALSE ); } /** * file_move_to_cb: * @widget: unused #GtkWidget * @bfwin: #Tbfwin* with the current window * * Move current document, let user choose filename. * * Return value: void **/ void file_move_to_cb( GtkWidget * widget, Tbfwin *bfwin ) { doc_save( bfwin->current_document, TRUE, TRUE, FALSE ); } /** * file_open_cb: * @widget: unused #GtkWidget * @bfwin: #Tbfwin* with the current window * * Prompt user for files to open. * * Return value: void **/ void file_open_cb( GtkWidget * widget, Tbfwin *bfwin ) { GList * tmplist = NULL; DEBUG_MSG( "file_open_cb, started, calling return_files()\n" ); #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; GSList *slist; dialog = file_chooser_dialog( bfwin, _( "Select files" ), GTK_FILE_CHOOSER_ACTION_OPEN, NULL, TRUE, TRUE, NULL ); if ( gtk_dialog_run ( GTK_DIALOG ( dialog ) ) == GTK_RESPONSE_ACCEPT ) { slist = gtk_file_chooser_get_filenames( GTK_FILE_CHOOSER( dialog ) ); tmplist = glist_from_gslist( slist ); g_slist_free( slist ); } gtk_widget_destroy( dialog ); } #else tmplist = return_files( NULL ); #endif if ( !tmplist ) { return ; } { gint len = g_list_length( tmplist ); gchar *message = g_strdup_printf( _( "Loading %d file(s)..." ), len ); statusbar_message( bfwin, message, 2000 + len * 50 ); g_free( message ); flush_queue(); } DEBUG_MSG( "file_open_cb, calling docs_new_from_files()\n" ); docs_new_from_files( bfwin, tmplist, FALSE, -1 ); free_stringlist( tmplist ); } /** * file_insert_menucb: * @bfwin: Tbfwin* which window * @callback_action: unused #guint * @widget: #GtkWidget* unused * * Prompt user for a file, and insert the contents into the current document. * * Return value: void **/ void file_insert_menucb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { gchar * tmpfilename = NULL; #ifdef HAVE_ATLEAST_GTK_2_4 { GtkWidget *dialog; dialog = file_chooser_dialog( bfwin, _( "Select file to insert" ), GTK_FILE_CHOOSER_ACTION_OPEN, NULL, TRUE, FALSE, NULL ); if ( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_ACCEPT ) { tmpfilename = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER( dialog ) ); } gtk_widget_destroy( dialog ); } #else tmpfilename = return_file_w_title( NULL, _( "Select file to insert" ) ); #endif if ( tmpfilename == NULL ) { statusbar_message( bfwin, _( "no file to insert" ), 2000 ); return ; } else { /* do we need to set the insert point in some way ?? */ doc_file_to_textbox( bfwin->current_document, tmpfilename, TRUE, FALSE ); g_free( tmpfilename ); doc_set_modified( bfwin->current_document, 1 ); } } /** * file_new_cb: * @windget: #GtkWidget* ignored * @bfwin: Tbfwin* where to open the new document * * Create a new, empty file in window bfwin * * Return value: void **/ void file_new_cb( GtkWidget *widget, Tbfwin *bfwin ) { DEBUG_MSG("file_new_cb: hello world\n"); Tdocument * doc; doc = doc_new( bfwin, FALSE ); switch_to_document_by_pointer( bfwin, doc ); if ( bfwin->project && bfwin->project->template && strlen( bfwin->project->template ) > 2 ) { doc_file_to_textbox( doc, bfwin->project->template , FALSE, FALSE ) ; doc_activate( doc ); } } /** * file_close_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Close the current document. * * Return value: void **/ void file_close_cb( GtkWidget * widget, Tbfwin *bfwin ) { doc_close( bfwin->current_document, 0 ); } void bfwin_close_all_documents( Tbfwin *bfwin, gboolean window_closing ) { GList * tmplist; Tdocument *tmpdoc; gint retval = -1; DEBUG_MSG( "file_close_all_cb, started\n" ); /* first a warning loop */ if ( test_docs_modified( bfwin->documentlist ) ) { if ( g_list_length ( bfwin->documentlist ) > 1 ) { gchar * options[] = {_( "_Save All" ), _( "Close _All" ), _( "Choose per _File" ), _( "_Cancel" ), NULL}; retval = multi_query_dialog( bfwin->main_window, _( "Multiple open files have been changed." ), _( "If you don't save your changes they will be lost." ), 3, 3, options ); if ( retval == 3 ) { DEBUG_MSG( "file_close_all_cb, cancel clicked, returning 0\n" ); return ; } } else { retval = 2; } } else { retval = 1; } DEBUG_MSG( "file_close_all_cb, after the warnings, retval=%d, now close all the windows\n", retval ); tmplist = g_list_first( bfwin->documentlist ); while ( tmplist ) { tmpdoc = ( Tdocument * ) tmplist->data; if ( test_only_empty_doc_left( bfwin->documentlist ) ) { return ; } switch ( retval ) { case 0: doc_save( tmpdoc, FALSE, FALSE, window_closing ); if ( !tmpdoc->modified ) { doc_destroy( tmpdoc, TRUE ); } else { return ; } tmplist = g_list_first( bfwin->documentlist ); break; case 1: doc_destroy( tmpdoc, TRUE ); tmplist = g_list_first( bfwin->documentlist ); break; case 2: if ( doc_close( tmpdoc, 0 ) != 2 ) { tmplist = g_list_first( bfwin->documentlist ); } else { /* notebook_changed();*/ return ; } break; default: /* notebook_changed();*/ return ; break; } } notebook_changed( bfwin, -1 ); DEBUG_MSG( "file_close_all_cb, finished\n" ); } /** * file_close_all_cb: * @widget: unused #GtkWidget * @bfwin: #Tbfwin* * * Close all open files. Prompt user when neccessary. * * Return value: void **/ void file_close_all_cb( GtkWidget * widget, Tbfwin *bfwin ) { bfwin_close_all_documents( bfwin, FALSE ); } /** * file_save_all_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Save all editor notebooks * * Return value: void **/ void file_save_all_cb( GtkWidget * widget, Tbfwin *bfwin ) { GList * tmplist; Tdocument *tmpdoc; tmplist = g_list_first( bfwin->documentlist ); while ( tmplist ) { tmpdoc = ( Tdocument * ) tmplist->data; if ( tmpdoc->modified ) { doc_save( tmpdoc, FALSE, FALSE, FALSE ); } tmplist = g_list_next( tmplist ); } } /** * edit_cut_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Cut selection from current buffer, to clipboard. * * Return value: void **/ void edit_cut_cb( GtkWidget * widget, Tbfwin *bfwin ) { doc_unre_new_group( bfwin->current_document ); gtk_text_buffer_cut_clipboard( bfwin->current_document->buffer, gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ), TRUE ); doc_unre_new_group( bfwin->current_document ); } /** * edit_copy_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Copy selection from current buffer, to clipboard. * * Return value: void **/ void edit_copy_cb( GtkWidget * widget, Tbfwin *bfwin ) { gtk_text_buffer_copy_clipboard( bfwin->current_document->buffer, gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ) ); } /** * edit_paste_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Paste contents of clipboard. Disable highlighting while pasting, for speed. * * Return value: void **/ void edit_paste_cb( GtkWidget * widget, Tbfwin *bfwin ) { GtkTextMark * mark; GtkTextIter itstart, itend; gint eo_so_diff; Tdocument *doc = bfwin->current_document; DEBUG_MSG( "edit_paste_cb, started\n" ); if ( !doc->paste_operation ) { doc->paste_operation = g_new( Tpasteoperation, 1 ); PASTEOPERATION( doc->paste_operation ) ->so = -1; PASTEOPERATION( doc->paste_operation ) ->eo = -1; } doc_unre_new_group( doc ); DEBUG_MSG( "edit_paste_cb, pasting clipboard\n" ); gtk_text_buffer_paste_clipboard ( doc->buffer, gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ), NULL, TRUE ); doc_unre_new_group( doc ); eo_so_diff = PASTEOPERATION( doc->paste_operation ) ->eo - PASTEOPERATION( doc->paste_operation ) ->so; if ( eo_so_diff >0 ) { /* BUG#80 */ if (doc->view_bars & VIEW_COLORIZED) { DEBUG_MSG( "edit_paste_cb, start doc_highlight_region for so=%d, eo=%d\n", PASTEOPERATION( doc->paste_operation ) ->so, PASTEOPERATION( doc->paste_operation ) ->eo ); doc_highlight_region( doc, PASTEOPERATION( doc->paste_operation ) ->so, PASTEOPERATION( doc->paste_operation ) ->eo ); }else{ /* removed all tags ;) */ gtk_text_buffer_get_bounds(doc->buffer, &itstart, &itend); gtk_text_buffer_remove_all_tags(doc->buffer, &itstart, &itend); } } g_free( doc->paste_operation ); doc->paste_operation = NULL; mark = gtk_text_buffer_get_insert( doc->buffer ); gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( bfwin->current_document->view ), mark ); /* BUGS#88 */ if ( eo_so_diff ==1 ) { gtk_text_buffer_get_iter_at_mark(doc->buffer, &itstart, mark); itend = itstart; gtk_text_iter_backward_char(&itend); gtk_text_buffer_remove_tag(doc->buffer, BRACEFINDER(doc->brace_finder)->tag , &itstart, &itend); } DEBUG_MSG( "edit_paste_cb, finished\n" ); } /** * edit_select_all_cb: * @widget: unused #GtkWidget * @data: unused #gpointer * * Mark entire current document as selected. * * Return value: void **/ void edit_select_all_cb( GtkWidget * widget, Tbfwin *bfwin ) { GtkTextIter itstart, itend; gtk_text_buffer_get_bounds( bfwin->current_document->buffer, &itstart, &itend ); gtk_text_buffer_move_mark_by_name( bfwin->current_document->buffer, "insert", &itstart ); gtk_text_buffer_move_mark_by_name( bfwin->current_document->buffer, "selection_bound", &itend ); } /** * doc_toggle_highlighting_cb: * @callback_data: unused #gpointer * @action: unused #guint * @widget: unused #GtkWidget* * * Toggle highlighting on/off for current document. * * Return value: void **/ void doc_toggle_highlighting_cb( Tbfwin *bfwin, guint action, GtkWidget *widget ) { bfwin->current_document->view_bars = SET_BIT(bfwin->current_document->view_bars, VIEW_COLORIZED, !(GET_BIT(bfwin->current_document->view_bars,VIEW_COLORIZED))); DEBUG_MSG( "doc_toggle_highlighting_cb, started, highlightstate now is %d\n", bfwin->current_document->view_bars &VIEW_COLORIZED ); if ( !(bfwin->current_document->view_bars &VIEW_COLORIZED) ) { doc_remove_highlighting( bfwin->current_document ); } else { doc_highlight_full( bfwin->current_document ); } } /** * all_documents_apply_settings: * * applies changes from the preferences to all documents * * Return value: void */ void all_documents_apply_settings() { GList * tmplist = g_list_first( return_allwindows_documentlist() ); while ( tmplist ) { Tdocument * doc = tmplist->data; doc_set_tabsize( doc, main_v->props.editor_tab_width ); doc_set_font( doc, main_v->props.editor_font_string ); tmplist = g_list_next( tmplist ); } } /** * doc_convert_asciichars_in_selection: * @callback_data: unused #gpointer * @callback_action: #guint type of chars to change * @widget: unused #GtkWidget* * * Convert characters in current document to entities. * callback_action set to 1 (only ascii), 2 (only iso) or 3 (both). * or 4 (ToUppercase) or 5 (ToLowercase) * * Return value: void **/ void doc_convert_asciichars_in_selection( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if (callback_action < 4) { doc_convert_case_in_selection( bfwin->current_document, callback_action ); } /* kyanh, removed, 20050303, */ else { doc_convert_chars_to_entities_in_selection(bfwin->current_document, (callback_action &4), (callback_action &8 )); } } /** * doc_toggle_highlighting_cb: * @callback_data: unused #gpointer * @action: unused #guint * @widget: unused #GtkWidget* * * Show word-, line- and charcount for current document in the statusbar. * Note: The wordcount() call returns number of actual utf8-chars, not bytes. * * Return value: void **/ void word_count_cb ( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { guint chars = 0, lines = 0, words = 0; gchar *allchars, *wc_message; allchars = doc_get_chars( bfwin->current_document, 0, -1 ); wordcount( allchars, &chars, &lines, &words ); g_free( allchars ); wc_message = g_strdup_printf( _( "Statistics: %d lines, %d words, %d characters" ), lines, words, chars ); statusbar_message ( bfwin, wc_message, 5000 ); g_free ( wc_message ); } /** * doc_toggle_highlighting_cb: * @doc: a #Tdocument* * @unindent: #gboolean * * Indent the selected block in current document. * Set unindent to TRUE to unindent. * * Return value: void **/ void doc_indent_selection( Tdocument *doc, gboolean unindent ) { GtkTextIter itstart, itend; if ( gtk_text_buffer_get_selection_bounds( doc->buffer, &itstart, &itend ) ) { GtkTextMark * end; /* gboolean firstrun=TRUE;*/ doc_unbind_signals( doc ); doc_unre_new_group( doc ); /* we have a selection, now we loop trough the characters, and for every newline we add or remove a tab, we set the end with a mark */ end = gtk_text_buffer_create_mark( doc->buffer, NULL, &itend, TRUE ); if ( gtk_text_iter_get_line_offset( &itstart ) > 0 ) { gtk_text_iter_set_line_index( &itstart, 0 ); } while ( gtk_text_iter_compare( &itstart, &itend ) < 0 ) { GtkTextMark * cur; /* if (firstrun && !gtk_text_iter_starts_line(&itstart)) { gtk_text_iter_forward_line(&itstart); } firstrun = FALSE;*/ cur = gtk_text_buffer_create_mark( doc->buffer, NULL, &itstart, TRUE ); if ( unindent ) { /* when unindenting we try to set itend to the end of the indenting step which might be a tab or 'tabsize' spaces, then we delete that part */ gboolean cont = TRUE; gchar *buf = NULL; gunichar cchar = gtk_text_iter_get_char( &itstart ); if ( cchar == 9 ) { /* 9 is ascii for tab */ itend = itstart; cont = gtk_text_iter_forward_char( &itend ); buf = g_strdup( "\t" ); } else if ( cchar == 32 ) { /* 32 is ascii for space */ gint i = 0; itend = itstart; gtk_text_iter_forward_chars( &itend, main_v->props.editor_tab_width ); buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); DEBUG_MSG( "tab_width=%d, strlen(buf)=%d, buf='%s'\n", main_v->props.editor_tab_width, strlen( buf ), buf ); while ( cont && buf[ i ] != '\0' ) { cont = ( buf[ i ] == ' ' ); DEBUG_MSG( "doc_indent_selection, buf[%d]='%c'\n", i, buf[ i ] ); i++; } if ( !cont ) { g_free ( buf ); } } else { cont = FALSE; } if ( cont ) { gint offsetstart, offsetend; offsetstart = gtk_text_iter_get_offset( &itstart ); offsetend = gtk_text_iter_get_offset( &itend ); gtk_text_buffer_delete( doc->buffer, &itstart, &itend ); doc_unre_add( doc, buf, offsetstart, offsetend, UndoDelete ); g_free ( buf ); } #ifdef DEBUG else { DEBUG_MSG( "doc_indent_selection, NOT continue!!\n" ); } #endif } else { /* indent */ gint offsetstart = gtk_text_iter_get_offset( &itstart ); gchar *indentstring; gint indentlen; if ( main_v->props.view_bars & MODE_INDENT_WITH_SPACES ) { indentstring = bf_str_repeat( " ", main_v->props.editor_tab_width ); indentlen = main_v->props.editor_tab_width; } else { indentstring = g_strdup( "\t" ); indentlen = 1; } gtk_text_buffer_insert( doc->buffer, &itstart, indentstring, indentlen ); doc_unre_add( doc, indentstring, offsetstart, offsetstart + indentlen, UndoInsert ); g_free( indentstring ); } gtk_text_buffer_get_iter_at_mark( doc->buffer, &itstart, cur ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, end ); gtk_text_buffer_delete_mark( doc->buffer, cur ); gtk_text_iter_forward_line( &itstart ); DEBUG_MSG( "doc_indent_selection, itstart at %d, itend at %d\n", gtk_text_iter_get_offset( &itstart ), gtk_text_iter_get_offset( &itend ) ); } gtk_text_buffer_delete_mark( doc->buffer, end ); doc_bind_signals( doc ); doc_set_modified( doc, 1 ); } else { /* there is no selection, work on the current line */ GtkTextIter iter; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); gtk_text_iter_set_line_offset( &iter, 0 ); if ( unindent ) { gint deletelen = 0; gchar *tmpstr, *tmp2str; GtkTextIter itend = iter; gtk_text_iter_forward_chars( &itend, main_v->props.editor_tab_width ); tmpstr = gtk_text_buffer_get_text( doc->buffer, &iter, &itend, FALSE ); tmp2str = bf_str_repeat( " ", main_v->props.editor_tab_width ); if ( tmpstr[ 0 ] == '\t' ) { deletelen = 1; } else if ( tmpstr && strncmp( tmpstr, tmp2str, main_v->props.editor_tab_width ) == 0 ) { deletelen = main_v->props.editor_tab_width; } g_free( tmpstr ); g_free( tmp2str ); if ( deletelen ) { itend = iter; gtk_text_iter_forward_chars( &itend, deletelen ); gtk_text_buffer_delete( doc->buffer, &iter, &itend ); } } else { /* indent */ gchar *indentstring; gint indentlen; if ( main_v->props.view_bars & MODE_INDENT_WITH_SPACES ) { indentstring = bf_str_repeat( " ", main_v->props.editor_tab_width ); indentlen = main_v->props.editor_tab_width; } else { indentstring = g_strdup( "\t" ); indentlen = 1; } gtk_text_buffer_insert( doc->buffer, &iter, indentstring, indentlen ); g_free( indentstring ); } } } void menu_indent_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if ( bfwin->current_document ) { doc_indent_selection( bfwin->current_document, ( callback_action == 1 ) ); } } /** * list_relative_document_filenames: * @curdoc: #Tdocument: the current document * * this function will generate a stringlist with a relative links to * all other open documents. This list should be freed using free_stringlist() * * Return value: #GList with strings */ GList *list_relative_document_filenames( Tdocument *curdoc ) { GList * tmplist, *retlist = NULL; if ( curdoc->filename == NULL ) { return NULL; } tmplist = g_list_first( BFWIN( curdoc->bfwin ) ->documentlist ); while ( tmplist ) { Tdocument * tmpdoc = tmplist->data; if ( tmpdoc != curdoc && tmpdoc->filename != NULL ) { retlist = g_list_append( retlist, create_relative_link_to( curdoc->filename, tmpdoc->filename ) ); } tmplist = g_list_next( tmplist ); } return retlist; } static void floatingview_destroy_lcb( GtkWidget *widget, Tdocument *doc ) { DEBUG_MSG( "floatingview_destroy_lcb, called for doc=%p, doc->floatingview=%p\n", doc, doc->floatingview ); if ( doc->floatingview ) { gtk_widget_destroy( FLOATINGVIEW( doc->floatingview ) ->window ); g_free( doc->floatingview ); doc->floatingview = NULL; } } static void new_floatingview( Tdocument *doc ) { Tfloatingview * fv; gchar *title; GtkWidget *scrolwin; if ( doc->floatingview ) { fv = FLOATINGVIEW( doc->floatingview ); gtk_window_present( GTK_WINDOW( fv->window ) ); return ; } fv = g_new( Tfloatingview, 1 ); doc->floatingview = fv; DEBUG_MSG( "new_floatingview for doc=%p is at %p\n", doc, doc->floatingview ); title = ( doc->filename ) ? doc->filename : "Untitled"; fv->window = window_full2( title, GTK_WIN_POS_NONE, 5, G_CALLBACK( floatingview_destroy_lcb ), doc, TRUE, NULL ); gtk_window_set_role( GTK_WINDOW( fv->window ), "floatingview" ); fv->textview = gtk_text_view_new_with_buffer( doc->buffer ); gtk_text_view_set_editable( GTK_TEXT_VIEW( fv->textview ), FALSE ); gtk_text_view_set_cursor_visible( GTK_TEXT_VIEW( fv->textview ), FALSE ); apply_font_style( fv->textview, main_v->props.editor_font_string ); gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( fv->textview ), GTK_WRAP_WORD ); scrolwin = gtk_scrolled_window_new( NULL, NULL ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolwin ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( scrolwin ), fv->textview ); gtk_container_add( GTK_CONTAINER( fv->window ), scrolwin ); gtk_window_set_default_size( GTK_WINDOW( fv->window ), 600, 600 ); gtk_widget_show_all( fv->window ); } void file_floatingview_menu_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { new_floatingview( bfwin->current_document ); } /* kyanh, added */ void menu_comment_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if ( bfwin->current_document ) { doc_comment_selection( bfwin->current_document, ( callback_action == 1 ) ); } } /* kyanh, added */ void doc_comment_selection( Tdocument *doc, gboolean uncomment ) { GtkTextIter itstart, itend; if ( gtk_text_buffer_get_selection_bounds( doc->buffer, &itstart, &itend ) ) { GtkTextMark * end; doc_unbind_signals( doc ); doc_unre_new_group( doc ); /* we have a selection, now we loop trough the characters, and for every newline we add or remove a tab, we set the end with a mark */ end = gtk_text_buffer_create_mark( doc->buffer, NULL, &itend, TRUE ); /* set to: the fist char of the fist line */ if ( gtk_text_iter_get_line_offset( &itstart ) > 0 ) { gtk_text_iter_set_line_index( &itstart, 0 ); } gint maxpre = 0; /* maximum number of stripped string from previous line*/ if ( uncomment ) { gchar * tmpstr = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); /* g_print("===========\nCurrent selection:[\n%s]\n",tmpstr); */ /* TODO: donot use split; use gtk_text_iter_forward_line(&itstart); */ gchar **tmpsplit = g_strsplit( tmpstr, "\n", 0 ); gint nline = count_array( tmpsplit ); /* number of line */ DEBUG_MSG( "Number of lines: %d\n", nline ); gint i = 0, j = 0; /* TODO: for (i=0; tmpsplit[i]!=NULL; i++ ) */ for ( i = 0; i < nline; i++ ) { /* g_print("Line %d: %s\n", i,tmpsplit[i]); */ j = 0; while ( tmpsplit[ i ][ j ] != '\0' && ( tmpsplit[ i ][ j ] == '%' || tmpsplit[ i ][ j ] == ' ' || tmpsplit[ i ][ j ] == '\t' ) ) { j++; } /*g_print("May be remove %d chars\n", j); */ if ( i ) { /* isNOT first line? */ /* we check for the last char of line */ if ( tmpsplit[ i ][ j ] != '\0' && tmpsplit[ i ][ j ] != '%' && tmpsplit[ i ][ j ] != ' ' && tmpsplit[ i ][ j ] != '\t' ) { if ( maxpre > j ) { maxpre = j; } } /*else: a line contains only space, tab or percent*/ } else { maxpre = j; } } DEBUG_MSG( "Will remove %d chars from each line\n", maxpre ); /* ASK SOME ONE, what version of FREE to be used here */ g_strfreev( tmpsplit ); } /* remove one line from current selection for each step*/ while ( gtk_text_iter_compare( &itstart, &itend ) < 0 ) { GtkTextMark * cur; cur = gtk_text_buffer_create_mark( doc->buffer, NULL, &itstart, TRUE ); if ( uncomment ) { /* TODO: use insert-replace buffer for faster code */ if ( maxpre ) { itend = itstart; gtk_text_iter_forward_chars( &itend, maxpre ); gchar *buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); gint offsetstart, offsetend; offsetstart = gtk_text_iter_get_offset( &itstart ); offsetend = gtk_text_iter_get_offset( &itend ); DEBUG_MSG( "Remove: Range [%d,%d] String [%s]\n", offsetstart, offsetend, buf ); gtk_text_buffer_delete( doc->buffer, &itstart, &itend ); doc_unre_add( doc, buf, offsetstart, offsetend, UndoDelete ); } } else { /* comment */ gint offsetstart = gtk_text_iter_get_offset( &itstart ); gchar *indentstring; gint indentlen; indentstring = g_strdup( "%% " ); indentlen = 3; gtk_text_buffer_insert( doc->buffer, &itstart, indentstring, indentlen ); doc_unre_add( doc, indentstring, offsetstart, offsetstart + indentlen, UndoInsert ); g_free( indentstring ); } gtk_text_buffer_get_iter_at_mark( doc->buffer, &itstart, cur ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, end ); gtk_text_buffer_delete_mark( doc->buffer, cur ); /* forward one more line */ gtk_text_iter_forward_line( &itstart ); DEBUG_MSG( "doc_comment_selection, itstart at %d, itend at %d\n", gtk_text_iter_get_offset( &itstart ), gtk_text_iter_get_offset( &itend ) ); } gtk_text_buffer_delete_mark( doc->buffer, end ); doc_bind_signals( doc ); doc_set_modified( doc, 1 ); } else { /* there is no selection, work on the current line */ GtkTextIter iter; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); gtk_text_iter_set_line_offset( &iter, 0 ); if ( uncomment ) { GtkTextIter itend; gtk_text_buffer_get_end_iter( doc->buffer, &itend ); gchar *tmpstr = gtk_text_buffer_get_text( doc->buffer, &iter, &itend, FALSE ); /* TODO: COULD WE USE PCRE HERE ?*/ gint i = 0; while ( tmpstr[ i ] != '\0' && ( tmpstr[ i ] == '%' || tmpstr[ i ] == ' ' || tmpstr[ i ] == '\t' ) ) { i++; } g_free( tmpstr ); if ( i ) { itend = iter; gtk_text_iter_forward_chars( &itend, i ); gtk_text_buffer_delete( doc->buffer, &iter, &itend ); } } else { /* comment */ gchar *indentstring; gint indentlen; indentstring = g_strdup( "%% " ); indentlen = 3; gtk_text_buffer_insert( doc->buffer, &iter, indentstring, indentlen ); g_free( indentstring ); } } } /* kyanh, added */ void menu_shift_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if ( bfwin->current_document ) { doc_shift_selection( bfwin->current_document, ( callback_action == 1 ) ); } } /* kyanh, added */ /* vers=0: right == NOOPS*/ void doc_shift_selection( Tdocument *doc, gboolean vers ) { GtkTextIter itstart, itend; if ( gtk_text_buffer_get_selection_bounds( doc->buffer, &itstart, &itend ) ) { GtkTextMark * end; doc_unbind_signals( doc ); doc_unre_new_group( doc ); /* we have a selection, now we loop trough the characters, and for every newline we add or remove a tab, we set the end with a mark */ end = gtk_text_buffer_create_mark( doc->buffer, NULL, &itend, TRUE ); /* set to: the fist char of the fist line */ if ( gtk_text_iter_get_line_offset( &itstart ) > 0 ) { gtk_text_iter_set_line_index( &itstart, 0 ); } /* remove one line from current selection for each step*/ while ( gtk_text_iter_compare( &itstart, &itend ) < 0 ) { GtkTextMark * cur; cur = gtk_text_buffer_create_mark( doc->buffer, NULL, &itstart, TRUE ); if ( vers ) { itend = itstart; gtk_text_iter_forward_chars( &itend, 1 ); gchar *buf = gtk_text_buffer_get_text( doc->buffer, &itstart, &itend, FALSE ); if ( !strstr( buf, "\n" ) ) { gint offsetstart, offsetend; offsetstart = gtk_text_iter_get_offset( &itstart ); offsetend = gtk_text_iter_get_offset( &itend ); gtk_text_buffer_delete( doc->buffer, &itstart, &itend ); doc_unre_add( doc, buf, offsetstart, offsetend, UndoDelete ); } g_free( buf ); } gtk_text_buffer_get_iter_at_mark( doc->buffer, &itstart, cur ); gtk_text_buffer_get_iter_at_mark( doc->buffer, &itend, end ); gtk_text_buffer_delete_mark( doc->buffer, cur ); /* forward one more line */ gtk_text_iter_forward_line( &itstart ); } gtk_text_buffer_delete_mark( doc->buffer, end ); doc_bind_signals( doc ); doc_set_modified( doc, 1 ); } else { /* there is no selection, work on the current line */ GtkTextIter iter; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); if ( vers ) { GtkTextIter itend; gtk_text_iter_set_line_offset( &iter, 0 ); itend = iter; gtk_text_iter_forward_chars( &itend, 1 ); gtk_text_buffer_delete( doc->buffer, &iter, &itend ); } } } /* kyanh, added */ void menu_del_line_cb( Tbfwin *bfwin, guint callback_action, GtkWidget *widget ) { if ( bfwin->current_document ) { doc_del_line( bfwin->current_document, ( callback_action == 1 ) ); } } /* kyanh, added */ /* vers=0: remove from cursor to the end*/ void doc_del_line( Tdocument *doc, gboolean vers ) { GtkTextIter itstart, itend; if ( !gtk_text_buffer_get_selection_bounds( doc->buffer, &itstart, &itend ) ) { /* there is no selection, work on the current line */ GtkTextIter iter; gtk_text_buffer_get_iter_at_mark( doc->buffer, &iter, gtk_text_buffer_get_insert( doc->buffer ) ); if ( vers ) { gtk_text_iter_set_line_offset( &iter, 0 ); gtk_text_iter_forward_line( &itend ); gtk_text_buffer_delete( doc->buffer, &iter, &itend ); } } } winefish-1.3.3/src/undo_redo.c0000600000047200004720000004100110373411041015227 0ustar kyanhkyanh/* $Id: undo_redo.c 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * * undo_redo.c - imrpoved undo/redo functionality * Copyright (C) 2001-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* #define DEBUG */ #include #include #include "bluefish.h" #include "undo_redo.h" #include "document.h" /* doc_bind_signals() */ typedef struct { char *text; /* text to be inserted or deleted */ int start; /* starts at this position */ int end; /* ends at this position */ undo_op_t op; /* action to execute */ } unreentry_t; static unregroup_t *unregroup_new(Tdocument *doc) { unregroup_t *newgroup; newgroup = g_malloc(sizeof(unregroup_t)); newgroup->changed = doc->modified; newgroup->entries = NULL; DEBUG_MSG("unregroup_new, at %p with modified=%d\n", newgroup, newgroup->changed); return newgroup; } static void unreentry_destroy(unreentry_t *remove_entry) { if (remove_entry->text) { g_free(remove_entry->text); } g_free(remove_entry); } static void unregroup_destroy(unregroup_t *to_remove) { GList *tmplist; tmplist = g_list_first(to_remove->entries); while (tmplist) { unreentry_destroy((unreentry_t *)tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(tmplist); g_free(to_remove); } static void doc_unre_destroy_last_group(Tdocument *doc) { DEBUG_MSG("doc_unre_destroy_last_group, called, last=%p\n", doc->unre.last); if (doc->unre.last) { unregroup_t *to_remove = doc->unre.last->data; doc->unre.last = g_list_previous(doc->unre.last); g_list_remove (doc->unre.last, to_remove); doc->unre.num_groups--; unregroup_destroy(to_remove); } } static gint unregroup_activate(unregroup_t *curgroup, Tdocument *doc, gint is_redo) { GList *tmplist; gint lastpos=-1; if (is_redo) { tmplist = g_list_last(curgroup->entries); } else { tmplist = g_list_first(curgroup->entries); } while (tmplist) { GtkTextIter itstart; unreentry_t *entry = tmplist->data; gtk_text_buffer_get_iter_at_offset(doc->buffer,&itstart,entry->start); gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(doc->view),&itstart,0.05,FALSE,0.0,0.0); if ((entry->op == UndoInsert && !is_redo) || (entry->op == UndoDelete && is_redo)) { GtkTextIter itend; DEBUG_MSG("unregroup_activate set start to %d, end to %d and delete\n", entry->start, entry->end); gtk_text_buffer_get_iter_at_offset(doc->buffer,&itend,entry->end); gtk_text_buffer_delete(doc->buffer,&itstart,&itend); } else { DEBUG_MSG("unregroup_activate set start to %d and insert %d chars: %s\n", entry->start, strlen(entry->text), entry->text); gtk_text_buffer_insert(doc->buffer,&itstart,entry->text,-1); } lastpos = entry->start; if (is_redo) { tmplist = g_list_previous(tmplist); } else { tmplist = g_list_next(tmplist); } } if (is_redo) { doc_set_modified(doc, 1); } else { DEBUG_MSG("unregroup_activate, calling set modified with %d\n", curgroup->changed); doc_set_modified(doc, curgroup->changed); } return lastpos; } static unreentry_t *unreentry_new(const char *text, int start, int end, undo_op_t op) { unreentry_t *new_entry; new_entry = g_malloc(sizeof(unreentry_t)); DEBUG_MSG("unreentry_new, for text='%s'\n", text); new_entry->text = g_strdup(text); new_entry->start = start; new_entry->end = end; new_entry->op = op; return new_entry; } static void unre_list_cleanup(GList **list) { if (list && *list) { GList *tmplist; tmplist = g_list_first(*list); while (tmplist) { unregroup_destroy(tmplist->data); tmplist = g_list_next(tmplist); } g_list_free(*list); *list = NULL; } } static gint doc_undo(Tdocument *doc) { unregroup_t *curgroup = NULL; if (g_list_length(doc->unre.current->entries) > 0) { /* if the current group has entries we have to undo that one */ DEBUG_MSG("doc_undo, undo the entries of the current group, and create a new group\n"); curgroup = doc->unre.current; /* hmm, when this group is created, the doc->modified is not yet in the 'undo' state because activate is not yet called, so this group will have the wrong 'changed' value*/ doc->unre.current = unregroup_new(doc); doc->unre.current->changed = curgroup->changed; } else if (doc->unre.first) { /* we have to undo the first one in the list */ DEBUG_MSG("doc_undo, current group is empty--> undo the entries of the previous group\n"); curgroup = doc->unre.first->data; doc->unre.first = g_list_remove(doc->unre.first, curgroup); doc->unre.num_groups--; /* what happens when this was the last entry in the list?*/ DEBUG_MSG("doc_undo, removed a group, num_groups =%d\n", doc->unre.num_groups); if (doc->unre.num_groups == 0) { doc->unre.first = NULL; doc->unre.last = NULL; } else { doc->unre.first = g_list_first(doc->unre.first); } } if (curgroup) { doc->unre.redofirst = g_list_prepend(doc->unre.redofirst,curgroup); /* since activate calls doc_set_modified, and doc_set_modified sets the undo/redo widgets, the lenght of the redolist should be > 0 _before_ activate is called */ DEBUG_MSG("doc_undo, calling unregroup_activate\n"); return unregroup_activate(curgroup, doc, 0); } return -1; } static gint doc_redo(Tdocument *doc) { if (doc->unre.redofirst) { unregroup_t *curgroup = NULL; curgroup = doc->unre.redofirst->data; doc->unre.redofirst = g_list_remove(doc->unre.redofirst, curgroup); /* what happens when this was the last one of the list? does it return NULL ? */ DEBUG_MSG("doc_redo, doc->unre.redofirst=%p\n", doc->unre.redofirst); doc_unre_new_group(doc); doc->unre.first = g_list_prepend(doc->unre.first, curgroup); if (!doc->unre.last) { doc->unre.last = doc->unre.first; } doc->unre.num_groups++; DEBUG_MSG("doc_redo, added a group, num_groups =%d\n", doc->unre.num_groups); return unregroup_activate(curgroup, doc, 1); } return -1; } /** * doc_unre_add: * @doc: a #Tdocument * @text: a #const gchar * with the deleted/inserted text * @start: a #gint with the start position * @end: a #gint with the end position * @op: a #undo_op_t, if this is a insert or delete call * * adds the text to the current undo/redo group for document doc * with action insert or undo, dependent on the value of op * * Return value: void **/ void doc_unre_add(Tdocument *doc, const char *text, gint start, gint end, undo_op_t op) { unreentry_t *entry=NULL; gboolean handled = FALSE; if (end < start) { gint tmp = start; start = end; end = tmp; } DEBUG_MSG("doc_unre_add, start=%d, end=%d\n", start, end); if (doc->unre.current->entries) { entry = (unreentry_t *)(doc->unre.current->entries->data); DEBUG_MSG("doc_unre_add, currentgroup=%p, entry=%p\n", doc->unre.current,entry ); DEBUG_MSG("doc_unre_add, entry=%p entry->end=%d, entry->start=%d\n", entry, entry->end, entry->start); DEBUG_MSG("doc_unre_add, entry->op=%d, op=%d, UndoInsert=%d\n", entry->op, op, UndoInsert); /* do efficient, add the current one to the previous one */ if ((entry->end == start && entry->op == UndoInsert && op == UndoInsert) || ((entry->start == end || start == entry->start)&& entry->op == UndoDelete && op == UndoDelete)) { gchar *newstr; if (op == UndoInsert) { /* multiple inserts can be grouped together, just add them together, and set the end * to the end of the new one */ newstr = g_strconcat(entry->text, text, NULL); entry->end = end; DEBUG_MSG("doc_unre_add, INSERT, text=%s\n", newstr); } else if (entry->start == end) { /* multiple backspaces can be grouped together, just add the new one before the * old one, and set the start to the start of the new one */ newstr = g_strconcat(text, entry->text, NULL); entry->start = start; DEBUG_MSG("doc_unre_add, BACKSPACE, text=%s\n", newstr); } else { /* multiple delete's at the same position have the same start, but the second delete * can be added to the right side of the previous delete, so only the end should * be increased */ newstr = g_strconcat(entry->text,text,NULL); entry->end += (end - start); DEBUG_MSG("doc_unre_add, DELETE, text=%s\n", newstr); } g_free(entry->text); entry->text = newstr; handled = TRUE; } else { DEBUG_MSG("doc_unre_add, NOT grouped with previous entry\n"); } } if (!handled) { unreentry_t *new_entry; new_entry = unreentry_new(text, start, end, op); DEBUG_MSG("doc_unre_add, not handled yet, new entry with text=%s\n", text); doc->unre.current->entries = g_list_prepend(doc->unre.current->entries, new_entry); if (doc->unre.redofirst) { /* destroy the redo list, groups and entries */ unre_list_cleanup(&doc->unre.redofirst); DEBUG_MSG("doc_unre_add, redolist=%p\n", doc->unre.redofirst); } } } static void doc_unre_start(Tdocument *doc) { DEBUG_MSG("doc_unre_start, started\n"); doc_unbind_signals(doc); } static void doc_unre_finish(Tdocument *doc, gint cursorpos) { DEBUG_MSG("doc_unre_finish, started\n"); /* now re-establish the signals */ doc_bind_signals(doc); /* if (doc->highlightstate) { doc_need_highlighting(doc); }*/ { GtkTextIter iter; gtk_text_buffer_get_iter_at_offset(doc->buffer,&iter,cursorpos); gtk_text_buffer_place_cursor(doc->buffer,&iter); } } /** * doc_unre_new_group: * @doc: a #Tdocument * * starts a new undo/redo group for document doc, all items in one group * are processed as a single undo or redo operation * * Return value: void **/ void doc_unre_new_group(Tdocument *doc) { DEBUG_MSG("doc_unre_new_group, started, num entries=%d\n", g_list_length(doc->unre.current->entries)); if (g_list_length(doc->unre.current->entries) > 0) { doc->unre.first = g_list_prepend(doc->unre.first, doc->unre.current); if (!doc->unre.last) { doc->unre.last = doc->unre.first; } doc->unre.num_groups++; DEBUG_MSG("doc_unre_new_group, added a group, num_groups =%d\n", doc->unre.num_groups); doc->unre.current = unregroup_new(doc); if (doc->unre.num_groups > main_v->props.num_undo_levels) { doc_unre_destroy_last_group(doc); } } } /** * doc_unre_init: * @doc: a #Tdocument * * initializes the Tdocument struct for undo/redo operations * * Return value: void **/ void doc_unre_init(Tdocument *doc) { DEBUG_MSG("doc_unre_init, started\n"); doc->unre.first = NULL; doc->unre.last = NULL; doc->unre.current = unregroup_new(doc); doc->unre.num_groups = 0; doc->unre.redofirst = NULL; } /** * doc_unre_destroy: * @doc: a #Tdocument * * cleans/free's all undo/redo information for this document (for document close etc.) * * Return value: void **/ void doc_unre_destroy(Tdocument *doc) { /* TODO */ DEBUG_MSG("doc_unre_destroy, about to destroy undolist %p\n",doc->unre.first ); unre_list_cleanup(&doc->unre.first); DEBUG_MSG("doc_unre_destroy, about to destroy redofirst %p\n", doc->unre.redofirst); unre_list_cleanup(&doc->unre.redofirst); DEBUG_MSG("doc_unre_destroy, about to destroy current %p\n", doc->unre.current); unregroup_destroy(doc->unre.current); } /** * doc_unre_clear_all: * @doc: a #Tdocument * * cleans all undo/redo information for doc, but re-inits the doc for new undo/redo operations * * Return value: void **/ void doc_unre_clear_all(Tdocument *doc) { doc_unre_destroy(doc); doc_unre_init(doc); } /** * doc_undo_op_compare: * @doc: a #Tdocument * @testfor: a #undo_op_t, test for the last operation * @position: a #gint, test if this was the last position * * tests the last undo/redo operation, if it was insert or delete, and if the position * does match the previous position * * Return value: gboolean, TRUE if everything matches or if there was no previous operation, FALSE if not **/ /* gint doc_undo_op_compare(Tdocument *doc, undo_op_t testfor, gint position) { DEBUG_MSG("doc_undo_op_compare, testfor=%d, position=%d\n", testfor, position); if (doc->unre.current->entries && doc->unre.current->entries->data) { unreentry_t *entry = doc->unre.current->entries->data; DEBUG_MSG("doc_undo_op_compare, entry->op=%d, entry->start=%d, entry->end=%d\n", entry->op, entry->start, entry->end); if (entry->op == testfor) { gint testforpos = (entry->op == UndoDelete) ? entry->start : entry->end; if (testforpos == position) { return 1; } } return 0; } return 1; } */ /** * doc_unre_test_last_entry: * @doc: a #Tdocument * @testfor: a #undo_op_t, test for the last operation * @start: a #gint, test if this was the start position, -1 if not to be tested * @end: a #gint, test if this was the end position, -1 if not to be tested * * tests the last undo/redo operation, if it was (insert or delete) AND if the start AND end * are equal, use -1 for start or end if they do not need testing * * Return value: gboolean, TRUE if everything matches or if there was no previous operation, FALSE if not **/ gboolean doc_unre_test_last_entry(Tdocument *doc, undo_op_t testfor, gint start, gint end) { if (doc->unre.current->entries && doc->unre.current->entries->data) { gboolean retval; unreentry_t *entry = doc->unre.current->entries->data; DEBUG_MSG("doc_unre_test_last_entry, start=%d, entry->start=%d, end=%d, entry->end=%d\n",start, entry->start, end, entry->end); retval = ((entry->op == testfor) && (start == -1 || start == entry->start) && (end == -1 || end == entry->end)); DEBUG_MSG("doc_unre_test_last_entry, return %d\n",retval); return retval; } return TRUE; } /** * undo_cb: * @widget: a #GtkWidget *, ignored * @bfwin: a #Tbfwin* with the window * * activates the last undo group on the current document * * Return value: void **/ void undo_cb(GtkWidget * widget, Tbfwin *bfwin) { DEBUG_MSG("undo_cb, started\n"); if (bfwin->current_document) { gint lastpos; doc_unre_start(bfwin->current_document); lastpos = doc_undo(bfwin->current_document); doc_unre_finish(bfwin->current_document, lastpos); } } /** * redo_cb: * @widget: a #GtkWidget *, ignored * @bfwin: a #Tbfwin* with the window * * activates the last redo group on the current document * * Return value: void **/ void redo_cb(GtkWidget * widget, Tbfwin *bfwin) { if (bfwin->current_document) { gint lastpos; doc_unre_start(bfwin->current_document); lastpos = doc_redo(bfwin->current_document); doc_unre_finish(bfwin->current_document,lastpos); } } /** * undo_all_cb: * @widget: a #GtkWidget *, ignored * @bfwin: a #Tbfwin* with the window * * activates all undo groups on the current document * * Return value: void **/ void undo_all_cb(GtkWidget * widget, Tbfwin *bfwin) { /* TODO -> what needs to be done?? */ if (bfwin->current_document) { gint lastpos = -1; doc_unre_start(bfwin->current_document); while (bfwin->current_document->unre.first) { lastpos = doc_undo(bfwin->current_document); } doc_unre_finish(bfwin->current_document, lastpos); } } /** * redo_all_cb: * @widget: a #GtkWidget *, ignored * @bfwin: a #Tbfwin* with the window * * activates all redo groups on the current document * * Return value: void **/ void redo_all_cb(GtkWidget * widget, Tbfwin *bfwin) { /* TODO -> what needs to be done?? */ if (bfwin->current_document) { gint lastpos = -1; doc_unre_start(bfwin->current_document); while (bfwin->current_document->unre.redofirst) { lastpos = doc_redo(bfwin->current_document); } doc_unre_finish(bfwin->current_document, lastpos); } } /** * doc_has_undo_list: * @doc: a #Tdocument * * returns TRUE if the document doc has a undo list * returns FALSE if there is nothing to undo * * Return value: gboolean, TRUE if the doc has a undo list, else FALSE **/ #ifdef __GNUC__ __inline__ #endif gboolean doc_has_undo_list(Tdocument *doc) { return (doc->unre.first || doc->unre.current->entries) ? TRUE : FALSE; } /** * doc_has_redo_list: * @doc: a #Tdocument * * returns TRUE if the document doc has a redo list * returns FALSE if there is nothing to redo * * Return value: gboolean, TRUE if the doc has a redo list, else FALSE **/ #ifdef __GNUC__ __inline__ #endif gboolean doc_has_redo_list(Tdocument *doc) { return (doc->unre.redofirst) ? TRUE : FALSE; } winefish-1.3.3/src/document.h0000600000047200004720000001470510367544166015131 0ustar kyanhkyanh/* $Id: document.h 1746 2006-01-31 02:16:22Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * document.h - global function for document handling * * Copyright (C) 1998 Olivier Sessink and Chris Mazuc * Copyright (C) 1999-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __DOCUMENT_H_ #define __DOCUMENT_H_ enum { DOCUMENT_BACKUP_ABORT_SAVE, DOCUMENT_BACKUP_ABORT_ABORT, DOCUMENT_BACKUP_ABORT_ASK }; void autoclosing_init(void); GList *return_allwindows_documentlist(void); GList *return_filenamestringlist_from_doclist(GList *doclist); gint documentlist_return_index_from_filename(GList *doclist, gchar *filename); Tdocument *documentlist_return_document_from_filename(GList *doclist, gchar *filename); Tdocument *documentlist_return_document_from_index(GList *doclist, gint index); void doc_update_highlighting(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void doc_set_wrap(Tdocument *doc); gboolean doc_set_filetype(Tdocument *doc, Tfiletype *ft); Tfiletype *get_filetype_by_name(gchar * name); Tfiletype *get_filetype_by_filename_and_content(gchar *filename, gchar *buf); void doc_reset_filetype(Tdocument * doc, gchar * newfilename, gchar *buf); void doc_set_font(Tdocument *doc, gchar *fontstring); void doc_set_tabsize(Tdocument *doc, gint tabsize); void gui_change_tabsize(Tbfwin *bfwin,guint action,GtkWidget *widget); gboolean doc_is_empty_non_modified_and_nameless(Tdocument *doc); gboolean test_docs_modified(GList *doclist); gboolean test_only_empty_doc_left(GList *doclist); gboolean doc_has_selection(Tdocument *doc); void doc_set_modified(Tdocument *doc, gint value); void doc_scroll_to_cursor(Tdocument *doc); gchar *doc_get_chars(Tdocument *doc, gint start, gint end); gint doc_get_max_offset(Tdocument *doc); void doc_select_region(Tdocument *doc, gint start, gint end, gboolean do_scroll); void doc_select_line(Tdocument *doc, gint line, gboolean do_scroll); gboolean doc_get_selection(Tdocument *doc, gint *start, gint *end); gint doc_get_cursor_position(Tdocument *doc); void doc_set_statusbar_insovr(Tdocument *doc); void doc_set_statusbar_editmode_encoding(Tdocument *doc); /* the prototype for these functions is changed!! */ void doc_replace_text_backend(Tdocument *doc, const gchar * newstring, gint start, gint end); void doc_replace_text(Tdocument *doc, const gchar * newstring, gint start, gint end); void doc_insert_two_strings(Tdocument *doc, const gchar *before_str, const gchar *after_str); void doc_bind_signals(Tdocument *doc); void doc_unbind_signals(Tdocument *doc); gboolean buffer_to_file(Tbfwin *bfwin, gchar *buffer, gchar *filename); void doc_destroy(Tdocument * doc, gboolean delay_activation); void document_unset_filename(Tdocument *doc); gchar *ask_new_filename(Tbfwin *bfwin,gchar *oldfilename, const gchar *gui_name, gboolean is_move); gint doc_save(Tdocument * doc, gboolean do_save_as, gboolean do_move, gboolean window_closing); void document_set_line_numbers(Tdocument *doc, gboolean value); Tdocument *doc_new(Tbfwin* bfwin, gboolean delay_activate); void doc_new_with_new_file(Tbfwin *bfwin, gchar * new_filename); Tdocument *doc_new_with_file(Tbfwin *bfwin, gchar * filename, gboolean delay_activate, gboolean move_to_this_win); void docs_new_from_files(Tbfwin *bfwin, GList * file_list, gboolean move_to_this_win, gint linenumber); void doc_reload(Tdocument *doc); void doc_activate(Tdocument *doc); void doc_force_activate(Tdocument *doc); /* callbacks for the menu and toolbars */ void file_open_from_selection(Tbfwin *bfwin); void file_save_cb(GtkWidget * widget, Tbfwin *bfwin); void file_save_as_cb(GtkWidget * widget, Tbfwin *bfwin); void file_move_to_cb(GtkWidget * widget, Tbfwin *bfwin); /* void file_open_url_cb(GtkWidget * widget, Tbfwin *bfwin); */ void file_open_cb(GtkWidget * widget, Tbfwin *bfwin); /* void file_open_advanced_cb(GtkWidget * widget, Tbfwin *bfwin); void open_advanced_from_filebrowser(Tbfwin *bfwin, gchar *path); */ void file_insert_menucb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void file_new_cb(GtkWidget * widget, Tbfwin *bfwin); void file_close_cb(GtkWidget * widget, Tbfwin *bfwin); void bfwin_close_all_documents(Tbfwin *bfwin, gboolean window_closing); void file_close_all_cb(GtkWidget * widget, Tbfwin *bfwin); void file_save_all_cb(GtkWidget * widget, Tbfwin *bfwin); void edit_cut_cb(GtkWidget * widget, Tbfwin *bfwin); void edit_copy_cb(GtkWidget * widget, Tbfwin *bfwin); void edit_paste_cb(GtkWidget * widget, Tbfwin *bfwin); void edit_select_all_cb(GtkWidget * widget, Tbfwin *bfwin); void doc_toggle_highlighting_cb(Tbfwin *bfwin,guint action,GtkWidget *widget); void doc_toggle_wrap_cb(Tbfwin *bfwin,guint action,GtkWidget *widget); void doc_toggle_linenumbers_cb(Tbfwin *bfwin,guint action,GtkWidget *widget); void all_documents_apply_settings(void); void doc_convert_asciichars_in_selection(Tbfwin *bfwin,guint callback_action,GtkWidget *widget); void word_count_cb (Tbfwin *bfwin,guint callback_action,GtkWidget *widget); void doc_indent_selection(Tdocument *doc, gboolean unindent); void menu_indent_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); GList * list_relative_document_filenames(Tdocument *curdoc); void file_floatingview_menu_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); /* kyanh */ void doc_comment_selection(Tdocument *doc, gboolean uncomment); void menu_comment_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void doc_shift_selection(Tdocument *doc, gboolean uncomment); void menu_shift_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void menu_del_line_cb(Tbfwin *bfwin,guint callback_action, GtkWidget *widget); void doc_del_line(Tdocument *doc, gboolean vers); gboolean doc_file_to_textbox( Tdocument * doc, gchar * filename, gboolean enable_undo, gboolean delay ); #endif /* __DOCUMENT_H_ */ winefish-1.3.3/src/undo_redo.h0000600000047200004720000000336310373411041015245 0ustar kyanhkyanh/* $Id: undo_redo.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * * undo_redo.h -- undo structures and function declarations * * Copyright (C) 1998-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __UNDO_REDO_H_ #define __UNDO_REDO_H_ void doc_unre_add(Tdocument *doc, const char *text, int start, int end, undo_op_t op); void doc_unre_new_group(Tdocument *doc); void doc_unre_init(Tdocument *doc); void doc_unre_destroy(Tdocument *doc); void doc_unre_clear_all(Tdocument *doc); gint doc_undo_op_compare(Tdocument *doc, undo_op_t testfor, gint position); gboolean doc_unre_test_last_entry(Tdocument *doc, undo_op_t testfor, gint start, gint end); void redo_cb(GtkWidget * widget, Tbfwin *bfwin); void undo_cb(GtkWidget * widget, Tbfwin *bfwin); void redo_all_cb(GtkWidget * widget, Tbfwin *bfwin); void undo_all_cb(GtkWidget * widget, Tbfwin *bfwin); gboolean doc_has_undo_list(Tdocument *doc); gboolean doc_has_redo_list(Tdocument *doc); #endif /* __UNDO_REDO_H_ */ winefish-1.3.3/src/snr2.c0000600000047200004720000020300210366454524014155 0ustar kyanhkyanh/* $Id: snr2.c 1700 2006-01-27 17:33:08Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * snr2.c - rewrite of search 'n replace functions * * Copyright (C) 2000-2004 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * THIS IS THE BACKEND FLOW DIAGRAM * * snr2_run * ________________/ | \ \___________________________ * / / | | \ \ \ \ * search_bookmark | | | replace_prompt_all | \ \ * | / | | / / \ \ * | search_all | _____replace_prompt_doc / \ replace_all * | | | / / / \ / * | \ doc_show_result / replace_doc_once replace_doc_multiple * | \ __/ \ / * | search_doc / replace_backend * \________ \ / ___________________________/ * \ \ / / * search_backend */ /*****************************************************/ /* #define DEBUG */ #include #include "config.h" #ifdef HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #include #include #include /* _before_ regex.h for freeBSD */ #include /* regcomp() */ #include /* pcre_compile */ #include /* GDK_Return */ #include "bluefish.h" #include "bookmark.h" /* bmark_add_extern() */ #include "bf_lib.h" #include "undo_redo.h" /* doc_unre_new_group */ #include "document.h" /* doc_replace_text() */ #include "gui.h" /* switch_to_document_by_pointer() */ #include "gtk_easy.h" /* a lot of GUI functions */ #include "snr2.h" #include "highlight.h" /* doc_highlight_full() */ #include "stringlist.h" /* add_to_history_stringlist */ /* Updates, May 2003, by Ruben Dorta */ typedef enum { string, uppercase, lowercase } Treplace_types; typedef enum { match_normal, match_posix, match_perl } Tmatch_types; typedef enum { beginning, cursor, selection, opened_files } Tplace_types; typedef struct { gint start; gint end; Tdocument *doc; } Tsearch_all_result; typedef struct { Tbfwin *bfwin; Tdocument *doc; Tsearch_result result; gint replace; gchar *search_pattern; gchar *replace_pattern; gint unescape; gint overlapping_search; gint prompt_before_replace; gint is_case_sens; gint replace_once; gint bookmark_results; Treplace_types replacetype_option; Tmatch_types matchtype_option; Tplace_types placetype_option; } Tlast_snr2; typedef struct { gint replace; Tbfwin *bfwin; GtkWidget *window; GtkWidget *search_combo; /*GtkWidget *search_entry;*/ GtkWidget *search_label; /*GtkWidget *search_scrollbox;*/ GtkWidget *replace_combo; /*GtkWidget *replace_entry;*/ GtkWidget *replace_label; /*GtkWidget *replace_scrollbox;*/ GtkWidget *subpat_help; GtkWidget *overlapping_search; GtkWidget *prompt_before_replace; GtkWidget *is_case_sens; GtkWidget *replace_once; GtkWidget *unescape; GtkWidget *replacetype_option; GtkWidget *matchtype_option; GtkWidget *placetype_option; GtkWidget *bookmark_results; } Tsnr2_win; #define LASTSNR2(var) ((Tlast_snr2 *)(var)) /***********************************************************/ void snr2_run(Tbfwin *bfwin,Tdocument *doc); /***********************************************************/ void snr2_init(Tbfwin *bfwin) { Tlast_snr2 *lsnr2 = g_new0(Tlast_snr2,1); lsnr2->bfwin = bfwin; bfwin->snr2 = lsnr2; } void snr2_cleanup(Tbfwin *bfwin) { g_free(bfwin->snr2); } static void reset_last_snr2(Tbfwin *bfwin) { if (LASTSNR2(bfwin->snr2)->search_pattern) { g_free(LASTSNR2(bfwin->snr2)->search_pattern); } if (LASTSNR2(bfwin->snr2)->replace_pattern) { g_free(LASTSNR2(bfwin->snr2)->replace_pattern); } memset(LASTSNR2(bfwin->snr2), 0, sizeof(Tlast_snr2)); } /***********************************************************/ /** * search_backend: * @bfwin: #Tbfwin* * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: If the search is case sensitive, #gint * @buf: #gchar* to the document buffer * @byte_offset: #guint where in the buffer the search should start, in bytes, not characters * @want_submatches: #gint * * Performs an actual search in a supplied buffer (#gchar*, aka string). * NOTE: If want_submatches is set, tsearch_result->pmatch should be free`ed by the calling function! * * Return value: #Tsearch_result, contains both character and byte offsets, for wide-char-compatibility. Note values for start/end are set to -1 on error. **/ Tsearch_result search_backend(Tbfwin *bfwin, gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gchar *buf, guint byte_offset, gboolean want_submatches) { Tsearch_result returnvalue; int (*f) (); gint buflen, patlen, match, i; returnvalue.start = -1; returnvalue.end = -1; returnvalue.bstart = -1; returnvalue.bend = -1; returnvalue.pmatch = NULL; returnvalue.nmatch = 0; if ((!search_pattern) || (!buf)) { DEBUG_MSG("search_backend, search_pattern or buf is NULL\n"); return returnvalue; } DEBUG_MSG("search_backend, starting for byte_offset=%u\n",byte_offset); if (matchtype == match_posix) { /* regex part start */ regex_t reg_pat; regmatch_t *pmatch; gint nmatch, retval; retval = regcomp(®_pat, search_pattern, (is_case_sens ? REG_EXTENDED : REG_EXTENDED | REG_ICASE)); DEBUG_MSG("search_backend, regcomp retval=%d\n", retval); if (retval != 0) { #define ERRORSTR_SIZE 300 gchar errorstr[ERRORSTR_SIZE], *errorstr2; regerror(retval, ®_pat, errorstr, ERRORSTR_SIZE); errorstr2 = g_strconcat(_("Regular expression error: "), errorstr, NULL); warning_dialog(bfwin->main_window,_("Search failed"), errorstr2); g_free(errorstr2); /* error compiling the search_pattern, returning the default result set, which is the 'nothing found' set */ return returnvalue; } nmatch = (want_submatches) ? reg_pat.re_nsub+1 : 1; DEBUG_MSG("search_backend, expr. contains %d sub search_patterns\n", reg_pat.re_nsub ); pmatch = g_malloc(nmatch*sizeof(regmatch_t)); retval = regexec(®_pat, buf+byte_offset, nmatch, pmatch, 0); DEBUG_MSG("search_backend, regexec retval=%d\n", retval); if (retval != 0) { returnvalue.bstart = -1; returnvalue.bend = -1; } else { returnvalue.bstart = pmatch[0].rm_so + byte_offset; returnvalue.bend = pmatch[0].rm_eo + byte_offset; } #ifdef DEBUG { int i; for (i=0;imain_window,_("Search failed"), errstring); g_free(errstring); return returnvalue;/* error compiling the search_pattern, returning the default result set,which is the 'nothing found' set */ } retval = pcre_exec(pcre_c,NULL,buf+byte_offset,strlen(buf+byte_offset),0,0,ovector,30); if (retval > 0) { returnvalue.bstart = ovector[0] + byte_offset; returnvalue.bend = ovector[1] + byte_offset; } else { returnvalue.bstart = -1; returnvalue.bend = -1; } if (want_submatches) { int nmatch,i; regmatch_t *pmatch; pcre_fullinfo(pcre_c, NULL, PCRE_INFO_CAPTURECOUNT, &nmatch); DEBUG_MSG("search_backend, nmatch=%d, retval=%d\n", nmatch, retval); pmatch = g_malloc((nmatch+1)*sizeof(regmatch_t)); for (i=0;i<=nmatch;i++) { /* nmatch==1 means 1 subsearch_pattern, so 2 search_patterns in total*/ pmatch[i].rm_so = ovector[i*2] + byte_offset; pmatch[i].rm_eo = ovector[i*2+1] + byte_offset; } returnvalue.pmatch = pmatch; returnvalue.nmatch = retval; #ifdef DEBUG { int i; for (i=0;i= 0 && returnvalue.bend >= 0) { /* utf8_offset_cache_reset(); */ if (returnvalue.bstart >= 0) { returnvalue.start = utf8_byteoffset_to_charsoffset_cached(buf, returnvalue.bstart); } if (returnvalue.bend >= 0) { returnvalue.end = utf8_byteoffset_to_charsoffset_cached(buf, returnvalue.bend); } if (want_submatches) { int i; for (i=0;i 0) { DEBUG_MSG("search_doc, received a result (start=%d), adding startpos (%d) to it\n", result.start, startpos); result.start += startpos; result.end += startpos; LASTSNR2(bfwin->snr2)->result.start = result.start; LASTSNR2(bfwin->snr2)->result.end = result.end; LASTSNR2(bfwin->snr2)->doc = document; } else { LASTSNR2(bfwin->snr2)->result.start = -1; LASTSNR2(bfwin->snr2)->result.end = -1; LASTSNR2(bfwin->snr2)->doc = document; } DEBUG_MSG("search_doc, result.start=%d, result.end=%d\n", result.start, result.end); return result; } /*****************************************************/ /** * doc_show_result: * @document: a #Tdocument * @start: Selection start. * @end: Selection end. * * Focus a document and select the supplied range. * * Return value: void **/ void doc_show_result(Tdocument *document, gint start, gint end) { DEBUG_MSG("doc_show_result, select from start=%d to end=%d\n",start, end); if (document != BFWIN(document->bfwin)->current_document) { switch_to_document_by_pointer(BFWIN(document->bfwin),document); } doc_select_region(document, start, end, TRUE); } /*****************************************************/ /** * search_all: * @bfwin: #Tbfwin* * @search_pattern: #gchar to search pattern * @matchtype: see #Tmatch_types * is_case_sens: #gint set to 0 or 1. * * Perform a specified search, spanning all open documents. * * When called several times, the search continues from where it left off last time. * The current 'search-position' is stored in the internal last_snr2 structure. * * Return value: #Tsearch_all_result **/ Tsearch_all_result search_all(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gboolean unescape) { GList *tmplist; Tsearch_all_result result_all; DEBUG_MSG("search_all, started\n"); result_all.start = -1; result_all.end = -1; result_all.doc = NULL; if (LASTSNR2(bfwin->snr2)->doc) { tmplist = g_list_find(bfwin->documentlist, LASTSNR2(bfwin->snr2)->doc); } else { LASTSNR2(bfwin->snr2)->result.end = 0; tmplist = g_list_first(bfwin->documentlist); } while (tmplist) { Tsearch_result result; result = search_doc(bfwin,(Tdocument *)tmplist->data, search_pattern, matchtype, is_case_sens, LASTSNR2(bfwin->snr2)->result.end, unescape); if (result.end > 0) { result_all.start = result.start; result_all.end = result.end; result_all.doc = tmplist->data; DEBUG_MSG("search_all, found!! start=%d, end=%d, doc=%p\n", result.start, result.end, tmplist->data); return result_all; } tmplist = g_list_next(tmplist); if (tmplist) { LASTSNR2(bfwin->snr2)->result.end = 0; } } DEBUG_MSG("search_all, not found..\n"); return result_all; } /*****************************************************/ static gchar *reg_replace(gchar *replace_pattern, gint offset, Tsearch_result result, Tdocument *doc, gboolean standardescape) { Tconvert_table * tct; gchar *retval; gint i, size; DEBUG_MSG("reg_replace, started for pattern='%s',standardescape=%d\n",replace_pattern,standardescape); size = (result.nmatch <= 10) ? (result.nmatch == 0 ) ? 0 : result.nmatch -1 : 10; tct = new_convert_table(size, standardescape); for (i=0;i= 48 && (gint)*tmp1 <= 57) { gint num = (gint)*tmp1 - 48; tmpstr1 = newstring; tmpstr2 = g_strndup(&replace_pattern[from], to-from); DEBUG_MSG("reg_replace, from=%d, to=%d, tmpstr2='%s'\n", from, to, tmpstr2); if (result.nmatch >= num+1) { DEBUG_MSG("reg_replace, wanted: sub search_pattern %d, offset=%d, so=%d, eo=%d\n", num, offset, result.pmatch[num+1].rm_so, result.pmatch[num+1].rm_eo); tmpstr3 = doc_get_chars(doc, offset+result.pmatch[num+1].rm_so, offset+result.pmatch[num+1].rm_eo); DEBUG_MSG("reg_replace, subsearch_pattern %d = '%s'\n", num, tmpstr3); } else { DEBUG_MSG("reg_replace, subsearch_pattern %d does not exist, nmatch=%d\n", num, result.nmatch); tmpstr3 = g_strdup(""); } newstring = g_strconcat(tmpstr1, tmpstr2, tmpstr3, NULL); g_free(tmpstr1); g_free(tmpstr2); g_free(tmpstr3); to += 2; from = to; DEBUG_MSG("reg_replace, substituted subsearch_pattern, newstring='%s'\n", newstring); } else { to += 2; } escaped = 0; } else { if (*tmp1 == '\\') { escaped = 1; } else { to++; } } tmp1++; } tmpstr1 = newstring; tmpstr2 = g_strndup(&replace_pattern[from], to-from); newstring = g_strconcat(tmpstr1, tmpstr2, NULL); g_free(tmpstr1); g_free(tmpstr2); DEBUG_MSG("reg_replace, end, newstring='%s'\n", newstring); return newstring; }*/ /** * replace_backend: * @bfwin: #Tbfwin with the window from this/these documents * @search_pattern: #gchar* to search pattern * @matchtype: See #Tmatch_types * @is_case_sens: #gint * @buf: #ghar* to buffer * @replace_pattern: The replace pattern. * @doc: the #Tdocument * @offset: The difference between the buffer and the text widget because of previous replace actions, so the first char in buf is actually number offset in the text widget. * @replacetype: see #Treplace_types * @replacelen: #gint*, set to -1 to calculate this automatically. * * This will perform a search and the actual replacement of data in the buffer. * Note that *buf is probably an offset in the documents buffer. * * Return value: #Tsearch_result **/ Tsearch_result replace_backend(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens , gchar *buf, guint byte_offset, gchar *replace_pattern, Tdocument *doc, gint offset, Treplace_types replacetype , gint *replacelen, gboolean unescape) { /* the offset in this function is the difference between the buffer and the text widget because of previous replace actions, so the first char in buf is actually number offset in the text widget */ /* replacelen -1 means there is no replacelen known yet, so we have to calculate it */ Tsearch_result result; gchar *tmpstr=NULL, *realpat; if (unescape) { realpat = unescape_string(search_pattern,FALSE); DEBUG_MSG("replace_backend, realpat='%s'\n",realpat); } else { realpat = search_pattern; } result = search_backend(bfwin,realpat, matchtype, is_case_sens, buf, byte_offset, (matchtype != match_normal)); if (unescape) { DEBUG_MSG("replace_backend, free-ing realpat\n"); g_free(realpat); } DEBUG_MSG("replace_backend, offset=%d, result.start=%d, result.end=%d\n", offset, result.start, result.end); if (result.end > 0) { switch (replacetype) { case string: if (matchtype == match_normal) { if (unescape) { DEBUG_MSG("replace_backend, replace_pattern='%s'\n",replace_pattern); tmpstr = unescape_string(replace_pattern, FALSE); } else { tmpstr = g_strdup(replace_pattern); } } else { tmpstr = reg_replace(replace_pattern, offset, result, doc, unescape); } DEBUG_MSG("replace_backend, tmpstr='%s'\n", tmpstr); break; case uppercase: tmpstr = g_strndup(&buf[result.bstart], result.bend - result.bstart); tmpstr = g_utf8_strup(tmpstr,-1); break; case lowercase: tmpstr = g_strndup(&buf[result.bstart], result.bend - result.bstart); tmpstr = g_utf8_strdown(tmpstr,-1); break; } DEBUG_MSG("replace_backend, len=%d, offset=%d, start=%d, end=%d, document=%p, tmpstr='%s'\n", result.end - result.start, offset, result.start + offset, result.end + offset, doc,tmpstr); doc_replace_text_backend(doc, tmpstr, result.start + offset, result.end + offset); if (*replacelen == -1) { *replacelen = g_utf8_strlen(tmpstr, -1); } g_free(tmpstr); } if (matchtype == match_posix) { g_free(result.pmatch); result.pmatch = NULL; } return result; } /*****************************************************/ /** * replace_doc_once: * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: #gint * @startpos: #gint offset in document. * @endpos: #gint where to stop replacing. Set to -1 to cover the entire buffer. * @replace_pattern: #gchar* to replace pattern * @doc: a #Tdocument* to work on * @replacetype: see #Treplace_types * * Performs a single replace with the selected parameters, by calling replace_backend(). * Calls doc_unre_new_group(doc) to make this action undoable. * Updates the internal last_snr2 struct, but the _caller_ is responsible for honouring this data. * * Return value: #Tsearch_result **/ Tsearch_result replace_doc_once(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gint startpos, gint endpos, gchar *replace_pattern, Tdocument *doc, Treplace_types replacetype, gboolean unescape) { /* endpos -1 means do till end */ gchar *fulltext; gint replacelen = 0; /* replacelen -1 means there is no replacelen known yet , but we don't need one, so we set it to 0 */ Tsearch_result result; doc_unre_new_group(doc); fulltext = doc_get_chars(doc, startpos, endpos); result = replace_backend(bfwin,search_pattern, matchtype, is_case_sens, fulltext, 0, replace_pattern, doc, startpos, replacetype, &replacelen, unescape); if ( result.end > 0) { LASTSNR2(bfwin->snr2)->result.start = result.start + startpos; LASTSNR2(bfwin->snr2)->result.end = result.end + startpos; LASTSNR2(bfwin->snr2)->doc = doc; } else { LASTSNR2(bfwin->snr2)->result.start = -1; LASTSNR2(bfwin->snr2)->result.end = -1; LASTSNR2(bfwin->snr2)->doc = doc; } g_free(fulltext); doc_unre_new_group(doc); return result; } /*****************************************************/ /** * replace_doc_multiple: * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: #gint * @endpos: #gint where to stop replacing. Set to -1 to cover the entire buffer. * @replace_pattern: #gchar* to replace pattern * @doc: a #Tdocument* to work on * @replacetype: see #Treplace_types * * Performs a replace on all occurences of the pattern in the supplied document. * The doc's buffer will be modified. * * last_snr2 is reset with .start = .end = -1, and .doc = doc. * * Return value: void **/ void replace_doc_multiple(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gint startpos, gint endpos, gchar *replace_pattern, Tdocument *doc, Treplace_types replacetype, gboolean unescape) { /* endpos -1 means do till end */ gchar *fulltext, *realpats, *realpatr; gboolean realunesc; Tsearch_result result; gint buf_byte_offset=0; gint buf_text_offset=startpos; gint replacelen; /* replacelen -1 means there is no replacelen known yet */ doc_unre_new_group(doc); DEBUG_MSG("replace_doc_multiple, startpos=%d, endpos=%d\n", startpos, endpos); if (matchtype == match_normal || replacetype != string) { /* the replace string has a fixed length if it is not regex, or it is not type string in this case we can also do the unescaping in this function */ if (unescape) { realpats = unescape_string(search_pattern, FALSE); realpatr = unescape_string(replace_pattern, FALSE); DEBUG_MSG("replace_doc_multiple, unescaped patterns, realpats='%s', realpatr='%s'\n",realpats, realpatr); } else { realpats = search_pattern; realpatr = replace_pattern; } replacelen = g_utf8_strlen(realpatr,-1); realunesc = FALSE; } else { replacelen=-1; realpats = search_pattern; realpatr = replace_pattern; realunesc = unescape; } fulltext = doc_get_chars(doc, startpos, endpos); result = replace_backend(bfwin,realpats, matchtype, is_case_sens, fulltext, 0, realpatr, doc, buf_text_offset, replacetype, &replacelen, realunesc); while (result.end > 0) { if (replacetype == string) { buf_text_offset += replacelen - (result.end - result.start); } if (LASTSNR2(bfwin->snr2)->overlapping_search) { buf_byte_offset = result.bstart + 1; /* buf_text_offset += result.start + 1; */ } else { buf_byte_offset = result.bend; /* buf_text_offset += result.end; */ } DEBUG_MSG("replace_doc_multiple, after first search, buf_text_offset=%d, buf_byte_offset=%d\n", buf_text_offset, buf_byte_offset); if (matchtype != match_normal && replacetype == string) { /* all regex replaces can have different replace lengths, so they have to be re-calculated */ replacelen = -1; } result = replace_backend(bfwin,realpats, matchtype, is_case_sens, fulltext, buf_byte_offset, realpatr, doc, buf_text_offset, replacetype, &replacelen, realunesc); DEBUG_MSG("replace_doc_multiple, 1- buf_text_offset=%d, buf_byte_offset=%d, result.start=%d, result.end=%d\n", buf_text_offset, buf_byte_offset, result.start, result.end); } if (unescape && (matchtype == match_normal || replacetype != string)) { DEBUG_MSG("replace_doc_multiple, free-ing realpats and realpatr\n"); g_free(realpats); g_free(realpatr); } doc_unre_new_group(doc); LASTSNR2(bfwin->snr2)->result.start = -1; LASTSNR2(bfwin->snr2)->result.end = -1; LASTSNR2(bfwin->snr2)->doc = doc; g_free(fulltext); } /*****************************************************/ /** * replace_all: * @bfwin: #Tbfwin* the window with the documents to act upon * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: #gint * @replace_pattern: #gchar* to replace pattern * @replacetype: see #Treplace_types * * Perform a replace_doc_multiple() with supplied data on all open documents. * This will replace all occurences of search_pattern in all documents. * * Return value: void **/ void replace_all(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gchar *replace_pattern, Treplace_types replacetype, gboolean unescape) { GList *tmplist; tmplist = g_list_first(bfwin->documentlist); while (tmplist) { replace_doc_multiple(bfwin,search_pattern, matchtype, is_case_sens, 0, -1, replace_pattern, (Tdocument *)tmplist->data, replacetype, unescape); tmplist = g_list_next(tmplist); } } /*****************************************************/ /* Replace prompt callbacks */ /*****************************************************/ /* * * Performs the actual replace-surgery by calls to doc_replace_text_backend() ! * Continues the replace cycle by calling snr2_run(), unless this is a single replace. * */ static void replace_prompt_dialog_ok_lcb(GtkWidget *widget, Tbfwin *bfwin) { gchar *tmpstr; gint sel_start_pos, sel_end_pos; window_close_by_widget_cb(widget, NULL); doc_get_selection(bfwin->current_document, &sel_start_pos, &sel_end_pos); if ((sel_start_pos == LASTSNR2(bfwin->snr2)->result.start) && (sel_end_pos == LASTSNR2(bfwin->snr2)->result.end)) { gint lenadded; if (LASTSNR2(bfwin->snr2)->replacetype_option==string) { tmpstr = g_strdup(LASTSNR2(bfwin->snr2)->replace_pattern); /* if it was a regex replace we need to do the sub-search_pattern matching */ tmpstr = reg_replace(tmpstr, 0, LASTSNR2(bfwin->snr2)->result, bfwin->current_document, LASTSNR2(bfwin->snr2)->unescape); } else if (LASTSNR2(bfwin->snr2)->replacetype_option==uppercase) { tmpstr = doc_get_chars(bfwin->current_document, LASTSNR2(bfwin->snr2)->result.start ,LASTSNR2(bfwin->snr2)->result.end); tmpstr = g_utf8_strup(tmpstr,-1); } else { tmpstr = doc_get_chars(bfwin->current_document, LASTSNR2(bfwin->snr2)->result.start ,LASTSNR2(bfwin->snr2)->result.end); tmpstr = g_utf8_strdown(tmpstr,-1); } /* avoid new highlighting at this stage, so call the backend directly instead of the frontend function this because the highlighting interferes with the selection the better solution is to have the highlighting handle the selection better, the problem starts in document.c in get_positions() because the selection is not saved there I don't know why the selection is gray, but that's basically the reason why it doesn't save the selection */ doc_unre_new_group(bfwin->current_document); doc_replace_text_backend(bfwin->current_document, tmpstr, LASTSNR2(bfwin->snr2)->result.start,LASTSNR2(bfwin->snr2)->result.end); doc_unre_new_group(bfwin->current_document); doc_set_modified(bfwin->current_document, 1); lenadded = strlen(tmpstr) - (LASTSNR2(bfwin->snr2)->result.end - LASTSNR2(bfwin->snr2)->result.start); DEBUG_MSG("lenadded=%d (streln=%d, end-start=%d)\n",lenadded,strlen(tmpstr),(LASTSNR2(bfwin->snr2)->result.end - LASTSNR2(bfwin->snr2)->result.start)); g_free(tmpstr); if (LASTSNR2(bfwin->snr2)->result.pmatch) { g_free(LASTSNR2(bfwin->snr2)->result.pmatch); LASTSNR2(bfwin->snr2)->result.pmatch = NULL; } if (!LASTSNR2(bfwin->snr2)->replace_once) { if (!LASTSNR2(bfwin->snr2)->overlapping_search && lenadded > 0) { LASTSNR2(bfwin->snr2)->result.end += lenadded; } snr2_run(bfwin,NULL); } } #ifdef DEBUG else { DEBUG_MSG("replace_prompt_dialog_ok_lcb, selection != result, not replacing!!\n"); } #endif /* DEBUG */ } static void replace_prompt_dialog_skip_lcb(GtkWidget *widget, Tbfwin *bfwin) { window_close_by_widget_cb(widget, NULL); if (LASTSNR2(bfwin->snr2)->result.pmatch) { g_free(LASTSNR2(bfwin->snr2)->result.pmatch); LASTSNR2(bfwin->snr2)->result.pmatch = NULL; } if (!LASTSNR2(bfwin->snr2)->replace_once) { snr2_run(bfwin,NULL); } } /* Alters last_snr2, setting no-prompt-mode, backtracking one step on the startpoint and .end = .start * continues by running snr2_run(). This will replace all occurrences of the string.. */ static void replace_prompt_dialog_all_lcb(GtkWidget *widget, Tbfwin *bfwin) { window_close_by_widget_cb(widget, NULL); LASTSNR2(bfwin->snr2)->prompt_before_replace = 0; LASTSNR2(bfwin->snr2)->result.start--; LASTSNR2(bfwin->snr2)->result.end = LASTSNR2(bfwin->snr2)->result.start; if (LASTSNR2(bfwin->snr2)->result.pmatch) { g_free(LASTSNR2(bfwin->snr2)->result.pmatch); LASTSNR2(bfwin->snr2)->result.pmatch = NULL; } snr2_run(bfwin,NULL); } /** * replace_prompt_dialog: * * Prompt the user for a replace action. Simply creates and shows GUI. * Used by replace_prompt_doc(). * * Return value: void **/ void replace_prompt_dialog(Tbfwin *bfwin) { GtkWidget *win, *vbox, *hbox; GtkWidget *butok, *butclose, *butall, *butskip; GtkWidget *image, *label; DEBUG_MSG("replace_prompt_dialog, start\n"); win = window_full(_("Confirm replace"), GTK_WIN_POS_MOUSE, 12, G_CALLBACK(window_close_by_widget_cb), NULL, TRUE); gtk_window_set_resizable (GTK_WINDOW (win), FALSE); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (win), vbox); hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); image = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0); label = gtk_label_new (_("Replace selected text?")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, TRUE, 12); hbox = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (hbox), 6); butclose = bf_gtkstock_button(GTK_STOCK_CLOSE, G_CALLBACK(window_close_by_widget_cb), NULL); butskip = bf_allbuttons_backend(_("_Skip"), TRUE, 1000, G_CALLBACK(replace_prompt_dialog_skip_lcb), bfwin); butok = bf_allbuttons_backend(_("_Replace"), TRUE, 1001, G_CALLBACK(replace_prompt_dialog_ok_lcb), bfwin); butall = bf_generic_mnemonic_button(_("Replace _all"), G_CALLBACK(replace_prompt_dialog_all_lcb), bfwin); gtk_box_pack_start(GTK_BOX(hbox), butclose, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), butall, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), butok, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), butskip, FALSE, FALSE, 0); gtk_widget_grab_focus(butskip); gtk_widget_show_all(win); DEBUG_MSG("replace_prompt_dialog, end\n"); } /** * replace_prompt_doc: * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: #gint * @startpos: Start offset in document buffer. * @endpos: End offset of search area. Set to -1 to cover entire buffer. * @replace_pattern: #gchar to replace pattern * @doc: a #Tdocument * * Finds the next occurence of search_pattern in *doc, shows and selects it in the document, * and finally shows a replace_prompt_dialog to the user. * * last_snr2 is updated if an occurrence of search_pattern is found. * * Return value: #gint, 1 if a new occurence of the search_pattern was found and a dialog is shown. 0 else. **/ gint replace_prompt_doc(Tbfwin *bfwin, gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gint startpos, gint endpos, gchar *replace_pattern, Tdocument *doc, gboolean unescape) { /* endpos -1 means do till end , returns if the document still had a match*/ gchar *fulltext, *realpat; Tsearch_result result; DEBUG_MSG("replace_prompt_doc, doc=%p, startpos=%d, endpos=%d\n",doc,startpos,endpos); if (LASTSNR2(bfwin->snr2)->result.pmatch) { g_free(LASTSNR2(bfwin->snr2)->result.pmatch); LASTSNR2(bfwin->snr2)->result.pmatch = NULL; } fulltext = doc_get_chars(doc, startpos, endpos); utf8_offset_cache_reset(); if (unescape) { realpat = unescape_string(search_pattern, FALSE); } else { realpat = search_pattern; } result = search_backend(bfwin,realpat, matchtype, is_case_sens, fulltext,0, 1); if (unescape) { g_free(realpat); } LASTSNR2(bfwin->snr2)->doc = doc; g_free(fulltext); DEBUG_MSG("replace_prompt_doc, doc=%p, result.end=%d\n", doc, result.end); if (result.end > 0) { gint i; LASTSNR2(bfwin->snr2)->result.start = result.start + startpos; LASTSNR2(bfwin->snr2)->result.end = result.end + startpos; LASTSNR2(bfwin->snr2)->result.nmatch = result.nmatch; LASTSNR2(bfwin->snr2)->result.pmatch = result.pmatch; for (i=0;isnr2)->result.pmatch[i].rm_so += startpos; LASTSNR2(bfwin->snr2)->result.pmatch[i].rm_eo += startpos; } doc_show_result(doc, result.start + startpos, result.end + startpos); replace_prompt_dialog(bfwin); return 1; } else { g_free(result.pmatch); return 0; } } /** * replace_prompt_all: * @search_pattern: #gchar* to search pattern * @matchtype: see #Tmatch_types * @is_case_sens: #gint * @replace_pattern: #gchar to replace pattern * * Performs a replace_prompt_doc for all open documents. * * Return value: void **/ void replace_prompt_all(Tbfwin *bfwin,gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gchar *replace_pattern, gboolean unescape) { GList *tmplist; gint retvalue; Tdocument *tmpdoc; if (LASTSNR2(bfwin->snr2)->doc) { tmpdoc = LASTSNR2(bfwin->snr2)->doc; } else { tmplist = g_list_first(bfwin->documentlist); tmpdoc = (Tdocument *)tmplist->data; } DEBUG_MSG("replace_prompt_all, starting with tmpdoc=%p at position %d\n",tmpdoc,LASTSNR2(bfwin->snr2)->result.end); retvalue = replace_prompt_doc(bfwin,search_pattern, matchtype, is_case_sens, (LASTSNR2(bfwin->snr2)->result.end < 0)?0:LASTSNR2(bfwin->snr2)->result.end, -1, replace_pattern, tmpdoc, unescape); while (retvalue == 0) { tmplist = g_list_find(bfwin->documentlist, LASTSNR2(bfwin->snr2)->doc); tmplist = g_list_next(tmplist); if (tmplist) { DEBUG_MSG("replace_prompt_all, next document is %p\n",tmplist->data); retvalue = replace_prompt_doc(bfwin,search_pattern, matchtype, is_case_sens, 0, -1, replace_pattern, (Tdocument *)tmplist->data, unescape); } else { retvalue = 1; } } } static void search_doc_bookmark_backend(Tbfwin *bfwin,Tdocument *document, gchar *search_pattern, Tmatch_types matchtype, gint is_case_sens, gint startpos, gboolean unescape) { gchar *fulltext, *realpat; gint buf_byte_offset=0; Tsearch_result result; fulltext = doc_get_chars(document, 0, -1); utf8_offset_cache_reset(); if (unescape) { realpat = unescape_string(search_pattern, FALSE); } else { realpat = search_pattern; } result = search_backend(bfwin,realpat, matchtype, is_case_sens, fulltext, 0, FALSE); while (result.end > 0) { gchar *text = doc_get_chars(document, result.start, result.end); DEBUG_MSG("search_bookmark, adding bookmark '%s' at %d\n", text, result.start); bmark_add_extern(document, result.start, NULL, text, !main_v->props.bookmarks_default_store); g_free(text); if (LASTSNR2(bfwin->snr2)->overlapping_search) { buf_byte_offset = result.bstart + 1; } else { buf_byte_offset = result.bend; } result = search_backend(bfwin,realpat, matchtype, is_case_sens, fulltext, buf_byte_offset, FALSE); } if (unescape) { g_free(realpat); } g_free(fulltext); } /** * search_bookmark: * @bfwin: #Tbfwin * * @startat: #gint * * will search, and bookmark all matches * */ static void search_bookmark(Tbfwin *bfwin, gint startat) { DEBUG_MSG("search_bookmark, started\n"); if (LASTSNR2(bfwin->snr2)->placetype_option==opened_files) { GList *tmplist = g_list_first(bfwin->documentlist); while (tmplist) { search_doc_bookmark_backend(bfwin,DOCUMENT(tmplist->data), LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, 0, LASTSNR2(bfwin->snr2)->unescape); tmplist = g_list_next(tmplist); } } else { search_doc_bookmark_backend(bfwin,DOCUMENT(bfwin->current_document), LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, startat, LASTSNR2(bfwin->snr2)->unescape); } DEBUG_MSG("search_bookmark, done\n"); } /*****************************************************/ /** * snr2_run: * @bfwin: #Tbfwin* * @doc: a #Tdocument* If set to NULL, use bfwin->current_document * * Continues a search or replace action as specified by the last_snr2 struct. * * Return value: void **/ void snr2_run(Tbfwin *bfwin, Tdocument *doc) { gint startpos, endpos; Tsearch_result result; Tsearch_all_result result_all; Treplace_types replacetype; if (doc==NULL) { doc = bfwin->current_document; } if (LASTSNR2(bfwin->snr2)->result.pmatch) { g_free(LASTSNR2(bfwin->snr2)->result.pmatch); LASTSNR2(bfwin->snr2)->result.pmatch = NULL; } /* should be more stuff here */ if (LASTSNR2(bfwin->snr2)->placetype_option==beginning) { startpos = 0; endpos = -1; } else if (LASTSNR2(bfwin->snr2)->placetype_option==cursor) { startpos = doc_get_cursor_position(doc); endpos = -1; } else if (LASTSNR2(bfwin->snr2)->placetype_option==selection) { if (!doc_get_selection(doc,&startpos,&endpos)) { /* what to do if there was no selection ?*/ DEBUG_MSG("snr2_run, no selection found, returning\n"); return; } DEBUG_MSG("snr2_run, from selection: startpos=%d, endpos=%d\n", startpos, endpos); } if (LASTSNR2(bfwin->snr2)->doc == doc) { if (LASTSNR2(bfwin->snr2)->result.end > 0) { if (LASTSNR2(bfwin->snr2)->overlapping_search) { startpos = LASTSNR2(bfwin->snr2)->result.start + 1; } else { startpos = LASTSNR2(bfwin->snr2)->result.end; } } DEBUG_MSG("snr2_run, LASTSNR2(bfwin->snr2)->result.end=%d, startpos=%d\n", LASTSNR2(bfwin->snr2)->result.end, startpos); } if (LASTSNR2(bfwin->snr2)->replace) { if (LASTSNR2(bfwin->snr2)->replacetype_option==string) { replacetype = string; } else if (LASTSNR2(bfwin->snr2)->replacetype_option==uppercase) { replacetype = uppercase; } else { replacetype = lowercase; } if (LASTSNR2(bfwin->snr2)->prompt_before_replace) { if (LASTSNR2(bfwin->snr2)->placetype_option==opened_files) { replace_prompt_all(bfwin,LASTSNR2(bfwin->snr2)->search_pattern,LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, LASTSNR2(bfwin->snr2)->replace_pattern, LASTSNR2(bfwin->snr2)->unescape); } else { replace_prompt_doc(bfwin,LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, startpos, endpos, LASTSNR2(bfwin->snr2)->replace_pattern, doc, LASTSNR2(bfwin->snr2)->unescape); } } else { if (LASTSNR2(bfwin->snr2)->placetype_option==opened_files) { replace_all(bfwin,LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, LASTSNR2(bfwin->snr2)->replace_pattern, replacetype, LASTSNR2(bfwin->snr2)->unescape); } else if (LASTSNR2(bfwin->snr2)->replace_once) { replace_doc_once(bfwin,LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, startpos, endpos, LASTSNR2(bfwin->snr2)->replace_pattern, doc, replacetype, LASTSNR2(bfwin->snr2)->unescape); } else { replace_doc_multiple(bfwin,LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, startpos, endpos, LASTSNR2(bfwin->snr2)->replace_pattern, doc, replacetype, LASTSNR2(bfwin->snr2)->unescape); } } } else { /* find, not replace */ if (LASTSNR2(bfwin->snr2)->bookmark_results) { search_bookmark(bfwin, startpos); } else { if (LASTSNR2(bfwin->snr2)->placetype_option==opened_files) { DEBUG_MSG("snr2dialog_ok_lcb, search = all\n"); result_all = search_all(bfwin,LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, LASTSNR2(bfwin->snr2)->unescape); DEBUG_MSG("snr2dialog_ok_lcb, result_all.doc=%p\n",result_all.doc); if (result_all.end > 0) { doc_show_result(result_all.doc, result_all.start, result_all.end); } else { info_dialog(bfwin->main_window,_("Search: no match found"), NULL); } } else { result = search_doc(bfwin,doc, LASTSNR2(bfwin->snr2)->search_pattern, LASTSNR2(bfwin->snr2)->matchtype_option, LASTSNR2(bfwin->snr2)->is_case_sens, startpos, LASTSNR2(bfwin->snr2)->unescape); if (result.end > 0) { doc_show_result(doc, result.start, result.end); } else { info_dialog(bfwin->main_window,_("Search: no match found"), NULL); } } } } /* if highlighting is needed for this document do this now !! */ if (doc->need_highlighting && (doc->view_bars & VIEW_COLORIZED) ) { doc_highlight_full(doc); } } /** * snr2_run_extern_replace: * @doc: a #Tdocument * @search_pattern: #gchar* to search pattern * @region: #gint, 0 = region_from_beginning, 1 = region_from_cursor, 2 = region_selection, 3 = region_all_open_files * @matchtype: #gint, 0 = normal, 1 = posix, 2 = perl * @is_case_sens: #gint * @replace_pattern: #gchar* to replace pattern. * @store_as_last_snr2: Set to FALSE to keep the old last_snr2 after the snr has been completed. * * Performs the specified replace action on the document by setting * a last_snr2 and calling snr2_run(). * * Additional non-configureable arguments passed to snr2_run() via last_snr2: * replace = 1 * prompt_before_replace = off * replace_once = off * * Return value: void **/ void snr2_run_extern_replace(Tdocument *doc, gchar *search_pattern, gint region, gint matchtype, gint is_case_sens, gchar *replace_pattern, gboolean store_as_last_snr2) { Tbfwin *bfwin = BFWIN(doc->bfwin); gchar *search_pattern_bck, *replace_pattern_bck; Tlast_snr2 last_snr2_bck; search_pattern_bck = LASTSNR2(bfwin->snr2)->search_pattern; replace_pattern_bck = LASTSNR2(bfwin->snr2)->replace_pattern; last_snr2_bck = *LASTSNR2(bfwin->snr2); DEBUG_MSG("snr2..extern..: last_snr2_bck.search_pattern=%p, replace_pattern=%p\n" ,last_snr2_bck.search_pattern, last_snr2_bck.replace_pattern); if (!search_pattern || !replace_pattern || !strlen(search_pattern)) { DEBUG_MSG("snr2_run_extern, returning, non-valid arguments\n"); return; } DEBUG_MSG("snr2..extern..: doc=%p, search_pattern='%s', region=%d, matchtype=%d, is_case_sens=%d, replace_pattern=%s, store_as_last=%d\n" ,doc,search_pattern,region,matchtype,is_case_sens,replace_pattern,store_as_last_snr2); LASTSNR2(bfwin->snr2)->search_pattern = g_strdup(search_pattern); LASTSNR2(bfwin->snr2)->placetype_option = region; LASTSNR2(bfwin->snr2)->is_case_sens = is_case_sens; LASTSNR2(bfwin->snr2)->overlapping_search = 0; LASTSNR2(bfwin->snr2)->replace = 1; LASTSNR2(bfwin->snr2)->replace_pattern = g_strdup(replace_pattern); LASTSNR2(bfwin->snr2)->prompt_before_replace = 0; LASTSNR2(bfwin->snr2)->replace_once = 0; LASTSNR2(bfwin->snr2)->unescape = 0; LASTSNR2(bfwin->snr2)->matchtype_option = matchtype; LASTSNR2(bfwin->snr2)->replacetype_option = string; LASTSNR2(bfwin->snr2)->bookmark_results = 0; snr2_run(BFWIN(doc->bfwin),doc); if (store_as_last_snr2) { DEBUG_MSG("free-ing old patterns at %p and %p\n",search_pattern_bck,replace_pattern_bck); g_free(search_pattern_bck); g_free(replace_pattern_bck); } else { g_free(LASTSNR2(bfwin->snr2)->search_pattern); g_free(LASTSNR2(bfwin->snr2)->replace_pattern); *LASTSNR2(bfwin->snr2) = last_snr2_bck; } } /** * doc_search_run_extern: * @doc: a #Tdocument * @search_pattern: #gchar search pattern * @matchtype: #gint, 0 = normal, 1 = posix, 2 = perl * @is_case_sens: #gint, case sensitive pattern? * * Frontend for search_doc, calling it with supplied arguments and startpos = 0. * * Return value: #Tsearch_result_doc **/ Tsearch_result doc_search_run_extern(Tdocument *doc, gchar *search_pattern, gint matchtype, gint is_case_sens) { return search_doc(BFWIN(doc->bfwin),doc, search_pattern, matchtype, is_case_sens, 0, FALSE); } /******************************************************/ /* Search and replace dialogs callbacks */ /******************************************************/ static void snr2dialog_destroy_lcb(GtkWidget *widget, gpointer data) { DEBUG_MSG("snr2dialog_destroy_lcb, started, about to call window_destroy\n"); window_destroy(((Tsnr2_win *)data)->window); DEBUG_MSG("snr2dialog_destroy_lcb, about to free data %p\n", data); g_free(data); DEBUG_MSG("snr2dialog_destroy_lcb, done\n"); } static void snr2dialog_cancel_lcb(GtkWidget *widget, gpointer data) { snr2dialog_destroy_lcb(NULL, data); } /*****************************************************/ /* * Sets the last_snr2 as specified by the user and calls snr2_run(NULL) (aka, run on current document) */ static void snr2dialog_ok_lcb(GtkWidget *widget, Tsnr2_win *data) { /*GtkTextIter itstart, itend; GtkTextBuffer *buf;*/ Tbfwin *bfwin = data->bfwin; if (LASTSNR2(bfwin->snr2)->search_pattern) { g_free(LASTSNR2(bfwin->snr2)->search_pattern); LASTSNR2(bfwin->snr2)->search_pattern = NULL; } if (LASTSNR2(bfwin->snr2)->replace_pattern) { g_free(LASTSNR2(bfwin->snr2)->replace_pattern); LASTSNR2(bfwin->snr2)->replace_pattern = NULL; } /*buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->search_entry)); gtk_text_buffer_get_bounds(buf,&itstart,&itend); LASTSNR2(bfwin->snr2)->search_pattern = gtk_text_buffer_get_text(buf,&itstart,&itend, FALSE);*/ LASTSNR2(bfwin->snr2)->search_pattern = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(data->search_combo)->entry),0,-1); data->bfwin->session->searchlist = add_to_history_stringlist(data->bfwin->session->searchlist,LASTSNR2(bfwin->snr2)->search_pattern,TRUE,TRUE); LASTSNR2(bfwin->snr2)->unescape = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->unescape)); LASTSNR2(bfwin->snr2)->is_case_sens = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->is_case_sens)); LASTSNR2(bfwin->snr2)->overlapping_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->overlapping_search)); if (data->replace) { /*GtkTextIter itstart, itend; GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->replace_entry)); gtk_text_buffer_get_bounds(buf,&itstart,&itend); LASTSNR2(bfwin->snr2)->replace_pattern = gtk_text_buffer_get_text(buf,&itstart,&itend, FALSE);*/ LASTSNR2(bfwin->snr2)->replace = 1; LASTSNR2(bfwin->snr2)->replace_pattern = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(data->replace_combo)->entry),0,-1); data->bfwin->session->replacelist = add_to_history_stringlist(data->bfwin->session->replacelist,LASTSNR2(bfwin->snr2)->replace_pattern,TRUE,TRUE); LASTSNR2(bfwin->snr2)->prompt_before_replace = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->prompt_before_replace)); LASTSNR2(bfwin->snr2)->replace_once = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->replace_once)); } else { LASTSNR2(bfwin->snr2)->replace = 0; LASTSNR2(bfwin->snr2)->bookmark_results = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->bookmark_results)); } window_destroy(data->window); g_free(data); snr2_run(bfwin,NULL); } static void placetype_changed_lcb(GtkWidget *widget, Tsnr2_win *snr2win) { LASTSNR2(snr2win->bfwin->snr2)->placetype_option = gtk_option_menu_get_history((GtkOptionMenu *) snr2win->placetype_option); DEBUG_MSG("placetype_changed_lcb, changing option to %d\n", LASTSNR2(snr2win->bfwin->snr2)->placetype_option); } static void matchtype_changed_lcb(GtkWidget *widget, Tsnr2_win *snr2win) { LASTSNR2(snr2win->bfwin->snr2)->matchtype_option = gtk_option_menu_get_history((GtkOptionMenu *) snr2win->matchtype_option); if (snr2win->replace) { if (LASTSNR2(snr2win->bfwin->snr2)->matchtype_option==0) { gtk_widget_hide(snr2win->subpat_help); } else { gtk_widget_show(snr2win->subpat_help); } } DEBUG_MSG("matchtype_changed_lcb, changing option to %d\n", LASTSNR2(snr2win->bfwin->snr2)->matchtype_option); } static void replacetype_changed_lcb(GtkWidget *widget, Tsnr2_win *snr2win) { LASTSNR2(snr2win->bfwin->snr2)->replacetype_option = gtk_option_menu_get_history((GtkOptionMenu *) snr2win->replacetype_option); /*gtk_widget_set_sensitive(snr2win->replace_entry, LASTSNR2(snr2win->bfwin->snr2)->replacetype_option==0);*/ gtk_widget_set_sensitive(snr2win->replace_combo, LASTSNR2(snr2win->bfwin->snr2)->replacetype_option==0); DEBUG_MSG("replacetype_changed_lcb, changing option to %d\n", LASTSNR2(snr2win->bfwin->snr2)->replacetype_option); } /* static gboolean search_entry_key_press_event_lcb(GtkWidget *widget,GdkEventKey *event,Tsnr2_win *snr2win) { if ((event->state & GDK_CONTROL_MASK) && (event->keyval == GDK_Return)) { snr2dialog_ok_lcb(NULL, snr2win); return TRUE; } return FALSE; }*/ static void snr2dialog(Tbfwin *bfwin, gint is_replace, gint is_new_search) { Tsnr2_win *snr2win; GtkWidget *vbox, *hbox, *button, *table; const gchar *tmptext; gchar *buffer; GtkTextIter start, end; snr2win = g_malloc(sizeof(Tsnr2_win)); snr2win->bfwin = bfwin; if (is_replace) { tmptext = _("Replace"); snr2win->replace = 1; } else { tmptext = _("Find"); snr2win->replace = 0; } if (is_new_search) { reset_last_snr2(bfwin); } else { LASTSNR2(bfwin->snr2)->result.start = -1; LASTSNR2(bfwin->snr2)->result.end = -1; LASTSNR2(bfwin->snr2)->doc = NULL; } snr2win->window = window_full(tmptext, GTK_WIN_POS_MOUSE, 12, G_CALLBACK(snr2dialog_destroy_lcb), snr2win, TRUE); gtk_window_set_role(GTK_WINDOW(snr2win->window), "snr"); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(snr2win->window), vbox); if (is_replace) { table = gtk_table_new (2, 2, FALSE); } else { table = gtk_table_new (1, 2, FALSE); } gtk_widget_show (table); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table), 12); gtk_table_set_col_spacings (GTK_TABLE (table), 6); snr2win->search_label = gtk_label_new_with_mnemonic(_("_Search for: ")); gtk_table_attach (GTK_TABLE (table), snr2win->search_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 2, 0); gtk_label_set_justify (GTK_LABEL (snr2win->search_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (snr2win->search_label), 0, 0.5); /*snr2win->search_scrollbox = textview_buffer_in_scrolwin(&snr2win->search_entry, 300, 50, LASTSNR2(bfwin->snr2)->search_pattern, GTK_WRAP_NONE);*/ gtk_text_buffer_get_selection_bounds(bfwin->current_document->buffer, &start, &end); buffer = gtk_text_buffer_get_text(bfwin->current_document->buffer, &start, &end, FALSE); if (strchr(buffer,'\n')!=NULL) { /* a newline in the selection, we probably don't want this string as search string */ g_free(buffer); buffer = NULL; } /* put the selected text in the search|find textfield */ snr2win->search_combo = combo_with_popdown(buffer ? buffer : "", bfwin->session->searchlist, TRUE); if (buffer) g_free(buffer); /* TODO: should we free this variable ? */ /* snr2win->search_combo = combo_with_popdown("", bfwin->session->searchlist, TRUE); */ gtk_table_attach (GTK_TABLE (table), snr2win->search_combo, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); /*g_signal_connect(G_OBJECT(snr2win->search_entry), "key_press_event", G_CALLBACK(search_entry_key_press_event_lcb), snr2win);*/ if (is_replace) { snr2win->replace_label = gtk_label_new_with_mnemonic(_("_Replace with: ")); gtk_table_attach (GTK_TABLE (table), snr2win->replace_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 2, 0); gtk_label_set_justify (GTK_LABEL (snr2win->replace_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (snr2win->replace_label), 0, 0.5); /*snr2win->replace_scrollbox = textview_buffer_in_scrolwin(&snr2win->replace_entry, 300, 50, LASTSNR2(bfwin->snr2)->replace_pattern, GTK_WRAP_NONE);*/ snr2win->replace_combo = combo_with_popdown("", bfwin->session->replacelist, TRUE); gtk_table_attach (GTK_TABLE (table), snr2win->replace_combo, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); /*g_signal_connect(G_OBJECT(snr2win->replace_entry), "key_press_event", G_CALLBACK(search_entry_key_press_event_lcb), snr2win);*/ snr2win->subpat_help = gtk_label_new(_("\\0 refers to the first subsearch_pattern, \\1 to the second etc.")); gtk_box_pack_start(GTK_BOX(vbox), snr2win->subpat_help, FALSE, TRUE, 6); gtk_label_set_justify (GTK_LABEL (snr2win->subpat_help), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (snr2win->subpat_help), 1, 0.5); } if (is_replace) { table = gtk_table_new (3, 2, FALSE); } else { table = gtk_table_new (2, 2, FALSE); } gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 12); gtk_table_set_row_spacings (GTK_TABLE (table), 12); gtk_table_set_col_spacings (GTK_TABLE (table), 6); { gchar *placeactions[] = {N_("Beginning of document till end"), N_("Current position till end"), N_("Beginning of selection till end of selection"), N_("All opened files begin till end"), NULL}; gchar *matchactions[] = {N_("Disabled"), N_("POSIX type"), N_("PERL type"), NULL}; GtkWidget *matchlabel, *placelabel = gtk_label_new(_("Starts at:")); DEBUG_MSG("snr2dialog, LASTSNR2(bfwin->snr2)->placetype_option=%d\n", LASTSNR2(bfwin->snr2)->placetype_option); snr2win->placetype_option = optionmenu_with_value(placeactions, LASTSNR2(bfwin->snr2)->placetype_option); gtk_table_attach (GTK_TABLE (table), placelabel, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 2, 0); gtk_label_set_justify (GTK_LABEL (placelabel), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (placelabel), 0, 0.5); gtk_table_attach (GTK_TABLE (table), snr2win->placetype_option, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); g_signal_connect(G_OBJECT((GtkWidget *) snr2win->placetype_option), "changed", G_CALLBACK(placetype_changed_lcb), snr2win); matchlabel = gtk_label_new(_("Regular expression:")); DEBUG_MSG("snr2dialog, LASTSNR2(bfwin->snr2)->matchtype_option=%d\n", LASTSNR2(bfwin->snr2)->matchtype_option); snr2win->matchtype_option = optionmenu_with_value(matchactions, LASTSNR2(bfwin->snr2)->matchtype_option); gtk_table_attach (GTK_TABLE (table), matchlabel, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 2, 0); gtk_label_set_justify (GTK_LABEL (matchlabel), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (matchlabel), 0, 0.5); gtk_table_attach (GTK_TABLE (table), snr2win->matchtype_option, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); g_signal_connect(G_OBJECT((GtkWidget *) snr2win->matchtype_option), "changed", G_CALLBACK(matchtype_changed_lcb), snr2win); if (is_replace) { gchar *replaceactions[] = {N_("Normal"), N_("Uppercase"), N_("Lowercase"), NULL}; GtkWidget *replacelabel = gtk_label_new(_("Replace type:")); DEBUG_MSG("snr2dialog, LASTSNR2(bfwin->snr2)->replacetype_option=%d\n", LASTSNR2(bfwin->snr2)->replacetype_option); snr2win->replacetype_option = optionmenu_with_value(replaceactions, LASTSNR2(bfwin->snr2)->replacetype_option); gtk_table_attach (GTK_TABLE (table), replacelabel, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 2, 0); gtk_label_set_justify (GTK_LABEL (replacelabel), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (replacelabel), 0, 0.5); gtk_table_attach (GTK_TABLE (table), snr2win->replacetype_option, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); g_signal_connect(G_OBJECT((GtkWidget *) snr2win->replacetype_option), "changed", G_CALLBACK(replacetype_changed_lcb), snr2win); } } snr2win->unescape = boxed_checkbut_with_value(_("_Patterns contain backslash escape sequences (\\n, \\t)"), LASTSNR2(bfwin->snr2)->unescape, vbox); snr2win->is_case_sens = boxed_checkbut_with_value(_("_Match case"), LASTSNR2(bfwin->snr2)->is_case_sens, vbox); snr2win->overlapping_search = boxed_checkbut_with_value(_("O_verlap searches"), LASTSNR2(bfwin->snr2)->overlapping_search, vbox); if (is_replace) { snr2win->prompt_before_replace = boxed_checkbut_with_value(_("Prompt _before replace"), LASTSNR2(bfwin->snr2)->prompt_before_replace, vbox); snr2win->replace_once = boxed_checkbut_with_value(_("Replace o_nce"), LASTSNR2(bfwin->snr2)->replace_once, vbox); } else { snr2win->bookmark_results = boxed_checkbut_with_value(_("Bookmark results"), LASTSNR2(bfwin->snr2)->bookmark_results, vbox); } hbox = gtk_hseparator_new (); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 12); hbox = gtk_hbutton_box_new(); gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), bf_stock_cancel_button(G_CALLBACK(snr2dialog_cancel_lcb), snr2win), FALSE, TRUE, 0); button = bf_stock_ok_button(G_CALLBACK(snr2dialog_ok_lcb), snr2win); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); gtk_window_set_default(GTK_WINDOW(snr2win->window), button); gtk_label_set_mnemonic_widget(GTK_LABEL(snr2win->search_label), GTK_COMBO(snr2win->search_combo)->entry); if(is_replace) { gtk_label_set_mnemonic_widget(GTK_LABEL(snr2win->replace_label), GTK_COMBO(snr2win->replace_combo)->entry); } gtk_widget_grab_focus(snr2win->search_combo); gtk_widget_show_all(vbox); gtk_widget_show(snr2win->window); /* { GtkTextIter itstart, itend; gtk_text_buffer_get_bounds(gtk_text_view_get_buffer(GTK_TEXT_VIEW(snr2win->search_entry)),&itstart,&itend); gtk_text_buffer_move_mark_by_name(gtk_text_view_get_buffer(GTK_TEXT_VIEW(snr2win->search_entry)),"insert",&itstart); gtk_text_buffer_move_mark_by_name(gtk_text_view_get_buffer(GTK_TEXT_VIEW(snr2win->search_entry)),"selection_bound",&itend); }*/ if (is_replace) { matchtype_changed_lcb(NULL, snr2win); replacetype_changed_lcb(NULL, snr2win); } } /*****************************************************/ void search_from_selection(Tbfwin *bfwin) { gchar *string; GtkClipboard* cb; cb = gtk_clipboard_get(GDK_SELECTION_PRIMARY); string = gtk_clipboard_wait_for_text(cb); if (string) { if (LASTSNR2(bfwin->snr2)->search_pattern) { g_free(LASTSNR2(bfwin->snr2)->search_pattern); } if (LASTSNR2(bfwin->snr2)->replace_pattern) { g_free(LASTSNR2(bfwin->snr2)->replace_pattern); LASTSNR2(bfwin->snr2)->replace_pattern = NULL; } LASTSNR2(bfwin->snr2)->search_pattern = string; LASTSNR2(bfwin->snr2)->placetype_option = 0; LASTSNR2(bfwin->snr2)->is_case_sens = 1; LASTSNR2(bfwin->snr2)->overlapping_search = 0; LASTSNR2(bfwin->snr2)->replace = 0; LASTSNR2(bfwin->snr2)->matchtype_option = 0; snr2_run(bfwin,bfwin->current_document); } } /** * search_cb: * @widget: unused #GtkWidget* * @data: unused #gpointer * * Show the search-dialog. * * Return value: void **/ void search_cb(GtkWidget *widget, Tbfwin *bfwin) { snr2dialog(bfwin, 0, 0); } /** * search_again_cb: * @widget: unused #GtkWidget* * @data: unused #gpointer * * Repeat last search, if any. * * Return value: void **/ void search_again_cb(GtkWidget *widget, Tbfwin *bfwin) { snr2_run(bfwin,NULL); } /** * replace_again_cb: * @widget: unused #GtkWidget* * @data: unused #gpointer * * Repeat last replace, if any. * * Return value: void **/ void replace_again_cb(GtkWidget *widget, Tbfwin *bfwin) { snr2_run(bfwin,NULL); } /** * replace_cb: * @widget: unused #GtkWidget* * @data: unused #gpointer * * Show replace dialog. * * Return value: void **/ void replace_cb(GtkWidget *widget, Tbfwin *bfwin) { snr2dialog(bfwin, 1, 0); } /*****************************************************/ #ifdef NOTPORTEDYET static gint do_filename_curfile_replace(gchar *fulltext, Tsearch_result result, gint offset, gchar *olddirname, gchar *newfilename, gint changelen, Tdocument *doc) { /* returns the change in the lenght of the buffer compared to the actual document text */ gchar *possible_filename; gchar *olddirfile; gint len; gchar *replacestring; gint change_lenght = changelen; possible_filename = g_strndup(&fulltext[offset + result.bstart +1], result.bend - result.bstart -2 ); DEBUG_MSG("do_filename_change_replace, possible_filename=%s\n", possible_filename); len = strlen(possible_filename) + strlen(olddirname) + 2; olddirfile = strncat(strncat(strncpy(g_malloc(len), olddirname, len), "/", len), possible_filename, len); /* code to check if this is a file */ if (file_exists_and_readable(olddirfile)) { DEBUG_MSG("do_filename_change_replace, olddirfile=%s does exist!!\n", olddirfile); /* code to create replace_pattern */ olddirfile = most_efficient_filename(olddirfile); DEBUG_MSG("do_filename_change_replace, updated olddirfile=%s \n", olddirfile); replacestring = create_relative_link_to(newfilename, olddirfile); DEBUG_MSG("do_filename_change_replace, replacestring=%s, newfilename=%s\n", replacestring, newfilename); /* code to actual replace it */ doc_replace_text(doc, replacestring, result.start + offset + 1 + changelen, result.end + offset + changelen -1); change_lenght = strlen(replacestring) - strlen(possible_filename) + changelen; DEBUG_MSG("do_filename_change_replace, replacestring=%s, possible_filename=%s\n", replacestring, possible_filename); DEBUG_MSG("do_filename_change_replace, change_lenght=%d\n",change_lenght ); g_free(replacestring); } else { DEBUG_MSG("do_filename_change_replace, olddirfile=%s does NOT exist\n", olddirfile); } g_free(possible_filename); g_free(olddirfile); return change_lenght; } static gint do_filename_otherfile_replace(gchar *fulltext, Tsearch_result result, gint offset, gchar *oldfilename, gchar *newfilename, gint changelen, Tdocument *doc) { gchar *possible_filename, *replacestring, *foundstring; gint change_length = changelen; gchar *eff_my_filename; foundstring = g_strndup(&fulltext[offset + result.bstart +1], result.bend - result.bstart -2 ); possible_filename = most_efficient_filename(create_full_path(foundstring, doc->filename)); g_free(foundstring); DEBUG_MSG("do_filename_otherfile_replace, posname=%s\n", possible_filename); DEBUG_MSG("do_filename_otherfile_replace, newname=%s\n", oldfilename); if (strcmp(possible_filename, oldfilename) == 0) { eff_my_filename = most_efficient_filename(g_strdup(doc->filename)); replacestring = create_relative_link_to(eff_my_filename, newfilename); doc_replace_text(doc, replacestring, result.start + offset + 1 + changelen, result.end + offset + changelen -1); change_length = strlen(replacestring) - strlen(possible_filename) + changelen; g_free(eff_my_filename); g_free(replacestring); } g_free(possible_filename); return change_length; } /** * update_filenames_in_file: * @doc: a #Tdocument * @oldfilename: Filename to change from. * @newfilename: Filename to change to. * @doc_has_newfilename: If *doc (blabla?) * * * * Return value: void **/ void update_filenames_in_file(Tdocument *doc, gchar *oldfilename, gchar *newfilename, gint doc_has_newfilename) { gchar *fulltext; Tsearch_result result; gint cur_offset, changelen=0; gchar *search_pattern; Tmatch_types matchtype; gint is_case_sens; gchar *olddirname=NULL; if ((oldfilename == NULL)|| (newfilename == NULL)) { return; } search_pattern = "\"[^\"]+\""; matchtype = match_posix; is_case_sens = 0; cur_offset = 0; if (doc_has_newfilename) { olddirname = g_path_get_dirname(oldfilename); } fulltext = doc_get_chars(doc, 0, -1); utf8_offset_cache_reset(); result = search_backend(search_pattern, matchtype, is_case_sens, fulltext, 0); while (result.end > 0) { if (doc_has_newfilename) { changelen = do_filename_curfile_replace(fulltext, result, cur_offset, olddirname, newfilename, changelen, doc); } else { changelen = do_filename_otherfile_replace(fulltext, result, cur_offset, oldfilename, newfilename, changelen, doc); } cur_offset += result.bstart +1; result = search_backend(search_pattern, matchtype, is_case_sens, &fulltext[cur_offset], 0); } g_free(fulltext); if (doc_has_newfilename) { g_free(olddirname); } } #endif /* NOTPORTEDYET */ winefish-1.3.3/src/snr2.h0000600000047200004720000000424110373411041014147 0ustar kyanhkyanh/* $Id: snr2.h 1830 2006-02-11 16:34:41Z kyanh $ */ /* Winefish LaTeX Editor (based on Bluefish HTML Editor) * snr2.h - the search 'n replace rewrite prototypes * * Copyright (C) 2000-2002 Olivier Sessink * Modified for Winefish (C) 2005 Ky Anh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __SNR2_H_ #define __SNR2_H_ typedef struct { /* span of characters */ gint start; gint end; /* span of byte-data in buffer */ gint bstart; gint bend; /* these data are only used (and alloc'ed) if want_submatches is set in the search backend, they should be freed by the calling function! */ regmatch_t *pmatch; gint nmatch; } Tsearch_result; void snr2_init(Tbfwin *bfwin); void snr2_run_extern_replace(Tdocument *doc, gchar *search_pattern, gint region, gint matchtype, gint is_case_sens, gchar *replace_pattern, gboolean store_as_last_snr2); Tsearch_result doc_search_run_extern(Tdocument *doc, gchar *search_pattern, gint matchtype, gint is_case_sens); void search_from_selection(Tbfwin *bfwin); void search_cb(GtkWidget *widget, Tbfwin *bfwin); void replace_again_cb(GtkWidget *widget, Tbfwin *bfwin); void search_again_cb(GtkWidget *widget, Tbfwin *bfwin); void replace_cb(GtkWidget *widget, Tbfwin *bfwin); void update_filenames_in_file(Tdocument *doc, gchar *oldfilename, gchar *newfilename, gint doc_has_newfilename); /* kyanh, removed, 20050220 void update_encoding_meta_in_file(Tdocument *doc, gchar *encoding); */ void snr2_cleanup(Tbfwin *bfwin); #endif /* __SNR_H_ */ winefish-1.3.3/configure0000700000047200004720000101744510414700166014250 0ustar kyanhkyanh#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="src/winefish.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION ALL_LINGUAS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os CPP EGREP PKG_CONFIG PCRE_CONFIG localedir EXTERNAL_FIND EXTERNAL_GREP EXTERNAL_SED EXTERNAL_XARGS GNOME1MENU FDMENU UPDATE_DESKTOP FDMIME UPDATE_MIME GMIMEINFO GAPPREG ICONPATH pkgdatadir SET_MAKE RANLIB ac_ct_RANLIB ALLOCA GLIBC21 LIBICONV USE_NLS MSGFMT GMSGFMT XGETTEXT INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT GMOFILES INTLLIBS INTLOBJS POFILES POSUB DATADIRNAME INSTOBJEXT GENCAT MKINSTALLDIRS INTL_LIBTOOL_SUFFIX_PREFIX MSGMERGE INSTALLDATA INSTALLMAIN MAKEMAIN LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-auto-optimization try to automatically determine the most optimal build options for your architecture --enable-gcc3-optimization=type gcc3 can optimize for: i386, i486, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp, athlon-mp, winchip-c6, winchip2, c3 --enable-gcc2-optimization=type gcc2 can optimize for: i386, i486, pentium, pentiumpro, k6 --enable-debugging-output Turns massive debugging output on, will slow down the program! --disable-splash-screen disables the splash screen --enable-highlight-profiling Enables profiling information about highlighting patterns --enable-development Enables development checks, will slow down the program! --enable-gprof-profiling Enables gprof profiling, will slow down the program! --enable-gcov-coverage Enables coverage, will slow down the program! --disable-update-databases do not run the update-desktop-database or update-mime-database utilities, mostly useful for package maintainers --disable-nls do not use Native Language Support --enable-fix-unikey-gtk (Vietnamese) fix a BUG related to UniKeyGTK --enable-column-marker enable column markers Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnome1-menu enable gnome1 menu, use --with-gnome1-menu=/path to override the gnome1 prefix default /usr/share/gnome/apps --without-freedesktop_org-menu disable freedesktop_org menu, use --with-freedesktop_org-menu=/path to override the default location /usr/share/applications --without-freedesktop_org-mime disable freedesktop_org mime, use --with-freedesktop_org-mime=/path to override the default location /usr/share/mime --without-gnome2_4-mime disable gnome2.4 mime install, use --with-gnome2_4-mime=/path to override the default /usr/share/mime-info --without-gnome2_4-appreg disable gnome2.4 application-registry install, use --with-gnome2_4-appreg=/path to override the default /usr/share/application-registry --without-icon-path do not install icon in /usr/share/pixmaps/, use --with-icon-path=/path to override the default path --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib --with-included-gettext use the GNU gettext library included here Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/config.h" PACKAGE=winefish VERSION=1.3.3 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define CURRENT_VERSION_NAME "$PACKAGE $VERSION LaTeX editor" _ACEOF cat >>confdefs.h <<_ACEOF #define CONFIGURE_OPTIONS "$0 $*" _ACEOF # these are the languages that will be installed, so these should be finished ALL_LINGUAS="fr it vi" test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for strerror in -lcposix" >&5 echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6 if test "${ac_cv_lib_cposix_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strerror (); int main () { strerror (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_cposix_strerror=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cposix_strerror=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strerror" >&5 echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6 if test $ac_cv_lib_cposix_strerror = yes; then LIBS="$LIBS -lcposix" fi echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "$CC" = "gcc" ; then CFLAGS="$CFLAGS -Wall -pipe" fi # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` case $host_os in *cygwin* ) CYGWIN=yes;; * ) CYGWIN=no;; esac if test "x$CYGWIN" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define WIN32 1 _ACEOF CFLAGS="$CFLAGS" LIBS="$LIBS -lintl.dll" fi case "${host}" in powerpc-apple-darwin*) OSTYPE="DARWIN" ;; esac echo -n "checking for Mac OS X... " if test "x$OSTYPE" = "xDARWIN";then echo "yes" cat >>confdefs.h <<\_ACEOF #define PLATFORM_DARWIN 1 _ACEOF else echo "no" fi # Check whether --enable-auto-optimization or --disable-auto-optimization was given. if test "${enable_auto_optimization+set}" = set; then enableval="$enable_auto_optimization" UNAMEP=`uname -p` if test "x$UNAMEP" = "x"; then UNAMEP="unknown" fi if test "x$UNAMEP" = "xunknown"; then UNAMEP=`grep "model name" /proc/cpuinfo | cut -d: -f2` fi if $CC -dumpversion|egrep -i -q "^3\.(3|4).*"; then # gcc-3.3 or gcc-3.4 if echo $UNAMEP|grep -i -q "Intel(R) Pentium(R) 4 CPU"; then MARCH="-march=pentium4 -mmmx -mfpmath=sse -msse" elif echo $UNAMEP|grep -i -q "Pentium III"; then MARCH="-march=pentium3 -mmmx -mfpmath=sse" elif echo $UNAMEP|grep -i -q "AMD-K6(tm) 3D"; then MARCH="-march=k6-2 -m3dnow" elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium elif echo $UNAMEP|grep -i -q "Pentium II"; then MARCH="-march=pentium2 -mmmx" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) XP"; then MARCH="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) MP"; then MARCH="-march=athlon-mp -mfpmath=sse -mmmx -msse -m3dnow" elif echo $UNAMEP|grep -i -q "AMD Athlon(tm) 64"; then MARCH="-march=k8" else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT -O3 $MARCH -malign-double -fno-exceptions -pipe -s -ffast-math" elif $CC -dumpversion|egrep -i -q "^3\.2.*"; then # gcc-3.2 if echo $UNAMEP|grep -i -q "Intel(R) Pentium(R) 4 CPU"; then MARCH="-march=pentium4 -mmmx -mfpmath=sse -msse" elif echo $UNAMEP|grep -i -q "Pentium III"; then MARCH="-march=pentium3 -mmmx -mfpmath=sse" elif echo $UNAMEP|grep -i -q "AMD-K6(tm) 3D"; then MARCH="-march=k6-2 -m3dnow" elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium elif echo $UNAMEP|grep -i -q "Pentium II"; then MARCH="-march=pentium2 -mmmx" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) XP"; then MARCH="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow" else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT -O3 $MARCH -malign-double -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops -fstrict-aliasing" elif $CC -dumpversion|egrep -i -q "^3\.0.*"; then # gcc-3.0 CFLAGS="-DG_DISABLE_ASSERT -O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops" elif $CC -dumpversion | egrep -i -q "^2\.95.*" ; then # gcc-2.95 if echo $UNAMEP|egrep -i -q "(Pentium III|Pentium II|Pentium\(R\) 4|Athlon)"; then MARCH=-march=pentiumpro elif echo $UNAMEP|grep -i -q "AMD-K6"; then MARCH=-march=k6 elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT $MARCH -O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations" else echo "warning: compiler is not known: not optimizing!" fi echo "using $CC $CFLAGS" fi; # Check whether --enable-gcc3-optimization or --disable-gcc3-optimization was given. if test "${enable_gcc3_optimization+set}" = set; then enableval="$enable_gcc3_optimization" if $CC -dumpversion|egrep -q "^3\..*"; then CFLAGS="-O3 -march=$enableval -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops" echo "using $CC $CFLAGS" else echo "warning: compiler is not gcc3: not optimizing!" fi fi; # Check whether --enable-gcc2-optimization or --disable-gcc2-optimization was given. if test "${enable_gcc2_optimization+set}" = set; then enableval="$enable_gcc2_optimization" if $CC -dumpversion | egrep -q "^2\..*" ; then CFLAGS="-O3 -march=$enableval -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations" echo "using $CC $CFLAGS" else echo "warning: compiler is not gcc2: not optimizing!" fi fi; # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Check whether --enable-debugging-output or --disable-debugging-output was given. if test "${enable_debugging_output+set}" = set; then enableval="$enable_debugging_output" echo "With debugging output", cat >>confdefs.h <<\_ACEOF #define DEBUG 1 _ACEOF fi; # Check whether --enable-splash-screen or --disable-splash-screen was given. if test "${enable_splash_screen+set}" = set; then enableval="$enable_splash_screen" echo "Without splash screen", cat >>confdefs.h <<\_ACEOF #define NOSPLASH 1 _ACEOF fi; # Check whether --enable-highlight-profiling or --disable-highlight-profiling was given. if test "${enable_highlight_profiling+set}" = set; then enableval="$enable_highlight_profiling" echo "With highlighting profiling", cat >>confdefs.h <<\_ACEOF #define HL_PROFILING 1 _ACEOF fi; # Check whether --enable-development or --disable-development was given. if test "${enable_development+set}" = set; then enableval="$enable_development" echo "With development checks" cat >>confdefs.h <<\_ACEOF #define DEVELOPMENT 1 _ACEOF fi; # Check whether --enable-gprof-profiling or --disable-gprof-profiling was given. if test "${enable_gprof_profiling+set}" = set; then enableval="$enable_gprof_profiling" echo "With gprof profiling" CFLAGS="$CFLAGS -pg" LDFLAGS="$LDFLAGS -pg" fi; # Check whether --enable-gcov-coverage or --disable-gcov-coverage was given. if test "${enable_gcov_coverage+set}" = set; then enableval="$enable_gcov_coverage" echo "With gcov coverage" CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" fi; ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 echo "${ECHO_T}$PKG_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$PKG_CONFIG" = "xno" ; then { { echo "$as_me:$LINENO: error: pkg-config not found. Please install pkg-config" >&5 echo "$as_me: error: pkg-config not found. Please install pkg-config" >&2;} { (exit 1); exit 1; }; } fi echo -n "checking for glib-2.0 >= 2.2... " if pkg-config glib-2.0 --atleast-version=2.2; then echo "yes" else echo "no" { { echo "$as_me:$LINENO: error: glib-2.0 version 2.2 or higher is required" >&5 echo "$as_me: error: glib-2.0 version 2.2 or higher is required" >&2;} { (exit 1); exit 1; }; } fi echo -n "checking for gtk+-2.0... " if pkg-config --exists gtk+-2.0 ; then LIBS="$LIBS `pkg-config --libs gtk+-2.0`" CFLAGS="$CFLAGS `pkg-config --cflags gtk+-2.0`" echo "yes" else echo "no" { { echo "$as_me:$LINENO: error: libgtk2.0-dev missing please install libgtk2.0-dev" >&5 echo "$as_me: error: libgtk2.0-dev missing please install libgtk2.0-dev" >&2;} { (exit 1); exit 1; }; } fi echo -n "checking for gtk+-2.4... " if pkg-config gtk+-2.0 --atleast-version=2.4 ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ATLEAST_GTK_2_4 1 _ACEOF echo "yes" else echo "no" { { echo "$as_me:$LINENO: error: libgtk+-2.0 version 2.4 or higher" >&5 echo "$as_me: error: libgtk+-2.0 version 2.4 or higher" >&2;} { (exit 1); exit 1; }; } fi echo -n "checking for libgnomeui >= 2.6... " if pkg-config libgnomeui-2.0 --atleast-version=2.6 ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ATLEAST_GNOMEUI_2_6 1 _ACEOF LIBS="$LIBS `pkg-config --libs libgnomeui-2.0`" CFLAGS="$CFLAGS `pkg-config --cflags libgnomeui-2.0`" echo "yes" else echo "no" fi # Extract the first word of "pcre-config", so it can be a program name with args. set dummy pcre-config; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PCRE_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PCRE_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PCRE_CONFIG="$PCRE_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PCRE_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_PCRE_CONFIG" && ac_cv_path_PCRE_CONFIG="no" ;; esac fi PCRE_CONFIG=$ac_cv_path_PCRE_CONFIG if test -n "$PCRE_CONFIG"; then echo "$as_me:$LINENO: result: $PCRE_CONFIG" >&5 echo "${ECHO_T}$PCRE_CONFIG" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$PCRE_CONFIG" = "xno" ; then { { echo "$as_me:$LINENO: error: pcre-config not found please install libpcre3-dev or similar" >&5 echo "$as_me: error: pcre-config not found please install libpcre3-dev or similar" >&2;} { (exit 1); exit 1; }; } else LIBS="$LIBS `$PCRE_CONFIG --libs`" CFLAGS="$CFLAGS `$PCRE_CONFIG --cflags`" fi echo "$as_me:$LINENO: checking for nanosleep in -lposix4" >&5 echo $ECHO_N "checking for nanosleep in -lposix4... $ECHO_C" >&6 if test "${ac_cv_lib_posix4_nanosleep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix4 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char nanosleep (); int main () { nanosleep (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix4_nanosleep=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix4_nanosleep=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix4_nanosleep" >&5 echo "${ECHO_T}$ac_cv_lib_posix4_nanosleep" >&6 if test $ac_cv_lib_posix4_nanosleep = yes; then LIBS="$LIBS -lposix4" cat >>confdefs.h <<\_ACEOF #define HAVE_NANOSLEEP 1 _ACEOF else echo "$as_me:$LINENO: checking for nanosleep in -lrt" >&5 echo $ECHO_N "checking for nanosleep in -lrt... $ECHO_C" >&6 if test "${ac_cv_lib_rt_nanosleep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char nanosleep (); int main () { nanosleep (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_rt_nanosleep=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_rt_nanosleep=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_rt_nanosleep" >&5 echo "${ECHO_T}$ac_cv_lib_rt_nanosleep" >&6 if test $ac_cv_lib_rt_nanosleep = yes; then LIBS="$LIBS -lrt" cat >>confdefs.h <<\_ACEOF #define HAVE_NANOSLEEP 1 _ACEOF fi fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${ac_cv_header_aspell_h+set}" = set; then echo "$as_me:$LINENO: checking for aspell.h" >&5 echo $ECHO_N "checking for aspell.h... $ECHO_C" >&6 if test "${ac_cv_header_aspell_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_aspell_h" >&5 echo "${ECHO_T}$ac_cv_header_aspell_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking aspell.h usability" >&5 echo $ECHO_N "checking aspell.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking aspell.h presence" >&5 echo $ECHO_N "checking aspell.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: aspell.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: aspell.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: aspell.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: aspell.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: aspell.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: aspell.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: aspell.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: aspell.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: aspell.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: aspell.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: aspell.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for aspell.h" >&5 echo $ECHO_N "checking for aspell.h... $ECHO_C" >&6 if test "${ac_cv_header_aspell_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_aspell_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_aspell_h" >&5 echo "${ECHO_T}$ac_cv_header_aspell_h" >&6 fi if test $ac_cv_header_aspell_h = yes; then echo "$as_me:$LINENO: checking for new_aspell_config in -laspell" >&5 echo $ECHO_N "checking for new_aspell_config in -laspell... $ECHO_C" >&6 if test "${ac_cv_lib_aspell_new_aspell_config+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-laspell $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char new_aspell_config (); int main () { new_aspell_config (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_aspell_new_aspell_config=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_aspell_new_aspell_config=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_aspell_new_aspell_config" >&5 echo "${ECHO_T}$ac_cv_lib_aspell_new_aspell_config" >&6 if test $ac_cv_lib_aspell_new_aspell_config = yes; then LIBS="$LIBS -laspell" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBASPELL 1 _ACEOF else OLDLIBS=$LIBS LIBS="$OLDSLIBS -lstdc++" echo "$as_me:$LINENO: checking for new_aspell_config in -laspell" >&5 echo $ECHO_N "checking for new_aspell_config in -laspell... $ECHO_C" >&6 if test "${ac_cv_lib_aspell_new_aspell_config+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-laspell $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char new_aspell_config (); int main () { new_aspell_config (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_aspell_new_aspell_config=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_aspell_new_aspell_config=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_aspell_new_aspell_config" >&5 echo "${ECHO_T}$ac_cv_lib_aspell_new_aspell_config" >&6 if test $ac_cv_lib_aspell_new_aspell_config = yes; then LIBS="$LIBS -laspell" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBASPELL 1 _ACEOF else LIBS="$OLDSLIBS -laspell-common -lstdc++" echo "$as_me:$LINENO: checking for new_aspell_config in -laspell" >&5 echo $ECHO_N "checking for new_aspell_config in -laspell... $ECHO_C" >&6 if test "${ac_cv_lib_aspell_new_aspell_config+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-laspell $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char new_aspell_config (); int main () { new_aspell_config (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_aspell_new_aspell_config=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_aspell_new_aspell_config=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_aspell_new_aspell_config" >&5 echo "${ECHO_T}$ac_cv_lib_aspell_new_aspell_config" >&6 if test $ac_cv_lib_aspell_new_aspell_config = yes; then LIBS="$LIBS -laspell" cat >>confdefs.h <<\_ACEOF #define HAVE_LIBASPELL 1 _ACEOF else LIBS=$OLDLIBS echo "libaspell not found please install libaspell-dev or similar" fi fi fi fi localedir='${prefix}/share/locale' for ac_header in stdlib.h unistd.h string.h strings.h errno.h stdio.h sys/stat.h ctype.h getopt.h math.h time.h sys/types.h fcntl.h netdb.h netinet/in.h sys/socket.h arpa/inet.h dirent.h sys/select.h sys/time.h sys/ipc.h sys/msg.h sys/wait.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Extract the first word of "find", so it can be a program name with args. set dummy find; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXTERNAL_FIND+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EXTERNAL_FIND in [\\/]* | ?:[\\/]*) ac_cv_path_EXTERNAL_FIND="$EXTERNAL_FIND" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_EXTERNAL_FIND="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_EXTERNAL_FIND" && ac_cv_path_EXTERNAL_FIND="/usr/bin/find" ;; esac fi EXTERNAL_FIND=$ac_cv_path_EXTERNAL_FIND if test -n "$EXTERNAL_FIND"; then echo "$as_me:$LINENO: result: $EXTERNAL_FIND" >&5 echo "${ECHO_T}$EXTERNAL_FIND" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "grep", so it can be a program name with args. set dummy grep; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXTERNAL_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EXTERNAL_GREP in [\\/]* | ?:[\\/]*) ac_cv_path_EXTERNAL_GREP="$EXTERNAL_GREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_EXTERNAL_GREP="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_EXTERNAL_GREP" && ac_cv_path_EXTERNAL_GREP="/bin/grep" ;; esac fi EXTERNAL_GREP=$ac_cv_path_EXTERNAL_GREP if test -n "$EXTERNAL_GREP"; then echo "$as_me:$LINENO: result: $EXTERNAL_GREP" >&5 echo "${ECHO_T}$EXTERNAL_GREP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXTERNAL_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EXTERNAL_SED in [\\/]* | ?:[\\/]*) ac_cv_path_EXTERNAL_SED="$EXTERNAL_SED" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_EXTERNAL_SED="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_EXTERNAL_SED" && ac_cv_path_EXTERNAL_SED="/bin/sed" ;; esac fi EXTERNAL_SED=$ac_cv_path_EXTERNAL_SED if test -n "$EXTERNAL_SED"; then echo "$as_me:$LINENO: result: $EXTERNAL_SED" >&5 echo "${ECHO_T}$EXTERNAL_SED" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "xargs", so it can be a program name with args. set dummy xargs; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXTERNAL_XARGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EXTERNAL_XARGS in [\\/]* | ?:[\\/]*) ac_cv_path_EXTERNAL_XARGS="$EXTERNAL_XARGS" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_EXTERNAL_XARGS="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_EXTERNAL_XARGS" && ac_cv_path_EXTERNAL_XARGS="/usr/bin/xargs" ;; esac fi EXTERNAL_XARGS=$ac_cv_path_EXTERNAL_XARGS if test -n "$EXTERNAL_XARGS"; then echo "$as_me:$LINENO: result: $EXTERNAL_XARGS" >&5 echo "${ECHO_T}$EXTERNAL_XARGS" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi cat >>confdefs.h <<_ACEOF #define EXTERNAL_FIND "$EXTERNAL_FIND" _ACEOF cat >>confdefs.h <<_ACEOF #define EXTERNAL_GREP "$EXTERNAL_GREP" _ACEOF cat >>confdefs.h <<_ACEOF #define EXTERNAL_SED "$EXTERNAL_SED" _ACEOF cat >>confdefs.h <<_ACEOF #define EXTERNAL_XARGS "$EXTERNAL_XARGS" _ACEOF cat >>confdefs.h <<\_ACEOF #define WITH_SPC 1 _ACEOF for ac_header in sys/select.h sys/socket.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking types of arguments for select" >&5 echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6 if test "${ac_cv_func_select_args+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #if HAVE_SYS_SELECT_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : ${ac_cv_func_select_args='int,int *,struct timeval *'} fi echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 echo "${ECHO_T}$ac_cv_func_select_args" >&6 ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi ##################################################### if test "${prefix}" == "NONE"; then prefix=${ac_default_prefix} fi # Check whether --with-gnome1-menu or --without-gnome1-menu was given. if test "${with_gnome1_menu+set}" = set; then withval="$with_gnome1_menu" GNOME1MENU=$withval else GNOME1MENU=no fi; if test "x${GNOME1MENU}" != "xno" ; then if test "x$GNOME1MENU" = "xyes" ; then echo -n "checking for gnome1 menu directory... " if test -d /usr/share/gnome/apps ; then GNOME1MENU=/usr/share/gnome/apps else GNOME1MENU=no fi echo $GNOME1MENU fi if test "x${GNOME1MENU}" != "xno" ; then INSTALLDATA="$INSTALLDATA install-gnome1-menu" fi fi # Check whether --enable-update-databases or --disable-update-databases was given. if test "${enable_update_databases+set}" = set; then enableval="$enable_update_databases" UPDATEDATABASES=$enableval else UPDATEDATABASES=yes fi; # Check whether --with-freedesktop_org-menu or --without-freedesktop_org-menu was given. if test "${with_freedesktop_org_menu+set}" = set; then withval="$with_freedesktop_org_menu" FDMENU=$withval else FDMENU=yes fi; if test "${FDMENU}" != "no" ; then if test "${FDMENU}" = "yes" ; then echo -n "checking freedesktop.org menu directory... " if test -d /usr/share/applications ; then FDMENU=/usr/share/applications else if test -d ${prefix}/share/applications ; then FDMENU=${prefix}/share/applications else if test -d /usr/X11R6/share/gnome/applications ; then FDMENU=/usr/X11R6/share/gnome/applications else if test -d ${prefix}/share/gnome/applications ; then FDMENU=${prefix}/share/gnome/applications else FDMENU=no fi fi fi fi echo $FDMENU fi if test "${FDMENU}" != "no" ; then INSTALLDATA="$INSTALLDATA install-fdmenu" # Extract the first word of "update-desktop-database", so it can be a program name with args. set dummy update-desktop-database; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_UPDATE_DESKTOP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $UPDATE_DESKTOP in [\\/]* | ?:[\\/]*) ac_cv_path_UPDATE_DESKTOP="$UPDATE_DESKTOP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_UPDATE_DESKTOP="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_UPDATE_DESKTOP" && ac_cv_path_UPDATE_DESKTOP=""no"" ;; esac fi UPDATE_DESKTOP=$ac_cv_path_UPDATE_DESKTOP if test -n "$UPDATE_DESKTOP"; then echo "$as_me:$LINENO: result: $UPDATE_DESKTOP" >&5 echo "${ECHO_T}$UPDATE_DESKTOP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "${UPDATEDATABASES}" != "no" -a "${UPDATE_DESKTOP}" != "no"; then INSTALLDATA="$INSTALLDATA install-update-menu" fi fi fi # Check whether --with-freedesktop_org-mime or --without-freedesktop_org-mime was given. if test "${with_freedesktop_org_mime+set}" = set; then withval="$with_freedesktop_org_mime" FDMIME=$withval else FDMIME=yes fi; if test "${FDMIME}" != "no" ; then if test "${FDMIME}" = "yes" ; then echo -n "checking freedesktop.org mime directory... " if test -d /usr/share/mime ; then FDMIME=/usr/share/mime else if test -d ${prefix}/share/mime ; then FDMIME=${prefix}/share/mime else if test -d /usr/X11R6/share/gnome/mime ; then FDMIME=/usr/X11R6/share/gnome/mime else if test -d ${prefix}/share/gnome/mime ; then FDMIME=${prefix}/share/gnome/mime else FDMIME=no fi fi fi fi echo ${FDMIME} fi if test "${FDMIME}" != "no" ; then INSTALLDATA="$INSTALLDATA install-fdmime" # Extract the first word of "update-mime-database", so it can be a program name with args. set dummy update-mime-database; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_UPDATE_MIME+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $UPDATE_MIME in [\\/]* | ?:[\\/]*) ac_cv_path_UPDATE_MIME="$UPDATE_MIME" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_UPDATE_MIME="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_UPDATE_MIME" && ac_cv_path_UPDATE_MIME=""no"" ;; esac fi UPDATE_MIME=$ac_cv_path_UPDATE_MIME if test -n "$UPDATE_MIME"; then echo "$as_me:$LINENO: result: $UPDATE_MIME" >&5 echo "${ECHO_T}$UPDATE_MIME" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "${UPDATEDATABASES}" != "no" -a "${UPDATE_MIME}" != "no"; then INSTALLDATA="install-update-mime $INSTALLDATA" fi fi fi # Check whether --with-gnome2_4-mime or --without-gnome2_4-mime was given. if test "${with_gnome2_4_mime+set}" = set; then withval="$with_gnome2_4_mime" GMIMEINFO=$withval else GMIMEINFO=yes fi; if test "${GMIMEINFO}" != "no" ; then if test "${GMIMEINFO}" = "yes" ; then echo -n "checking gnome 2.4 mime-info directory... " if test -d /usr/share/mime-info ; then GMIMEINFO=/usr/share/mime-info else if test -d ${prefix}/share/mime-info ; then GMIMEINFO=${prefix}/share/mime-info else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/mime-info ; then GMIMEINFO=/usr/X11R6/share/gnome/mime-info else if test -d ${prefix}/share/gnome/mime-info ; then GMIMEINFO=${prefix}/share/gnome/mime-info else GMIMEINFO=no fi fi fi fi echo $GMIMEINFO fi if test "${GMIMEINFO}" != "no" ; then INSTALLDATA="$INSTALLDATA install-gnome-2.4-mime" fi fi # Check whether --with-gnome2_4-appreg or --without-gnome2_4-appreg was given. if test "${with_gnome2_4_appreg+set}" = set; then withval="$with_gnome2_4_appreg" GAPPREG=$withval else GAPPREG=yes fi; if test "${GAPPREG}" != "no" ; then if test "${GAPPREG}" = "yes" ; then echo -n "checking gnome 2.4 application-registry directory... " if test -d /usr/share/application-registry ; then GAPPREG=/usr/share/application-registry else if test -d ${prefix}/share/application-registry ; then GAPPREG=${prefix}/share/application-registry else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/application-registry ; then GAPPREG=/usr/X11R6/share/gnome/application-registry else if test -d ${prefix}/share/gnome/application-registry ; then GAPPREG=${prefix}/share/gnome/application-registry else GAPPREG=no fi fi fi fi echo $GAPPREG fi if test "${GAPPREG}" != "no" ; then INSTALLDATA="$INSTALLDATA install-gnome-2.4-appreg" fi fi # Check whether --with-icon-path or --without-icon-path was given. if test "${with_icon_path+set}" = set; then withval="$with_icon_path" ICONPATH=$withval else ICONPATH=yes fi; if test "x$ICONPATH" != "xno" ; then if test "x${ICONPATH}" = "xyes" ; then echo -n "checking icon path... " # the default answer is yes, so this is for users that did not use theicon-path option at all if test -d /usr/share/pixmaps ; then ICONPATH=/usr/share/pixmaps else if test -d ${prefix}/share/pixmaps ; then ICONPATH=${prefix}/share/pixmaps else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/pixmaps ; then ICONPATH=/usr/X11R6/share/gnome/pixmaps else if test -d ${prefix}/share/gnome/pixmaps ; then ICONPATH=${prefix}/share/gnome/pixmaps else # the user did not specify an icon-path, and the default path seems to be wrong for this system # we will not install an icon ICONPATH=no fi fi fi fi echo $ICONPATH fi if test "${ICONPATH}" != "no" ; then INSTALLMAIN="${INSTALLMAIN} install-icon" INSTALLDATA="${INSTALLDATA} install-icon" fi fi pkgdatadir=${datadir}/${PACKAGE}/ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long _ACEOF fi echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo "$as_me:$LINENO: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 _ACEOF fi echo "$as_me:$LINENO: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6 if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 if test $ac_cv_func_alloca_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.$ac_objext cat >>confdefs.h <<\_ACEOF #define C_ALLOCA 1 _ACEOF echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { exit (find_stack_direction () < 0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi for ac_header in stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for working mmap" >&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) exit (1); for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) exit (1); if (write (fd, data, pagesize) != pagesize) exit (1); close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) exit (1); data2 = (char *) malloc (2 * pagesize); if (!data2) exit (1); data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) exit (1); /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) exit (1); if (read (fd, data3, pagesize) != pagesize) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) exit (1); close (fd); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 if test "${ac_cv_gnu_library_2_1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "Lucky GNU user" >/dev/null 2>&1; then ac_cv_gnu_library_2_1=yes else ac_cv_gnu_library_2_1=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 GLIBC21="$ac_cv_gnu_library_2_1" for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ strdup strtoul tsearch __argz_count __argz_stringify __argz_next do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then withval="$with_libiconv_prefix" for dir in `echo "$withval" | tr : ' '`; do if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi done fi; echo "$as_me:$LINENO: checking for iconv" >&5 echo $ECHO_N "checking for iconv... $ECHO_C" >&6 if test "${am_cv_func_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_lib_iconv=yes am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 echo "${ECHO_T}$am_cv_func_iconv" >&6 if test "$am_cv_func_iconv" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ICONV 1 _ACEOF echo "$as_me:$LINENO: checking for iconv declaration" >&5 echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 if test "${am_cv_proto_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_proto_iconv_arg1="" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 am_cv_proto_iconv_arg1="const" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` echo "$as_me:$LINENO: result: ${ac_t:- }$am_cv_proto_iconv" >&5 echo "${ECHO_T}${ac_t:- }$am_cv_proto_iconv" >&6 cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF fi LIBICONV= if test "$am_cv_lib_iconv" = yes; then LIBICONV="-liconv" fi echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char* cs = nl_langinfo(CODESET); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_langinfo_codeset=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 am_cv_langinfo_codeset=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 if test $am_cv_langinfo_codeset = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LANGINFO_CODESET 1 _ACEOF fi if test $ac_cv_header_locale_h = yes; then echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 if test "${am_cv_val_LC_MESSAGES+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { return LC_MESSAGES ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_val_LC_MESSAGES=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 am_cv_val_LC_MESSAGES=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 if test $am_cv_val_LC_MESSAGES = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LC_MESSAGES 1 _ACEOF fi fi echo "$as_me:$LINENO: checking whether NLS is requested" >&5 echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" USE_NLS=$enableval else USE_NLS=yes fi; echo "$as_me:$LINENO: result: $USE_NLS" >&5 echo "${ECHO_T}$USE_NLS" >&6 BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no INTLLIBS= if test "$USE_NLS" = "yes"; then cat >>confdefs.h <<\_ACEOF #define ENABLE_NLS 1 _ACEOF echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" nls_cv_force_use_gnu_gettext=$withval else nls_cv_force_use_gnu_gettext=no fi; echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then CATOBJEXT=NONE if test "${ac_cv_header_libintl_h+set}" = set; then echo "$as_me:$LINENO: checking for libintl.h" >&5 echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 if test "${ac_cv_header_libintl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking libintl.h usability" >&5 echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking libintl.h presence" >&5 echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for libintl.h" >&5 echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 if test "${ac_cv_header_libintl_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_libintl_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 fi if test $ac_cv_header_libintl_h = yes; then echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 if test "${gt_cv_func_gnugettext1_libc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; int main () { bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_gnugettext1_libc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext1_libc=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 if test "$gt_cv_func_gnugettext1_libc" != "yes"; then echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -lintl $LIBICONV" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include extern int _nl_msg_cat_cntr; int main () { bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then gt_cv_func_gnugettext1_libintl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext1_libintl=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 fi if test "$gt_cv_func_gnugettext1_libc" = "yes" \ || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ && test "$PACKAGE" != gettext; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETTEXT 1 _ACEOF if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then INTLLIBS="-lintl $LIBICONV" fi gt_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" for ac_func in dcgettext do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS="$gt_save_LIBS" # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then echo "$as_me:$LINENO: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GMSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then echo "$as_me:$LINENO: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then echo "$as_me:$LINENO: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CATOBJEXT=.gmo fi fi if test "$CATOBJEXT" = "NONE"; then nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then INTLOBJS="\$(GETTOBJS)" # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then echo "$as_me:$LINENO: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GMSGFMT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then echo "$as_me:$LINENO: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_XGETTEXT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then echo "$as_me:$LINENO: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi if test "$GMSGFMT" != ":"; then if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then : ; else echo "$as_me:$LINENO: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6 GMSGFMT=":" fi fi if test "$XGETTEXT" != ":"; then if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then : ; else echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 XGETTEXT=":" fi fi POSUB=po fi ac_config_commands="$ac_config_commands default-1" if test "$PACKAGE" = gettext; then BUILD_INCLUDED_LIBINTL=yes fi for ac_prog in bison do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_INTLBISON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$INTLBISON"; then ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_INTLBISON="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi INTLBISON=$ac_cv_prog_INTLBISON if test -n "$INTLBISON"; then echo "$as_me:$LINENO: result: $INTLBISON" >&5 echo "${ECHO_T}$INTLBISON" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$INTLBISON" && break done if test -z "$INTLBISON"; then ac_verc_fail=yes else echo "$as_me:$LINENO: checking version of bison" >&5 echo $ECHO_N "checking version of bison... $ECHO_C" >&6 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac echo "$as_me:$LINENO: result: $ac_prog_version" >&5 echo "${ECHO_T}$ac_prog_version" >&6 fi if test $ac_verc_fail = yes; then INTLBISON=: fi for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done nls_cv_header_intl= nls_cv_header_libgt= DATADIRNAME=share INSTOBJEXT=.mo GENCAT=gencat if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS echo "$as_me:$LINENO: result: $LINGUAS" >&5 echo "${ECHO_T}$LINGUAS" >&6 fi if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi INTL_LIBTOOL_SUFFIX_PREFIX= # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MSGMERGE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MSGMERGE in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE="/usr/bin/msgmerge" ;; esac fi MSGMERGE=$ac_cv_path_MSGMERGE if test -n "$MSGMERGE"; then echo "$as_me:$LINENO: result: $MSGMERGE" >&5 echo "${ECHO_T}$MSGMERGE" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test ! -x "$GMSGFMT" ; then echo "no gmsgfmt - NLS disabled" USE_NLS=no fi if test ! -x "$MSGFMT" ; then echo "no msfmt - NLS disabled" USE_NLS=no fi if test "$USE_NLS" = "yes" ; then echo "$as_me:$LINENO: checking for gettext in -lintl" >&5 echo $ECHO_N "checking for gettext in -lintl... $ECHO_C" >&6 if test "${ac_cv_lib_intl_gettext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettext (); int main () { gettext (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_intl_gettext=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_gettext=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_gettext" >&5 echo "${ECHO_T}$ac_cv_lib_intl_gettext" >&6 if test $ac_cv_lib_intl_gettext = yes; then LIBS="$LIBS -lintl" fi cat >>confdefs.h <<\_ACEOF #define ENABLE_NLS 1 _ACEOF INSTALLMAIN="${INSTALLMAIN} install-nls" MAKEMAIN="${MAKEMAIN} make-nls" fi # kyanh ################################ # Check whether --enable-unikey-fix-gtk or --disable-unikey-fix-gtk was given. if test "${enable_unikey_fix_gtk+set}" = set; then enableval="$enable_unikey_fix_gtk" cat >>confdefs.h <<\_ACEOF #define ENABLE_FIX_UNIKEY_GTK 1 _ACEOF fi; # Check whether --enable-column-marker or --disable-column-marker was given. if test "${enable_column_marker+set}" = set; then enableval="$enable_column_marker" cat >>confdefs.h <<\_ACEOF #define ENABLE_COLUMN_MARKER 1 _ACEOF fi; #AC_ARG_WITH(vte-terminal, # AC_HELP_STRING([--with-vte-terminal],[enable VTE terminal]),[ # echo -n "checking for vte... " # if pkg-config --exists vte; then # LIBS="$LIBS `pkg-config --libs vte`" # CFLAGS="$CFLAGS `pkg-config --cflags vte`" # AC_DEFINE(HAVE_VTE_TERMINAL) # echo "yes" # else # echo "no" # fi # ],) # kyanh ################################ ac_config_files="$ac_config_files Makefile icons/Makefile src/Makefile data/Makefile po/Makefile man/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "icons/Makefile" ) CONFIG_FILES="$CONFIG_FILES icons/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "data/Makefile" ) CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "po/Makefile" ) CONFIG_FILES="$CONFIG_FILES po/Makefile" ;; "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ALL_LINGUAS@,$ALL_LINGUAS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@PCRE_CONFIG@,$PCRE_CONFIG,;t t s,@localedir@,$localedir,;t t s,@EXTERNAL_FIND@,$EXTERNAL_FIND,;t t s,@EXTERNAL_GREP@,$EXTERNAL_GREP,;t t s,@EXTERNAL_SED@,$EXTERNAL_SED,;t t s,@EXTERNAL_XARGS@,$EXTERNAL_XARGS,;t t s,@GNOME1MENU@,$GNOME1MENU,;t t s,@FDMENU@,$FDMENU,;t t s,@UPDATE_DESKTOP@,$UPDATE_DESKTOP,;t t s,@FDMIME@,$FDMIME,;t t s,@UPDATE_MIME@,$UPDATE_MIME,;t t s,@GMIMEINFO@,$GMIMEINFO,;t t s,@GAPPREG@,$GAPPREG,;t t s,@ICONPATH@,$ICONPATH,;t t s,@pkgdatadir@,$pkgdatadir,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@ALLOCA@,$ALLOCA,;t t s,@GLIBC21@,$GLIBC21,;t t s,@LIBICONV@,$LIBICONV,;t t s,@USE_NLS@,$USE_NLS,;t t s,@MSGFMT@,$MSGFMT,;t t s,@GMSGFMT@,$GMSGFMT,;t t s,@XGETTEXT@,$XGETTEXT,;t t s,@INTLBISON@,$INTLBISON,;t t s,@BUILD_INCLUDED_LIBINTL@,$BUILD_INCLUDED_LIBINTL,;t t s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t s,@CATALOGS@,$CATALOGS,;t t s,@CATOBJEXT@,$CATOBJEXT,;t t s,@GMOFILES@,$GMOFILES,;t t s,@INTLLIBS@,$INTLLIBS,;t t s,@INTLOBJS@,$INTLOBJS,;t t s,@POFILES@,$POFILES,;t t s,@POSUB@,$POSUB,;t t s,@DATADIRNAME@,$DATADIRNAME,;t t s,@INSTOBJEXT@,$INSTOBJEXT,;t t s,@GENCAT@,$GENCAT,;t t s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t s,@INTL_LIBTOOL_SUFFIX_PREFIX@,$INTL_LIBTOOL_SUFFIX_PREFIX,;t t s,@MSGMERGE@,$MSGMERGE,;t t s,@INSTALLDATA@,$INSTALLDATA,;t t s,@INSTALLMAIN@,$INSTALLMAIN,;t t s,@MAKEMAIN@,$MAKEMAIN,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in default-1 ) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" fi ;; esac done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi winefish-1.3.3/inline_images/0000700000047200004720000000000010414700277015133 5ustar kyanhkyanhwinefish-1.3.3/inline_images/winefish_icon1.png0000600000047200004720000000312010412006206020531 0ustar kyanhkyanhPNG  IHDR00WbKGDC pHYs  tIME.`"IDAThYIlSW=&hHC M -RU ,ʦRUꮭ@RĂ BS 18qҐ<8c'x."b?*E]?{T<c XMK ˃(*`4d5~g"|IYZq|]JEKb?<0^hg_۝;߅ `. p5+C|e`޹0~O-i’>ӄ CQ3·4F1qޤ/\`vK?&-Cfn` ug\ҢspxX~D*m)247öwĠ,|~4(?+Il]s}M>4 aeB4ǃiъ!|qMyiFLZŌ+;>>.:\3MSػ[ѐdwtD-P)z Nr>* ZL˾2%"#c ǭҫZ++s%(,ʃRIò<ɗ» QAtP儯)7:m.:+ h#?8fEQiw'OݢR>,Q!K!~On% p5^"DbokY.˂xsϾ:#TEr/9/gQQx㨕Q8/D0$|Ӻuˌ nY*I6W)6 ne(fO~n԰zd;z\68N[PU/ز)*% W% u]Iv4ũFrY6KO,JL4|^Z̔gw^(7GrK^kEĐQS|vEY8w V6lW5kVNPFIENDB`winefish-1.3.3/inline_images/close_small.png0000600000047200004720000000034310373352236020142 0ustar kyanhkyanhPNG  IHDRRWsBIT|dtEXtSoftwareEye of Gnome /IDATxc` gBD8$ub\Ɉl toolbar_icons.c gdk-pixbuf-csource --raw --extern --build-list $(GENERAL) > general_icons.c winefish-1.3.3/inline_images/toolbar_icons.c0000600000047200004720000010041310373352236020137 0ustar kyanhkyanh/* GdkPixbuf RGBA C-Source image dump */ #ifdef __SUNPRO_C #pragma align 4 (pixmap_winefish_icon1) #endif #ifdef __GNUC__ const guint8 pixmap_winefish_icon1[] __attribute__ ((__aligned__ (4))) = #else const guint8 pixmap_winefish_icon1[] = #endif { "" /* Pixbuf magic (0x47646b50) */ "GdkP" /* length: header (24) + pixel_data (9216) */ "\0\0$\30" /* pixdata_type (0x1010002) */ "\1\1\0\2" /* rowstride (192) */ "\0\0\0\300" /* width (48) */ "\0\0\0""0" /* height (48) */ "\0\0\0""0" /* pixel_data: */ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0" "\0\2\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\13Ik\2153o\237\321\244i\227\310" "F&7I\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\5\0\0\0\34\0\0\0=g\225\304\305}\255\336\377u\245\327\304f\224" "\304'\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5" "\0\0\0!\0\0\0W5Mf\242s\246\333\377\205\262\340\377~\255\334\357h\230" "\311>\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\2\0\0\0\3\0\0" "\0\5\0\0\0\5\0\0\0\5\0\0\0\5\0\0\0\4\0\0\0\2\0\0\0\2\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\26" "\0\0\0N\6\11\13\223o\242\325\373v\250\334\377\216\270\342\377\201\257" "\335\360g\226\306*\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\6\0\0\0\16""9X|=Ek\227q" "=k\242\2510f\247\324-f\253\354-g\255\357,g\254\334+e\251\273+d\247\212" "*`\241D\27""6Z\10\0\0\0\3\0\0\0\4\0\0\0\4\0\0\0\3\0\0\0\2\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\1\0\0\0\13\0\0\0;\0\0\0\210\\\207\262\354r\246\333\377\202\260" "\337\377\224\273\343\377x\250\330\316Ln\222\6\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\22*B^GNx\252\316" "Y\207\275\377\\\213\301\377]\215\303\377]\214\302\377K\177\273\3770l" "\262\377.k\263\377/l\264\377/m\265\377/m\266\377.k\262\344)`\240\210" "Ai\231\206Mx\251\263R~\261\272S\177\262\227U\200\261Q:Wx\10\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\6\0\0\0,\0\0\0xNq\225\336r\246\333\377v\250\334\377\222\272\343\377" "\216\267\342\377j\233\315n\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\2\0\0\0\13\4\12\22$)O}\227P|\261\367X\207\275\377^\215\303" "\377b\222\310\377d\225\312\377d\225\312\377a\221\307\377R\205\277\377" "0m\265\377/m\266\377/n\267\377/o\270\377/o\270\377/o\270\3772p\267\377" "I}\271\377[\212\300\377^\216\304\377`\220\305\377^\215\302\333X\205\266" "D\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\5\0\0\0$\0\0\0kDc\202\323r\246\333\377r\246\333\377\211\264\341\377" "\230\276\344\377v\246\330\331\34)6\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1" "\0\0\0\5\0\0\0\24\22)EL&T\217\333Gu\255\377U\203\271\377[\212\300\377" "a\222\307\377f\230\315\377j\235\322\377j\234\322\377f\227\314\377`\220" "\306\377E|\274\377/o\270\377/p\272\3770p\272\3770p\273\3770p\273\377" "/p\272\377/o\271\377B{\275\377c\224\312\377g\230\316\377f\230\315\377" "b\223\310\373[\210\274c\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\4\0\0\0\36\0\0\0a=Yu\313r\246\333\377r\246\333\377\200" "\256\336\377\227\275\344\377\206\262\340\377g\226\306@\0\0\0\0\0\0\0" "\0\0\0\0\1\0\0\0\10\0\0\0\34\32""8_z)Z\232\3650]\225\377P|\262\377V\204" "\272\377\\\214\301\377b\223\310\377h\232\320\377n\241\326\377m\240\326" "\377h\231\317\377b\222\307\377X\210\300\3771q\272\3770q\274\3770r\275" "\3770r\275\3770r\275\3770q\274\3770p\272\377/o\271\377@{\277\377k\237" "\324\377l\236\323\377f\230\315\377`\220\306\374V\201\263E\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0\33\0\0\0[:Up\307r" "\246\333\377r\246\333\377y\252\335\377\224\274\343\377\222\272\343\377" "l\235\317\235\0\0\0\2\0\0\0\2\0\0\0\12\0\0\0$\34>j\227*\\\234\375(X\225" "\377>i\236\377O|\261\377U\203\271\377[\212\300\377a\221\307\377f\230" "\315\377j\234\321\377i\234\321\377e\227\314\377`\220\306\377Z\211\277" "\377;w\273\3770r\276\3770s\277\3770t\300\3770s\277\3770r\276\3770q\274" "\3770p\272\377/n\270\377E\200\302\377l\236\324\377g\230\316\377a\221" "\307\377Y\210\275\336:Y|\11\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\3\0\0\0\32\0\0\0X9Sm\304r\246\333\377r\246\333\377s\247\333\377" "\222\272\343\377\232\277\345\377r\245\331\347&7I\11\0\0\0\13\0\0\0(\36" "@m\246)[\233\377+]\236\377&R\213\377Hs\251\377My\257\377S\200\266\377" "X\207\274\377]\215\302\377a\221\307\377c\224\312\377c\224\311\377a\221" "\306\377\\\214\301\377W\206\273\377Cz\272\3770s\277\3771u\301\3771u\302" "\3771u\301\3770t\300\3770r\275\3770q\273\377/o\271\377/n\267\377N\205" "\303\377c\224\311\377^\216\304\377Y\210\275\377Ny\253^\0\0\0\1\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0\31\0\0\0W6Oi\302q\244\331\377" "r\246\333\377r\246\333\377\215\267\341\377\230\276\344\377~\256\336\377" "V}\245B\0\0\0)\34\0\0\0y\5\12\21\261\34""6" "a\365\40\77o\377\40Aq\377!Bs\377!Cu\377\"Ew\377\"Ey\377\"G{\377#H}\377" "#I~\377$J\200\377+S\212\377N{\261\377U\203\271\377V\203\271\377V\203" "\271\377S\177\262\377Nx\251\377Js\243\377Go\237\377El\234\377Dk\231\377" "Dj\231\377Fm\234\377Hp\237\377Lu\245\377T\201\264\377V\203\267\362';" "R*\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\2\0" "\0\0\2\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0" "\27\0\0\0A\0\0\0z\4\10\17\256\33""4\\\362\40\77o\377\40Aq\377!As\377" "!Cu\377\"Dv\377\"Ex\377\"Fz\377\"G{\377#H}\377$I~\377'M\203\377\77i\237" "\377My\257\377My\257\377Mz\257\377Mz\260\377Nz\260\377Nz\260\377N{\261" "\377N{\261\377O{\261\377O|\261\377O|\262\377O|\262\377Nz\257\3733Oqn" "\0\0\0\14\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\5\0\0\0\27\0\0\0\77\0\0\0u\2\4\7\245\27-P\350\40>n\377\40@p\377" "\40Ar\377!Bt\377\"Cu\377\"Dw\377\"Ey\377\"Fz\377\"G{\377#H}\377$I~\377" ",S\211\377>g\235\377Hs\251\377It\252\377It\252\377It\252\377It\252\377" "It\252\377It\252\377It\252\377It\252\377Ck\235\357&m\376\40@p\377!Aq\377!Ar\377!Bt\377!Cu\377!Cv\377\"Dw\377#Ex\377" "\"Dx\376\34""8a\334\15\33/\206\0\0\0A\0\0\0,\0\0\0!\0\0\0\25\0\0\0\12" "\0\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0" "\0\6\0\0\0\23\0\0\0+\0\0\0M\0\0\0p\0\0\0\213\6\13\24\251\20\40:\316\30" "/T\347\35""8b\364\37 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA SHELL = /bin/sh VPATH = @srcdir@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ srcdir = src prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ datadir=@datadir@ pkgdatadir=$(datadir)/$(PACKAGE) pixmapsdir=@prefix@/share/pixmaps docdir=@prefix@/share/doc/$(PACKAGE) INSTALLMAIN=@INSTALLMAIN@ MAKEMAIN=@MAKEMAIN@ iconpath=@ICONPATH@ INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_DATA = $(INSTALL) -m 644 #make -C is a GNU extension, BSD make doesn't have it #use cd dir ; make all instead #and [ "bla" == "bla" ] does not work on netBSD #use [ "bla" = "bla" ] instead winefish:all all: ${MAKEMAIN} @cd data/ && $(MAKE) all @cd src/ && $(MAKE) all @cd man/ && $(MAKE) all make-nls: cd po/ && $(MAKE) all; clean: rm -f core *~ @cd src/ && $(MAKE) clean @cd po/ && $(MAKE) clean @cd data/ && $(MAKE) clean @cd man/ && $(MAKE) clean patchclean: clean rm -f *.orig *.rej @cd src/ && $(MAKE) patchclean distclean: @cd src/ && $(MAKE) distclean @cd po/ && $(MAKE) distclean @cd data/ && $(MAKE) distclean rm -f Makefile src/Makefile icons/Makefile man/Makefile config.status config.cache config.log rm -rf autom4te.cache/ rm -f *.orig *.rej install-icon: $(INSTALL_DIR) $(DESTDIR)$(iconpath) $(INSTALL_DATA) inline_images/winefish_icon1.png $(DESTDIR)$(iconpath)/winefish-icon.png install-nls: cd po/ && $(MAKE) install install: src/winefish ${INSTALLMAIN} pkgdatadir=@pkgdatadir@ $(INSTALL_DIR) $(DESTDIR)$(pkgdatadir) $(INSTALL_DATA) images/winefish_splash.png $(DESTDIR)$(pkgdatadir) $(INSTALL_DIR) $(DESTDIR)$(docdir) $(INSTALL_DATA) doc/winefish.html $(DESTDIR)$(docdir) # $(INSTALL_DATA) doc/winefish.txt $(DESTDIR)$(docdir) @cd icons/ && $(MAKE) install @cd src/ && $(MAKE) install @cd data/ && $(MAKE) install @cd man/ && $(MAKE) install uninstall: @cd icons/ && $(MAKE) uninstall @cd src/ && $(MAKE) uninstall @cd po/ && $(MAKE) uninstall @cd data/ && $(MAKE) uninstall @cd man/ && $(MAKE) uninstall rm -f $(pkgdatadir)/winefish_splash.png rm -f $(pkgdatadir)/winefish_splash.png rm -f $(pkgdatadir)/winefish_splash.png rm -f $(iconpath)/winefish-icon.png rm -f $(docdir)/winefish.html # rm -f $(docdir)/winefish.txt /bin/rmdir $(DESTDIR)$(pkgdatadir) strip: @cd src/ && strip winefish winefish-1.3.3/ROADMAP0000600000047200004720000000132410404557573013350 0ustar kyanhkyanh-: todo %: ignore it +: done ==============================================> +\infty <=== 3.0.x ===== - code folding 2.0.x ===== - plugins support - emacs key style 1.5.4 ===== - book marks by group + (1.3.2.6c) improve outputbox (backend) 1.4.3 ===== - label autocompletion (static scanner) - editor command - improve outputbox (multi-pages) - support multiple main files for project + (1.3.2.6b) improve outputbox (frontend) % context support ==============================================> current <=== 1.3.2 ===== + (1.3.2.5) command collector + (1.3.2.6e) brace recognizer + KISS 1.2.x ===== + (1.1.1.beta.1) autocompletion 1.x.x ===== + Blue2Wine ==============================================> -\infty <=== winefish-1.3.3/AUTHORS0000600000047200004720000000030210372326256013401 0ustar kyanhkyanhauthors: * kyanh translators: * (Fr) Michèle Garoche * (It) Daniele Medri * (Vi) kyanh winefish-1.3.3/THANKS0000600000047200004720000000343410412070731013242 0ustar kyanhkyanh SPECIAL THANKS to Bluefish's AUTHORS who are creating a very best Open Source HTML Editor -- Bluefish. THANKS to YOU for choosing Winefish. THANKS to Berlios [ http://developer.berlios.de/ ] SourceForge [ http://sourceforge.net/ ] TuxFamily [ http://tuxfamily.org/ ] THANKS to: IBMackey Daniele Medri Michèle Garoche [MacOSX, BUG#8{84,6408}, many more] Daniel Leidert Salman Ansari [x86_md64 bugs report and fix] Stew Heckenberg [wf-1.3.2.5, feedback, report bugs] bmh1980, bilco [BUG#{5869,5689}] Bojaren (???) [beta tester] Nicola Vitale [beta tester, FreeBSD port] mattions [beta tester, gentoo port] Andrés Villaveces [feedback] Claudio Polegato Junior [BUG#82] bender02 (http://winefish.berlios.de/forum/account.php?u=4) [BUG#90] Michele Mattioni [1.3.2-RC2; many useful comments and suggestions] Viết Ánh [first tried Winefish] Larry Nguyễn [tested Winefish 1.x] Việt Long [very generic stuff] vnoss|work [comment on ConTeXT support] xomhau [report a BUG/Free BSD] Nguyễn Văn Hạnh [cool friend] vnpenguin [Winefish review, conTeXt stuff and more] pclouds [Winefish for Gentoo -- promise :)] Do Hong Minh [tried Winefish 1.3.2.6 ???] THANKS to all who helped making this software available. THANKS to the EARTH where I am being. winefish-1.3.3/config.guess0000600000047200004720000012025610373411041014645 0ustar kyanhkyanh#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-01-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:MicroBSD:*:*) echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. eval $set_cc_for_build cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null if test "$?" = 0 ; then case `$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; 3-1307) UNAME_MACHINE="alphaev7" ;; esac fi echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i586-pc-interix3 exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: winefish-1.3.3/config.sub0000600000047200004720000007210310373411041014305 0ustar kyanhkyanh#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-01-03' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic4x | c4x*) basic_machine=tic4x-unknown os=-coff ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -microbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: winefish-1.3.3/configure.ac0000600000047200004720000004413610414700166014625 0ustar kyanhkyanh# Winefish LaTeX Editor # configure.ac - the autoconf file # # Copyright (C) 2002-2004 Olivier Sessink # Copyright (C) 2005 2006 Ky Anh # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA AC_INIT AC_CONFIG_SRCDIR(src/winefish.c) AC_CONFIG_HEADER(src/config.h) PACKAGE=winefish VERSION=1.3.3 AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") AC_DEFINE_UNQUOTED(CURRENT_VERSION_NAME, "$PACKAGE $VERSION LaTeX editor") AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS, "$0 $*") # these are the languages that will be installed, so these should be finished ALL_LINGUAS="fr it vi" AC_SUBST(ALL_LINGUAS) dnl ************************ dnl Compiler options dnl ************************ AC_ARG_PROGRAM AC_PROG_CC AC_ISC_POSIX AC_C_INLINE AC_PROG_INSTALL if test "$CC" = "gcc" ; then CFLAGS="$CFLAGS -Wall -pipe" fi AC_CANONICAL_HOST case $host_os in *cygwin* ) CYGWIN=yes;; * ) CYGWIN=no;; esac if test "x$CYGWIN" = "xyes"; then AC_DEFINE(WIN32) CFLAGS="$CFLAGS" LIBS="$LIBS -lintl.dll" fi case "${host}" in powerpc-apple-darwin*) OSTYPE="DARWIN" ;; esac echo -n "checking for Mac OS X... " if test "x$OSTYPE" = "xDARWIN";then echo "yes" AC_DEFINE(PLATFORM_DARWIN) else echo "no" fi AC_ARG_ENABLE(auto-optimization, AC_HELP_STRING([--enable-auto-optimization], [try to automatically determine the most optimal build options for your architecture]), UNAMEP=`uname -p` if test "x$UNAMEP" = "x"; then UNAMEP="unknown" fi if test "x$UNAMEP" = "xunknown"; then UNAMEP=`grep "model name" /proc/cpuinfo | cut -d: -f2` fi if $CC -dumpversion|egrep -i -q "^3\.(3|4).*"; then # gcc-3.3 or gcc-3.4 if echo $UNAMEP|grep -i -q "Intel(R) Pentium(R) 4 CPU"; then MARCH="-march=pentium4 -mmmx -mfpmath=sse -msse" elif echo $UNAMEP|grep -i -q "Pentium III"; then MARCH="-march=pentium3 -mmmx -mfpmath=sse" elif echo $UNAMEP|grep -i -q "AMD-K6(tm) 3D"; then MARCH="-march=k6-2 -m3dnow" elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium elif echo $UNAMEP|grep -i -q "Pentium II"; then MARCH="-march=pentium2 -mmmx" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) XP"; then MARCH="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) MP"; then MARCH="-march=athlon-mp -mfpmath=sse -mmmx -msse -m3dnow" elif echo $UNAMEP|grep -i -q "AMD Athlon(tm) 64"; then MARCH="-march=k8" else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT -O3 $MARCH -malign-double -fno-exceptions -pipe -s -ffast-math" elif $CC -dumpversion|egrep -i -q "^3\.2.*"; then # gcc-3.2 if echo $UNAMEP|grep -i -q "Intel(R) Pentium(R) 4 CPU"; then MARCH="-march=pentium4 -mmmx -mfpmath=sse -msse" elif echo $UNAMEP|grep -i -q "Pentium III"; then MARCH="-march=pentium3 -mmmx -mfpmath=sse" elif echo $UNAMEP|grep -i -q "AMD-K6(tm) 3D"; then MARCH="-march=k6-2 -m3dnow" elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium elif echo $UNAMEP|grep -i -q "Pentium II"; then MARCH="-march=pentium2 -mmmx" elif echo $UNAMEP|grep -i -q "AMD Athlon(TM) XP"; then MARCH="-march=athlon-xp -mfpmath=sse -mmmx -msse -m3dnow" else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT -O3 $MARCH -malign-double -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops -fstrict-aliasing" elif $CC -dumpversion|egrep -i -q "^3\.0.*"; then # gcc-3.0 CFLAGS="-DG_DISABLE_ASSERT -O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops" elif $CC -dumpversion | egrep -i -q "^2\.95.*" ; then # gcc-2.95 if echo $UNAMEP|egrep -i -q "(Pentium III|Pentium II|Pentium\(R\) 4|Athlon)"; then MARCH=-march=pentiumpro elif echo $UNAMEP|grep -i -q "AMD-K6"; then MARCH=-march=k6 elif echo $UNAMEP|grep -i -q "Pentium 75 - 200"; then MARCH=-march=pentium else MARCH="" fi CFLAGS="-DG_DISABLE_ASSERT $MARCH -O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations" else echo "warning: compiler is not known: not optimizing!" fi echo "using $CC $CFLAGS" ) AC_ARG_ENABLE(gcc3-optimization, AC_HELP_STRING([--enable-gcc3-optimization=type], [gcc3 can optimize for: i386, i486, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp, athlon-mp, winchip-c6, winchip2, c3]), if $CC -dumpversion|egrep -q "^3\..*"; then CFLAGS="-O3 -march=$enableval -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations -falign-functions -falign-loops" echo "using $CC $CFLAGS" else echo "warning: compiler is not gcc3: not optimizing!" fi ) AC_ARG_ENABLE(gcc2-optimization, AC_HELP_STRING([--enable-gcc2-optimization=type], [gcc2 can optimize for: i386, i486, pentium, pentiumpro, k6]), if $CC -dumpversion | egrep -q "^2\..*" ; then CFLAGS="-O3 -march=$enableval -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations" echo "using $CC $CFLAGS" else echo "warning: compiler is not gcc2: not optimizing!" fi ) AC_PROG_INSTALL AC_ARG_ENABLE(debugging-output, AC_HELP_STRING([--enable-debugging-output],[Turns massive debugging output on, will slow down the program!]),[ echo "With debugging output", AC_DEFINE(DEBUG)],) AC_ARG_ENABLE(splash-screen, AC_HELP_STRING([--disable-splash-screen],[disables the splash screen]),[ echo "Without splash screen", AC_DEFINE(NOSPLASH)],) AC_ARG_ENABLE(highlight-profiling, AC_HELP_STRING([--enable-highlight-profiling],[Enables profiling information about highlighting patterns]),[ echo "With highlighting profiling", AC_DEFINE(HL_PROFILING)],) AC_ARG_ENABLE(development, AC_HELP_STRING([--enable-development],[Enables development checks, will slow down the program!]),[ echo "With development checks" AC_DEFINE(DEVELOPMENT)],) AC_ARG_ENABLE(gprof-profiling, AC_HELP_STRING([--enable-gprof-profiling],[Enables gprof profiling, will slow down the program!]),[ echo "With gprof profiling" CFLAGS="$CFLAGS -pg" LDFLAGS="$LDFLAGS -pg"],) AC_ARG_ENABLE(gcov-coverage, AC_HELP_STRING([--enable-gcov-coverage],[Enables coverage, will slow down the program!]),[ echo "With gcov coverage" CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"],) dnl ************************ dnl Check for standard headers dnl ************************ AC_HEADER_STDC dnl ************************ dnl Checks for librarries dnl ************************ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "x$PKG_CONFIG" = "xno" ; then AC_MSG_ERROR(pkg-config not found. Please install pkg-config) fi echo -n "checking for glib-2.0 >= 2.2... " if pkg-config glib-2.0 --atleast-version=2.2; then echo "yes" else echo "no" AC_MSG_ERROR(glib-2.0 version 2.2 or higher is required) fi echo -n "checking for gtk+-2.0... " if pkg-config --exists gtk+-2.0 ; then LIBS="$LIBS `pkg-config --libs gtk+-2.0`" CFLAGS="$CFLAGS `pkg-config --cflags gtk+-2.0`" echo "yes" else echo "no" AC_MSG_ERROR(libgtk2.0-dev missing please install libgtk2.0-dev) fi echo -n "checking for gtk+-2.4... " if pkg-config gtk+-2.0 --atleast-version=2.4 ; then AC_DEFINE(HAVE_ATLEAST_GTK_2_4) echo "yes" else echo "no" AC_MSG_ERROR(libgtk+-2.0 version 2.4 or higher) fi echo -n "checking for libgnomeui >= 2.6... " if pkg-config libgnomeui-2.0 --atleast-version=2.6 ; then AC_DEFINE(HAVE_ATLEAST_GNOMEUI_2_6) LIBS="$LIBS `pkg-config --libs libgnomeui-2.0`" CFLAGS="$CFLAGS `pkg-config --cflags libgnomeui-2.0`" echo "yes" else echo "no" fi AC_PATH_PROG(PCRE_CONFIG, pcre-config, no) if test "x$PCRE_CONFIG" = "xno" ; then AC_MSG_ERROR(pcre-config not found please install libpcre3-dev or similar) else LIBS="$LIBS `$PCRE_CONFIG --libs`" CFLAGS="$CFLAGS `$PCRE_CONFIG --cflags`" fi AC_CHECK_LIB(posix4, nanosleep, LIBS="$LIBS -lposix4" AC_DEFINE(HAVE_NANOSLEEP), AC_CHECK_LIB(rt, nanosleep, LIBS="$LIBS -lrt" AC_DEFINE(HAVE_NANOSLEEP) ) ) AC_CHECK_HEADER(aspell.h, AC_CHECK_LIB(aspell, new_aspell_config, LIBS="$LIBS -laspell" AC_DEFINE(HAVE_LIBASPELL), OLDLIBS=$LIBS LIBS="$OLDSLIBS -lstdc++" AC_CHECK_LIB(aspell, new_aspell_config, LIBS="$LIBS -laspell" AC_DEFINE(HAVE_LIBASPELL), LIBS="$OLDSLIBS -laspell-common -lstdc++" AC_CHECK_LIB(aspell, new_aspell_config, LIBS="$LIBS -laspell" AC_DEFINE(HAVE_LIBASPELL), LIBS=$OLDLIBS echo "libaspell not found please install libaspell-dev or similar" ) ) ) ) localedir='${prefix}/share/locale' AC_SUBST(localedir) dnl ************************ dnl Checks for header files. dnl ************************ AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h errno.h stdio.h sys/stat.h ctype.h getopt.h math.h time.h sys/types.h fcntl.h netdb.h netinet/in.h sys/socket.h arpa/inet.h dirent.h sys/select.h sys/time.h sys/ipc.h sys/msg.h sys/wait.h) dnl ************************ dnl Checks for external programs. dnl ************************ AC_PATH_PROG(EXTERNAL_FIND, find, /usr/bin/find) AC_PATH_PROG(EXTERNAL_GREP, grep, /bin/grep) AC_PATH_PROG(EXTERNAL_SED, sed, /bin/sed) AC_PATH_PROG(EXTERNAL_XARGS, xargs, /usr/bin/xargs) AC_DEFINE_UNQUOTED(EXTERNAL_FIND, "$EXTERNAL_FIND") AC_DEFINE_UNQUOTED(EXTERNAL_GREP, "$EXTERNAL_GREP") AC_DEFINE_UNQUOTED(EXTERNAL_SED, "$EXTERNAL_SED") AC_DEFINE_UNQUOTED(EXTERNAL_XARGS, "$EXTERNAL_XARGS") dnl ************************** dnl For the spell checker dnl ************************** dnl don't define WITH_SPC if you want to build without spell-checker AC_DEFINE(WITH_SPC) dnl Checks select argument types AC_FUNC_SELECT_ARGTYPES AC_HEADER_TIME dnl ************************ dnl Program locations dnl ************************ ##################################################### if test "${prefix}" == "NONE"; then prefix=${ac_default_prefix} AC_SUBST(prefix) fi AC_ARG_WITH(gnome1-menu, AC_HELP_STRING([--with-gnome1-menu],[enable gnome1 menu, use --with-gnome1-menu=/path to override the gnome1 prefix default /usr/share/gnome/apps]),[ GNOME1MENU=$withval ],[ GNOME1MENU=no] ) if test "x${GNOME1MENU}" != "xno" ; then if test "x$GNOME1MENU" = "xyes" ; then echo -n "checking for gnome1 menu directory... " if test -d /usr/share/gnome/apps ; then GNOME1MENU=/usr/share/gnome/apps else GNOME1MENU=no fi echo $GNOME1MENU fi if test "x${GNOME1MENU}" != "xno" ; then INSTALLDATA="$INSTALLDATA install-gnome1-menu" AC_SUBST(GNOME1MENU) fi fi AC_ARG_ENABLE([update-databases], AC_HELP_STRING([--disable-update-databases],[do not run the update-desktop-database or update-mime-database utilities, mostly useful for package maintainers]),[ UPDATEDATABASES=$enableval ],[ UPDATEDATABASES=yes] ) AC_ARG_WITH(freedesktop_org-menu, AC_HELP_STRING([--without-freedesktop_org-menu],[disable freedesktop_org menu, use --with-freedesktop_org-menu=/path to override the default location /usr/share/applications]),[ FDMENU=$withval ],[ FDMENU=yes] ) if test "${FDMENU}" != "no" ; then if test "${FDMENU}" = "yes" ; then echo -n "checking freedesktop.org menu directory... " if test -d /usr/share/applications ; then FDMENU=/usr/share/applications else if test -d ${prefix}/share/applications ; then FDMENU=${prefix}/share/applications else if test -d /usr/X11R6/share/gnome/applications ; then FDMENU=/usr/X11R6/share/gnome/applications else if test -d ${prefix}/share/gnome/applications ; then FDMENU=${prefix}/share/gnome/applications else FDMENU=no fi fi fi fi echo $FDMENU fi if test "${FDMENU}" != "no" ; then INSTALLDATA="$INSTALLDATA install-fdmenu" AC_SUBST(FDMENU) AC_PATH_PROG(UPDATE_DESKTOP, update-desktop-database, "no") if test "${UPDATEDATABASES}" != "no" -a "${UPDATE_DESKTOP}" != "no"; then INSTALLDATA="$INSTALLDATA install-update-menu" AC_SUBST(UPDATE_DESKTOP) fi fi fi AC_ARG_WITH(freedesktop_org-mime, AC_HELP_STRING([--without-freedesktop_org-mime],[disable freedesktop_org mime, use --with-freedesktop_org-mime=/path to override the default location /usr/share/mime]),[ FDMIME=$withval ],[ FDMIME=yes] ) if test "${FDMIME}" != "no" ; then if test "${FDMIME}" = "yes" ; then echo -n "checking freedesktop.org mime directory... " if test -d /usr/share/mime ; then FDMIME=/usr/share/mime else if test -d ${prefix}/share/mime ; then FDMIME=${prefix}/share/mime else if test -d /usr/X11R6/share/gnome/mime ; then FDMIME=/usr/X11R6/share/gnome/mime else if test -d ${prefix}/share/gnome/mime ; then FDMIME=${prefix}/share/gnome/mime else FDMIME=no fi fi fi fi echo ${FDMIME} fi if test "${FDMIME}" != "no" ; then INSTALLDATA="$INSTALLDATA install-fdmime" AC_SUBST(FDMIME) AC_PATH_PROG(UPDATE_MIME, update-mime-database, "no") if test "${UPDATEDATABASES}" != "no" -a "${UPDATE_MIME}" != "no"; then INSTALLDATA="install-update-mime $INSTALLDATA" AC_SUBST(UPDATE_MIME) fi fi fi AC_ARG_WITH(gnome2_4-mime, AC_HELP_STRING([--without-gnome2_4-mime],[disable gnome2.4 mime install, use --with-gnome2_4-mime=/path to override the default /usr/share/mime-info]),[ GMIMEINFO=$withval ],[ GMIMEINFO=yes] ) if test "${GMIMEINFO}" != "no" ; then if test "${GMIMEINFO}" = "yes" ; then echo -n "checking gnome 2.4 mime-info directory... " if test -d /usr/share/mime-info ; then GMIMEINFO=/usr/share/mime-info else if test -d ${prefix}/share/mime-info ; then GMIMEINFO=${prefix}/share/mime-info else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/mime-info ; then GMIMEINFO=/usr/X11R6/share/gnome/mime-info else if test -d ${prefix}/share/gnome/mime-info ; then GMIMEINFO=${prefix}/share/gnome/mime-info else GMIMEINFO=no fi fi fi fi echo $GMIMEINFO fi if test "${GMIMEINFO}" != "no" ; then AC_SUBST(GMIMEINFO) INSTALLDATA="$INSTALLDATA install-gnome-2.4-mime" fi fi AC_ARG_WITH(gnome2_4-appreg, AC_HELP_STRING([--without-gnome2_4-appreg],[disable gnome2.4 application-registry install, use --with-gnome2_4-appreg=/path to override the default /usr/share/application-registry]),[ GAPPREG=$withval ],[ GAPPREG=yes] ) if test "${GAPPREG}" != "no" ; then if test "${GAPPREG}" = "yes" ; then echo -n "checking gnome 2.4 application-registry directory... " if test -d /usr/share/application-registry ; then GAPPREG=/usr/share/application-registry else if test -d ${prefix}/share/application-registry ; then GAPPREG=${prefix}/share/application-registry else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/application-registry ; then GAPPREG=/usr/X11R6/share/gnome/application-registry else if test -d ${prefix}/share/gnome/application-registry ; then GAPPREG=${prefix}/share/gnome/application-registry else GAPPREG=no fi fi fi fi echo $GAPPREG fi if test "${GAPPREG}" != "no" ; then INSTALLDATA="$INSTALLDATA install-gnome-2.4-appreg" AC_SUBST(GAPPREG) fi fi AC_ARG_WITH(icon-path, AC_HELP_STRING([--without-icon-path],[do not install icon in /usr/share/pixmaps/, use --with-icon-path=/path to override the default path]),[ ICONPATH=$withval ], [ ICONPATH=yes ]) if test "x$ICONPATH" != "xno" ; then if test "x${ICONPATH}" = "xyes" ; then echo -n "checking icon path... " # the default answer is yes, so this is for users that did not use theicon-path option at all if test -d /usr/share/pixmaps ; then ICONPATH=/usr/share/pixmaps else if test -d ${prefix}/share/pixmaps ; then ICONPATH=${prefix}/share/pixmaps else # FreeBSD defaults to: if test -d /usr/X11R6/share/gnome/pixmaps ; then ICONPATH=/usr/X11R6/share/gnome/pixmaps else if test -d ${prefix}/share/gnome/pixmaps ; then ICONPATH=${prefix}/share/gnome/pixmaps else # the user did not specify an icon-path, and the default path seems to be wrong for this system # we will not install an icon ICONPATH=no fi fi fi fi echo $ICONPATH fi if test "${ICONPATH}" != "no" ; then AC_SUBST(ICONPATH) INSTALLMAIN="${INSTALLMAIN} install-icon" INSTALLDATA="${INSTALLDATA} install-icon" fi fi pkgdatadir=${datadir}/${PACKAGE}/ AC_SUBST(pkgdatadir) dnl ******************************* dnl GETTEXT dnl ******************************* AM_GNU_GETTEXT AC_PATH_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge) if test ! -x "$GMSGFMT" ; then echo "no gmsgfmt - NLS disabled" USE_NLS=no fi if test ! -x "$MSGFMT" ; then echo "no msfmt - NLS disabled" USE_NLS=no fi dnl OpenBSD has gettext in -lintl if test "$USE_NLS" = "yes" ; then AC_CHECK_LIB(intl, gettext, LIBS="$LIBS -lintl" ) AC_DEFINE(ENABLE_NLS) INSTALLMAIN="${INSTALLMAIN} install-nls" MAKEMAIN="${MAKEMAIN} make-nls" fi # kyanh ################################ AC_ARG_ENABLE(unikey-fix-gtk, AC_HELP_STRING([--enable-fix-unikey-gtk],[(Vietnamese) fix a BUG related to UniKeyGTK]),[ AC_DEFINE(ENABLE_FIX_UNIKEY_GTK) ],) AC_ARG_ENABLE(column-marker, AC_HELP_STRING([--enable-column-marker],[enable column markers]),[ AC_DEFINE(ENABLE_COLUMN_MARKER) ],) #AC_ARG_WITH(vte-terminal, # AC_HELP_STRING([--with-vte-terminal],[enable VTE terminal]),[ # echo -n "checking for vte... " # if pkg-config --exists vte; then # LIBS="$LIBS `pkg-config --libs vte`" # CFLAGS="$CFLAGS `pkg-config --cflags vte`" # AC_DEFINE(HAVE_VTE_TERMINAL) # echo "yes" # else # echo "no" # fi # ],) # kyanh ################################ AC_SUBST(INSTALLDATA) AC_SUBST(INSTALLMAIN) AC_SUBST(MAKEMAIN) AC_CONFIG_FILES(Makefile icons/Makefile src/Makefile data/Makefile po/Makefile man/Makefile) AC_OUTPUT winefish-1.3.3/README0000600000047200004720000000153110373113667013217 0ustar kyanhkyanhWinefish LaTeX Editor (based on Bluefish) Some features: Autotext support Autocompletion support Command collector Multiple encodings support A custom menu, specify your own tags or sets of code, and define your own dialogs Customizable syntax highlighting based on Perl Compatible regular expressions, User customizable integration of many programs, including latex, pdflatex,... Custom search and replace pattern support for the Custom menu Wizards for startup, tables, list and others Starting Winefish: run from the command line: winefish run winefish -h for more startup options Documentation: see ./doc/winefish.html Homepage: http://winefish.berlios.de/ http://winefish.viettug.org/ http://winefish.sourceforge.net/ Mailinglists: (devel) winefish-devel@lists.berlios.de (user) winefish-users@lists.berlios.de winefish-1.3.3/doc/0000700000047200004720000000000010414700277013075 5ustar kyanhkyanhwinefish-1.3.3/doc/winefish.html0000600000047200004720000004001010414700277015574 0ustar kyanhkyanh Winefish Documentation

Winefish 1.3.2 Documentation

CONTENTS top

THANKS top

Special THANKS to Michèle Garoche for correcting some typo errors in previous version of this document.

FEATURES top

INSTALLATION top

Read INSTALL

INPUT METHOD top

Input Method is not a function of Winefish.

Right click on the document. In the context menu, goto Input Methods and choose your favorite input method. These various methods are selected from your system, not provided by Winefish.

NEWS top

Some new features: any many more. See NEWS and CHANGES for details.

IMPORTANT NOTES top

Winefish now uses $HOME/.winefish/rcfile to save configuration. Move the old one $HOME/.winefish/rcfile_v2 to $HOME/.winefish/rcfile manually, then reconfigure Winefish (use Preferences Pages.) Please take care of following properties:
  • Editor / Highlighting Syntax by Default
  • Files / Create Backup On Save
  • Users Interface / *
  • TeXbox / Save, Show
  • Miscellaneous / Templates Directory
If you do not move $HOME/.winefish/rcfile_v2 to $HOME/.winefish/rcfile, winefish will start with default settings and of course ignore your old ones.

There is also new color scheme for hilighting. Backup then remove your $HOME/.winefish/highlighting to enjoy the new one.

HOTKEYS: EDITING top

  • Start "autocompletion": control + Space
  • Start "autotext": shift + Space
  • Update syntax highlighting: meta + Space
  • Go to a line: control + /
  • Start a numbered section: control + {0,1,2,3,4,5,6}
  • Start an unnumbered section: control + meta + {0,1,2,3,4}
  • Insert an image: control + I
  • Insert a table or array: control + T
  • Insert a list: control + L
  • Insert `verbatim': shift + control + V, shift + control + meta + V
  • (Un)comment selected text: control + %, control + meta + %
  • Increase/Decrease Indent: control + , / control + .
  • Insert source separator: control + =
  • Delete the first char of each line in the selected text: control + <
  • Delete current line: control + K
  • Templates manager: control + meta + shift + F
  • Advanced Find in Files: control + meta + F
  • Brace Finder: control + ], control + [

HOTKEYS: COMPILING top

By default, Winefish requires LaTeX, xdvi and xpdf. You may change these from Preferences Page.
  • Convert to DVI format: F1
  • View DVI document (with DVI SYNC): control + F1
  • Convert to PDF: F2
  • View PDF document: control + F2
  • Stop running tools: Escape
If you are working in project mode, by default, the above tools will start in the base directory and file of the project.

If you want to compile the current document, NOT the base document of the project, you may use control + ESC to turn project mode ON/OFF, *OR* select menu External/Project Mode

PROJECT MODE top

  • Each project requires a base directory and a base file
  • The "base file" must be located in "base directory"
  • Project's files should be located in "base directory"

DOCUMENT STRUCTURE top

In order to get the document structure, you may try this:
  • Press control + F to start the search engine
  • Type exactly the following string:
    ^\\(sub){0,2}section.*?$
  • Select PERL type as type (regular expression)
  • Select Bookmark Results
  • Press OK.

AUTOTEXT top

If $HOME/.winefish/autotext has not been modified, you may try to open a new document, type the string /tsta then press shift + Space. Other tests are /tstd, /tstc and /tstd.

You may modify the file $HOME/.winefish/autotext. You should not try to modify it directly, as Winefish will override it when existing. But you could modify it from the Preferences Page, Automation panel. As long as you click on Apply after editing it, the changes will survive exiting. The contents are similar to
att: /tsta:\\begin{foo\n:\n\\end{foo:
att: /tstb:\\begin{this-is-b\n:\n\\end{this-is-b:
att: /tstc:\\testofsomething::
att: /tstd:: Can you see?:
Each line is of the form:
att: /foo:begin:end:
where /foo is the new definition which must be started by a slash /. The string begin will be inserted before the cursor, the string end will be inserted after the cursor.

Here are some rules:
  • Length of /foo should be at most AUTOTEXT_MAX_LENGTH (defined in src/config_spec.h)
  • one of the two strings `begin' and `end' should not be NULL.
  • If foo is defined twice or more, for e.g.,
  • only the first one is used.
  • some special characters must be escaped:
    • \n for the new line
    • \t for a tab
    • \: for a colon
    • \\ for the backslash

AUTO_COMPLETION top

Press control + Space to start autocompletion. You may delete a word from popup menu press Delete, or from Preferences page.

The words are saved in $HOME/.winefish/words. You should not try to modify it directly, as Winefish will override it when existing. But you could modify it from the Preferences Page, Automation panel. As long as you click on Apply after editing it, the changes will survive exiting.

When you're typing, Winefish collects LaTeX commands and add them to list of known words. If there's a bad command, you may `delete' it directly from PopUp menu.

A command will be added to completion list if its length is:
  • greater than 2
  • less than or equal COMMAND_MAX_LENGTH (defined in src/config_spec.h)
You may add commands by using Preferences Pages / AutoX but this is not recommended as Winefish collects commands automatically and Preferences Pages / AutoX will be dropped some day.)

COMMANDLINE OPTIONS top

$ winefish -h
winefish 1.3.2.6 LaTeX editor
Usage: winefish options filenames ...
Currently accepted options are:
-s skip root check
-v current version
-n 0|1 open new window (1) or not (0)
-p filename open project
-l number set line number. Negative value takes no effect.
-h this help screen

OUTPUTBOX top

When you start a tool, start `Grep Function' (control + meta + F), or start listing your templates (control + meta + shift + F), the results are shipped out to a Outputbox.

There are some useful operations with Outputbox:
  • single-click: open file at specified line
  • right-click: create a popup menu
  • control + click: clone file (create a new file with the same contents)
You may press shift + Escape to hide/show the Outputbox.

TEMPLATES SUPPORT top

Go to Preferences Pages / Miscellaneous and specify the directory which contains your templates. By default, it is $HOME/tex/templates.

The template file is of type *.tex or *.sty. Each template *MUST* contain the pattern %%wf=. This helps you writing description for templates. For e.g.,
%%wf=this is a template file
%%wf=this is the template's description
\documentclass{article}
...
To list all your template files, press control + meta + shift + F. You may also use the menu Edit/Find, Replace/Templates. Then press control + click to create a clone file (See OUTPUTBOX)

Winefish does not clean up the %%wf= string automatically.

BRACE FINDER top

If your editor cursor is placed beside a brace ( $, (, ), {, }, [, ] ), you may want to find the matching one. Just press control + ] (forward) or control + [ (backward). Here are the rules:
  • escaped characters will be ignored
  • characters in comment line will be ignored
  • for $, control + ] starts forward-finding the matched $.
  • for $, control + [ starts backward-finding the matched $.
  • for other braces:
    • forward: starts finding the matching for current brace.
    • backward:
      • if the characters on the left hand is a brace too, start finding the matching for it;
      • otherwise, treat as forward.
  • for other characters:
    • forward: start finding }
    • backward: start finding the {
The brace finder also starts its job automatically when you're editing: the matched braces will be highlighted. For performance reason, the finder will search in a limited area. The maximum number of lines of this area is defined via BRACE_FINDER_MAX_LINES (src/config_spec.h).

NOTE: when a key is pressed and is not released yet, the color of matching braces is dropped. This causes FLASH effect. This is an unwanted-effect which takes place naturally after fixing the BUG#87. I (kyanh) found this is quite nice stuff. Please give comment via forum (http://winefish.berlios.de/forum/).

LOCALE SUPPORT top

There are English, French, Italian and Vietnamese translations. For e.g.,
$ LANG=vi_VN winefish # start winefish with Vietnamese frontend
$ LANG=it_IT winefish # for Italian users
$ LANG=fr_FR winefish # for French users

TIPS top

  • Press shift + control + Escape to hide/show the Sidebar.
  • Press shift + Escape to hide/show the Outputbox.
  • Press control + I to insert an image.
  • Doubleclick on an image in the file browser.
  • Long line should be split into shorter ones. (I have a file with a very long line. I tried to open it in Emacs, KDE applications, Bluefish and Winefish. Only the *fishes make me annoyed! The cursor moved very very slowly when it was inside that line. (I do not know whether this problem occurs with other GTK applicatons))
  • To open a file in existing running Winefish at specific line, try for e.g.
    winefish -n0 -l 12 foobar.tex blablabla.tex
    If you specify multiple files, all are opened at the same line numbered :)
  • What does Winefish mean?
    • Winefish = Wine + fish = to be drunk (Oops, I can't drink)
    • Winefish = White fish (white not blue)
    • Winefish = Why fish? See About

COLUMN MARKER top

Column marker is a vertical line which is positioned at a specific line number. This marker helps you find easily the document's blocks. The feature is inspired from EditPlus but it seems to make people annoyed. So the feature is disabled by default. You can turn it on via the option --enable-column-marker when running configure script.

There are 3 markers what you can specify from Preferences Page / Miscellaneous. The zero value is equivalent to disabled.

ABOUT top

I am a vietnamese who loves maths, music and of course winefish ;)

Please write my name with lowercase characters -- kyanh -- as it is my *nix* name... and it's very hard to write the vietnamese one ;(




This HTML file was generated from winefish.txt by k2h program.
$Id: winefish.txt 2267 2006-03-27 23:30:41Z kyanh $
winefish-1.3.3/images/0000700000047200004720000000000010414700277013575 5ustar kyanhkyanhwinefish-1.3.3/images/winefish_splash.png0000600000047200004720000001342710373352236017504 0ustar kyanhkyanhPNG  IHDRTFlbKGD pHYs  tIME;3k(#tEXtCommentCreated by Waldo Web DesignuIDATx{\Teaf`.#xZ%*)IB^¬\shjvQ1,D[jj f/_~.ٶmj:t(VTT}_CC;~6A9Sǘ1c,ѣܽz7{3װAAAxq7on$6OcbbΝ{W__=ve4?9r;>|8s}РAQ˗ ___̄\ؽ{weĈׯx]7nܵvK:?]~ĉ,F}||FZ!==~iɁz &Nh@&O?mQ=gsڵk LumM ==<ȝ'0fAUVkUUU/WSNeKJJ`Æ  COSXXȬICYYrY0(--۷oW/W޽V^ pvBggiT*˳Ky>xG p P(֭\"pr`|}}G֭[F#>8q.] {5TDK.7N&NGGj̛7`\GGGq=32e SGKl_4:mٲ믿ݢN}yQ*!C`ӦMLضm`ŊySSL4 ڸ0Nsνg؞Lljyyy9sДرcpE|ܸq=+Wkzf I$xxxj:N_K/f͂hw޹Ν;}2{~ʏX[[ k(ˍ.\ "0q~GAkעBHtvoߎ (QTbjj*F܌_166J%bT-‹/ 9~88|D\0$$r9J$ ŭ[UDN,..3f`tt4jZtvvFd?SSRt뇙”oř3gAP* ~zlii1+NH$6MI>C1ePTꫯ ށ>~f;v߸qx FB燙8ydkHQVD"AFnnnr WZ%(Kcc#all,T*8`|?Q.}݇G}&LJjqƍ}lq<<>>xUANt[^B%%%=~E&*1 x) F~? }B9sOxW8f͂~;wvvdK.zꫯ 11f̘탊 _hh(ĀJB0i$pDBmmmehii1S,ѣё[Aӳ> c4 <àR`h\Gcʕ+!++K ;wT~Rqhiia#<PUUǎ82سg={_{̦̫d28;;3mlZAJJ ܹZ[[ð{nHNN6a9ffҥK}k Ν;ٳٳ`޽XVVƄ͙3ᛜ𧲶P uuusZ'00Ϟ=]/**°0&ѣGkw Ffi]t}.5 O8URC֭[̵ ĉ4_$+¬r?i,Cijj¨(3quulG?HJ%jZ:t(='O3g W_}eJass3ǚ5k,Zcw&СC_宗5O3rrr^pwG)))\!G x&<..w߿f.\0 R)*_bcc#am-(sORSSMڴRv|=Pz)e˖ 7y_;6{@~04MUVjͳMKKW*G߮'*_6D",/ŋzء{|0[}y|Dpuu5ȑ#QQQ&QQQh"&/ r2dddd-;T~ɓܹ?L2;~777áC3fج<==!;;۬Ν~롩t:TTT@aa!#GBYY`㐖PSSm*ʪ7;v<#`plȎ=e7߄3a!?? [h|}Fp{,?3;22;ޅ1D\-\ZmT#FGG\gF[|uQo ǏLmn޼i0 F .sAaa!i F555a~\#GH$`A8MV3z]Y`2wSJWc/شiLؤI`Ŋ0uTf`SL^H=^U ^Ȟ;$*Tgggr777d*1n8|uǐ2UAwWe˖1K F( "6ֹuj .j:s81fSTTTc(..3f:͛7snݺuLN>m7SxKZ.))U64GD8tQ=PFL6Mh;ӧۥ,z}5.7QZ @BB?^3g8p3Lxx8ڵI6nȤo|׏i{kfD]?|I4͵IfYBr,XKoa0{ߐΜC$ayy9gj(**bl>\bV}&Ϝ9m^ׁmٲ!HB}GsXh67_gfSQQQj|2ߨ[,s.-]Ԡ믿.͛L|v|Q,|)))?ʠ0[Uׯ?'Nd nԩp [WWWuRR/?fee7zZh> SN]ke R׿ʯyfjڦwKs}%K02ݡ7'McaÆuly% ;N1ڽP>2iZc͚5(1<<+W "PNN:;;cDD;wNp~ bLL j(qذa8gBNر455UpԨQ쌡8m46mBwww vtRT*˗/Y_|{1T\066322pɒ%XXXȌ qMxCż}vLLLDwwwtttD>}:VWWg(0**ʤ!!Çb1=AwR=ރ#Fpr *Aa&AP HAB% HAB% JA  JA *AA *A)T RA)T RAP HAP HA?FY4IENDB`winefish-1.3.3/TODO0000600000047200004720000002611410404561742013027 0ustar kyanhkyanh$Id: TODO 2132 2006-03-11 14:51:14Z kyanh $ * Glib 2.6: use g_stat() instead of stat(), g_unlink() instead of unlink() * Move template_rescan_cb() from func_grep.c to menu.c (make it static) * Optimize usage of GET_BIT * implement message box (not statusbar_message); * windows/close all others /done/* add option: save file before run tool (outputbox) * gtk2.4: gtk_combo_* => gtk_combo_box_* /done/kyanh/200507/19/* add '~', '\~' /done/* add line number in lines of table /done/kyanh/200601xx/* Document: HTML version (tex4ht: bad!) * Optimized document.c::(gap_command) /none/* Use VTE to emulate the console * capture: \usepackage{foobar} /done/kyanh/200507xx/* Move 'project_mode' from main_v to project's properties * increase the length of command recognized by collector /done/* add vertical rule [ col 79 ] [ ~ EditPlus, column marker ] /done/kyanh/2005071x/* reformat: table, split, array,... * (Outputbox) scroll the output as option. For 'cat', scrolling will slow down Winefish. * Join list: pcre, glib, gtk+ * common/exported syntax hilight * optmized the use of GtkTextIter /none/kyanh/20050718/* show Sidebar as default * Backspace doesnot start autocompletion /done/* smooth the Fish (splash, logo) * project: various main files support * update chars: should add 'backspace' /done/kyanh/20050714/* tex hilight: add special chars: \;, \,, \!, etc. * autocompletion: customizable 'start/stop' regular expresion /done/* option to turn autocompletion on/off * code folding /done/* outputbox: popup menu /done/kyanh/20050703/* colorize the outputbox [ the 3rd column ] * bookmarks by name/groups /done/* brace recognize * import/export hilight configuration /none/* merge user/system configuration: words, autotext, * bookmarks moveup/do /none/* natural table for context /done/* outputbox: use g_spawn_async_with_pipes() to start command * dropdown autotext list * dropdown menu should have the background color customizeable. /done/* hilight current line /done/* new document from template * color scheme * TOOLS - latex - metapost - dtx [*.dtx, *.ins] - style [latex package] - metafont - normal file - bibtex - xml file * expandsion: file extension [*.tex and *.dtx] * METAFONT support * indent the contents for \(sub){0,2}section*, \chapter*, etc * set READNONLY for files with '-r' permission /done/kyanh/20050706/* line number recognizer <== for outputbox ... on input line 117 ... at lines 302 -- 303 /done/kyanh/20050614/* vntex support as an optional [configure] /done/* template support * date format support /done/kyanh/20050613/* indent latex code * creating a new project should create the new files too. Currently, we cannot enter the new basefile for the new project * start folder sometime failed * Completion word, not only latex command [like KILE, KDevelop] /none/kyanh/20050613/* press 'Enter' to start 'environment' completion [Kile's Style] * Add more reconigzer for LaTeX Error !File ended while scanning use of \eqref /done/kyanh/20050501/* Modified layout of "Split" environment /done/kyanh/200506xx/* Version numbering needs change /done/kyanh/20050606/* Re-setup the Home page * METAPOST support /none/* Autoclose the OutputBox (require timeout) /unknown/* Upgrade to winefish-1.0.1 (filebrowsers, func-ref). Then modify the func-ref [for package commands, for example] /done/kyanh/20050323/* Completion Window: Down Key should not move to top of popup window /done/kyanh/20050323/* PageUp/PageDown in completion popup window * Add autotext to completion [see KDevelop] * READONLY files couldnot be changed ? * Use to describe system of menus [as recommendation of GTK doc.] * test: autotext <:(> autocompletion * closing Winefish if the last file of project is removed. ... i don't like it... stupid sometimes /done/kyanh/unknown/* moving names: autocompletion => completion /none/kyanh/20050323/* the title of winefish [user's selection] * plugins support ? [see gedit :)] See Bluefish Mailing List * add grep tools (see kdevelop) * add IDLE to collect users input macros [ or *cache* support ] * win32 port [but i hate win32] * Hyperref support for *label* and *ref* * Image for preference page of `autox' /none/* Added timeout/autoclose the outputbox /done/kyanh/20050317/* Preferences/Autotext: sort, lookup /done/* Get position of cursors [not the mouse] * File Types: dtx, cls, context (+detection) /done/kyanh/20050317/* Autotext Lookup (in preferences page) /none/* ./configure: check for xdvi, xpdf, latex, /bin/sh /done/kyanh/20050315/22:54/* Added preferences for Autotext /done/kyanh/20050313/* Remove C++ comment style (//) [GTK recommended] /none/kyanh/20050614/* Implement "Ctrl+K" as Emacs does [delete to the end of line] I wonder if i could implement an Emacs keyboard layout? /none/* ConTeXT support /done/kyanh/20050314/* add about.c::THANKS /done/kyanh/20050302/* Using g_io_channel() NOT gdk_input_* for outputbox.c /done/kyanh/20050316/* Add Cleanning-Tools /none/kyanh/20050316/* Add comment support for resource files /done/kyanh/20050302/* Remove VnTeX support from NewDocument Wizard. Vietnamese... others? /done/kyanh/20050302/* Move DVIPDFM downward * Join C++ Forum /done/kyanh/20050314/* English version of 'doc/winefish.tex' (documentation) /done/kyanh/20050301/* scroll outputbox to the end of message box /done/kyanh/20050228/* StatusBar: Project Mode /50%/done/kyanh/20050302/* autocompletion [version 1.1] /80%/done/kyanh/20050310/ sick, 'autocompletion' is different from 'autotext' /done/TODO: using 'g_hashes' for looking up (key,value) /90%/done/kyanh/20050311/ /done/TODO: free variables after use. /100%/done/kyanh/20050313/ /done/kyanh/20050223/* tex syntax * xml version of latex,ams packges [DOCUMENTATION] /none/* filetype: log /none/* filetype: aux,bl, etc * add support for bib. * tools: bibtex, makeindex /done/bluefish/* project: cd [basedir] /done/kyanh/20050220/* command parsing [%F, %D, %d, %f, %b, %c] /done/kyanh/20050222/* expandsion: %c [HOWTO get the current line?] /none/kyanh/20050309/* expandsion: add %e OR NOT? [file extension, useless in many case] /done/kyanh/200507xx/* open file at a specified line Do this in Winefish 1.2.1 :) /none/* add toolbars * intelligent syntax highlight for latex [special design] /done/kyanh/200503xx/* documentation /done/kyanh/20050228/* setup home page /done/kyanh/200506xx/* setup cvs server [home page at source forge net] Project page was moved to Berlios.de. Thanks for a great host! /done/kyanh/20050225/* setup sf.net account /done/kyanh/20050228/* setup lists for users /done/kyanh/20050220/* logos /none/* images, 15x15 toolbar images /done/kyanh/20050226/* THANKS Bluefish's AUTHORS /none/* debian, slackware, redhat support /done/kyanh/200507xx/* VI- translation. Download kabael /failed/kyanh/20050222/* fixbug: Insert/New Document [compare two version of doc_insert_two_strings] two versions are the same; don't know why Insert/New Document cannot work correctly with SELECTION /done/kyanh/20050222/* intelligent HOTKEYS selection hope the... this selection fits you * fixbug: UNDO/REDO for autoclosingtag() * latex/custom menus /done/kyanh/20050223/* copyright notices (for ./src/*.{c,h}) /unknown/* multiple/single instance of winefish /unknown/* icons /done/kyanh/20050228/NOT_A_BUG/* fixbug: autoclosingtag still works although we turn it off * syntax: for sty, for tex (differs?) /done/kyanh/20050223/* xdvi: source browsers: [xdvi -sourceposition filename ] /done/kyanh/20050223/* latex: -src-specials /done/kyanh/20050303/* remove: html_form2.* /done/kyanh/20050303/* remove: html_form.* /done/kyanh/20050303/* remove: cap.c and cap.h (completely unused) /done/kyanh/20050222/* expandsion: %c: currentline /failed/kyanh/20050223/* use instead of in /done/* add "STOP TOOLS" (require IOChannel; study code from SciTE) /done/kyanh/20050221/* add : Project/Single File MODE /done/kyanh/20050220/THANKS SciTE/* HOWTO stop LaTeX? Sometimes LaTeX needs to be feed... /done/kyanh/20050223/* remove unusefull g_print() :) /done/kyanh/20050221/* SHIFTLEFT the 0.1 in the logo /done/kyanh/200503xx/* remove estrl_dialog () /done/kyanh/20050321/* glib: utils: autocompletion /done/kyanh/20050223/* move LOGO (Winefish Layer) to right (slightly :) /done/kyanh/200507xx/* hightline the OUTPUT BOX (see SciTE :) /done/kyanh/20050222/* [Bluefish1.0:] it saves settings only at the end of session [ This means that, if we customize Bluefish1.0, do somethings, then make the program crashed, then we lost everythings. I had tried to add and test syntax hightlighting for LaTeX and finally got a ZERO :(( ] Add "rcfile_save_all();" to "preferences.c::preferences_apply_clicked_lcb()" /done/kyanh/20050316/* add HOTKEYS/MENU to SHOW/HIDE the OUTPUT BOX We should Show/Hide, NOT Show/Destroy [like winefish 1.1.0] * optimize expandsion (pre-calculate the basedir, basename) functions: view_in_browsers(menu.c), (...)outputbox.c * MenuGO: goto the main document (basedir/basefile) of project /done/kyanh/20050222/* changedir (outputbox, view_in_browser): change to project folder :) * split the job (output commands); sometimes we needs the output before starting xdvi. DONOT use [latex && xdvi] in Viewers... ref.: Scite/ExcuteNext() /done/kyanh/20050223/* LOGO: change \author{VietTUG} to \author{KyAnh\and...} /done/kyanh/20050222/* External Commands: Hotkeys /none/* Outputbox: shouldNOT be show if running tools was canceled. /none/* Show TOOL progress (easy, but lower performance) * add: set file in READONLY MODE * syntax problem: [currently NOT implement this feature] if we define "group-single"="{[^{}]+}" then (unfortunately), the percent in \foo{asdf %} willNOT be treated a comment starter. /done/kyanh/2005022/* fixbug: menu Insert/.../Verbatim/ /none/kyanh/20050316/* dialog for inserting an environment /done/kyanh/200502xx/* HOTKEYS: Ctrl+Space "Update Highlighting" +... AutoclosingTAG!!! I removed GDK_space for document.c:: /done/kyanh/20050222/* fix MIME types for Winefish /done/kyanh/200503xx/* remove Bluefish' VFS Implementations [for performance] * the source specials ARENOT ALWAYS of the form %c%b.tex Sometime, it should be: %c%b.tex Determination of is hard problem? ==> SO IN THIS VERSION OF WINEFISH, the files we include should be located in the same directory with the BASEFILE * add DATE format (dynamic/preference) [like Win32/EditPlus] this feature is not very important but necessary. should implement this in some minor version * some behaviour from Abiword: image previous IN FILE CHOOSER (very good) * add drop-down list in the toolbar [See Abiword] /done/kyanh/20050301/* problem: syntax highilight: VERBATIM cannot be nested Verbatim Environment cannot be nested. OF COURSE. So i did NOTHING :) for latex syntax file. /none/kyanh/20050316/* Study LyX and/or Tk-LaTeX Editor (freshmeat.net) /done/kyanh/200506xx/* Study ConTeXt /done/kyanh/200507xx/* Check for running instances /done/kyanh/20050227* Capture the ExitStatus, ExitSignal of External Command * hotkey to to5Aggle Bookmark ============================================================== [EOF] winefish-1.3.3/data/0000700000047200004720000000000010414700277013241 5ustar kyanhkyanhwinefish-1.3.3/data/winefish.keys0000600000047200004720000000140410372323160015746 0ustar kyanhkyanhtext/xml short_list_application_ids_for_novice_user_level=winefish short_list_application_ids_for_intermediate_user_level=winefish short_list_application_ids_for_advanced_user_level=winefish text/x-tex short_list_application_ids_for_novice_user_level=winefish short_list_application_ids_for_intermediate_user_level=winefish short_list_application_ids_for_advanced_user_level=winefish application/winefish-project description=winefish project [fr]description=Projet Winefish default_action=application icon_filename=gnome-application-winefish-project.png short_list_application_ids_for_novice_user_level=winefishproject short_list_application_ids_for_intermediate_user_level=winefishproject short_list_application_ids_for_advanced_user_level=winefishproject winefish-1.3.3/data/autotext.in0000600000047200004720000000022610372323160015443 0ustar kyanhkyanhatt: /tsta:\\begin{foo}\n:\n\\end{foo}: att: /tstb:\\begin{this-is-b}\n:\n\\end{this-is-b}: att: /tstc:\\testofsomething:: att: /tstd:: Can you see?: winefish-1.3.3/data/Makefile.in0000600000047200004720000000650310372323160015307 0ustar kyanhkyanh# Makefile for data files # Copyright (C) 2002-2004 Olivier Sessink PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = /bin/sh top_srcdir = @top_srcdir@ top_builddir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ pkgdatadir = @pkgdatadir@ datadir = @datadir@ localedir = $(datadir)/locale GNOME1MENU=@GNOME1MENU@ FDMENU=@FDMENU@ FDMIME=@FDMIME@ UPDATE_DESKTOP=@UPDATE_DESKTOP@ UPDATE_MIME=@UPDATE_MIME@ GMIMEINFO=@GMIMEINFO@ GAPPREG=@GAPPREG@ ICONPATH=@ICONPATH@ INSTALLDATA=@INSTALLDATA@ HAVE_GNOME_VFS=@HAVE_GNOME_VFS@ INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_DATA = ${INSTALL} -m 644 DEFAULTFILES = highlighting.default filetypes.default encodings.default custom_menu.default autotext.default words.default FUNCREFFILES = funcref_symbols.xml funcref_packages.xml funcref_bib.xml .SUFFIXES: .in .default .in.default: sed -e 's!PKGDATADIR!$(pkgdatadir)!' < $< > $@ all: $(DEFAULTFILES) sed -e 's!ICONDIR!$(ICONPATH)!' < winefish.desktop.in > winefish.desktop sed -e 's!ICONDIR!$(ICONPATH)!' < winefish-project.desktop.in > winefish-project.desktop if test "x${HAVE_GNOME_VFS}" = "x1" ; then \ sed -e 's!EXPECT_URIS!true!' -e 's!SUPPORTED_URI_SCHEMES!file,http,ftp,sftp,smb!' < winefish.applications.in > winefish.applications ;\ else \ sed -e 's!EXPECT_URIS!false!' -e 's!SUPPORTED_URI_SCHEMES!!' < winefish.applications.in > winefish.applications ;\ fi install-gnome1-menu: $(INSTALL_DIR) $(DESTDIR)$(GNOME1MENU) $(INSTALL_DATA) winefish.desktop $(DESTDIR)$(GNOME1MENU) $(INSTALL_DATA) winefish-project.desktop $(DESTDIR)$(GNOME1MENU) install-fdmenu: $(INSTALL_DIR) $(DESTDIR)$(FDMENU) $(INSTALL_DATA) winefish.desktop $(DESTDIR)$(FDMENU) $(INSTALL_DATA) winefish-project.desktop $(DESTDIR)$(FDMENU) install-update-menu: $(UPDATE_DESKTOP) install-fdmime: $(INSTALL_DIR) $(DESTDIR)$(FDMIME)/packages $(INSTALL_DATA) winefish.xml $(DESTDIR)$(FDMIME)/packages install-update-mime: $(UPDATE_MIME) $(FDMIME) install-gnome-2.4-mime: $(INSTALL_DIR) $(DESTDIR)$(GMIMEINFO) $(INSTALL_DATA) winefish.mime $(DESTDIR)$(GMIMEINFO) $(INSTALL_DATA) winefish.keys $(DESTDIR)$(GMIMEINFO) install-gnome-2.4-appreg: $(INSTALL_DIR) $(DESTDIR)$(GAPPREG) $(INSTALL_DATA) winefish.applications $(DESTDIR)$(GAPPREG) install-icon: $(INSTALL_DIR) $(DESTDIR)$(ICONPATH) $(INSTALL_DATA) gnome-application-winefish.png $(DESTDIR)$(ICONPATH)/gnome-application-winefish-project.png install: all $(INSTALLDATA) $(INSTALL_DIR) $(DESTDIR)$(pkgdatadir) for file in $(DEFAULTFILES) ; do \ $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir) ;\ done for file in $(FUNCREFFILES) ; do \ $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir) ;\ done uninstall: rm -f $(FDMIME)/packages/winefish.xml rm -f $(GMIMEINFO)/winefish.mime rm -f $(GMIMEINFO)/winefish.keys rm -f $(GAPPREG)/winefish.applications rm -f $(GNOME1MENU)/winefish.desktop rm -f $(FDMENU)/winefish.desktop rm -f $(FDMENU)/winefish-project.desktop rm -f $(ICONPATH)/gnome-application-winefish-project.png @for file in $(DEFAULTFILES) ; do \ rm -f $(pkgdatadir)$$file ;\ done @for file in $(FUNCREFFILES) ; do \ rm -f $(pkgdatadir)$$file ;\ done clean: rm -f *.default rm -f winefish.desktop rm -f winefish-project.desktop rm -f winefish.applications distclean: clean rm -f Makefile *.rej *.orig *~ winefish-1.3.3/data/winefish.applications.in0000600000047200004720000000061110372323160020065 0ustar kyanhkyanhwinefish command=winefish -n name=winefish can_open_multiple_files=true expects_uris=EXPECT_URIS supported_uri_schemes=SUPPORTED_URI_SCHEMES requires_terminal=false mime_types=text/x-tex,text/plain,tex/xml/* winefishproject command=winefish -p name=winefish project can_open_multiple_files=false expects_uris=false requires_terminal=false mime_types=application/winefish-project winefish-1.3.3/data/funcref_packages.xml0000600000047200004720000000311010372323160017241 0ustar kyanhkyanh Thousands of LaTeX packages canbe downloaded from TUG http://tug.org/ Gói VnTeX được viết bởi Hàn Thế Thành. Gói này cung cấp hỗ trợ tiếng Việt cho TeX -- bao gồm macro và fonts ở nhiều dạng khác nhau. Bạn có thể tải về gói này ở http://vntex.sourceforge.net/ \usepackage[utf8]{vietnam} Dùng bảng mã UTF8 cho tài liệu của bạn. Nếu bạn dùng bản mới nhất của 'ucs' (hỗ trợ unicode cho LaTeX), bạn có thể phải dùng \usepackage[utf8x]{vietnam}. Liên hệ tác giả của VnTeX để biết thêm chi tiết. \usepackage[tcvn]{vietnam} Dùng bảng mã TCVN có nhiều bất tiện. Chẳng hạn bạn không thể thấy trên trình soạn thảo của bạn phần lớn các chữ cái hoa, ví dụ Ấ, Ổ,... Bạn có thể định nghĩa \let\up\MakeUppercase, sau đó dùng \up{â, ổ} để có Ẩ, Ổ. \usepackage[viscii]{vietnam} \usepackage[vps]{vietnam} \usepackage[mviscii]{vietnam} Input Method (Viscii) on MAC winefish-1.3.3/data/winefish.desktop.in0000600000047200004720000000061510373632461017064 0ustar kyanhkyanh[Desktop Entry] Name=Winefish LaTeX Editor Name[fr]=Éditeur LaTeX Winefish Comment=LaTeX Editor based on Bluefish Comment[fr]=Éditeur LaTeX basé sur Bluefish Exec=winefish -n 0 Icon=ICONDIR/winefish-icon.png Terminal=false Type=Application Categories=GTK;GNOME;Application;Editors;Office;Development; Encoding=UTF-8 StartupNotify=true MimeType=text/x-tex;application/winefish-project;text/xml; winefish-1.3.3/data/funcref_symbols.xml0000600000047200004720000000522010372323160017157 0ustar kyanhkyanh For the full list, see "symbols.pdf". You can download this file from CTAN http://ctan.org/. Greek Letters. Contributed by kyanh <kyanh@o2.pl> \alpha \beta \gamma \delta \epsilon \varepsilon \zeta \eta \theta \iota \kappa \lambda \mu \nu \xi \pi \varpi \rho \sigma \varsigma \tau \upsilon \phi \chi \psi \omega \Gamma \Delta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega winefish-1.3.3/data/winefish-project.desktop.in0000600000047200004720000000050510373632461020526 0ustar kyanhkyanh[Desktop Entry] Name=Winefish Editor Name[fr]=Éditeur Winefish Comment=LaTeX Editor based on Bluefish Comment[fr]=Éditeur LaTeX basé sur Bluefish Exec=winefish -n 1 -p %f Icon=ICONDIR/winefish-icon.png Terminal=false Type=Application NoDisplay=true Encoding=UTF-8 StartupNotify=true MimeType=application/winefish-project; winefish-1.3.3/data/winefish.mime0000600000047200004720000000013310372323160015720 0ustar kyanhkyanhtext/xml ext: xml text/x-tex ext: tex sty application/winefish-project ext: wfproject winefish-1.3.3/data/funcref_bib.xml0000600000047200004720000000674610372323160016241 0ustar kyanhkyanh Some samples from TeXMaker @Article{, author = {}, title = {}, journal = {}, year = {}, OPTkey = {}, OPTvolume = {}, OPTnumber = {}, OPTpages = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @InProceedings{, author = {}, title = {}, booktitle = {}, OPTcrossref = {}, OPTkey = {}, OPTpages = {}, OPTyear = {}, OPTeditor = {}, OPTvolume = {}, OPTnumber = {}, OPTseries = {}, OPTaddress = {}, OPTmonth = {}, OPTorganization = {}, OPTpublisher = {}, OPTnote = {}, OPTannote = {} } @InCollection{, author = {}, title = {}, booktitle = {}, OPTcrossref = {}, OPTkey = {}, OPTpages = {}, OPTpublisher = {}, OPTyear = {}, OPTeditor = {}, OPTvolume = {}, OPTnumber = {}, OPTseries = {}, OPTtype = {}, OPTchapter = {}, OPTaddress = {}, OPTedition = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @InBook{, ALTauthor = {}, ALTeditor = {}, title = {}, chapter = {}, publisher = {}, year = {}, OPTkey = {}, OPTvolume = {}, OPTnumber = {}, OPTseries = {}, OPTtype = {}, OPTaddress = {}, OPTedition = {}, OPTmonth = {}, OPTpages = {}, OPTnote = {}, OPTannote = {} } @Proceedings{, title = {}, year = {}, OPTkey = {}, OPTeditor = {}, OPTvolume = {}, OPTnumber = {}, OPTseries = {}, OPTaddress = {}, OPTmonth = {}, OPTorganization = {}, OPTpublisher = {}, OPTnote = {}, OPTannote = {} } @Book{, ALTauthor = {}, ALTeditor = {}, title = {}, publisher = {}, year = {}, OPTkey = {}, OPTvolume = {}, OPTnumber = {}, OPTseries = {}, OPTaddress = {}, OPTedition = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @Booklet{, title = {}, OPTkey = {}, OPTauthor = {}, OPThowpublished = {}, OPTaddress = {}, OPTmonth = {}, OPTyear = {}, OPTnote = {}, OPTannote = {} } @PhdThesis{, author = {}, title = {}, school = {}, year = {}, OPTkey = {}, OPTtype = {}, OPTaddress = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @MastersThesis{, author = {}, title = {}, school = {}, year = {}, OPTkey = {}, OPTtype = {}, OPTaddress = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @TechReport{, author = {}, title = {}, institution = {}, year = {}, OPTkey = {}, OPTtype = {}, OPTnumber = {}, OPTaddress = {}, OPTmonth = {}, OPTnote = {}, OPTannote = {} } @Manual{, title = {}, OPTkey = {}, OPTauthor = {}, OPTorganization = {}, OPTaddress = {}, OPTedition = {}, OPTmonth = {}, OPTyear = {}, OPTnote = {}, OPTannote = {} } @Unpublished{, author = {}, title = {}, note = {}, OPTkey = {}, OPTmonth = {}, OPTyear = {}, OPTannote = {} } @Misc{, OPTkey = {}, OPTauthor = {}, OPTtitle = {}, OPThowpublished = {}, OPTmonth = {}, OPTyear = {}, OPTnote = {}, OPTannote = {} } winefish-1.3.3/data/words.in0000600000047200004720000010132510372323160014726 0ustar kyanhkyanhw: tex:\\APLcirc: w: tex:\\APLinput: w: tex:\\APLinv: w: tex:\\APLminus: w: tex:\\APLrightarrowbox: w: tex:\\Anglesign: w: tex:\\Apricot: w: tex:\\Aquamarine: w: tex:\\Aquarius: w: tex:\\Arabic: w: tex:\\Aries: w: tex:\\ArrowBoldDownRight: w: tex:\\ArrowBoldRightCircled: w: tex:\\ArrowBoldRightShort: w: tex:\\ArrowBoldRightStrobe: w: tex:\\ArrowBoldUpRight: w: tex:\\Asterisk: w: tex:\\AsteriskBold: w: tex:\\AsteriskCenterOpen: w: tex:\\AsteriskRoundedEnds: w: tex:\\AsteriskThin: w: tex:\\AsteriskThinCenterOpen: w: tex:\\AtBeginDocument: w: tex:\\AtNinetyFive: w: tex:\\AtSixty: w: tex:\\Bearing: w: tex:\\Bicycle: w: tex:\\Big: w: tex:\\BigCircle: w: tex:\\BigCross: w: tex:\\BigDiamondshape: w: tex:\\BigHBar: w: tex:\\BigLowerDiamond: w: tex:\\BigRightDiamond: w: tex:\\BigSquare: w: tex:\\BigTriangleDown: w: tex:\\BigTriangleLeft: w: tex:\\BigTriangleRight: w: tex:\\BigTriangleUp: w: tex:\\BigVBar: w: tex:\\Bigg: w: tex:\\Biggl: w: tex:\\Biggr: w: tex:\\Bigl: w: tex:\\Bigr: w: tex:\\Biohazard: w: tex:\\Bittersweet: w: tex:\\Blitz: w: tex:\\BlueViolet: w: tex:\\Bmatrix: w: tex:\\Bowtie: w: tex:\\BrickRed: w: tex:\\CEsign: w: tex:\\Capricorn: w: tex:\\CarnationPink: w: tex:\\Circle: w: tex:\\CircleShadow: w: tex:\\CircleSolid: w: tex:\\CircledA: w: tex:\\Circpipe: w: tex:\\Circsteel: w: tex:\\ClassWarning: w: tex:\\ClassWarningNoLine: w: tex:\\CleaningA: w: tex:\\CleaningF: w: tex:\\CleaningFF: w: tex:\\CleaningP: w: tex:\\CleaningPP: w: tex:\\Colonsim: w: tex:\\CrossBoldOutline: w: tex:\\CrossClowerTips: w: tex:\\CrossOutline: w: tex:\\CurrentOption: w: tex:\\Cutline: w: tex:\\Cutright: w: tex:\\Dandelion: w: tex:\\DarkOrchid: w: tex:\\DavidStar: w: tex:\\DavidStarSolid: w: tex:\\DeclareFontEncoding: w: tex:\\DeclareMathOperator: w: tex:\\DeclareOption: w: tex:\\Denarius: w: tex:\\Diamond: w: tex:\\DiamondLeft: w: tex:\\DiamondRight: w: tex:\\DiamondShadowA: w: tex:\\DiamondShadowB: w: tex:\\DiamondShadowC: w: tex:\\DiamondSolid: w: tex:\\Diamondblack: w: tex:\\Diamonddot: w: tex:\\DiamonddotLeft: w: tex:\\DiamonddotRight: w: tex:\\Diamonddotleft: w: tex:\\Diamonddotright: w: tex:\\Diamondleft: w: tex:\\Diamondright: w: tex:\\Diamondshape: w: tex:\\EURdig: w: tex:\\EightAsterisk: w: tex:\\EightFlowerPetal: w: tex:\\EightFlowerPetalRemoved: w: tex:\\EightStar: w: tex:\\EightStarBold: w: tex:\\EightStarConvex: w: tex:\\EightStarTaper: w: tex:\\Ellipse: w: tex:\\EllipseShadow: w: tex:\\EllipseSolid: w: tex:\\Email: w: tex:\\Emailct: w: tex:\\Endpiece: w: tex:\\Estatically: w: tex:\\ExecuteOptions: w: tex:\\Explosionsafe: w: tex:\\FallingEdge: w: tex:\\Faxmachine: w: tex:\\FilledBigCircle: w: tex:\\FilledBigDiamondshape: w: tex:\\FilledBigSquare: w: tex:\\FilledBigTriangleDown: w: tex:\\FilledBigTriangleLeft: w: tex:\\FilledBigTriangleRight: w: tex:\\FilledBigTriangleUp: w: tex:\\FilledCircle: w: tex:\\FilledCloud: w: tex:\\FilledDiamondShadowA: w: tex:\\FilledDiamondShadowC: w: tex:\\FilledDiamondshape: w: tex:\\FilledHut: w: tex:\\FilledRainCloud: w: tex:\\FilledSectioningDiamond: w: tex:\\FilledSmallCircle: w: tex:\\FilledSmallDiamondshape: w: tex:\\FilledSmallSquare: w: tex:\\FilledSmallTriangleDown: w: tex:\\FilledSmallTriangleLeft: w: tex:\\FilledSmallTriangleRight: w: tex:\\FilledSmallTriangleUp: w: tex:\\FilledSnowCloud: w: tex:\\FilledSquare: w: tex:\\FilledSquareShadowA: w: tex:\\FilledSquareShadowC: w: tex:\\FilledSunCloud: w: tex:\\FilledTriangleDown: w: tex:\\FilledTriangleLeft: w: tex:\\FilledTriangleRight: w: tex:\\FilledTriangleUp: w: tex:\\FilledWeakRainCloud: w: tex:\\Finv: w: tex:\\Fire: w: tex:\\FiveFlowerOpen: w: tex:\\FiveFlowerPetal: w: tex:\\FiveStar: w: tex:\\FiveStarCenterOpen: w: tex:\\FiveStarConvex: w: tex:\\FiveStarLines: w: tex:\\FiveStarOpen: w: tex:\\FiveStarOpenCircled: w: tex:\\FiveStarOpenDotted: w: tex:\\FiveStarOutline: w: tex:\\FiveStarOutlineHeavy: w: tex:\\FiveStarShadow: w: tex:\\Fixedbearing: w: tex:\\FourAsterisk: w: tex:\\FourClowerSolid: w: tex:\\Fuchsia: w: tex:\\Galois: w: tex:\\Gemini: w: tex:\\HalfCircleLeft: w: tex:\\HalfCircleRight: w: tex:\\HalfFilledHut: w: tex:\\HandCuffRight: w: tex:\\HandCuffRightUp: w: tex:\\HandPencilLeft: w: tex:\\HandRight: w: tex:\\HandRightUp: w: tex:\\Hermaphrodite: w: tex:\\IceMountain: w: tex:\\IfFileExists: w: tex:\\InputIfFileExists: w: tex:\\IroningI: w: tex:\\IroningII: w: tex:\\IroningIII: w: tex:\\Irritant: w: tex:\\Join: w: tex:\\Jupiter: w: tex:\\Kutline: w: tex:\\LEFTcircle: w: tex:\\LTcapwidth: w: tex:\\LaTeX: w: tex:\\LaTeX{}: w: tex:\\Ladiesroom: w: tex:\\Leftcircle: w: tex:\\Leftrightarrow: w: tex:\\Leftscissors: w: tex:\\Libra: w: tex:\\Lightning: w: tex:\\LimeGreen: w: tex:\\Lineload: w: tex:\\LongPulseHigh: w: tex:\\Longleftrightarrow: w: tex:\\Longrightarrow: w: tex:\\Loosebearing: w: tex:\\LowerDiamond: w: tex:\\MMultido: w: tex:\\MVEight: w: tex:\\MVFive: w: tex:\\MVNine: w: tex:\\MVSix: w: tex:\\MartinVogel: w: tex:\\Midline: w: tex:\\MidnightBlue: w: tex:\\Mobilefone: w: tex:\\Mountain: w: tex:\\Multido: w: tex:\\MultidoCheckNames: w: tex:\\NibLeft: w: tex:\\NibRight: w: tex:\\NibSolidLeft: w: tex:\\NibSolidRight: w: tex:\\NoChemicalCleaning: w: tex:\\NoIroning: w: tex:\\OliveGreen: w: tex:\\OptionNotUsed: w: tex:\\Orchid: w: tex:\\OrnamentDiamondSolid: w: tex:\\PackageWarning: w: tex:\\PackageWarningNoLine: w: tex:\\PaperPortrait: w: tex:\\PassOptionsToClass: w: tex:\\PassOptionsToPackage: w: tex:\\PencilLeft: w: tex:\\PencilLeftDown: w: tex:\\PencilLeftUp: w: tex:\\PencilRight: w: tex:\\PencilRightDown: w: tex:\\PencilRightUp: w: tex:\\Periwinkle: w: tex:\\Phi: w: tex:\\Pi: w: tex:\\Pickup: w: tex:\\PineGreen: w: tex:\\Pisces: w: tex:\\Pisymbol: w: tex:\\PlusOutline: w: tex:\\PlusThinCenterOpen: w: tex:\\Pointinghand: w: tex:\\Printer: w: tex:\\ProcessOptions: w: tex:\\ProvidesClass: w: tex:\\ProvidesFile: w: tex:\\ProvidesPackage: w: tex:\\Psi: w: tex:\\PulseHigh: w: tex:\\RIGHTcircle: w: tex:\\Radiation: w: tex:\\Radioactivity: w: tex:\\Rain: w: tex:\\RainCloud: w: tex:\\RaisingEdge: w: tex:\\RawSienna: w: tex:\\RectangleThin: w: tex:\\Rectpipe: w: tex:\\RedViolet: w: tex:\\RequireClass: w: tex:\\RequireClassWithOptions: w: tex:\\RequirePackage: w: tex:\\RequirePackageWithOptions: w: tex:\\Rewind: w: tex:\\RewindToIndex: w: tex:\\RewindToStart: w: tex:\\Rhodamine: w: tex:\\RightDiamond: w: tex:\\Rightarrow: w: tex:\\Rightcircle: w: tex:\\Rightscissors: w: tex:\\Righttorque: w: tex:\\Rrightarrow: w: tex:\\RubineRed: w: tex:\\Sagittarius: w: tex:\\ScissorHollowLeft: w: tex:\\ScissorHollowRight: w: tex:\\ScissorLeft: w: tex:\\ScissorLeftBrokenBottom: w: tex:\\ScissorLeftBrokenTop: w: tex:\\ScissorRight: w: tex:\\ScissorRightBrokenBottom: w: tex:\\ScissorRightBrokenTop: w: tex:\\Scorpio: w: tex:\\SectioningDiamond: w: tex:\\Sepia: w: tex:\\SerialInterface: w: tex:\\SerialPort: w: tex:\\Shilling: w: tex:\\ShortFifty: w: tex:\\ShortNinetyFive: w: tex:\\ShortPulseHigh: w: tex:\\ShortSixty: w: tex:\\ShortThirty: w: tex:\\Sigma: w: tex:\\Simpson: w: tex:\\SixFlowerAltPetal: w: tex:\\SixFlowerAlternate: w: tex:\\SixFlowerOpenCenter: w: tex:\\SixFlowerPetalDotted: w: tex:\\SixFlowerPetalRemoved: w: tex:\\SixFlowerRemovedOpenPetal: w: tex:\\SixStar: w: tex:\\SixteenStarLight: w: tex:\\SmallCircle: w: tex:\\SmallDiamondshape: w: tex:\\SmallLowerDiamond: w: tex:\\SmallRightDiamond: w: tex:\\SmallTriangleDown: w: tex:\\SmallTriangleLeft: w: tex:\\SmallTriangleRight: w: tex:\\SmallTriangleUp: w: tex:\\Smiley: w: tex:\\SpecialForty: w: tex:\\SpinDown: w: tex:\\SpinUp: w: tex:\\SpringGreen: w: tex:\\SquareCastShadowBottomRight: w: tex:\\SquareCastShadowTopRight: w: tex:\\SquareShadowBottomRight: w: tex:\\SquareShadowTopRight: w: tex:\\SquareSolid: w: tex:\\Squarepipe: w: tex:\\Steiner: w: tex:\\Stopsign: w: tex:\\StrokeFive: w: tex:\\Summit: w: tex:\\SummitSign: w: tex:\\SunshineOpenCircled: w: tex:\\TOKafteritem: w: tex:\\TOKbeforeitem: w: tex:\\TOKpoplimit: w: tex:\\TeX: w: tex:\\TeX{}: w: tex:\\ThinFog: w: tex:\\Thistle: w: tex:\\Tilde: w: tex:\\TriangleDown: w: tex:\\TriangleLeft: w: tex:\\TriangleRight: w: tex:\\TriangleUp: w: tex:\\Turquoise: w: tex:\\Upsilon: w: tex:\\VarIceMountain: w: tex:\\VarMountain: w: tex:\\VarSummit: w: tex:\\Vectorarrowhigh: w: tex:\\Viet: w: tex:\\Village: w: tex:\\Violet: w: tex:\\VioletRed: w: tex:\\Virgo: w: tex:\\Vmatrix: w: tex:\\WashSynthetics: w: tex:\\WeakRain: w: tex:\\WeakRainCloud: w: tex:\\Wheelchair: w: tex:\\White: w: tex:\\WildStrawberry: w: tex:\\Writinghand: w: tex:\\XSolid: w: tex:\\XSolidBold: w: tex:\\XSolidBrush: w: tex:\\Xi: w: tex:\\Yinyang: w: tex:\\Yright: w: tex:\\Zodiac: w: tex:\\abovecaptionskip: w: tex:\\abovedisplayshortskip: w: tex:\\abovedisplayskip: w: tex:\\abovewithdelims: w: tex:\\absBig: w: tex:\\absBigg: w: tex:\\absbig: w: tex:\\absbigg: w: tex:\\addcontentsline: w: tex:\\addtoversion: w: tex:\\adjdemerits: w: tex:\\afterassignment: w: tex:\\ain: w: tex:\\align: w: tex:\\alignat: w: tex:\\aligned: w: tex:\\alignedat: w: tex:\\alpha: w: tex:\\appendix: w: tex:\\appendixname: w: tex:\\aquarius: w: tex:\\arabic: w: tex:\\arcsin: w: tex:\\arcsinx: w: tex:\\aries: w: tex:\\arrayrulewidth: w: tex:\\article: w: tex:\\ataribox: w: tex:\\atopwithdelims: w: tex:\\author: w: tex:\\backepsilon: w: tex:\\backprime: w: tex:\\backsim: w: tex:\\backsimeq: w: tex:\\bari: w: tex:\\barsci: w: tex:\\baselineskip: w: tex:\\baselinestretch: w: tex:\\begin: w: tex:\\begingroup: w: tex:\\begin{Bmatrix: w: tex:\\begin{Vmatrix: w: tex:\\begin{align*: w: tex:\\begin{align: w: tex:\\begin{alignat: w: tex:\\begin{aligned: w: tex:\\begin{array: w: tex:\\begin{cases: w: tex:\\begin{center: w: tex:\\begin{description: w: tex:\\begin{document: w: tex:\\begin{enumerate: w: tex:\\begin{enumerate}[: w: tex:\\begin{equation*: w: tex:\\begin{equation: w: tex:\\begin{figure: w: tex:\\begin{flushleft: w: tex:\\begin{flushright: w: tex:\\begin{gather*: w: tex:\\begin{gathered: w: tex:\\begin{itemize: w: tex:\\begin{letter: w: tex:\\begin{list: w: tex:\\begin{longtable: w: tex:\\begin{matrix: w: tex:\\begin{minipage: w: tex:\\begin{multline*: w: tex:\\begin{multline: w: tex:\\begin{picture: w: tex:\\begin{pmatrix: w: tex:\\begin{quotation: w: tex:\\begin{quote: w: tex:\\begin{smallmatrix: w: tex:\\begin{subequation: w: tex:\\begin{tabbing: w: tex:\\begin{table: w: tex:\\begin{tabular: w: tex:\\begin{thebibliography: w: tex:\\begin{theorem: w: tex:\\begin{titlepage: w: tex:\\begin{verbatim*: w: tex:\\begin{verbatim: w: tex:\\begin{verse: w: tex:\\begin{vmatrix: w: tex:\\belowcaptionskip: w: tex:\\belowdisplayshortskip: w: tex:\\belowdisplayskip: w: tex:\\beta: w: tex:\\bezier: w: tex:\\bfseries: w: tex:\\bibcite: w: tex:\\bibdata: w: tex:\\bibindent: w: tex:\\bibitem: w: tex:\\bibliography: w: tex:\\bibliographystyle: w: tex:\\bibname: w: tex:\\bibstyle: w: tex:\\big: w: tex:\\bigO: w: tex:\\bigbox: w: tex:\\bigcap: w: tex:\\bigcirc: w: tex:\\bigclockfont: w: tex:\\bigcup: w: tex:\\bigcurlyvee: w: tex:\\bigcurlywedge: w: tex:\\bigg: w: tex:\\biggl: w: tex:\\biggr: w: tex:\\biginterleave: w: tex:\\bigl: w: tex:\\bignplus: w: tex:\\bigodot: w: tex:\\bigoplus: w: tex:\\bigotimes: w: tex:\\bigparallel: w: tex:\\bigr: w: tex:\\bigskip: w: tex:\\bigsqcap: w: tex:\\bigsqcapplus: w: tex:\\bigsqcup: w: tex:\\bigsqcupplus: w: tex:\\bigstar: w: tex:\\bigtriangledown: w: tex:\\bigtriangleleft: w: tex:\\bigtriangleup: w: tex:\\biguplus: w: tex:\\bigvee: w: tex:\\bigwedge: w: tex:\\binampersand: w: tex:\\bindnasrepma: w: tex:\\binom: w: tex:\\binoppenalty: w: tex:\\blacksmiley: w: tex:\\blacktriangle: w: tex:\\blacktriangledown: w: tex:\\blacktriangleleft: w: tex:\\blacktriangleright: w: tex:\\blitza: w: tex:\\blitzb: w: tex:\\blitzc: w: tex:\\blitzd: w: tex:\\blitze: w: tex:\\bmatrix: w: tex:\\botfigrule: w: tex:\\bottomfraction: w: tex:\\bowtie: w: tex:\\boxRight: w: tex:\\boxcircle: w: tex:\\boxdotRight: w: tex:\\boxdotright: w: tex:\\boxminus: w: tex:\\boxright: w: tex:\\boxtimes: w: tex:\\buildrel: w: tex:\\capricornus: w: tex:\\caption: w: tex:\\carriagereturn: w: tex:\\cbinom: w: tex:\\centering: w: tex:\\centerline: w: tex:\\chapter: w: tex:\\chardef: w: tex:\\chi: w: tex:\\chiup: w: tex:\\circ: w: tex:\\circeq: w: tex:\\circle: w: tex:\\circlearrowleft: w: tex:\\circlearrowright: w: tex:\\circledR: w: tex:\\circledS: w: tex:\\circledast: w: tex:\\circledbar: w: tex:\\circledbslash: w: tex:\\circledcirc: w: tex:\\circleddash: w: tex:\\circleddotleft: w: tex:\\circleddotright: w: tex:\\circledgtr: w: tex:\\circledless: w: tex:\\circledvee: w: tex:\\circledwedge: w: tex:\\circleleft: w: tex:\\circleright: w: tex:\\citation: w: tex:\\cite: w: tex:\\clickb: w: tex:\\clickc: w: tex:\\clickt: w: tex:\\cline: w: tex:\\clocktime: w: tex:\\closedniomega: w: tex:\\closedrevepsilon: w: tex:\\closein: w: tex:\\closing: w: tex:\\clubsuit: w: tex:\\colonsim: w: tex:\\colorlinks: w: tex:\\columnwidth: w: tex:\\condition: w: tex:\\conjunction: w: tex:\\contentsline: w: tex:\\copyright: w: tex:\\countdef: w: tex:\\crossnilambda: w: tex:\\curvearrowright: w: tex:\\dashint: w: tex:\\dashleftrightarrow: w: tex:\\dashrightarrow: w: tex:\\date: w: tex:\\datevietnam: w: tex:\\davidsstar: w: tex:\\dbinom: w: tex:\\dblfigrule: w: tex:\\dblfloatpagefraction: w: tex:\\dbltopfraction: w: tex:\\ddashint: w: tex:\\def: w: tex:\\defaultscriptratio: w: tex:\\defaultscriptscriptratio: w: tex:\\definition: w: tex:\\delimiter: w: tex:\\delimiterfactor: w: tex:\\delimitershortfall: w: tex:\\delta: w: tex:\\description: w: tex:\\descriptionlabel: w: tex:\\diagdown: w: tex:\\diagup: w: tex:\\diameter: w: tex:\\diamond: w: tex:\\diamondsuit: w: tex:\\dianmondsuit: w: tex:\\diatop: w: tex:\\diaunder: w: tex:\\digamma: w: tex:\\dim: w: tex:\\dimen: w: tex:\\dimendef: w: tex:\\ding: w: tex:\\dingautolist: w: tex:\\dingfill: w: tex:\\dingline: w: tex:\\dinglist: w: tex:\\dinhly: w: tex:\\dinhnghia: w: tex:\\dint: w: tex:\\disablehint: w: tex:\\discretionary: w: tex:\\displayindent: w: tex:\\displaylimits: w: tex:\\displaymath: w: tex:\\displaystyle: w: tex:\\displaywidowpenalty: w: tex:\\displaywidth: w: tex:\\div: w: tex:\\divide: w: tex:\\divideontimes: w: tex:\\dlbari: w: tex:\\documentclass: w: tex:\\dospecials: w: tex:\\dotfill: w: tex:\\dotsi: w: tex:\\doublehyphendemerits: w: tex:\\downbracefill: w: tex:\\downharpoonright: w: tex:\\drvalBig: w: tex:\\drvalBigg: w: tex:\\drvalbig: w: tex:\\drvalbigg: w: tex:\\eighthnote: w: tex:\\ejective: w: tex:\\else: w: tex:\\end: w: tex:\\endVmatrix: w: tex:\\endalign: w: tex:\\endalignat: w: tex:\\endbmatrix: w: tex:\\enddisplaymath: w: tex:\\endequation: w: tex:\\endflushright: w: tex:\\endgroup: w: tex:\\endhint: w: tex:\\endinput: w: tex:\\enditemize: w: tex:\\endlinechar: w: tex:\\endlist: w: tex:\\endmatrix: w: tex:\\endminipage: w: tex:\\endpicture: w: tex:\\endpmatrix: w: tex:\\endquotation: w: tex:\\endsplit: w: tex:\\endtabbing: w: tex:\\endtitlepage: w: tex:\\endtrivlist: w: tex:\\endverbatim: w: tex:\\endvmatrix: w: tex:\\endxalign: w: tex:\\endxalignat: w: tex:\\endxxalign: w: tex:\\endxxalignat: w: tex:\\enlargethispage: w: tex:\\epsfig: w: tex:\\epsilon: w: tex:\\epsilonup: w: tex:\\eqcirc: w: tex:\\eqref: w: tex:\\eqsim: w: tex:\\equation: w: tex:\\equiv: w: tex:\\errorcontextlines: w: tex:\\eta: w: tex:\\euscript: w: tex:\\evensidemargin: w: tex:\\everydisplay: w: tex:\\exists: w: tex:\\expandafter: w: tex:\\fallingdotseq: w: tex:\\family: w: tex:\\fatsemi: w: tex:\\fi: w: tex:\\figure: w: tex:\\figurename: w: tex:\\filecontents: w: tex:\\fill: w: tex:\\filledsquarewithdots: w: tex:\\finalhypendemerits: w: tex:\\fint: w: tex:\\firstmark: w: tex:\\floatingpenalty: w: tex:\\floatpagefraction: w: tex:\\flushright: w: tex:\\fontdimen: w: tex:\\fontencoding: w: tex:\\fontfamily: w: tex:\\fontseries: w: tex:\\fontsize: w: tex:\\footins: w: tex:\\footnote: w: tex:\\footnotesize: w: tex:\\footskip: w: tex:\\fracwithdelims: w: tex:\\frenchspacing: w: tex:\\frownie: w: tex:\\gamma: w: tex:\\gdef: w: tex:\\gemini: w: tex:\\generalsignature: w: tex:\\giamarrow: w: tex:\\gimel: w: tex:\\gnsim: w: tex:\\graphics: w: tex:\\graphicx: w: tex:\\gtrsim: w: tex:\\guillemotleft: w: tex:\\guillemotright: w: tex:\\guilsinglleft: w: tex:\\guilsinglright: w: tex:\\gvalBig: w: tex:\\gvalBigg: w: tex:\\gvalbig: w: tex:\\gvalbigg: w: tex:\\halign: w: tex:\\hangindent: w: tex:\\headheight: w: tex:\\heartsuit: w: tex:\\height: w: tex:\\hfil: w: tex:\\hfill: w: tex:\\hfilneg: w: tex:\\hint: w: tex:\\hintface: w: tex:\\hline: w: tex:\\hlinefill: w: tex:\\holdinginserts: w: tex:\\hookrevepsilon: w: tex:\\hookrightarrow: w: tex:\\hrulefill: w: tex:\\hsize: w: tex:\\hskip: w: tex:\\hyphenation: w: tex:\\i: w: tex:\\id: w: tex:\\idotsint: w: tex:\\iemph: w: tex:\\if: w: tex:\\ifcase: w: tex:\\ifcat: w: tex:\\ifdim: w: tex:\\ifeof: w: tex:\\iff: w: tex:\\iffalse: w: tex:\\ifhbox: w: tex:\\ifhmode: w: tex:\\ifinner: w: tex:\\ifmmode: w: tex:\\ifnotsummary: w: tex:\\ifnum: w: tex:\\ifodd: w: tex:\\ifpdf: w: tex:\\ifthen: w: tex:\\ifthenelse: w: tex:\\iftrue: w: tex:\\ifvbox: w: tex:\\ifvmode: w: tex:\\ifvoid: w: tex:\\ifx: w: tex:\\ignorespaces: w: tex:\\ignorespacesafterend: w: tex:\\iiiint: w: tex:\\iiint: w: tex:\\iint: w: tex:\\imath: w: tex:\\immediate: w: tex:\\in: w: tex:\\include: w: tex:\\includegraphics: w: tex:\\includeonly: w: tex:\\indent: w: tex:\\indentfirst: w: tex:\\index: w: tex:\\indexname: w: tex:\\indexspace: w: tex:\\inf: w: tex:\\infty: w: tex:\\injlim: w: tex:\\inplus: w: tex:\\input: w: tex:\\inputencoding: w: tex:\\inputlineno: w: tex:\\inputonly: w: tex:\\insert: w: tex:\\insertpenalties: w: tex:\\int: w: tex:\\intab: w: tex:\\intba: w: tex:\\intercal: w: tex:\\interleave: w: tex:\\interlinepenalty: w: tex:\\intertext: w: tex:\\intextsep: w: tex:\\intlim: w: tex:\\intlimits: w: tex:\\into: w: tex:\\inva: w: tex:\\invamp: w: tex:\\invdiameter: w: tex:\\inve: w: tex:\\invf: w: tex:\\invglotstop: w: tex:\\invh: w: tex:\\invlegr: w: tex:\\invm: w: tex:\\invneg: w: tex:\\invr: w: tex:\\invscr: w: tex:\\invscripta: w: tex:\\invv: w: tex:\\invw: w: tex:\\invy: w: tex:\\iota: w: tex:\\iotaup: w: tex:\\ipagamma: w: tex:\\islod: w: tex:\\islurd: w: tex:\\isluru: w: tex:\\ismodeledby: w: tex:\\isundefined: w: tex:\\it: w: tex:\\item: w: tex:\\itemindent: w: tex:\\itemize: w: tex:\\itemsep: w: tex:\\iterate: w: tex:\\itshape: w: tex:\\joinrel: w: tex:\\jupiter: w: tex:\\kappa: w: tex:\\kill: w: tex:\\kuvio: w: tex:\\lJoin: w: tex:\\label: w: tex:\\label{eq\:: w: tex:\\label{fig\:: w: tex:\\label{chap\:: w: tex:\\label{subsec\:: w: tex:\\label{subsubsec\:: w: tex:\\label{sec\:: w: tex:\\label{tab\:: w: tex:\\labelenumi: w: tex:\\labelitemi: w: tex:\\labelitemii: w: tex:\\labelitemiii: w: tex:\\labelitemiv: w: tex:\\labelwidth: w: tex:\\lambda: w: tex:\\largepencil: w: tex:\\lastskip: w: tex:\\latfric: w: tex:\\lceil: w: tex:\\lefrightarrows: w: tex:\\leftarrowtail: w: tex:\\leftarrowtriangle: w: tex:\\lefthreetimes: w: tex:\\lefthyphenmin: w: tex:\\leftline: w: tex:\\leftmargin: w: tex:\\leftmargini: w: tex:\\leftmarginii: w: tex:\\leftmarginiii: w: tex:\\leftmarginiv: w: tex:\\leftmarginv: w: tex:\\leftmarginvi: w: tex:\\leftpointright: w: tex:\\leftrightarrow: w: tex:\\leftrightarroweq: w: tex:\\leftrightarrows: w: tex:\\leftrightarrowtriangle: w: tex:\\leftrightharpoons: w: tex:\\leftrightsquigarrow: w: tex:\\leftskip: w: tex:\\leftslice: w: tex:\\leftsquigarrow: w: tex:\\leftthreetimes: w: tex:\\lei: w: tex:\\lesssim: w: tex:\\let: w: tex:\\libra: w: tex:\\lightning: w: tex:\\lim: w: tex:\\liminf: w: tex:\\limits: w: tex:\\limsup: w: tex:\\line: w: tex:\\linebreak: w: tex:\\linegoal: w: tex:\\linepenalty: w: tex:\\lineskip: w: tex:\\lineskiplimits: w: tex:\\linespread: w: tex:\\linethickness: w: tex:\\linewidth: w: tex:\\list: w: tex:\\listfigurename: w: tex:\\listfiles: w: tex:\\listoffigures: w: tex:\\listoftables: w: tex:\\listparindent: w: tex:\\listtablename: w: tex:\\llceil: w: tex:\\llparenthesis: w: tex:\\lnsim: w: tex:\\location: w: tex:\\longRightarrow: w: tex:\\longleftrightarrow: w: tex:\\longrightarrow: w: tex:\\looparrowright: w: tex:\\lowercase: w: tex:\\lrtimes: w: tex:\\ltimes: w: tex:\\makeatletter: w: tex:\\makeindex: w: tex:\\maketitle: w: tex:\\manboldkidney: w: tex:\\manconcentriccircles: w: tex:\\manconcentricdiamond: w: tex:\\manfilledquartercircle: w: tex:\\manhpennib: w: tex:\\manimpossiblecube: w: tex:\\mankidney: w: tex:\\manlhpenkidney: w: tex:\\manpenkidney: w: tex:\\manquadrifolium: w: tex:\\manquartercircle: w: tex:\\manrotatedquadrifolium: w: tex:\\manrotatedquartercircle: w: tex:\\mantiltpennib: w: tex:\\mantriangledown: w: tex:\\mantriangleright: w: tex:\\mantriangleup: w: tex:\\manvpennib: w: tex:\\marginpar: w: tex:\\marginparpush: w: tex:\\marginparsep: w: tex:\\marginparwidth: w: tex:\\markright: w: tex:\\mathbin: w: tex:\\mathchoice: w: tex:\\mathellipsis: w: tex:\\mathinner: w: tex:\\mathit: w: tex:\\mathop: w: tex:\\mathsterling: w: tex:\\mathversion: w: tex:\\matrix: w: tex:\\mdseries: w: tex:\\meaning: w: tex:\\medcirc: w: tex:\\medmuskip: w: tex:\\medskip: w: tex:\\medskipamount: w: tex:\\mid: w: tex:\\midtilde: w: tex:\\min: w: tex:\\minipage: w: tex:\\minus: w: tex:\\minuso: w: tex:\\mmultido: w: tex:\\moveright: w: tex:\\mskip: w: tex:\\mu: w: tex:\\multicol: w: tex:\\multicols: w: tex:\\multicolumn: w: tex:\\multido: w: tex:\\multiline: w: tex:\\multimap: w: tex:\\multimapboth: w: tex:\\multimapbothvert: w: tex:\\multimapdot: w: tex:\\multimapdotboth: w: tex:\\multimapdotbothA: w: tex:\\multimapdotbothAvert: w: tex:\\multimapdotbothB: w: tex:\\multimapdotbothBvert: w: tex:\\multimapdotbothvert: w: tex:\\multimapdotinv: w: tex:\\multimapinv: w: tex:\\multiply: w: tex:\\multiput: w: tex:\\multirow: w: tex:\\multline: w: tex:\\multlinegap: w: tex:\\multnoteskip: w: tex:\\muskip: w: tex:\\muskipdef: w: tex:\\ocircle: w: tex:\\oddsidemargin: w: tex:\\oiiint: w: tex:\\oiiintclockwise: w: tex:\\oiiintctrclockwise: w: tex:\\oiint: w: tex:\\oiintclockwise: w: tex:\\oiintctrclockwise: w: tex:\\oint: w: tex:\\ointclockwise: w: tex:\\ointctrclockwise: w: tex:\\olympic: w: tex:\\omega: w: tex:\\ominus: w: tex:\\omit: w: tex:\\oneside: w: tex:\\openJoin: w: tex:\\openin: w: tex:\\opening: w: tex:\\opentimes: w: tex:\\operatorname: w: tex:\\operatornamewithlimits: w: tex:\\opposition: w: tex:\\othermention: w: tex:\\otimes: w: tex:\\overleftrightarrow: w: tex:\\overline: w: tex:\\overrightarrow: w: tex:\\overring: w: tex:\\overwithdelims: w: tex:\\pagefilllstretch: w: tex:\\pagefillstretch: w: tex:\\pagefilstretch: w: tex:\\pagenumbering: w: tex:\\pageref: w: tex:\\pageshrink: w: tex:\\pagestyle: w: tex:\\palign: w: tex:\\paperheight: w: tex:\\paperwidth: w: tex:\\paragraph: w: tex:\\parfillskip: w: tex:\\parindent: w: tex:\\parskip: w: tex:\\part: w: tex:\\partial: w: tex:\\pausing: w: tex:\\permil: w: tex:\\phi: w: tex:\\phiup: w: tex:\\pi: w: tex:\\pica: w: tex:\\picture: w: tex:\\pifont: w: tex:\\pisces: w: tex:\\pitchfork: w: tex:\\piup: w: tex:\\plain: w: tex:\\pmatrix: w: tex:\\pointer: w: tex:\\polishhook: w: tex:\\postdisplaypenalty: w: tex:\\precnsim: w: tex:\\precsim: w: tex:\\predisplaypenalty: w: tex:\\predisplaysize: w: tex:\\prime: w: tex:\\proclaim: w: tex:\\projlim: w: tex:\\providecommand: w: tex:\\psi: w: tex:\\psiup: w: tex:\\qbezier: w: tex:\\qbeziermax: w: tex:\\qquad: w: tex:\\quotation: w: tex:\\quotesinglbase: w: tex:\\rJoin: w: tex:\\radical: w: tex:\\raggedright: w: tex:\\raise: w: tex:\\raisebox: w: tex:\\raisetag: w: tex:\\rceil: w: tex:\\realline: w: tex:\\ref: w: tex:\\ref{sec\:: w: tex:\\ref{chap\:: w: tex:\\ref{subsec\:: w: tex:\\ref{subsubsec\:: w: tex:\\ref{tab\:: w: tex:\\ref{fig\:: w: tex:\\ref{eq\:: w: tex:\\relax: w: tex:\\renewcommand: w: tex:\\renewenvironment: w: tex:\\renewtheorem: w: tex:\\revepsilon: w: tex:\\reversedvideodbend: w: tex:\\reversemarginpar: w: tex:\\rho: w: tex:\\righleftharpoons: w: tex:\\right: w: tex:\\rightarrow: w: tex:\\rightarrowtail: w: tex:\\rightarrowtriangle: w: tex:\\rightharpoondown: w: tex:\\rightharpoonup: w: tex:\\righthyphenmin: w: tex:\\rightleftarrows: w: tex:\\rightleftharpoons: w: tex:\\rightline: w: tex:\\rightmargin: w: tex:\\rightmark: w: tex:\\rightmoon: w: tex:\\rightp: w: tex:\\rightpointleft: w: tex:\\rightpointright: w: tex:\\rightrepeat: w: tex:\\rightrightarrows: w: tex:\\rightskip: w: tex:\\rightslice: w: tex:\\rightsquigarrow: w: tex:\\rightt: w: tex:\\righttag: w: tex:\\rightthreetimes: w: tex:\\rightthumbsdown: w: tex:\\rightthumbsup: w: tex:\\rightturn: w: tex:\\risingdotseq: w: tex:\\rmfamily: w: tex:\\rndlist: w: tex:\\rotating: w: tex:\\rrceil: w: tex:\\rrparenthesis: w: tex:\\rtimes: w: tex:\\sagittarius: w: tex:\\satellitedish: w: tex:\\sci: w: tex:\\scorpio: w: tex:\\scripta: w: tex:\\scriptfont: w: tex:\\scriptg: w: tex:\\scriptscriptfont: w: tex:\\scriptscriptstyle: w: tex:\\scriptsize: w: tex:\\scriptspace: w: tex:\\scriptstyle: w: tex:\\scriptv: w: tex:\\section: w: tex:\\sectionmark: w: tex:\\sectionname: w: tex:\\sectionrunhead: w: tex:\\setcounter: w: tex:\\setminus: w: tex:\\setpapersize: w: tex:\\settoheight: w: tex:\\settowidth: w: tex:\\sffamily: w: tex:\\shipout: w: tex:\\shortmid: w: tex:\\shortrightarrow: w: tex:\\shoveright: w: tex:\\showlists: w: tex:\\sideset: w: tex:\\sigma: w: tex:\\sigmaup: w: tex:\\sign: w: tex:\\signature: w: tex:\\sim: w: tex:\\simeq: w: tex:\\sin: w: tex:\\sinh: w: tex:\\sint: w: tex:\\sinx: w: tex:\\siny: w: tex:\\skip: w: tex:\\skipdef: w: tex:\\slide: w: tex:\\slides: w: tex:\\smallint: w: tex:\\smallmatrix: w: tex:\\smallpencil: w: tex:\\smallsetminus: w: tex:\\smallskip: w: tex:\\smallsmile: w: tex:\\smile: w: tex:\\smiley: w: tex:\\spaceskip: w: tex:\\spadesit: w: tex:\\spadesuit: w: tex:\\special: w: tex:\\sphericalangle: w: tex:\\split: w: tex:\\splitbotmark: w: tex:\\splitfirstmark: w: tex:\\splitmaxdepth: w: tex:\\splittopskip: w: tex:\\splitvert: w: tex:\\sptilde: w: tex:\\sqiiint: w: tex:\\sqiint: w: tex:\\sqint: w: tex:\\squarewithdots: w: tex:\\startpiece: w: tex:\\strictfi: w: tex:\\strictif: w: tex:\\strictiff: w: tex:\\string: w: tex:\\subitem: w: tex:\\subparagraph: w: tex:\\subscriptstyle: w: tex:\\subsection: w: tex:\\subsectionmark: w: tex:\\subsectionname: w: tex:\\subsubitem: w: tex:\\subsubsection: w: tex:\\subsubsectionmark: w: tex:\\subsubsectionname: w: tex:\\succnsim: w: tex:\\succsim: w: tex:\\sucsim: w: tex:\\sumlimits: w: tex:\\syllabic: w: tex:\\tableofcontents w: tex:\\tabbing: w: tex:\\tabbingsep: w: tex:\\tabskip: w: tex:\\tabularnewline: w: tex:\\taild: w: tex:\\tailinvr: w: tex:\\taill: w: tex:\\tailn: w: tex:\\tailr: w: tex:\\tails: w: tex:\\tailt: w: tex:\\tailz: w: tex:\\tbinom: w: tex:\\texorpdfstring: w: tex:\\textOlyoghlig: w: tex:\\textadvancing: w: tex:\\textasciiacute: w: tex:\\textasciibreve: w: tex:\\textasciicaron: w: tex:\\textasciicircum: w: tex:\\textasciidieresis: w: tex:\\textasciigrave: w: tex:\\textasciimacron: w: tex:\\textasciitilde: w: tex:\\textasteriskcentered: w: tex:\\textbari: w: tex:\\textbigcircle: w: tex:\\textbottomtiebar: w: tex:\\textbraceright: w: tex:\\textcelsius: w: tex:\\textchi: w: tex:\\textcircled: w: tex:\\textcircledP: w: tex:\\textcircumacute: w: tex:\\textcircumdot: w: tex:\\textcloseepsilon: w: tex:\\textcloserevepsilon: w: tex:\\textcommatailz: w: tex:\\textcopyright: w: tex:\\textcrinvglotstop: w: tex:\\textctdctzlig: w: tex:\\textcttctclig: w: tex:\\textdctzlig: w: tex:\\textdied: w: tex:\\textdiscount: w: tex:\\textdiv: w: tex:\\textdivorced: w: tex:\\textdoublebarpipe: w: tex:\\textdoublepipe: w: tex:\\textdoublevertline: w: tex:\\textdyoghlig: w: tex:\\textdzlig: w: tex:\\texteightoldstyle: w: tex:\\textellipsis: w: tex:\\textepsilon: w: tex:\\textestimated: w: tex:\\textfishhookr: w: tex:\\textfiveoldstyle: w: tex:\\textflorin: w: tex:\\textfraction: w: tex:\\textfractionsolidus: w: tex:\\textglobrise: w: tex:\\textgravecircum: w: tex:\\textgravemid: w: tex:\\textguarani: w: tex:\\texthardsign: w: tex:\\textheight: w: tex:\\texthvlig: w: tex:\\textifsym: w: tex:\\textinterrobang: w: tex:\\textinterrobangdown: w: tex:\\textinvglotstop: w: tex:\\textinvscr: w: tex:\\textinvsubbridge: w: tex:\\textiota: w: tex:\\textit: w: tex:\\textlhti: w: tex:\\textlhtlongi: w: tex:\\textlira: w: tex:\\textlowering: w: tex:\\textlquill: w: tex:\\textltailm: w: tex:\\textltailn: w: tex:\\textltilde: w: tex:\\textlyoghlig: w: tex:\\textmarried: w: tex:\\textmidacute: w: tex:\\textminus: w: tex:\\textmusicalnote: w: tex:\\textnaira: w: tex:\\textnineoldstyle: w: tex:\\textonesuperior: w: tex:\\textordfeminine: w: tex:\\textordmasculine: w: tex:\\textperiodcentered: w: tex:\\textphi: w: tex:\\textpilcrow: w: tex:\\textpipe: w: tex:\\textprimstress: w: tex:\\textquestiondown: w: tex:\\textquotedblright: w: tex:\\textquoteright: w: tex:\\textquotesingle: w: tex:\\textquotestraightbase: w: tex:\\textquotestraightdblbase: w: tex:\\textraiseglotstop: w: tex:\\textraisevibyi: w: tex:\\textraising: w: tex:\\textrecipe: w: tex:\\textregistered: w: tex:\\textretracting: w: tex:\\textrevepsilon: w: tex:\\textreversedvideodbend: w: tex:\\textrhookrevepsilon: w: tex:\\textrhoticity: w: tex:\\textrightarrow: w: tex:\\textringmacron: w: tex:\\textrquill: w: tex:\\textrtaild: w: tex:\\textrtaill: w: tex:\\textrtailn: w: tex:\\textrtailr: w: tex:\\textrtails: w: tex:\\textrtailt: w: tex:\\textrtailz: w: tex:\\textsci: w: tex:\\textscoelig: w: tex:\\textscripta: w: tex:\\textscriptv: w: tex:\\textsection: w: tex:\\textservicemark: w: tex:\\textsixoldstyle: w: tex:\\textsoftsign: w: tex:\\textsterling: w: tex:\\textsubbridge: w: tex:\\textsublhalfring: w: tex:\\textsubrhalfring: w: tex:\\textsubring: w: tex:\\textsubtilde: w: tex:\\textsuperimposetilde: w: tex:\\textsuperscript: w: tex:\\textsyllabic: w: tex:\\texttctclig: w: tex:\\textteshlig: w: tex:\\textthreesuperior: w: tex:\\texttildedot: w: tex:\\texttildelow: w: tex:\\texttimes: w: tex:\\texttoptiebar: w: tex:\\texttslig: w: tex:\\textturncelig: w: tex:\\textturnrrtail: w: tex:\\textturnscripta: w: tex:\\texttwosuperior: w: tex:\\textupsilon: w: tex:\\textvertline: w: tex:\\textvibyi: w: tex:\\textvibyy: w: tex:\\textvisiblespace: w: tex:\\textwidth: w: tex:\\thebibliography: w: tex:\\theenumi: w: tex:\\theenumiv: w: tex:\\theequation: w: tex:\\thefigure: w: tex:\\theindex: w: tex:\\theminutes: w: tex:\\thesection: w: tex:\\thesubsection: w: tex:\\thesubsubsection: w: tex:\\thickapprox: w: tex:\\thicklines: w: tex:\\thickmuskip: w: tex:\\thicksim: w: tex:\\thickspace: w: tex:\\thinlines: w: tex:\\thinmuskip: w: tex:\\thinspace: w: tex:\\thisisthelastpage: w: tex:\\thispagestyle: w: tex:\\tilde: w: tex:\\tildel: w: tex:\\time: w: tex:\\times: w: tex:\\tiny: w: tex:\\tinynotesize: w: tex:\\tinyvalue: w: tex:\\title: w: tex:\\titlepage: w: tex:\\topfigrule: w: tex:\\topfraction: w: tex:\\topmargin: w: tex:\\topskip: w: tex:\\totalheight: w: tex:\\tracing: w: tex:\\tracingcommands: w: tex:\\tracingfonts: w: tex:\\tracinglostchars: w: tex:\\tracingmacros: w: tex:\\tracingonline: w: tex:\\tracingoutput: w: tex:\\tracingpages: w: tex:\\tracingparagraphs: w: tex:\\tracingrestores: w: tex:\\tracingstats: w: tex:\\triangle: w: tex:\\triangledown: w: tex:\\triangleleft: w: tex:\\trianglelefteq: w: tex:\\trianglelefteqslant: w: tex:\\triangleq: w: tex:\\triangleright: w: tex:\\trianglerighteq: w: tex:\\trianglerighteqslant: w: tex:\\triangles: w: tex:\\trivlist: w: tex:\\ttfamily: w: tex:\\twoheadrightarrow: w: tex:\\twoside: w: tex:\\typein: w: tex:\\underleftrightarrow: w: tex:\\underline: w: tex:\\underrightarrow: w: tex:\\underring: w: tex:\\undertilde: w: tex:\\unitcm: w: tex:\\unitdm: w: tex:\\unitlength: w: tex:\\unitm: w: tex:\\unskip: w: tex:\\upbracefill: w: tex:\\upharpoonright: w: tex:\\uppercase: w: tex:\\upsilon: w: tex:\\upsilonup: w: tex:\\usepackage: w: tex:\\valign: w: tex:\\varPhi: w: tex:\\varPi: w: tex:\\varPsi: w: tex:\\varSigma: w: tex:\\varUpsilon: w: tex:\\varXi: w: tex:\\varbigcirc: w: tex:\\varclubsuit: w: tex:\\vardiamondsuit: w: tex:\\varepsilon: w: tex:\\varepsilonup: w: tex:\\varheartsuit: w: tex:\\varinjlim: w: tex:\\varint: w: tex:\\varliminf: w: tex:\\varlimsup: w: tex:\\varnothing: w: tex:\\varocircle: w: tex:\\varoiiintclockwise: w: tex:\\varoiiintctrclockwise: w: tex:\\varoiintclockwise: w: tex:\\varoiintctrclockwise: w: tex:\\varoint: w: tex:\\varointclockwise: w: tex:\\varointctrclockwise: w: tex:\\varominus: w: tex:\\varotimes: w: tex:\\varparallelinv: w: tex:\\varphi: w: tex:\\varphiup: w: tex:\\varpi: w: tex:\\varpiup: w: tex:\\varprojlim: w: tex:\\varrho: w: tex:\\varsigma: w: tex:\\varsigmaup: w: tex:\\varspadesuit: w: tex:\\vartimes: w: tex:\\vartriangle: w: tex:\\vartriangleleft: w: tex:\\vartriangleright: w: tex:\\vcondition: w: tex:\\verbatim: w: tex:\\vfil: w: tex:\\vfill: w: tex:\\vfilneg: w: tex:\\virgo: w: tex:\\vline: w: tex:\\vmatrix: w: tex:\\vpageref: w: tex:\\vref: w: tex:\\vsize: w: tex:\\vskip: w: tex:\\vsplit: w: tex:\\whiledo: w: tex:\\white: w: tex:\\widehat: w: tex:\\widetilde: w: tex:\\widowpenalty: w: tex:\\width: w: tex:\\wind: w: tex:\\write: w: tex:\\xLeftrightarrow: w: tex:\\xLongleftrightarrow: w: tex:\\xLongrightarrow: w: tex:\\xalign: w: tex:\\xalignat: w: tex:\\xdef: w: tex:\\xi: w: tex:\\xiup: w: tex:\\xleftrightarrow: w: tex:\\xlongleftrightarrow: w: tex:\\xlongrightarrow: w: tex:\\xmaketitle: w: tex:\\xmathxstoprecording: w: tex:\\xopenhint: w: tex:\\xopenlib: w: tex:\\xrightarrow: w: tex:\\xspaceskip: w: tex:\\xtitle: w: tex:\\xtitlenotoc: w: tex:\\xxalign: w: tex:\\xxalignat: w: tex:\\zeta: winefish-1.3.3/data/gnome-application-winefish.png0000600000047200004720000000677310372323160021201 0ustar kyanhkyanhPNG  IHDR04̓bKGDC pHYs  tIME f IDATx՚[Uz:=Wg3`\I ݗhHy*RH "DJsq dkb‚kl|[L_/UuΗ3&3Sw;r=љM63\!cccr=jU;&>lSM@&DD8tw_V؋t BD& ~KiJi=> ֙UH$xGVĉܹ` 0sW,T9v8VkDB sAi$Y|… }v~ms ^I޶ DµвВy \]y]]]{۷T*uU%9teh (FTSA`#FE0T(Nc-%獡;3^z:@PՔICkGZ =D0+ ZNZkFGG^N cLK|s@`DLlDzZr#q墎;wӤi lT*W_g W:C(΃8Ebވk.\F@ ւ[,^? ʋQ*=8T߹:J%BJ͸rdT< ]?f]x2,..q%^|k{BUF kK,RxGK+xpnΑ 5.-zenv+8b>IrE!24RA} u%/0/SXC= n1ǖ:Ȧ,;QtQ 0]lu*O!>C=RcP NfZp,əY&* L &]|mڐNX R|r YK~XX{B4K\g0&nt ;qw l{pE|-}f H$,ugqc4rX~{βc&6#IGa%X-]/E6lصkJǹV\> .-<}YIkGU(FYVxɥ C2I&m˲V7sK%jf=~l6K"V0r+>_D[IJ)²O0PC 1A׺&C8pe Z63Kvhopj 1R8 x0ua7>0B2(Ɣ,T|cK s!J {6rFxbt g<;IOo'hj8vo0 !$Dc4G?;/~뇝&;b*RЊ"<;w;th0s=w)[-td-(ؿ?}}@Z0.H J%?RԊ"Zky֧hR{>~,}L&hXu(N; ˂R5M6!!\`OO4)os=RgIxd ˕eΜcæ$6݃eaIx'[ B»K2qXNj ,1Z֏ZRl޼L&[@;EFm C4gpz2tT 7|k D!f1`b Ȭڒ)2v7%%1O ~)\+0">*)h݅skId> Z ˲T.1X,Dd.0OQ,#x4IU _16a; Fkɤ:HӨi gϓNMF&ADplh"FL[ 10[aҍLVb M(AYD:(+_5&1iIZd冏2( jC㻃S$ 0Y`- v&\Hz%sY.c۬Ξ^Hd)Պ,/W1Ŝs'||~ru#Q٪ eЗ qM#ch=x C|ٸM>&G` um l@abrHQ ka/ԍMΎR!BC&X[;y)tG"]6C1ee\ 9k#Khm8?נt2u#3sKjAb,ɤttdu"NqӹPͼ!>}U&*P'9yN34ЏHwLMḾ:P( ~jq%~]7] 롵 RضpH$$ $_]XEBfAMgwu7o%?_ /O8#Cgg{>| MUXUMB(.ZhD|#a+Df; o*6箭qlذnpSi 6VXZZJu^D02hdi4 sQ^~eyeyꩧ'inzmۣm;qͼhO6" 󐕎7sh8 L;Ӕe;~]SLNN>+^7 ]c'`Gco7=@G}~7S@)lo(@ Ԁ*XB_I?}vÖIENDB`winefish-1.3.3/data/custom_menu.in0000600000047200004720000000067310372323160016132 0ustar kyanhkyanhcmenu_replace: /Replace/Strip/End of line Whitespace:(?<=\\S)\\s*(?=(\\n|\\r))::2:2:0:0: cmenu_replace: /Replace/Convert In Selection/Tabs to Spaces (8):(\t): :2:1:0:0: cmenu_replace: /Replace/Convert In Selection/Tabs to Spaces (4):(\t): :2:1:0:0: cmenu_replace: /Replace/Convert In Selection/Spaces (8) to Single Tabs:( ):\t:2:1:0:0: cmenu_replace: /Replace/Convert In Selection/Spaces (4) to Single Tabs:( ):\t:2:1:0:0: winefish-1.3.3/data/highlighting.in0000600000047200004720000001115110374056042016236 0ustar kyanhkyanhpatterns: context:macro-any:1:\\\\[a-zA-Z]+::2::navy::0:0: patterns: context:macro-special:1:\\\\(index|completeindex|definedescription|defineenumeration|abbreviation|setuplayout|setuplayout|setupfootertexts|setupheadertexts)|&|#::2::red::0:0: patterns: context:separator:1:^%[ %]*[-%=]{50,}?$::2:comment:#829cb7:#829cb7:0:0: patterns: context:char-special-b:1:\\\\(~|\\$|#|&|%|{|}|\\^|_|,|;|!|\:| |\\|)::2::#4e00aa::2:0: patterns: context:char-special-a:1:~|_|\\^|\\$|\\\\\\]|\\\\\\[|(\\\\left[.([])|\\\\left\\\\{|\\\\right\\\\}|(\\\\right[\\.)\\]])|[{}\\[\\]()]::2::#4ebdaa::0:0: patterns: context:parameter:1:#[1-9]::2::#4e00aa::0:0: patterns: context:sectioning:0:\\\\(section|subsection|chapter|part|subsubsection)\\b::2::yellow:navy:0:0: patterns: context:macro-common:0:\\\\(title|subject|completecontent|em|bf|cap|infull|completelistofabbreviations|useexternalfigures|placefigure|externalfigure|placetable)\\b::2::yellow:navy:0:0: patterns: context:comment:1:%.*?$::2::#829cb7::0:0: patterns: context:wf-marker:1:^%context$::2::yellow:black:2:0: patterns: context:macro-start:1:\\\\(start|b)[a-zA-Z]+::2::brown::2:0: patterns: context:macro-end:1:\\\\(stop|e)[a-zA-Z]+::2::navy::2:0: patterns: xml:Character Entity:1:&[^;]+;::2::#9b0054::0:0: patterns: xml:Character Data:1::1::#a2b300::0:0: patterns: xml:DocType:1::1::#b35300::0:0: patterns: xml:Comment:0::1::#AAAAAA::1:2: patterns: xml:Attribute Content:1:2::3:^Attribute$:#ff7600::1:0: patterns: xml:Attribute:1:([a-z]*=)("[^"]*")::2:^Tag$:#3cb300::1:0: patterns: xml:Tag Name:1:1::3:^Tag$:#005676::2:0: patterns: xml:Tag:1:<((/)?[a-z0-9\:]+):[^?-]?>:1::#000000::0:0: patterns: tex:macro-any:1:\\\\[a-zA-Z]+::2::navy::0:0: patterns: tex:macro-special:1:\\\\(bibitem|item|displaystyle)\\b|\\\\\\\\(\\\\hline\\b)?|&|#::2::red::0:0: patterns: tex:macro-maths-symbol:1:\\\\(varepsilon|varpi|varrho|varsigma|alpha|beta|gamma|delta|chi|iota|kappa|lambda|mu|nu|phi|psi|pi|rho|tau|theta|upsilon|xi|zeta|omega|eta|epsilon|Sigma|sigma)\\b::2::brown::0:0: patterns: tex:macro-text:1:\\\\(centerline|rightline|leftline|bigskip|vskip|hskip|medskip|text[a-z]+|underline)\\b::2::navy::0:0: patterns: tex:include:1:\\\\in(put|clude|cludeonly|cludegraphics)\\b::2::white:black:2:0: patterns: tex:char-special-b:1:\\\\(~|\\$|#|&|%|{|}|\\^|_|,|;|!|\:| |\\|)::2::#4e00aa::0:0: patterns: tex:char-special-a:1:~|_|\\^|\\$|\\\\\\]|\\\\\\[|(\\\\left[.([])|\\\\left\\\\{|\\\\right\\\\}|(\\\\right[\\.)\\]])|[{}\\[\\]()]::2::#4ebdaa::0:0: patterns: tex:parameter:1:#[1-9]::2::#4e00aa::0:0: patterns: tex:number-units:0:[+-]?\\d+(\\.\\d+)?(pt|in|mm|cm|ex|em|pc)?::2::#541a9c::0:0: patterns: tex:labelref-type:1:2::3:^labelref$:blue::0:0: patterns: tex:labelref:0:\\\\(label|eqref|ref|vref|vpageref|pageref){([a-z]+)\:[^}]+}::2::brown:#e4d7e4:0:0: patterns: tex:macro-ams-a:0:\\\\(renewtheorem|newtheorem|newtheoremstyle|theoremstyle|DeclareMathOperator|tag|qquad|Big|Bigg|Biggl|Biggr|Bigl|Bigr|big|bigg|biggl|biggr|bigl|bigr|text|intertext)\\b::2::#A16734::0:0: patterns: tex:argument-optional:0:\\[[^\\n\\]]+\\]::2::#008C00::0:0: patterns: tex:argument-mandatory:0:{[a-zA-Z]+}::2::#54b6b6::0:0: patterns: tex:environments-ams-mix:0:{(subarray|split|smallmatrix|([vVpb]?matrix))}::2::brown::0:0: patterns: tex:environments-ams:0:{((align|aligned|equation|gather|gathered|cases|multline)\\*?)}::2::brown::2:0: patterns: tex:environments-standard:0:{((list|document|quote|flushleft|flushright|center|minipage|quotation|tabular|figure|table|longtable|itemize|description|enumerate)\\*?)}::2::navy::2:0: patterns: tex:macro-latex-standard:0:\\\\(begin|end|operatorname|operatornamewithlimits|newcounter|LaTeX|title|maketitle|author|date|today|hyphenation|makeatletter|usepackage|renewcommand|newenvironment|newcommand|documentclass|providecommand|mathop)\\b::2::blue::2:0: patterns: tex:macro-tex:0:\\\\(the|footnote|TeX|uppercase|lowercase|expandafter|newif|if|fi|ifx|else|let|xdef|gdef|def|relax|chardef|countdef)\\b::2::brown::2:0: patterns: tex:macro-sectioning:0:\\\\(tableofcontents|listoffigures|listtheorems|listoftables|section|subsection|chapter|part|subsubsection|paragraph|subparagraph)\\b::2::white:navy:2:0: patterns: tex:command-newdef:0:(?<=\\\\newcommand){\\\\[a-zA-Z]+}::2::#A16734::2:0: patterns: tex:macro-newdef:0:(?<=\\\\def)\\\\[a-z@A-Z]+\\b::2::#A16734::2:0: patterns: tex:separator:1:^%[ %]*[-%=]{50,}?$::2:comment:#829cb7:#829cb7:0:0: patterns: tex:verb:1:\\\\verb("|#|\\||~|!).*?\\1::2::brown::2:0: patterns: tex:verbatim:1:\\\\begin{(verbatim\\*?)}.*?(\\\\end{\\1})::2::brown::0:0: patterns: tex:comment-url:1:http\://[^ ]+::2:^comment$:blue::2:1: patterns: tex:comment:1:%.*?$::2::#829cb7::0:2: winefish-1.3.3/data/filetypes.in0000600000047200004720000000040510372323160015571 0ustar kyanhkyanhtex:.tex\:.sty: \\\n\t%$[]{}:PKGDATADIRicon_tex.png:1::1: context:.tex::::%context:1: xml:.xml\:.sgml:<> \n":PKGDATADIRicon_xml.png:1:<\\?xml:0: wfproject:.wfproject:::0::0: image:.jpg\:.png\:.gif\:.jpeg\:.tif\:.tiff\:.xpm\:.xcf::PKGDATADIRicon_image.png:0::0: winefish-1.3.3/data/winefish.xml0000600000047200004720000000056110372323160015576 0ustar kyanhkyanh Winefish project file Fichier projet Winefish winefish-1.3.3/data/encodings.in0000600000047200004720000000132510372323160015540 0ustar kyanhkyanhUTF-8:UTF-8: ISO-8859-1 (Latin 1, West European):ISO-8859-1: ISO-8859-2 (Latin 2, East European):ISO-8859-2: ISO-8859-3 (Latin 3, South European):ISO-8859-3: ISO-8859-4 (Latin 4, North European):ISO-8859-4: ISO-8859-5 (Cyrillic):ISO-8859-5: ISO-8859-6 (Arabic):ISO-8859-6: ISO-8859-7 (Greek):ISO-8859-7: ISO-8859-8 (Hebrew):ISO-8859-8: ISO-8859-9 (Turkish):ISO-8859-9: ISO-8859-10 (Nordic):ISO-8859-10: ISO-8859-11 (Thai):ISO-8859-11: ISO-8859-13 (Latin 7):ISO-8859-13: ISO-8859-14 (Latin 8):ISO-8859-14: ISO-8859-15 (Latin 9, West European with EURO):ISO-8859-15: GB2312 (Chinese):GB2312: BIG5 (Chinese):BIG5: SJIS (Japanese):SJIS: KSC (Korean):KSC: KOI8-R (Russian):KOI8-R: CP1251 (Russian):CP1251: EUCJP (Japanese):EUCJP: winefish-1.3.3/INSTALL0000600000047200004720000000173310412071613013360 0ustar kyanhkyanhTo install Winefish from source =============================== 1) get the required libraries (header files and executable files) * glib-2.0 (version >= 2.2.2) * libgtk2 (version >= 2.4.0) * libpcre * [ aspell ] (optional; for spell checking) * [ grep, find, [ sed, xargs ]] (optional; for grep function) 2) details about `configure' $ sh configure --help if you use --prefix=/home/myhome/apps/ please take care of options related to mime type, desktop icons, etc. Vietnamese TeX Users: you may use `--enable-fix-unikey-gtk' --- if you get troubles with Winefish + Unikey GTK. 3) for the development release (winefish-x.x.x.y), please excute `autoconf' to generate `configure' script $ autoconf 4) some variables control winefish. See `src/config_spec.h' for details. 5) configure and compile $ sh ./configure [your-options] $ make 6) reduce filesize $ make strip # this requires `strip' program 7) install everything $ su $ make install winefish-1.3.3/icons/0000700000047200004720000000000010414700277013443 5ustar kyanhkyanhwinefish-1.3.3/icons/icon_unknown.png0000600000047200004720000000037710373352236016673 0ustar kyanhkyanhPNG  IHDR Vu\IDATxڍ1N@DOѤ@)deK)!iD `S"\#EhLJ*%UjNuF6<=lܐHD(pI33Ny;дmRN!zSrs{Ǐ 1J-qFf5oce!0߲ IS}?>nU%/IENDB`winefish-1.3.3/icons/Makefile.in0000600000047200004720000000310710373352236015515 0ustar kyanhkyanh# Winefish LaTeX Editor # # Makefile.in - the Makefile template # Copyright (C) 2002 Olivier Sessink # Modified for Winefish (C) 2005 Ky Anh # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA top_srcdir = @top_srcdir@ top_builddir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ pkgdatadir = @pkgdatadir@ infodir = $(prefix)/info libdir = $(prefix)/lib/gnudl mandir = $(prefix)/man/man1 localedir = @localedir@ gnulocaledir = $(prefix)/share/locale aliaspath = $(localedir):. OBJS = icon_unknown.png \ icon_dir.png \ icon_image.png \ icon_xml.png \ icon_tex.png INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_DATA = $(INSTALL) -m 644 all: bluefish bluefish: install: all $(INSTALL_DIR) $(DESTDIR)$(pkgdatadir) for file in $(OBJS) ; \ do $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir) ; \ done uninstall: /bin/rm -f $(DESTDIR)$(pkgdatadir)icon_*.png winefish-1.3.3/icons/icon_dir.png0000600000047200004720000000037210373352236015745 0ustar kyanhkyanhPNG  IHDR Vu\IDATxڭ=JCaDOčd%6vE:-X rVBջg,C|୆;g2o|2 \M _#,,Y<,yh0!$K(#%Q thFV=hT7{  Z%ljVDя0tIENDB`winefish-1.3.3/icons/icon_image.png0000600000047200004720000000052010373352236016244 0ustar kyanhkyanhPNG  IHDR Vu\IDATxKJP?ɍE0 D*5qOC(+AiCj,Q6&i@<wvvխ=af Uh8v%1R)eU0c>}p;:@*%R$H< (A2Y)))Y#8-l{.c8ls}Ug]/šŰvBz-Nyפ.+NJ Q4@UضGD SI<ozK|IENDB`winefish-1.3.3/icons/icon_tex.png0000600000047200004720000000026310373352236015766 0ustar kyanhkyanhPNG  IHDR Vu\bKGDC pHYs  tIME3j]@IDATxck0̆WI_6Gр.t04 /f"Tq-N|>IENDB`winefish-1.3.3/icons/icon_xml.png0000600000047200004720000000067210373352236015772 0ustar kyanhkyanhPNG  IHDR Vu\bKGD pHYs  tIME$dGIDATxڍ?HBaG"!h1 *$5KCR3,!ZZ^CcBBP(8- QEH*>/H:rιr2u%]@CK4R"D ?C8hDc BV(QLߛ ߳6Q 8Z]8]]$gxLY\ߣÅi\Rՙ@4n 7'[s 469 Mh+M}YR)hJfg $RTǒ"4=!u9R'XU:=2Zh g|!=zQ5jx~d|oIENDB`winefish-1.3.3/COPYING0000600000047200004720000004313110367147072013374 0ustar kyanhkyanh GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. winefish-1.3.3/CHANGES0000600000047200004720000002171410414700266013330 0ustar kyanhkyanh$Id: CHANGES 2348 2006-04-05 08:32:54Z kyanh $ Winefish 1.3.3 ============== * fixed - patch for gtk+ 2.4 users (src/preferences.c) Winefish 1.3.2.8b ================= * fixed: - BUG#6408 - BUG#{99,106} - BUG#107 (partially;) * stuff: - `column marker' is enabled via `configure' option (--enable-column-marker) - {vi,fr}.po updated Winefish 1.3.2.8a ================= * fixed - BUG#{102-105} Winefish 1.3.2-RC2 ================== * fixed minor bugs * new features: - 3 customizable column markers * some changes was reported in Winefish 1.3.2.7 Winefish 1.3.2.7 ================ * fixed - BUG#{76a,90-93,96-98,100-101} * new features: - column markers (at most 3 markers) - grep_function: find from files (current file or all opened files) - hilight current line - column mark (testing) * improved: - outputbox_filter (use PCRE for filter) * dropped: - markup for messages of outputbox Winefish 1.3.2-RC1 ================== * Brace Finder improved/reimplemented (automatically) * New color scheme (hilight) [ more readable ] Winefish 1.3.2.6 (Spring Release) ================================= * important changes: - requires libgtk+-2.0 version >= 2.4 * for users of previous version: (see doc/winefish.html for details) - move ~/.winefish/rcfile_v2 to ~/.winefish/rcfile - reconfigure Winefish - reset the last variable (Save,Show) for tool (Preferences Page/TeXbox) * fixed - BUG#{5689,5869,5990} - BUG#{3,10,67,69-72,74,75,77-85} * new features: - brace finder (brace matching): control+[, control +] - delete command *directly* from popup menu (autocompletion) - automatically saved: + 'project mode' (external menu) + 'line numbers' (document menu) - TeX filter for spell checker - find in files (menu = edit/find, replace/find in files) (requires `find' and `grep') - templates directory support (control+alt+shift+F) (requires `find' and `grep') - outputbox: + right-click: popup menu, copy message from current line + single-click to open file + control+click to clone file - french po (fr.po) added - documentation: + ./doc/winefish.html + ./man/winefish.1 * improved: - outputbox's frontend/backend (backend: require gtk+-2.4; base on bluefish#20060119) - quicklist/table wizard (* print row/column index; * added ding(auto)list *) - menu items reordered (better???) * dropped: - toolbars (i have never used it) - context support (--with-context) - vntex support (--with-vntex) - vietnamese documentation - many images and stock items - many items from `insert' menu * stuffs: - added Menu External/Soft Clean Winefish 1.3.2.5 (Summer Release) ================================= * BUGS fixed: - Major BUG#{57,54,50} - Minor BUG#{62,59,58,56,55,49,48,47,46,44} * (NEW) ConTeXt support: - Beta/testing. Require "--with-context" while "./configure"ing - Filetype, hilight - Autocompletion [ \start...\stop, \begin...\end ] - Table wizard [ natural table only ] As I do*NOT* know conTeXT, your requests are highly appreciated! * Autocompletion: - FIXED: BUG#55 - (NEW) Collector: new command/environment will be added automatically to the database [ ~/.winefish/words_s ] *WARNING* the file is bigger day by day :) FIXME: Winefish eats also '\\notacommand' TODO: add to Preferences Page [ A page for session words ] - If the result of completion contains *ONLY* one command: = The popup menu will be hidden automatically [ if the user's input equals to the result in popup menu ] It may be activated when you press CTRL + Space :) = You can hide the popdown menu by the (Page)Up/Down keys - Duplicate entries will be ignored when Winefish starts. TODO: do this *ONLY* once -- as the feature may slow down Winefish. An option may be added -- bigger Winefish :( - The autocompletion starts (automatically) *ONLY* if at least three characters are typed (includes the backslash: \xy). Anytime, press CTRL + Space! - The mininum width of popdown menu was enlarged [ 64 => 100 ] * Outputbox: - Behavior changed: If a tool is set 'Show all output', the box will *NOT* scroll automatically. Why? 'Show all output' may produce too many lines and scrolling in this case will slow down the fish. 'cat' is an example. An option may be added in Winefish-1.3.2-7. Within the fix, 'cat' is as fast as you want :) - For maximum space, the header of treeview was hidden. - 'Close' icon was placed on the upper left corner [ more beautiful :) ] - When main GUI is resized, the outputbox is resized too. FIXME: not correct if window state changes * Autotext: - Autoindent supported. Winefish will append the 'indent' string to any '\n' characters of after/before string. I think this is GOOD, but it may make you tedious ;) * Hilight Syntax: - Updated [ almost new syntax|color ] - Fresh color - Bugs fixed - (NEW) conTeXt hilight syntax [ testing ] * LaTeX code: - Removed preformat items for: split, cases environment - Table: the '&' character will be vetically aligned TODO: edit table's items within the wizard * GUI: - Default mode is "Experience". See below. - Sidebar, Main Toolbar, LaTeX Toolbar, Custom Menu are hidden by default - The values of 'View/*' will be stored as global session variable. This mean that they are (re)stored per session. - Last change of 'Document/Line numbers' will be stored as session variable. - Menu reordered: '/Edit/{Save Settings, Preferences}' => '/?/*' FIXME: cannot add '/?/tearoff1' - There are*NOT* any submenus in '/External/' * The fish: - (NEW) splash screen [ Keep It Simple and Stupid ] - The fish is still blue. I need another one. [ So the fish does*NOT* live in the Splash ] * Documentation: - (NEW) Added 'doc/TIPS' - The files 'doc/*.pdf' are removed from source directory -- we may create a new package 'winefish-doc'. FIXME: The documation is 'out-of-date'. * Translation: - vi: typo fixed [ Thanks to VnPenguin at http://vnoss.org/ ] - it: updated * Stuff: - Disabled empty QuickBar warning. This may be considered as a TIPS -- addto documentation. - Code optmized: use (strncmp) instead of (strcmp) some places - (NEW) hilight: CHANGES, TODO, context I donot why these are needed. May be fun? At least I can read my CHANGES very very easily :) - Updated: THANKS, TODO, AUTHORS, README, and CHANGES :) - Added ROADMAP Winefish 1.3.2.4 ================ * Major BUGS (outputbox) fixed: - Winefish still eats so many system's resources after killing a child process [External/dvips]. * Minor BUGS fixed: - I forgot the BUG :( The change of hosting [sf.net/berlios.de] make me tedious. The CVSRoot at berlios.de was imported from Winefish 1.2.1 plus. I do*NOT* to make a mark in CVSROOT ... Winefish is released anytime i like to release :(( * (NEW) Menu added: - [/External/Stop] [ to cancel a tool ] - Yeap, you now can send 'SIGKILL' signal to child process * Autocompletion: - The dropdown menu appears automatically * Outputbox: - Hilight feature: somelines are italic, somelines are strong - (NEW) recognized linenumber in "... on input line 123" "... on input lines 123 -- 143" * Main menu: - Reordered: [File|Edit|Insert|Document|External|Project|Go|View|Help] * Translation: - vi: completed... but the custom menu Winefish 1.2.1 ============== * BUG fixed: - Minor BUG#{31,32,33,34,35} * (NEW) command support (set linenumber, -l option) * Added po files (it vi) * Useless code removed * Documentation Updated * ConTeXT words added (188 words) Winefish 1.2.0 ============== * Some minor bugs were fixed. See BUG. * (NEW) The contents of latex code (which is inserted from Wizard/Dialog) are indented automatically. * VnTeX support is an optional feature. You must specify this feature by ./configure --with-vntex * More log filters * (DEV) ChangeLog is moved to CHANGES Winefish 1.1.1 (beta 2) ======================= * BUG fixed: - BUG#{25} * Autocompletion: - moving selection by PageUp, PageDown, Up, Down keys Winefish 1.1.1 (beta 1) ======================= * BUG fixed: - BUG#{21,20,19,4,22,23,24} * (NEW) Autocompletion support - latex word list (over 1500 keys) * (NEW) Preference page for "Autotext" added * Tools: - Expandsion changed [%c => %l]. See 'doc/winefish-*.pdf' for details. * Outputbox: - scroll by line, not by output [slower performace :(] - Show/Hide Enable [Menu View/View Outputbox] - a bug fixed - Resizable * Documentation: - Updated * HotKey changed: - Changed for [View / View Sidebar] - Added for [View / View Outputbox] - Added [Control + Space] for autocompletion Winefish 1.1.0 ============== * (NEW) autotext support * Some bugs fixed (see BUG) * Outputbox: - performance improved - better handled with 'g_io_channel' - autosize - autoscroll * External menu: - 'View LOG' added - 'DVIPDFM' moved downwards * Removed: - 'gnome-vfs' support * New version numbering :) * Some HotKeys changed * Syntax File updated * Function References: - added: symbols, packages, bib - removed: css * Perfomance improved: unused code was removed * Documentation: - updated vietnamese version (doc/winefish.tex) - added: english version (doc/winefish-en.tex) * Removed the button 'View in Browser' from toolbar. Winefish 1.0-beta-1 =================== * Initial version winefish-1.3.3/man/0000700000047200004720000000000010414700277013103 5ustar kyanhkyanhwinefish-1.3.3/man/Makefile.in0000600000047200004720000000221110373416634015153 0ustar kyanhkyanh# Winefish LaTeX Editor # Makefile.in - the Makefile template # Copyright (C) 2006 Winefish Development Team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. prefix=@prefix@ exec_prefix=@exec_prefix@ mandir = @mandir@ INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_DATA = ${INSTALL} -m 644 all: install: $(INSTALL_DIR) $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) winefish.1 $(DESTDIR)$(mandir)/man1 uninstall: rm -f $(DESTDIR)$(mandir)/man1/winefish.1 clean: distclean: clean winefish-1.3.3/man/winefish.10000600000047200004720000000501710376073737015021 0ustar kyanhkyanh.TH "Winefish" "1" "1.3.2" "kyanh" "User Commands" .SH "NAME" .LP \fBwinefish\fR \- LaTeX editor .SH "SYNTAX" .LP \fBwinefish\fR [\fIoption\fP] <\fIfilename\fP> .SH "DESCRIPTION" .LP \fBwinefish\fR is a LaTeX editor based on bluefish. It features: .LP \- autotext support .LP \- autocompletion support .LP \- command collector .LP \- multiple encodings support .LP \- custom menu to define your own tags, sets of code, and dialogs .LP \- customizable syntax highlighting based on PCRE .LP \- user customizable integration of latex, pdflatex,... .LP \- custom search and replace pattern support for the custom menu .LP \- wizards for startup, tables, list and others .SH "OPTIONS" .TP \fB\-s\fR Skip root check .TP \fB\-v\fR Show the current version of \fBwinefish\fR .TP \fB\-n 0|1\fR Open a new window (1) or not (0) .TP \fB\-p \fR Open the project named .TP \fB\-l \fR Set the line number the file will be opened at .TP \fB\-h\fR Show this help screen .SH "FILES" .LP Some configuration files are loaded into $HOME/.winefish: .TP \fBautotext\fR Store shorcuts for text, i.e. LaTeX blocks .IP You may edit it from the autotext panel in the preferences window .TP \fBcustom_menu\fR Define the contents of the custom menu .IP You may edit it from the Edit custom menu item .TP \fBhightlighting\fR Define the highlighting patterns for some languages .IP You may edit it from the highlighting panel in the preferences window .TP \fBrcfile\fR Store most of the other settings defined in the preferences window .IP You may modify the settings in the various panels of the preferences window .TP \fBwords\fR Store a list of tags for autocompletion .IP You may add tags from the autoX panel in the preferences window .SH "EXAMPLES" .TP \fBStarting winefish from the command line:\fR winefish .TP \fBOpening a file in a new window at line 100:\fR winefish \-n 1 \-l 100 .TP \fBOpening a project in the current window:\fR winefish \-n 0 \-p .SH "AUTHORS" .TP \fBDocumentation\fR see $prefix/share/doc/winefish.html .TP \fBHomepage\fR http://winefish.berlios.de/ .IP http://winefish.viettug.org/ .IP http://winefish.sourceforge.net/ .TP \fBMailing lists\fR (devel) winefish\-devel@lists.berlios.de .IP (user) winefish\-users@lists.berlios.de .LP This manual page was written for the Fink distribution as the original program does not have a manual page by Michele Garoche . .LP It may be used by other distribution. .LP $LastChangedBy: kyanh $ winefish-1.3.3/po/0000700000047200004720000000000010414700277012746 5ustar kyanhkyanhwinefish-1.3.3/po/Makefile.in0000600000047200004720000000356210372322122015013 0ustar kyanhkyanh# Makefile for gettext support # Copyright (C) 2002 Olivier Sessink # Copyright (C) 2005 Ky Anh PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = /bin/sh top_srcdir = @top_srcdir@ top_builddir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ pkgdatadir = @pkgdatadir@ datadir = @datadir@ localedir = $(datadir)/locale ALL_LINGUAS = @ALL_LINGUAS@ INSTALL = @INSTALL@ INSTALL_DIR = $(INSTALL) -d -m 755 INSTALL_DATA = ${INSTALL} -m 644 MSGFMT = @MSGFMT@ XGETTEXT = @XGETTEXT@ MSGMERGE = @MSGMERGE@ SRCS = vi.po it.po fr.po .SUFFIXES: .po .gmo OBJS = $(SRCS:.po=.gmo) all: all-yes all-yes: $(SRCS) $(OBJS) all-no: .po.gmo: $(SRCS) $(MSGFMT) $< -o $@ # we only install the languages named in ALL_LINGUAS # because there is no reason to install 50% translated languages install: $(INSTALL_DIR) $(DESTDIR)$(localedir) for lang in $(ALL_LINGUAS) ; do \ if test -f $${lang}.po; then \ $(INSTALL_DIR) $(DESTDIR)$(localedir)/$${lang}/ ;\ $(INSTALL_DIR) $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/ ;\ $(INSTALL_DATA) $${lang}.gmo $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/${PACKAGE}.mo;\ echo "installing $${lang}" ;\ fi ;\ done uninstall: @for file in $(SRCS) ; do \ lang=`echo $${file} | sed -e 's/\.po$$//'`;\ rm -f $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/${PACKAGE}.mo;\ done clean: rm -f *.gmo distclean: clean rm -f Makefile tmp.po ${PACKAGE}.po *.rej *.orig *~ ${PACKAGE}.po: $(XGETTEXT) --from-code=UTF-8 --default-domain=${PACKAGE} --keyword=_ --keyword=N_ ../src/*.c update-po: ${PACKAGE}.po @for file in $(SRCS) ; do \ lang=`echo $${file} | sed -e 's/\.po$$//'`;\ echo -n "updating $${lang}.po...";\ $(MSGMERGE) -q --output-file=tmp.po $${lang}.po ${PACKAGE}.po && mv tmp.po $${lang}.po;\ $(MSGFMT) --statistics $${lang}.po -o $${lang}.gmo ;\ done winefish-1.3.3/po/fr.po0000600000047200004720000022052710412002305013710 0ustar kyanhkyanh# translation of fr.po to # French locale definition for Winefish. # Copyright (C) 2003, 2006 Free Software Foundation, Inc. # Michèle Garoche , 2006. # msgid "" msgstr "" "Project-Id-Version: winefish-1.3.2.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-03-27 22:28+0700\n" "PO-Revision-Date: 2006-03-12 07:14+0100\n" "Last-Translator: Michèle Garoche \n" "Language-Team: français \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/about.c:60 #, c-format msgid "" "Winefish LaTeX Editor (based on Bluefish)\n" "\n" "* home: http://winefish.berlios.de/\n" "* open source development project\n" "* released under the GPL license\n" "\n" "* version: %s\n" "* maximum length\n" " latex command: %d\n" " autotext command: %d\n" "* recursive grep: %s\n" "* delimiters:\n" " %s\n" "* configured:\n" " $%s\n" msgstr "" "Éditeur LaTeX Winefish (basé sur Bluefish)\n" "\n" "* Accueil : http://winefish.berlios.de/\n" "* Projet de développement open source\n" "* distribué sous licence GPL\n" "\n" "* Version : %s\n" "* Longueur maximale\n" " d'une commande latex : %d\n" " d'une commande autotext : %d\n" "* Récursion grep : %s\n" "* Délimiteurs :\n" " %s\n" "* Configuration :\n" " $%s\n" #: ../src/about.c:77 msgid "" "developers:\n" "* kyanh \n" "\n" "translators:\n" "* French: Michèle Garoche \n" "* Italian: Daniele Medri \n" "* Vietnamese: kyanh \n" "\n" "THANKS to all who helped making this software available.\n" msgstr "" "Développeurs :\n" "* kyanh \n" "\n" "Traducteurs :\n" "* Français: Michèle Garoche \n" "* Italien : Daniele Medri \n" "* Vietnamien : kyanh \n" "\n" "Merci à tous ceux qui ont contribué à donner vie à ce logiciel.\n" #: ../src/about.c:88 msgid "About Winefish" msgstr "À propos de Winefish" #: ../src/about.c:123 ../src/fref.c:2318 ../src/fref.c:2333 msgid "info" msgstr "Info" #: ../src/about.c:127 msgid "authors" msgstr "Auteurs" #: ../src/about.c:139 msgid "oops..." msgstr "hop-là..." #: ../src/bf_lib.c:54 ../src/bf_lib.c:68 msgid "" "Winefish has trouble reading the filenames. Try to set the environment " "variable G_BROKEN_FILENAMES=1\n" msgstr "" "Winefish a du mal à lire les noms de fichiers. Essayez d'initialiser la " "variable d'environnement G_BROKEN_FILENAMES=1\n" #: ../src/bfspell.c:428 msgid "Check Spelling" msgstr "Vérification orthographique" #: ../src/bfspell.c:432 msgid "Checking" msgstr "Vérification" #: ../src/bfspell.c:441 msgid "_Misspelled word:" msgstr "_Mot mal orthographié :" #: ../src/bfspell.c:445 msgid "Change _to:" msgstr "Remplacer _par :" #: ../src/bfspell.c:448 msgid "I_gnore" msgstr "I_gnorer" #: ../src/bfspell.c:449 ../src/snr2.c:890 msgid "_Replace" msgstr "_Remplacer" #: ../src/bfspell.c:462 msgid "In _document" msgstr "Dans le _document actif" #: ../src/bfspell.c:463 msgid "I_n selection" msgstr "Da_ns la sélection" #: ../src/bfspell.c:472 msgid "personal dictionary" msgstr "Dictionnaire personnel" #: ../src/bfspell.c:475 msgid "session dictionary" msgstr "Session dictionnaire" #: ../src/bfspell.c:481 msgid "Dictionary:" msgstr "Dictionnaire :" #: ../src/bfspell.c:485 msgid "_Add" msgstr "_Ajouter" #: ../src/bfspell.c:489 msgid "Language:" msgstr "Langue :" #: ../src/bfspell.c:493 msgid "Set defa_ult" msgstr "Par défa_ut" #: ../src/bfspell.c:497 msgid "Filter:" msgstr "Filtre :" #: ../src/bfspell.c:505 msgid "no filter" msgstr "Aucun filtre" #: ../src/bfspell.c:507 msgid "TeX filter" msgstr "Filtre TeX" #: ../src/bfspell.c:509 msgid "html filter" msgstr "Filtre HTML" #: ../src/bookmark.c:363 msgid "_Name:" msgstr "_Nom :" #: ../src/bookmark.c:368 msgid "_Description:" msgstr "_Description :" #: ../src/bookmark.c:370 msgid "Temporary" msgstr "Temporaire" #: ../src/bookmark.c:470 #, c-format msgid "Could not find the file \"%s\"." msgstr "Impossible de trouver le fichier \"%s\"." #: ../src/bookmark.c:472 msgid "This bookmark is set in a file that no longer exists." msgstr "Ce signet concerne un fichier qui n'existe plus." #: ../src/bookmark.c:607 #, c-format msgid "Do you really want to delete all bookmarks for %s?" msgstr "Voulez-vous vraiment supprimer tous les signets relatifs à %s ?" #: ../src/bookmark.c:608 msgid "Delete bookmarks?" msgstr "Voulez-vous supprimer les signets ?" #: ../src/bookmark.c:638 #, c-format msgid "Do you really want to delete %s?" msgstr "Désirez-vous vraiment supprimer %s ?" #: ../src/bookmark.c:640 msgid "Delete permanent bookmark." msgstr "Supprimer le signet permanent" #: ../src/bookmark.c:657 msgid "Edit bookmark" msgstr "Éditer le signet" #: ../src/bookmark.c:671 msgid "Goto bookmark" msgstr "Aller au signet" #: ../src/bookmark.c:679 msgid "Edit" msgstr "Éditer" #: ../src/bookmark.c:683 msgid "Delete" msgstr "Supprimer" #: ../src/bookmark.c:689 msgid "Delete all in document" msgstr "Tout supprimer dans le document actif" #: ../src/bookmark.c:694 msgid "Delete all" msgstr "Tout supprimer" #: ../src/bookmark.c:1275 ../src/bookmark.c:1292 ../src/bookmark.c:1330 #: ../src/document.c:2759 msgid "Add bookmark" msgstr "Ajouter un signet" #: ../src/bookmark.c:1276 ../src/bookmark.c:1331 msgid "Cannot add bookmarks in unnamed files." msgstr "Impossible d'ajouter un signet pour un fichier sans nom" #: ../src/bookmark.c:1293 msgid "You already have a bookmark here!" msgstr "Il existe déjà un signet à cet endroit !" #: ../src/bookmark.c:1368 msgid "Delete all bookmarks." msgstr "Supprimer tous les signets" #: ../src/bookmark.c:1368 msgid "Are you sure?" msgstr "En êtes-vous sûr(e) ?" #: ../src/bookmark.c:1407 msgid "File size changed in file\n" msgstr "Le nombre de caractères du fichier a changé\n" #: ../src/bookmark.c:1408 msgid "Bookmarks positions could be incorrect. Delete bookmarks?" msgstr "" "La position des signets est peut-être incorrecte. Voulez-vous supprimer les " "signets ?" #: ../src/document.c:322 ../src/document.c:3811 msgid "/Document/Highlight Syntax" msgstr "/Document/Colorer le code" #: ../src/document.c:782 msgid "name: " msgstr "Nom : " #: ../src/document.c:783 msgid "" "\n" "type: " msgstr "" "\n" "Type : " #: ../src/document.c:784 msgid "" "\n" "encoding: " msgstr "" "\n" "Encodage : " #: ../src/document.c:787 msgid "" "\n" "size (on disk): " msgstr "" "\n" "Taille (sur le disque) : " #: ../src/document.c:787 msgid " bytes" msgstr " octets" #: ../src/document.c:793 msgid "" "\n" "permissions: " msgstr "" "\n" "Permissions : " #: ../src/document.c:800 msgid "" "\n" "last modified: " msgstr "" "\n" "Dernière modification : " #: ../src/document.c:826 #, c-format msgid "Untitled %d" msgstr "Sans titre %d" #: ../src/document.c:1492 msgid "Could not read file:\n" msgstr "Impossible de lire le fichier :\n" #: ../src/document.c:1523 msgid "Opening file " msgstr "Ouverture du fichier" #: ../src/document.c:1594 msgid "Cannot display file, unknown characters found." msgstr "" "Impossible d'afficher le fichier, des caractères inconnus ont été trouvés." #: ../src/document.c:2079 #, c-format msgid "deleted '%s'" msgstr "supprimés '%s'" #: ../src/document.c:2741 ../src/snr2.c:1340 msgid "Replace" msgstr "Remplacer" #: ../src/document.c:2746 ../src/snr2.c:1343 msgid "Find" msgstr "Rechercher" #: ../src/document.c:2755 msgid "Delete bookmark" msgstr "Supprimer le signet" #: ../src/document.c:2900 msgid "saving file" msgstr "Enregistrement du fichier" #: ../src/document.c:2924 ../src/document.c:2948 msgid "_Abort save" msgstr "_Abandonner l'enregistrement" #: ../src/document.c:2924 msgid "_Continue save" msgstr "_Continuer l'enregistrement" #: ../src/document.c:2926 #, c-format msgid "" "A backupfile for %s could not be created. If you continue, this file will be " "overwritten." msgstr "" "Le fichier de sauvegarde pour %s n'a pas pu être créé. Si vous continuez, ce " "fichier sera écrasé." #: ../src/document.c:2927 msgid "File backup failure" msgstr "Échec de la sauvegarde" #: ../src/document.c:2948 msgid "_Continue save in UTF-8" msgstr "_Continuer l'enregistrement en UTF-8" #: ../src/document.c:2959 #, c-format msgid "" "Failed to convert %s to character encoding %s. Encoding failed on character " "'%s' at line %d column %d\n" "\n" "Continue saving in UTF-8 encoding?" msgstr "" "Impossible de convertir %s vers l'encodage %s. L'encodage a échoué sur le " "caractère '%s' à la ligne %d colonne %d\n" "\n" "Continuer l'enregistrement en UTF-8 ?" #: ../src/document.c:2960 msgid "File encoding conversion failure" msgstr "Échec de la conversion d'encodage du fichier" #: ../src/document.c:3115 msgid "Previously: " msgstr "Précédemment : " #: ../src/document.c:3148 #, c-format msgid "Move/rename %s to" msgstr "Déplacer (vers)/renommer (en) %s" #: ../src/document.c:3148 #, c-format msgid "Save %s as" msgstr "Enregistrer %s sous" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/document.c:4387 ../src/project.c:194 msgid "_Cancel" msgstr "An_nuler" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/project.c:194 msgid "_Overwrite" msgstr "_Écraser" #: ../src/document.c:3213 #, c-format msgid "File %s exists and is opened, overwrite?" msgstr "Le fichier %s est déjà ouvert, voulez-vous vraiment l'écraser ?" #: ../src/document.c:3214 msgid "The file you have selected is being edited in Winefish." msgstr "Le fichier sélectionné est en cours d'édition dans Winefish." #: ../src/document.c:3228 ../src/project.c:195 #, c-format msgid "A file named \"%s\" already exists." msgstr "Un fichier nommé \"%s\" existe déjà." #: ../src/document.c:3230 ../src/project.c:197 msgid "Do you want to replace the existing file?" msgstr "Désirez-vous remplacer le fichier existant ?" #: ../src/document.c:3298 msgid "save as..." msgstr "Enregistrer sous..." #: ../src/document.c:3339 #, c-format msgid "" "File: %s\n" "\n" "New modification time: %s\n" "Old modification time: %s" msgstr "" "Le fichier %s\n" "\n" "Heure de la nouvelle modification : %s\n" "Heure de l'ancienne modification : %s" #: ../src/document.c:3340 msgid "File has been modified by another process." msgstr "Le fichier a été modifié par un autre processus." #: ../src/document.c:3353 #, c-format msgid "Saving %s" msgstr "Enregistrement de %s" #: ../src/document.c:3369 msgid "" "Could not backup file:\n" "\"" msgstr "" "Impossible de sauvegarder le fichier :\n" "\"" #: ../src/document.c:3370 msgid "File save aborted.\n" msgstr "Sauvegarde du fichier annulée.\n" #: ../src/document.c:3375 msgid "" "Could not write file:\n" "\"" msgstr "" "Impossible d'écrire le fichier sur le disque :\n" "\"" #: ../src/document.c:3376 msgid "File save error" msgstr "Erreur d'enregistrement de fichier" #: ../src/document.c:3435 #, c-format msgid "Save changes to \"%s\" before closing?." msgstr "" "Voulez-vous enregistrer les modifications apportées à \"%s\" avant de le " "fermer ?" #: ../src/document.c:3442 ../src/project.c:362 msgid "Do_n't save" msgstr "Ne pas enre_gistrer" #: ../src/document.c:3444 ../src/document.c:4389 ../src/project.c:371 msgid "If you don't save your changes they will be lost." msgstr "Si vous n'enregistrez pas les modifications, elles seront perdues." #: ../src/document.c:3814 msgid "/Document/Line Numbers" msgstr "/Document/Numéros de ligne" #: ../src/document.c:3817 msgid "/Document/AutoCompletion" msgstr "/Document/Terminaison automatique" #: ../src/document.c:3853 msgid "No filename" msgstr "Aucun nom de fichier" #: ../src/document.c:4001 msgid "Loading files..." msgstr "Chargement des fichiers..." #: ../src/document.c:4028 msgid "" "These files could not opened:\n" "\n" msgstr "" "Ces fichiers n'ont pas pu être ouverts :\n" "\n" #: ../src/document.c:4030 ../src/msg_queue.c:245 msgid "Unable to open file(s)\n" msgstr "Impossible d'ouvrir le(s) fichier(s)\n" #: ../src/document.c:4077 msgid "unable to open file" msgstr "Impossible d'ouvrir le fichier" #: ../src/document.c:4133 msgid "_Reload" msgstr "_Recharger" #: ../src/document.c:4133 msgid "_Ignore" msgstr "_Ignorer" #: ../src/document.c:4137 #, c-format msgid "" "Filename: %s\n" "\n" "New modification time is: %s\n" "Old modification time is: %s" msgstr "" "Nom de fichier : %s\n" "\n" "Heure de la nouvelle modification : %s\n" "Heure de l'ancienne modification : %s" #: ../src/document.c:4138 msgid "File has been modified by another process\n" msgstr "Le fichier a été modifié par un autre processus.\n" #: ../src/document.c:4272 ../src/gtk_easy.c:1629 msgid "Select files" msgstr "Sélectionner des fichiers" #: ../src/document.c:4290 #, c-format msgid "Loading %d file(s)..." msgstr "Chargement de %d fichier(s)..." #: ../src/document.c:4317 ../src/document.c:4325 msgid "Select file to insert" msgstr "Sélectionner le fichier à insérer" #: ../src/document.c:4329 msgid "no file to insert" msgstr "Aucun fichier à insérer" #: ../src/document.c:4387 msgid "_Save All" msgstr "Tout enregi_strer" #: ../src/document.c:4387 msgid "Close _All" msgstr "Tout fermer" #: ../src/document.c:4387 msgid "Choose per _File" msgstr "Choisir par _fichier" #: ../src/document.c:4388 msgid "Multiple open files have been changed." msgstr "Certains fichiers ont été modifiés." #: ../src/document.c:4667 #, c-format msgid "Statistics: %d lines, %d words, %d characters" msgstr "Statistiques : %d lignes, %d mots, %d caractères" #: ../src/filebrowser.c:1019 msgid "Error creating path" msgstr "Erreur de création du chemin" #: ../src/filebrowser.c:1019 msgid "The specified pathname already exists." msgstr "Le chemin de fichier spécifié existe déjà." #: ../src/filebrowser.c:1085 msgid "File name" msgstr "Nom du fichier" #: ../src/filebrowser.c:1087 msgid "Directory name" msgstr "Nom du répertoire" #: ../src/filebrowser.c:1118 msgid "opening directory..." msgstr "Ouverture du répertoire..." #: ../src/filebrowser.c:1211 msgid "Could not rename\n" msgstr "Impossible de renommer le fichier\n" #: ../src/filebrowser.c:1253 #, c-format msgid "Are you sure you want to delete \"%s\" ?" msgstr "Voulez-vous vraiment supprimer \"%s\" ?" #: ../src/filebrowser.c:1254 msgid "If you delete this file, it will be permanently lost." msgstr "Le fichier sera définitivement effacé." #: ../src/filebrowser.c:1262 msgid "Could not delete \n" msgstr "Impossible d'effacer le fichier\n" #: ../src/filebrowser.c:1400 msgid "/Open _Advanced..." msgstr "/P_aramétrer l'ouverture..." #: ../src/filebrowser.c:1404 msgid "/_Refresh" msgstr "/Actualise_r" #: ../src/filebrowser.c:1405 msgid "/_Set as basedir" msgstr "/_Sélectionner comme répertoire de travail" #: ../src/filebrowser.c:1409 msgid "/New _File" msgstr "/Créer un _fichier" #: ../src/filebrowser.c:1410 msgid "/_New Directory" msgstr "/Créer u_n répertoire" #: ../src/filebrowser.c:1415 msgid "/_Open" msgstr "/_Ouvrir un fichier" #: ../src/filebrowser.c:1416 msgid "/Rena_me" msgstr "/Reno_mmer" #: ../src/filebrowser.c:1417 msgid "/_Delete" msgstr "/_Supprimer" #: ../src/filebrowser.c:1439 msgid "Show hidden files" msgstr "Afficher les fichiers cachés" #: ../src/filebrowser.c:1444 msgid "Show backup files" msgstr "Afficher les fichiers de sauvegarde" #: ../src/filebrowser.c:1450 msgid "Filter" msgstr "Filtre" #: ../src/filebrowser.c:1650 ../src/gtk_easy.c:1408 msgid "All files" msgstr "Tous les fichiers" #: ../src/filebrowser.c:1922 msgid "Show full tree" msgstr "Afficher toute l'arborescence" #: ../src/filebrowser.c:1923 msgid "Follow focus" msgstr "Suivre le focus" #: ../src/fref.c:1450 ../src/fref.c:1734 ../src/fref.c:1821 ../src/fref.c:1856 msgid "Info" msgstr "Informations" #: ../src/fref.c:1469 msgid "Close" msgstr "Fermer" #: ../src/fref.c:1473 ../src/fref.c:1815 ../src/fref.c:1851 msgid "Dialog" msgstr "Dialogue" #: ../src/fref.c:1474 ../src/fref.c:1818 ../src/fref.c:1845 msgid "Insert" msgstr "Insérer" #: ../src/fref.c:1827 msgid "Options" msgstr "Options" #: ../src/fref.c:1835 msgid "Rescan reference files" msgstr "Rescanner les fichiers de référence" #: ../src/fref.c:1839 msgid "Left doubleclick action" msgstr "Action du double clic gauche" #: ../src/fref.c:1861 msgid "Info type" msgstr "Type d'informations" #: ../src/fref.c:1866 msgid "Description" msgstr "Description" #: ../src/fref.c:1871 msgid "Attributes/Parameters" msgstr "Attributs/Paramètres" #: ../src/fref.c:1876 msgid "Notes" msgstr "Notes" #: ../src/fref.c:2052 ../src/fref.c:2066 msgid "Reference search" msgstr "Recherche dans la référence" #: ../src/fref.c:2067 msgid "Reference not found" msgstr "Référence introuvable" #: ../src/fref.c:2084 msgid "Error" msgstr "Erreur" #: ../src/fref.c:2086 msgid "" "Perhaps you didn't load a reference, or you did not select a reference to " "search in." msgstr "" "Peut-être n'avez-vous pas chargé de référence ou bien n'avez vous pas choisi " "de référence dans laquelle rechercher." #: ../src/fref.c:2328 msgid "d" msgstr "d" #: ../src/fref.c:2330 msgid "i" msgstr "i" #: ../src/fref.c:2331 msgid "s" msgstr "s" #: ../src/fref.c:2332 msgid "dialog" msgstr "Dialogue" #: ../src/fref.c:2334 msgid "search" msgstr "Recherche" #: ../src/func_grep.c:270 msgid "searching files..." msgstr "Recherche des fichiers..." #: ../src/func_grep.c:283 ../src/func_grep.c:286 ../src/func_grep.c:313 msgid "grep" msgstr "grep" #: ../src/func_grep.c:338 msgid "func_grep: file(s) without filename" msgstr "func_grep : fichier(s) sans nom" #: ../src/func_grep.c:340 msgid "please specify the pattern!" msgstr "Veuilez choisir le modèle" #: ../src/func_grep.c:344 msgid "func_grep: cannot create secure file" msgstr "finc_grep : impossible de créer un fichier sécurisé." #: ../src/func_grep.c:346 msgid "no matching files found" msgstr "Aucun fichier trouvé" #: ../src/func_grep.c:348 msgid "no directory specified" msgstr "Aucun répertoire spécifié" #: ../src/func_grep.c:373 ../src/project.c:445 ../src/project.c:452 msgid "Select basedir" msgstr "Choisir le répertoire de base" #: ../src/func_grep.c:434 msgid "Grep Function" msgstr "Fonction grep" #: ../src/func_grep.c:454 msgid "General" msgstr "Général" #: ../src/func_grep.c:456 msgid "Base_dir:" msgstr "Répertoire _de base :" #: ../src/func_grep.c:458 ../src/gtk_easy.c:1342 msgid "_Browse..." msgstr "_Parcourir..." #: ../src/func_grep.c:461 msgid "<0: current file>" msgstr "<0 : fichier actif>" #: ../src/func_grep.c:462 ../src/func_grep.c:472 msgid "<1: all opened files>" msgstr "<1: tous les fichiers ouverts>" #: ../src/func_grep.c:474 msgid "_File:" msgstr "_Fichier :" #: ../src/func_grep.c:481 msgid "_Recursive:" msgstr "_Récursif :" #: ../src/func_grep.c:485 msgid "_Open files:" msgstr "_Ouvrir les fichiers :" #: ../src/func_grep.c:490 msgid "Contains" msgstr "Contient" #: ../src/func_grep.c:508 msgid "_Pattern:" msgstr "_Modèle:" #: ../src/func_grep.c:513 msgid "_Case sensitive:" msgstr "Respecter la _casse :" #: ../src/func_grep.c:517 msgid "Is rege_x:" msgstr "Est une e_xpression régulière :" #: ../src/func_grep.c:521 msgid "Advanced" msgstr "Expert" #: ../src/func_grep.c:524 msgid "Skip _VCS dirs:" msgstr "Omettre les répertoires _VCS :" #: ../src/func_grep.c:593 ../src/func_grep.c:613 #, c-format msgid "loading %d file(s)..." msgstr "Chargement de %d fichier(s)" #: ../src/func_grep.c:636 msgid "template" msgstr "Modèle" #: ../src/gtk_easy.c:1186 #, c-format msgid "%d of %d" msgstr "%d sur %d" #: ../src/gtk_easy.c:1288 msgid "Select File" msgstr "Sélectionner un fichier" #: ../src/gtk_easy.c:1401 msgid "Show hidden" msgstr "Afficher les fichiers cachés" #: ../src/gtk_easy.c:1602 msgid "Select file" msgstr "Sélectionner un fichier" #: ../src/gui.c:231 msgid "tree" msgstr "Arborescence" #: ../src/gui.c:232 msgid "functions" msgstr "Fonctions" #: ../src/gui.c:233 msgid "marks" msgstr "Signets" #: ../src/gui.c:617 msgid "New Winefish Window" msgstr "Nouvelle fenêtre Winefish" #: ../src/gui.c:681 msgid "Stand by..." msgstr "Veuillez patienter..." #: ../src/gui.c:877 msgid "Goto line" msgstr "Aller à la ligne" #: ../src/gui.c:885 msgid "_Line number:" msgstr "Numéro de _ligne : " #: ../src/gui.c:891 msgid "From _selection" msgstr "À partir de la _sélection" #: ../src/gui.c:894 msgid "Keep _dialog" msgstr "Laisser la boîte de _dialogue ouverte" #: ../src/gui.c:960 msgid "starting winefish" msgstr "Démarrage de Winefish" #: ../src/gui.c:1059 ../src/gui.c:1068 ../src/outputbox.c:127 #: ../src/outputbox.c:353 ../src/outputbox.c:470 msgid "/View/View Outputbox" msgstr "/Afficher/Afficher la boîte de sortie" #: ../src/gui.c:1073 ../src/gui.c:1079 msgid "/View/View Terminal" msgstr "/Affichage/Afficher le terminal" #: ../src/highlight.c:391 ../src/highlight.c:403 ../src/highlight.c:430 #: ../src/highlight.c:444 msgid "Syntax highlighting error for " msgstr "Erreur de coloration syntaxique pour " #: ../src/highlight.c:392 #, c-format msgid "compiling pattern '%s': %s at offset %d" msgstr "compilation du modèle '%s' : %s à la position %d" #: ../src/highlight.c:404 #, c-format msgid "studying pattern '%s': %s" msgstr "vérification du modèle '%s' : %s" #: ../src/highlight.c:431 #, c-format msgid "compiling 2nd pattern '%s': %s at offset %d" msgstr "compilation du second modèle '%s' : %s à la position %d" #: ../src/highlight.c:445 #, c-format msgid "studying 2nd pattern '%s': %s" msgstr "vérification du second modèle '%s' : %s" #: ../src/image.c:209 msgid "Insert image" msgstr "Insérer une image" #: ../src/image.c:216 msgid "Preview" msgstr "Prévisualiser" #: ../src/image.c:240 msgid "_Image location:" msgstr "Emplacement de l'_image :" #: ../src/image.c:246 msgid "Relative Path:" msgstr "Chemin relatif :" #: ../src/image.c:250 msgid "Label:" msgstr "Étiquette :" #: ../src/image.c:255 msgid "Caption:" msgstr "Légende :" #: ../src/menu.c:225 msgid "project mode: ON" msgstr "Mode projet : ACTIF" #: ../src/menu.c:227 msgid "project mode: OFF" msgstr "Mode projet : INACTIF" #: ../src/menu.c:255 msgid "brace_finder: matching not found" msgstr "Appariement de crochets : aucun résultat" #: ../src/menu.c:257 msgid "brace_finder: inside a commented line" msgstr "Appariement de crochets : dans un commentaire" #: ../src/menu.c:259 msgid "brace_finder: inside the selection" msgstr "Appariement de crochets : dans la sélection" #: ../src/menu.c:272 msgid "/_File" msgstr "/_Fichier" #: ../src/menu.c:273 msgid "/File/tearoff1" msgstr "/Fichier/tearoff1" #: ../src/menu.c:274 msgid "/File/_New" msgstr "/Fichier/_Nouveau" #: ../src/menu.c:275 msgid "/File/New _Window" msgstr "/Fichier/Nouve_lle fenêtre" #: ../src/menu.c:276 msgid "/File/_Open..." msgstr "/Fichier/_Ouvrir..." #: ../src/menu.c:277 msgid "/File/Open Recen_t" msgstr "/Fichier/Récemment ou_vert" #: ../src/menu.c:278 msgid "/File/Open Recent/tearoff1" msgstr "/Fichier/Récemment ouvert/tearoff1" #: ../src/menu.c:281 msgid "/File/Open Ad_vanced..." msgstr "/Fichier/P_aramétrer l'ouverture..." #: ../src/menu.c:284 msgid "/File/Open _from selection" msgstr "/Fichier/Ouvrir à partir de la séle_ction" #: ../src/menu.c:285 msgid "/File/sep1" msgstr "/Fichier/sep1" #: ../src/menu.c:286 msgid "/File/_Save" msgstr "/Fichier/_Enregistrer" #: ../src/menu.c:287 msgid "/File/Save _As..." msgstr "/Fichier/Enregistrer _sous..." #: ../src/menu.c:288 msgid "/File/Sav_e All" msgstr "/Fichier/Tout Enre_gistrer" #: ../src/menu.c:289 msgid "/File/_Revert to Saved" msgstr "/Fichier/Revenir au _dernier enregistrement" #: ../src/menu.c:290 msgid "/File/sep2" msgstr "/Fichier/sep2" #: ../src/menu.c:291 msgid "/File/_Insert..." msgstr "/Fichier/_Insérer..." #: ../src/menu.c:292 msgid "/File/Rena_me..." msgstr "/Fichier/Reno_mmer..." #: ../src/menu.c:293 msgid "/File/sep3" msgstr "/Fichier/sep3" #: ../src/menu.c:294 msgid "/File/_Close" msgstr "/Fichier/_Fermer" #: ../src/menu.c:295 msgid "/File/Close A_ll" msgstr "/Fichier/_Tout fermer" #: ../src/menu.c:296 msgid "/File/Close Win_dow" msgstr "/Fichier/Fe_rmer la fenêtre" #: ../src/menu.c:297 msgid "/File/sep4" msgstr "/Fichier/sep4" #: ../src/menu.c:299 msgid "/File/_Quit" msgstr "/Fichier/_Quitter" #: ../src/menu.c:301 msgid "/_Edit" msgstr "/_Éditer" #: ../src/menu.c:302 msgid "/Edit/Tearoff1" msgstr "/Éditer/Tearoff1" #: ../src/menu.c:303 msgid "/Edit/_Undo" msgstr "/Éditer/_Annuler" #: ../src/menu.c:304 msgid "/Edit/_Redo" msgstr "/Éditer/_Rétablir" #: ../src/menu.c:305 msgid "/Edit/Undo All" msgstr "/Éditer/Tout annuler" #: ../src/menu.c:306 msgid "/Edit/Redo All" msgstr "/Éditer/Tout rétablir" #: ../src/menu.c:307 msgid "/Edit/sep1" msgstr "/Éditer/sep1" #: ../src/menu.c:308 msgid "/Edit/Selection" msgstr "/Éditer/Sélectionner" #: ../src/menu.c:309 msgid "/Edit/Selection/Tearoff1" msgstr "/Éditer/Sélectionner/Tearoff1" #: ../src/menu.c:310 msgid "/Edit/Selection/Cu_t" msgstr "/Éditer/Sélectionner/Cou_per" #: ../src/menu.c:311 msgid "/Edit/Selection/_Copy" msgstr "/Éditer/Sélectionner/_Copier" #: ../src/menu.c:312 msgid "/Edit/Selection/_Paste" msgstr "/Éditer/Sélectionner/Co_ller" #: ../src/menu.c:313 msgid "/Edit/Selection/sep2" msgstr "/Éditer/Sélectionner/sep2" #: ../src/menu.c:314 msgid "/Edit/Selection/Select _All" msgstr "/Éditer/Sélectionner/_Tout sélectionner" #: ../src/menu.c:315 msgid "/Edit/Find, Replace" msgstr "/Éditer/Rechercher, Remplacer" #: ../src/menu.c:316 msgid "/Edit/Find, Replace/Tearoff1" msgstr "/Éditer/Rechercher, Remplacer/Tearoff1" #: ../src/menu.c:317 msgid "/Edit/Find, Replace/Brace Finder (Forward)" msgstr "/Éditer/Rechercher, Remplacer/Apparier les crochets (vers le bas)" #: ../src/menu.c:318 msgid "/Edit/Find, Replace/Brace Finder (Backward)" msgstr "/Éditer/Rechercher, Remplacer/Apparier les crochets (vers le haut)" #: ../src/menu.c:319 msgid "/Edit/Find, Replace/sep0" msgstr "/Éditer/Rechercher, Remplacer/sep0" #: ../src/menu.c:320 msgid "/Edit/Find, Replace/_Find..." msgstr "/Éditer/Rechercher, Remplacer/Rec_hercher..." #: ../src/menu.c:321 msgid "/Edit/Find, Replace/Find A_gain" msgstr "/Éditer/Rechercher, Remplacer/Rec_ommencer la recherche" #: ../src/menu.c:322 msgid "/Edit/Find, Replace/Find from selection" msgstr "/Éditer/Rechercher, Remplacer/Rechercher à partir de la sélection" #: ../src/menu.c:325 msgid "/Edit/Find, Replace/Find from Files" msgstr "/Éditer/Rechercher, Remplacer/Rechercher à partir des fichiers" #: ../src/menu.c:326 msgid "/Edit/Find, Replace/Templates" msgstr "/Éditer/Rechercher, Remplacer/Modèles" #: ../src/menu.c:329 msgid "/Edit/Find, Replace/sep1" msgstr "/Éditer/Rechercher, Remplacer/sep1" #: ../src/menu.c:330 msgid "/Edit/Find, Replace/R_eplace..." msgstr "/Éditer/Rechercher, Remplacer/R_emplacer..." #: ../src/menu.c:331 msgid "/Edit/Find, Replace/Replace Agai_n" msgstr "/Éditer/Rechercher, Remplacer/Remplacer e_ncore" #: ../src/menu.c:332 msgid "/Edit/Find, Replace/sep2" msgstr "/Éditer/Rechercher, Remplacer/sep2" #: ../src/menu.c:334 msgid "/Edit/Find, Replace/To _Uppercase" msgstr "/Éditer/Rechercher, Remplacer/Par des maj_uscules" #: ../src/menu.c:335 msgid "/Edit/Find, Replace/To _Lowercase" msgstr "/Éditer/Rechercher, Remplacer/Par des minuscu_les" #: ../src/menu.c:336 msgid "/Edit/Find, Replace/sep3" msgstr "/Éditer/Rechercher, Remplacer/sep3" #: ../src/menu.c:337 msgid "/Edit/Find, Replace/ASCII to HTML entities" msgstr "/Éditer/Rechercher, Remplacer/ASCII => entités HTML" #: ../src/menu.c:338 msgid "/Edit/Find, Replace/ISO8859 to HTML entities" msgstr "/Éditer/Rechercher, Remplacer/ISO-8859 => entités HTML" #: ../src/menu.c:339 msgid "/Edit/Find, Replace/ASCII & ISO8859 to HTML entities" msgstr "/Éditer/Rechercher, Remplacer/ASCII et ISo8859 => entités HTML" #: ../src/menu.c:341 msgid "/Edit/sep4" msgstr "/Éditer/sep4" #: ../src/menu.c:342 msgid "/Edit/Sh_ift Right" msgstr "/Éditer/Au_gmenter le retrait" #: ../src/menu.c:343 msgid "/Edit/S_hift Left" msgstr "/Éditer/Dimin_uer le retrait" #: ../src/menu.c:344 msgid "/Edit/_Comment" msgstr "/Éditer/Mettre en _commentaire" #: ../src/menu.c:345 msgid "/Edit/_UnComment" msgstr "/Éditer/Ôter les _marques de commentaire" #: ../src/menu.c:346 msgid "/Edit/_Hard Shift Left" msgstr "/Éditer/Retrait _négatif" #: ../src/menu.c:347 msgid "/Edit/Delete Current Line" msgstr "/Éditer/Supprimer la ligne active" #: ../src/menu.c:348 msgid "/Edit/sep5" msgstr "/Éditer/sep5" #: ../src/menu.c:349 msgid "/Edit/Add _Bookmark" msgstr "/Éditer/A_jouter un signet" #: ../src/menu.c:350 msgid "/_Insert" msgstr "/_Insertion" #: ../src/menu.c:351 msgid "/Insert/Tearoff1" msgstr "/Insertion/Tearoff1" #: ../src/menu.c:353 msgid "/Insert/T_ools" msgstr "/Insertion/_Outils" #: ../src/menu.c:354 msgid "/Insert/Tools/Tearoff1" msgstr "/Insertion/Outils/Tearoff1" #: ../src/menu.c:355 msgid "/Insert/Tools/Simple document (code)" msgstr "/Insertion/Outils/Document de base (code)" #: ../src/menu.c:356 msgid "/Insert/Tools/Figure" msgstr "/Insertion/Outils/Graphique" #: ../src/menu.c:357 msgid "/Insert/Tools/Time, Date" msgstr "/Insertion/Outils/Date, Heure" #: ../src/menu.c:358 msgid "/Insert/Tools/Source Separator" msgstr "/Insertion/Outils/Séparateur de source" #: ../src/menu.c:360 msgid "/Insert/_Table, List" msgstr "/Insertion/_Tableau, Liste" #: ../src/menu.c:361 msgid "/Insert/Table, List/Tearoff1" msgstr "/Insertion/Tableau, Liste/Tearoff1" #: ../src/menu.c:362 msgid "/Insert/Table, List/_List" msgstr "/Insertion/Tableau, Liste/_Liste" #: ../src/menu.c:363 msgid "/Insert/Table, List/_Table, Array" msgstr "/Insertion/Tableau, Liste/_Tableau, Matrice" #: ../src/menu.c:365 msgid "/Insert/_Headings" msgstr "/Insertion/_En-têtes" #: ../src/menu.c:366 msgid "/Insert/Headings/Tearoff1" msgstr "/Insertion/En-têtes/Tearoff1" #: ../src/menu.c:367 msgid "/Insert/Headings/_part" msgstr "/Insertion/En-têtes/_Partie" #: ../src/menu.c:368 msgid "/Insert/Headings/_chapter" msgstr "/Insertion/En-têtes/_Chapitre" #: ../src/menu.c:369 msgid "/Insert/Headings/_section" msgstr "/Insertion/En-têtes/_Section" #: ../src/menu.c:370 msgid "/Insert/Headings/s_ubsection" msgstr "/Insertion/En-têtes/S_ous-section" #: ../src/menu.c:371 msgid "/Insert/Headings/su_bsubsection" msgstr "/Insertion/En-têtes/So_us-sous-section" #: ../src/menu.c:372 msgid "/Insert/Headings/sep1" msgstr "/Insertion/En-têtes/sep1" #: ../src/menu.c:373 msgid "/Insert/Headings/parag_raph" msgstr "/Insertion/En-têtes/Para_graphe" #: ../src/menu.c:374 msgid "/Insert/Headings/subparag_raph" msgstr "/Insertion/En-têtes/Sous-parag_raphe" #: ../src/menu.c:375 msgid "/Insert/Headings/sep2" msgstr "/Insertion/En-têtes/sep2" #: ../src/menu.c:376 msgid "/Insert/Headings/_part*" msgstr "/Insertion/En-têtes/P_artie*" #: ../src/menu.c:377 msgid "/Insert/Headings/_chapter*" msgstr "/Insertion/En-têtes/C_hapitre*" #: ../src/menu.c:378 msgid "/Insert/Headings/_section*" msgstr "/Insertion/En-têtes/Sectio_n*" #: ../src/menu.c:379 msgid "/Insert/Headings/s_ubsection*" msgstr "/Insertion/En-têtes/Sous-se_ction*" #: ../src/menu.c:380 msgid "/Insert/Headings/su_bsubsection*" msgstr "/Insertion/En-têtes/Sous-sous-sect_ion*" #: ../src/menu.c:382 msgid "/Insert/_Environments" msgstr "/Insertion/En_vironnements" #: ../src/menu.c:383 msgid "/Insert/Environments/tearoff1" msgstr "/Insertion/Environnements/tearoff1" #: ../src/menu.c:385 msgid "/Insert/Environments/flush_left" msgstr "/Insertion/Environnements/Aligné à _gauche" #: ../src/menu.c:386 msgid "/Insert/Environments/flush_right" msgstr "/Insertion/Environnements/Aligné à _droite" #: ../src/menu.c:387 msgid "/Insert/Environments/_centering" msgstr "/Insertion/Environnements/_Centré" #: ../src/menu.c:388 msgid "/Insert/Environments/sep2" msgstr "/Insertion/Environnements/sep2" #: ../src/menu.c:389 msgid "/Insert/Environments/_verbatim" msgstr "/Insertion/Environnements/_Verbatim" #: ../src/menu.c:390 msgid "/Insert/Environments/verbati_m*" msgstr "/Insertion/Environnements/Verbati_m*" #: ../src/menu.c:391 msgid "/Insert/Environments/ver_se" msgstr "/Insertion/Environnements/Ver_s" #: ../src/menu.c:392 msgid "/Insert/Environments/_quotation" msgstr "/Insertion/Environnements/_Guillemets" #: ../src/menu.c:395 msgid "/Insert/AMS equations" msgstr "/Insertion/Équations AMS" #: ../src/menu.c:396 msgid "/Insert/AMS equations/tearoff1" msgstr "/Insertion/Équations AMS/tearoff1" #: ../src/menu.c:397 msgid "/Insert/AMS equations/split" msgstr "/Insertion/Équations AMS/Scinder" #: ../src/menu.c:398 msgid "/Insert/AMS equations/cases" msgstr "/Insertion/Équations AMS/Cas" #: ../src/menu.c:399 msgid "/Insert/AMS equations/sep1" msgstr "/Insertion/Équations AMS/sep1" #: ../src/menu.c:401 msgid "/Insert/AMS equations/aligned" msgstr "/Insertion/Équations AMS/Aligné" #: ../src/menu.c:402 msgid "/Insert/AMS equations/gathered" msgstr "/Insertion/Équations AMS/Regroupé" #: ../src/menu.c:403 msgid "/Insert/AMS equations/sep2" msgstr "/Insertion/Équations AMS/sep2" #: ../src/menu.c:405 msgid "/Insert/AMS equations/equation" msgstr "/Insertion/Équations AMS/Équation" #: ../src/menu.c:406 msgid "/Insert/AMS equations/align" msgstr "/Insertion/Équations AMS/Alignement" #: ../src/menu.c:407 msgid "/Insert/AMS equations/subequations" msgstr "/Insertion/Équations AMS/Sous-équations" #: ../src/menu.c:408 msgid "/Insert/AMS equations/gather" msgstr "/Insertion/Équations AMS/Regrouper" #: ../src/menu.c:409 msgid "/Insert/AMS equations/multline" msgstr "/Insertion/Équations AMS/Multiligne" #: ../src/menu.c:411 msgid "/Insert/AMS equations/alignat" msgstr "/Insertion/Équations AMS/Alignement réparti" #: ../src/menu.c:412 msgid "/Insert/AMS equations/sep3" msgstr "/Insertion/Équations AMS/sep3" #: ../src/menu.c:414 msgid "/Insert/AMS equations/equation*" msgstr "/Insertion/Équations AMS/Équation*" #: ../src/menu.c:415 msgid "/Insert/AMS equations/align*" msgstr "/Insertion/Équations AMS/Alignement*" #: ../src/menu.c:416 msgid "/Insert/AMS equations/gather*" msgstr "/Insertion/Équations AMS/Regroupé*" #: ../src/menu.c:417 msgid "/Insert/AMS equations/multline*" msgstr "/Insertion/Équations AMS/Multiligne*" #: ../src/menu.c:419 msgid "/Insert/AMS equations/alignat*" msgstr "/Insertion/Équations AMS/Alignement réparti*" #: ../src/menu.c:421 msgid "/Insert/_Font style" msgstr "/Insertion/Style de _police" #: ../src/menu.c:424 msgid "/Insert/Font/Sizes" msgstr "/Insertion/Polices/Corps" #: ../src/menu.c:425 msgid "/Insert/Font/Sizes/tearoff1" msgstr "/Insertion/Polices/Corps/tearoff1" #: ../src/menu.c:426 msgid "/Insert/Font/Sizes/{\\\\tiny }" msgstr "/Insertion/Polices/Corps/{\\\\Très petit }" #: ../src/menu.c:427 msgid "/Insert/Font/Sizes/{\\\\scriptsize }" msgstr "/Insertion/Polices/Corps/{\\\\Script }" #: ../src/menu.c:428 msgid "/Insert/Font/Sizes/{\\\\footnotesize }" msgstr "/Insertion/Polices/Corps/{\\\\Note de bas de page }" #: ../src/menu.c:429 msgid "/Insert/Font/Sizes/{\\\\small }" msgstr "/Insertion/Polices/Corps/{\\\\Petit }" #: ../src/menu.c:430 msgid "/Insert/Font/Sizes/{\\\\normalsize }" msgstr "/Insertion/Polices/Corps/{\\\\Normal }" #: ../src/menu.c:431 msgid "/Insert/Font/Sizes/{\\\\large }" msgstr "/Insertion/Polices/Corps/{\\\\grand }" #: ../src/menu.c:432 msgid "/Insert/Font/Sizes/{\\\\Large }" msgstr "/Insertion/Polices/Corps/{\\\\Grand }" #: ../src/menu.c:433 msgid "/Insert/Font/Sizes/{\\\\huge }" msgstr "/Insertion/Polices/Corps/{\\\\Très grand }" #: ../src/menu.c:434 msgid "/Insert/Font/Sizes/{\\\\Huge }" msgstr "/Insertion/Polices/Corps/{\\\\Très Grand }" #: ../src/menu.c:438 msgid "/Insert/Font style/tearoff1" msgstr "/Insertion/Style de police/tearoff1" #: ../src/menu.c:439 msgid "/Insert/Font style/\\\\emph - _emphasized" msgstr "/Insertion/Style de police/\\\\emph - _Emphase" #: ../src/menu.c:440 msgid "/Insert/Font style/\\\\underline - _underlined" msgstr "/Insertion/Style de police/\\\\underline - _Souligné" #: ../src/menu.c:441 msgid "/Insert/Font style/\\\\textit - _italic" msgstr "/Insertion/Style de police/\\\\textit - _Italique" #: ../src/menu.c:442 msgid "/Insert/Font style/\\\\textsl - _slanted" msgstr "/Insertion/Style de police/\\\\textsl - _Oblique" #: ../src/menu.c:443 msgid "/Insert/Font style/\\\\textbf - _boldface" msgstr "/Insertion/Style de police/\\\\textbf - _Gras" #: ../src/menu.c:444 msgid "/Insert/Font style/\\\\texttt - _typewriter" msgstr "/Insertion/Style de police/\\\\texttt - _Machine à écrire" #: ../src/menu.c:445 msgid "/Insert/Font style/\\\\textsc - small_caps" msgstr "/Insertion/Style de police/\\\\textsc - Petites ma_juscules" #: ../src/menu.c:448 msgid "/Insert/Font/Maths" msgstr "/Insertion/Polices/Mathématique" #: ../src/menu.c:449 msgid "/Insert/Font/Maths/tearoff1" msgstr "/Insertion/Polices/Mathématique/tearoff1" #: ../src/menu.c:450 msgid "/Insert/Font/Maths/\\\\mathrm - Roman" msgstr "/Insertion/Polices/Mathématique/\\\\mathrm - Roman" #: ../src/menu.c:451 msgid "/Insert/Font/Maths/\\\\mathit - Italic" msgstr "/Insertion/Polices/Mathématique/\\\\mathit - Italique" #: ../src/menu.c:452 msgid "/Insert/Font/Maths/\\\\mathbf - Boldface" msgstr "/Insertion/Polices/Mathématique/\\\\mathbf - Gras" #: ../src/menu.c:453 msgid "/Insert/Font/Maths/\\\\mathsf - Sans serif" msgstr "/Insertion/Polices/Mathématique/\\\\mathsf - Sans serif" #: ../src/menu.c:454 msgid "/Insert/Font/Maths/\\\\mathtt - Typewriter" msgstr "/Insertion/Polices/Mathématique/\\\\mathtt - Machine à écrire" #: ../src/menu.c:455 msgid "/Insert/Font/Maths/sep1" msgstr "/Insertion/Polices/Mathématique/sep1" #: ../src/menu.c:456 msgid "/Insert/Font/Maths/\\\\mathcal - Caligraphic" msgstr "/Insertion/Polices/Mathématique/\\\\mathcal - Calligraphique" #: ../src/menu.c:457 msgid "/Insert/Font/Maths/\\\\mathbb - Blackboard" msgstr "/Insertion/Polices/Mathématique/\\\\mathbb - Tableau noir" #: ../src/menu.c:458 msgid "/Insert/Font/Maths/\\\\mathfrak - Fraktur" msgstr "/Insertion/Polices/Mathématique/\\\\mathfrak - Gothique" #: ../src/menu.c:500 msgid "/_Document" msgstr "/_Document" #: ../src/menu.c:501 msgid "/Document/tearoff1" msgstr "/Document/tearoff1" #: ../src/menu.c:502 msgid "/Document/_Increase Tabsize" msgstr "/Document/Au_gmenter la largeur de tabulat_ion" #: ../src/menu.c:503 msgid "/Document/_Decrease Tabsize" msgstr "/Document/Ré_duire la largeur de tabulation" #: ../src/menu.c:504 msgid "/Document/_Auto Indent" msgstr "/Document/Indentation _automatique" #: ../src/menu.c:505 msgid "/Document/sep1" msgstr "/Document/sep1" #: ../src/menu.c:506 msgid "/Document/Auto_Completion" msgstr "/Document/_Terminaison automatique" #: ../src/menu.c:507 msgid "/Document/_Wrap" msgstr "/Document/_Césure" #: ../src/menu.c:508 msgid "/Document/_Line Numbers" msgstr "/Document/Numéros de _ligne" #: ../src/menu.c:509 msgid "/Document/sep2" msgstr "/Document/sep2" #: ../src/menu.c:510 msgid "/Document/_Highlight Syntax" msgstr "/Document/C_olorer le code" #: ../src/menu.c:511 msgid "/Document/_Update Highlighting" msgstr "/Document/Mettre à jo_ur la coloration syntaxique" #: ../src/menu.c:512 msgid "/Document/sep3" msgstr "/Document/sep3" #: ../src/menu.c:513 msgid "/Document/Document Ty_pe" msgstr "/Document/Ty_pe de document" #: ../src/menu.c:514 msgid "/Document/Document Type/tearoff1" msgstr "/Document/Type de document/tearoff1" #: ../src/menu.c:515 msgid "/Document/Character _Encoding" msgstr "/Document/_Encodage" #: ../src/menu.c:516 msgid "/Document/Character Encoding/tearoff1" msgstr "/Document/Encodage/tearoff1" #: ../src/menu.c:517 msgid "/Document/sep4" msgstr "/Document/sep4" #: ../src/menu.c:519 msgid "/Document/Check _Spelling..." msgstr "/Document/Vérification ort_hographique..." #: ../src/menu.c:521 msgid "/Document/_Floating window" msgstr "/Document/Fenêtre _flottante" #: ../src/menu.c:522 msgid "/Document/Word _Count" msgstr "/Document/Compter les _mots" #: ../src/menu.c:526 msgid "/E_xternal" msgstr "/E_xterne" #: ../src/menu.c:527 msgid "/External/tearoff1" msgstr "/Externe/tearoff1" #: ../src/menu.c:528 ../src/menu.c:768 ../src/outputbox.c:627 #: ../src/outputbox.c:630 msgid "/External/Stop..." msgstr "/Externe/Arrêter..." #: ../src/menu.c:529 msgid "/External/_Project mode" msgstr "/Externe/Mode _projet" #: ../src/menu.c:531 msgid "/_Project" msgstr "/_Projet" #: ../src/menu.c:532 msgid "/Project/tearoff1" msgstr "/Projet/tearoff1" #: ../src/menu.c:533 msgid "/Project/_New" msgstr "/Projet/_Nouveau" #: ../src/menu.c:534 msgid "/Project/_Open" msgstr "/Projet/_Ouvrir" #: ../src/menu.c:535 msgid "/Project/Open R_ecent" msgstr "/Projet/_Récemment ouvert" #: ../src/menu.c:536 msgid "/Project/Open Recent/tearoff1" msgstr "/Projet/_Récemment ouvert/tearoff1" #: ../src/menu.c:537 msgid "/Project/sep1" msgstr "/Projet/sep1" #: ../src/menu.c:538 msgid "/Project/_Save" msgstr "/Projet/_Enregistrer" #: ../src/menu.c:539 msgid "/Project/Save _as..." msgstr "/Projet/Enregistrer _sous..." #: ../src/menu.c:540 msgid "/Project/Save & _close" msgstr "/Projet/Enregistrer et _fermer" #: ../src/menu.c:541 msgid "/Project/sep2" msgstr "Projet/sep2" #: ../src/menu.c:542 ../src/project.c:227 msgid "/Project/Project options..." msgstr "Projet/Options du projet..." #: ../src/menu.c:544 msgid "/_Go" msgstr "/A_ller à" #: ../src/menu.c:545 msgid "/Go/tearoff1" msgstr "Aller à/tearoff1" #: ../src/menu.c:546 msgid "/Go/_Previous document" msgstr "/Aller à/Document _précédent" #: ../src/menu.c:547 msgid "/Go/_Next document" msgstr "/Aller à/Document suiva_nt" #: ../src/menu.c:548 ../src/menu.c:551 msgid "/Go/sep1" msgstr "/Aller à/sep1" #: ../src/menu.c:549 msgid "/Go/_First document" msgstr "/Aller à/Premier d_ocument" #: ../src/menu.c:550 msgid "/Go/L_ast document" msgstr "/Aller à/Dernier doc_ument" #: ../src/menu.c:552 msgid "/Go/Goto _Line" msgstr "/Aller à/Aller à la _ligne" #: ../src/menu.c:553 msgid "/Go/Goto _Selection" msgstr "/Aller à/Aller à la _sélection" #: ../src/menu.c:555 msgid "/_View" msgstr "/A_ffichage" #: ../src/menu.c:556 msgid "/View/tearoff1" msgstr "/Affichage/tearoff1" #: ../src/menu.c:558 msgid "/View/View _Custom Menu" msgstr "/Affichage/Afficher le menu _personnalisé" #: ../src/menu.c:559 msgid "/View/View _Sidebar" msgstr "/Affichage/Afficher le panneau _latéral" #: ../src/menu.c:560 msgid "/View/View _Outputbox" msgstr "/Affichage/Afficher la boîte de _sortie" #: ../src/menu.c:562 msgid "/View/View _Terminal" msgstr "/Affichage/Afficher le _terminal" #: ../src/menu.c:564 msgid "/_?" msgstr "/_Aide" #: ../src/menu.c:565 msgid "/?/_About..." msgstr "/Aide/A _propos..." #: ../src/menu.c:566 msgid "/?/sep1" msgstr "/Aide/sep1" #: ../src/menu.c:567 msgid "/?/_Save Settings" msgstr "/Aide/Enregistrer les para_mètres" #: ../src/menu.c:568 msgid "/?/Save Shortcut _Keys" msgstr "/Aide/Enregistrer les _raccourcis clavier" #: ../src/menu.c:569 msgid "/?/_Preferences" msgstr "/Aide/_Préférences" #: ../src/menu.c:706 msgid "/Document/Document Type" msgstr "/Document/Type de document" #: ../src/menu.c:762 msgid "/View/View Custom Menu" msgstr "/Affichage/Afficher le menu personnalisé" #: ../src/menu.c:763 msgid "/View/View Sidebar" msgstr "/Affichage/Afficher le panneau latéral" #: ../src/menu.c:764 msgid "/Document/Auto Indent" msgstr "/Document/Indentation automatique" #: ../src/menu.c:765 ../src/project.c:229 ../src/project.c:231 #: ../src/project.c:233 msgid "/External/Project mode" msgstr "/Externe/Mode Projet" #: ../src/menu.c:796 msgid "output" msgstr "Sortie" #: ../src/menu.c:844 msgid "loading file(s)..." msgstr "Chargement des fichiers..." #: ../src/menu.c:848 msgid "The filename was:\n" msgstr "Le nom du fichier était :\n" #: ../src/menu.c:849 msgid "Could not open file\n" msgstr "Impossible d'ouvrir le fichier\n" #: ../src/menu.c:872 msgid "/Project/Open Recent" msgstr "/Projet/Récemment ouvert" #: ../src/menu.c:876 msgid "/File/Open Recent" msgstr "/Fichier/Récemment ouvert" #: ../src/menu.c:1003 msgid "/Windows" msgstr "/Fenêtres" #: ../src/menu.c:1053 msgid "Could not view file in browser, the file does not yet have a name\n" msgstr "" "Impossible de visualiser le fichier dans le navigateur, le fichier n'a pas " "encore de nom\n" #: ../src/menu.c:1216 ../src/menu.c:1236 ../src/menu.c:1254 ../src/menu.c:1268 #: ../src/menu.c:1292 ../src/menu.c:1306 msgid "/External" msgstr "/Externe" #: ../src/menu.c:1351 msgid "/Document/Character Encoding" msgstr "/Document/Encodage" #: ../src/menu.c:1617 msgid "This custom search and replace requires a selection" msgstr "Cette recherche et remplacement personnalisé requiert une sélection" #: ../src/menu.c:1715 msgid "/_Custom menu" msgstr "/_Menu personnalisé" #: ../src/menu.c:1716 msgid "/Custom menu/sep" msgstr "/Menu personnalisé/sep" #: ../src/menu.c:1717 msgid "/Custom menu/Edit custom menu..." msgstr "/Menu personnalisé/Éditer menu personnalisé..." #: ../src/menu.c:1718 msgid "/Custom menu/Reset" msgstr "Menu personnalisé/Revenir aux valeurs par défaut" #: ../src/menu.c:1719 msgid "/Custom menu/Load new" msgstr "Menu personnalisé/Charger le nouveau menu" #: ../src/menu.c:1935 msgid "Search Pattern" msgstr "Rechercher un modèle" #: ../src/menu.c:1936 msgid "Replace String" msgstr "Remplacer la chaîne" #: ../src/menu.c:1939 msgid "Formatstring Before" msgstr "Préfixe de formatage" #: ../src/menu.c:1940 msgid "Formatstring After" msgstr "Suffixe de formatage" #: ../src/menu.c:1987 msgid "The menupath you want to update does not exist yet" msgstr "Le chemin du menu que vous voulez mettre à jour n'existe pas encore" #: ../src/menu.c:1987 msgid "Try 'add' instead." msgstr "Essayez plutôt 'Ajouter'." #: ../src/menu.c:1989 msgid "The menupath you want to add already exists." msgstr "Le chemin du menu que vous voulez ajouter existe déjà." #: ../src/menu.c:1994 msgid "The menupath should start with a / character" msgstr "Le chemin du menu doit commencer par le caractère /" #: ../src/menu.c:2156 msgid "Custom Menu Editor" msgstr "Éditeur de menu personnalisé" #: ../src/menu.c:2167 msgid "Add New Menu Entry" msgstr "Ajouter une nouvelle entrée au Menu" #: ../src/menu.c:2169 msgid "Apply Changes" msgstr "Appliquer les changements" #: ../src/menu.c:2171 msgid "Delete Menu Entry" msgstr "Supprimer l'entrée du Menu" #: ../src/menu.c:2174 msgid "Close Discards Changes" msgstr "Abandonner et Fermer" #: ../src/menu.c:2176 msgid "Save Changes and Exit" msgstr "Enregistrer les changements et quitter" #: ../src/menu.c:2186 msgid "_Menu Path:" msgstr "Chemin du _menu :" #: ../src/menu.c:2207 msgid "Menu path" msgstr "Chemin du menu :" #: ../src/menu.c:2227 msgid "Number of _Variables:" msgstr "Nombre de _variables :" #: ../src/menu.c:2235 msgid "Variables" msgstr "Variables" #: ../src/menu.c:2254 msgid "Custom Dialo_g" msgstr "Dialo_gue personnalisé" #: ../src/menu.c:2256 msgid "Custom Replace" msgstr "Remplacement personnalisé" #: ../src/menu.c:2268 msgid "_Replace:" msgstr "_Remplacer :" #: ../src/menu.c:2271 msgid "in current document" msgstr "dans le document actif" #: ../src/menu.c:2271 msgid "from cursor" msgstr "à partir du curseur" #: ../src/menu.c:2271 msgid "in selection" msgstr "à l'intérieur de la sélection" #: ../src/menu.c:2271 msgid "in all open documents" msgstr "dans tous les documents ouverts" #: ../src/menu.c:2279 msgid "Matc_hing:" msgstr "Correspondance :" #: ../src/menu.c:2282 msgid "normal" msgstr "normale" #: ../src/menu.c:2282 msgid "posix regular expresions" msgstr "expression régulière posix" #: ../src/menu.c:2282 msgid "perl regular expresions" msgstr "expression régulière perl" #: ../src/menu.c:2288 msgid "Case Se_nsitive" msgstr "Se_nsible à la casse" #: ../src/msg_queue.c:243 msgid "These files were not opened:\n" msgstr "Ces fichiers n'ont pas été ouverts :\n" #: ../src/outputbox.c:166 msgid "hide this box" msgstr "Masquer la boîte" #: ../src/outputbox.c:172 msgid "copy this line" msgstr "Copier la ligne" #: ../src/outputbox.c:192 #, c-format msgid "goto line %s, file = %s" msgstr "Aller à la ligne %s du fichier %s" #: ../src/outputbox.c:194 #, c-format msgid "goto file = %s" msgstr "Aller dans le fichier %s" #: ../src/outputbox.c:198 #, c-format msgid "goto line %s, current file" msgstr "Aller à la ligne %s du fichier actif" #: ../src/outputbox.c:203 #, c-format msgid "file: %s" msgstr "Fichier : %s" #: ../src/outputbox.c:224 msgid "noop" msgstr "Néant" #: ../src/outputbox.c:385 msgid "term" msgstr "Élément" #: ../src/outputbox.c:482 msgid "tool is running. press Escape to stop it first." msgstr "" "La commande est en cours d'exécution. Appuyez d'abord sur la touche Escape " "pour arrêter son exécution." #: ../src/outputbox.c:492 msgid "empty command" msgstr "Rafraîchir la ligne de commande" #: ../src/outputbox.c:498 #, c-format msgid "%s # project mode: ON" msgstr "%s # mode projet: ACTIF" #: ../src/outputbox.c:500 #, c-format msgid "%s # project mode: OFF" msgstr "%s # mode projet: INACTIF" #: ../src/outputbox.c:509 msgid "file wasnot saved. tool canceled" msgstr "Le fichier n'a pas été enregistré. La commande a été annulée." #: ../src/outputbox.c:533 #, c-format msgid "failed to compile pattern %s" msgstr "Échec de la compilation du modèle %s" #: ../src/outputbox.c:586 msgid "stop request. stopping tool..." msgstr "Demande d'arrêt d'exécution. Commande en cours d'arrêt..." #: ../src/outputbox_bf.c:169 ../src/outputbox_bf.c:178 #, c-format msgid "some error happened creating fifo %s" msgstr "Une erreur s'est produite lors de la création du fifo %s" #: ../src/outputbox_bf.c:391 #, c-format msgid "exit code: %d" msgstr "Code de sortie : %d" #: ../src/outputbox_bf.c:399 ../src/outputbox_ka.c:97 msgid "the child process exited abnormally" msgstr "Le processus enfant s'est terminé anormalement" #: ../src/outputbox_ka.c:93 #, c-format msgid "Exit code: %d" msgstr "Code de sortie : %d" #: ../src/outputbox_ka.c:151 #, c-format msgid "IOChannel Error: %s" msgstr "Erreur sur les canaux E/S : %s" #: ../src/outputbox_ka.c:294 #, c-format msgid "Error: %s" msgstr "Erreur : %s" #: ../src/outputbox_ka.c:297 msgid "hint: you may call the tool again" msgstr "Astuce : vous pouvez relancer la commande" #: ../src/outputbox_ka.c:300 msgid "tool finished." msgstr "Exécution de la commande terminée." #: ../src/outputbox_ka.c:306 msgid "error: cannot create PIPE file." msgstr "Erreur : impossible de créer le fichier tube." #: ../src/outputbox_ka.c:311 msgid "error: cannot create temporarily file." msgstr "Erreur : impossible de créer le fichier temporaire." #: ../src/preferences.c:271 msgid "Untitled" msgstr "Sans titre" #: ../src/preferences.c:371 msgid "Select font" msgstr "Sélection de police" #: ../src/preferences.c:497 ../src/preferences.c:585 ../src/preferences.c:1070 #: ../src/preferences.c:1407 msgid "Label" msgstr "Étiquette" #: ../src/preferences.c:498 msgid "Extensions" msgstr "Extensions" #: ../src/preferences.c:499 msgid "Update chars" msgstr "Mise à jour des caractères" #: ../src/preferences.c:500 msgid "Icon" msgstr "Icône" #: ../src/preferences.c:501 msgid "Editable" msgstr "Modifiable" #: ../src/preferences.c:502 msgid "Content regex" msgstr "Contenu de l'expression régulière" #: ../src/preferences.c:503 msgid "AutoCompletion" msgstr "Terminaison automatique" #: ../src/preferences.c:586 msgid "Inverse filter" msgstr "Inverser le filtre" #: ../src/preferences.c:587 msgid "Filetypes in filter" msgstr "Types de fichier dans le filtre" #: ../src/preferences.c:941 msgid "filetype" msgstr "Type de fichier" #: ../src/preferences.c:946 msgid "Reset" msgstr "Revenir aux valeurs par défaut" #: ../src/preferences.c:952 msgid "Pattern name" msgstr "Nom du modèle" #: ../src/preferences.c:970 ../src/preferences.c:1497 msgid "Pattern" msgstr "Modèle" #: ../src/preferences.c:993 msgid "Start pattern and end pattern" msgstr "Le modèle comporte un début et une fin" #: ../src/preferences.c:995 msgid "Only start pattern" msgstr "Le modèle ne comporte pas de fin" #: ../src/preferences.c:997 msgid "Subpattern from parent" msgstr "Modèle enfant" #: ../src/preferences.c:1003 msgid "Start pattern" msgstr "Début du modèle" #: ../src/preferences.c:1004 msgid "End pattern" msgstr "Fin du modèle" #: ../src/preferences.c:1005 msgid "Case sensitive matching" msgstr "Respecter la casse" #: ../src/preferences.c:1006 msgid "Parentmatch" msgstr "Modèle parent" #: ../src/preferences.c:1007 msgid "Foreground color" msgstr "Couleur du premier plan" #: ../src/preferences.c:1008 msgid "Background color" msgstr "Couleur d'arrière-plan" #: ../src/preferences.c:1016 msgid "don't change weight" msgstr "Ne pas changer la graisse" #: ../src/preferences.c:1018 msgid "force non-bold weight" msgstr "Non-gras" #: ../src/preferences.c:1020 msgid "force bold weight" msgstr "Gras" #: ../src/preferences.c:1026 msgid "don't change style" msgstr "Ne pas changer le style" #: ../src/preferences.c:1028 msgid "force non-italic style" msgstr "Non-italique" #: ../src/preferences.c:1030 msgid "force italic style" msgstr "Italique" #: ../src/preferences.c:1071 ../src/preferences.c:1327 #: ../src/preferences.c:1408 ../src/preferences.c:1501 msgid "Command" msgstr "Commande" #: ../src/preferences.c:1175 ../src/preferences.c:1205 msgid "Warning:" msgstr "Important :" #: ../src/preferences.c:1175 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your autotext file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" "Veuillez mettre à jour la liste avant d'ajouter un élément.\n" "\n" "Pour des raisons de performance, Winefish ne charge pas automatiquement le " "texte automatique. Vous pouvez le faire manuellement en cliquant sur 'Mettre " "à jour maintenant'. *Notez* que cela peut prendre un certain temps." #: ../src/preferences.c:1205 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your 'word-list' file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" "Veuillez mettre à jour la liste avant d'ajouter un élément.\n" "\n" "Pour des raisons de performance, Winefish ne charge pas automatiquement le " "fichier 'liste de mots'. Vous pouvez le faire manuellement en cliquant sur " "'Mettre à jour maintenant'. *Notez* que cela peut prendre un certain temps." #: ../src/preferences.c:1274 msgid "Definition" msgstr "Définition de terme" #: ../src/preferences.c:1275 msgid "Before" msgstr "Avant" #: ../src/preferences.c:1276 msgid "After" msgstr "Après" #: ../src/preferences.c:1314 msgid "" "Add new autotext definition.\n" "Start finding the old one by pressing CTRL+F." msgstr "" "Ajoute une nouvelle définition de texte automatique.\n" "Commencez par rechercher l'ancienne en appuyant sur CTRL+F." #: ../src/preferences.c:1366 msgid "" "Add new word which should be started by '\\'.\n" "Start finding the old one by pressing CTRL+F." msgstr "" "Ajoute un nouveau mot - il doit commencer par '\\'.\n" "Commencez par rechercher l'ancien en appuyant sur CTRL+F." #: ../src/preferences.c:1496 msgid "Name" msgstr "Nom" #: ../src/preferences.c:1498 msgid "File #" msgstr "Fichier #" #: ../src/preferences.c:1499 msgid "Line #" msgstr "Ligne #" #: ../src/preferences.c:1500 msgid "Output #" msgstr "Résultat à l'écran #" #: ../src/preferences.c:1502 msgid "Save,Show" msgstr "Enregistrement, Affichage" #: ../src/preferences.c:1541 msgid "" "%D: basedir of project\n" "%B: basefile (without extension) of project\n" "%d: current directory\n" "%b: basename (without extension) of current file\n" "%f: current file (full path)\n" "%l: current line\n" "%%: percent sign\n" "\n" "If there isn't any project, or project mode is off, we have\n" "\t%D=%d, %B=%b\n" "\n" "Save,Show:\n" "\tneed save file: 1\n" "\tshow all output: 2\n" "\tboth of them: 1+2 =3\n" "\tnone of them: 0" msgstr "" "%D : répertoire de base du projet\n" "%B : fichier de base du projet (sans extension)\n" "%d : répertoire courant\n" "%b : nom de base du fichier actif (sans extension)\n" "%f : nom du fichier actif (chemin complet)\n" "%l : ligne active\n" "%% : signe pourcentage\n" "\n" "Si aucun projet n'est ouvert ou si le mode projet est inactif, on a :\n" "\t%D = %d et %B = %b\n" "\n" "Enregistrement, Affichage :\n" "\tEnregistrer le fichier : 1\n" "\tAfficher tous les résultats : 2\n" "\tLes deux : 1+2 =3\n" "\tAucun des deux: 0" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "left" msgstr "à gauche" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "right" msgstr "à droite" #: ../src/preferences.c:1856 msgid "top" msgstr "en haut" #: ../src/preferences.c:1856 msgid "bottom" msgstr "en bas" #: ../src/preferences.c:1858 msgid "no check" msgstr "Aucune vérification" #: ../src/preferences.c:1858 msgid "check mtime and size" msgstr "Vérifier la date de modification et la taille du fichier" #: ../src/preferences.c:1858 msgid "check mtime" msgstr "Vérifier la date de modification" #: ../src/preferences.c:1858 msgid "check size" msgstr "Vérifier la taille" #: ../src/preferences.c:1861 msgid "Edit preferences" msgstr "Éditer les préférences" #: ../src/preferences.c:1873 msgid "Editor" msgstr "Éditeur" #: ../src/preferences.c:1875 msgid "Editor options" msgstr "Options de l'éditeur" #: ../src/preferences.c:1880 msgid "Font" msgstr "Police" #: ../src/preferences.c:1881 msgid "Tab width" msgstr "Largeur de tabulation" #: ../src/preferences.c:1882 msgid "Use spaces to indent, not tabs" msgstr "Utiliser des espaces pour indenter plutôt que des tabulations" #: ../src/preferences.c:1883 msgid "Word wrap default" msgstr "Césure par défaut" #: ../src/preferences.c:1885 msgid "Highlight syntax by default" msgstr "Coloration syntaxique par défaut" #: ../src/preferences.c:1886 msgid "Highlight # lines" msgstr "Coloration nombre de lignes" #: ../src/preferences.c:1888 msgid "Undo" msgstr "Annuler" #: ../src/preferences.c:1893 msgid "Undo history size" msgstr "Nombre de niveaux d'annulation" #: ../src/preferences.c:1894 msgid "Clear undo history on save" msgstr "Effacer les niveaux d'annulation lors de l'enregistrement" #: ../src/preferences.c:1896 msgid "Bookmark options" msgstr "Options des signets" #: ../src/preferences.c:1901 msgid "Make permanent by default" msgstr "Rendre permanent par défaut" #: ../src/preferences.c:1903 msgid "full path" msgstr "Chemin complet" #: ../src/preferences.c:1903 msgid "path from basedir" msgstr "Chemin à partir du répertoire de travail" #: ../src/preferences.c:1903 msgid "filename" msgstr "Nom de fichier" #: ../src/preferences.c:1904 msgid "Bookmarks filename display" msgstr "Affichage du nom de fichier du signet" #: ../src/preferences.c:1909 msgid "Files" msgstr "Fichiers" #: ../src/preferences.c:1911 msgid "Encoding" msgstr "Encodage" #: ../src/preferences.c:1923 msgid "Default character set" msgstr "Jeu de caractères par défaut" #: ../src/preferences.c:1929 msgid "Backup" msgstr "Sauvegarder" #: ../src/preferences.c:1933 msgid "Create backup on save" msgstr "Créer une sauvegarde à l'enregistrement" #: ../src/preferences.c:1934 msgid "Backup file suffix" msgstr "Extension du fichier de sauvegarde" #: ../src/preferences.c:1936 msgid "save" msgstr "Enregistrer" #: ../src/preferences.c:1936 msgid "abort" msgstr "Abandonner" #: ../src/preferences.c:1936 msgid "ask" msgstr "Demander" #: ../src/preferences.c:1937 msgid "Action on backup failure" msgstr "Action en cas d'échec de la sauvegarde" #: ../src/preferences.c:1939 msgid "Remove backupfile on close" msgstr "Supprimer la sauvegarde à la fermeture" #: ../src/preferences.c:1943 msgid "Misc" msgstr "Divers" #: ../src/preferences.c:1948 msgid "Allow multi instances of a file" msgstr "Autoriser plusieurs instances d'un même fichier" #: ../src/preferences.c:1950 msgid "Open files in already running winefish window" msgstr "Ouvrir les fichiers dans la fenêtre active de Winefish" #: ../src/preferences.c:1952 msgid "File modified on disk check " msgstr "Fichier modifié sur le disque" #: ../src/preferences.c:1953 msgid "Number of files in 'Open recent'" msgstr "Nombre de fichiers dans 'Récemment ouvert'" #: ../src/preferences.c:1955 msgid "File browser" msgstr "Navigateur de fichiers" #: ../src/preferences.c:1959 msgid "Default basedir" msgstr "Répertoire de travail par défaut" #: ../src/preferences.c:1960 msgid "Use separate file and directory view" msgstr "Utiliser une vue scindée répertoires/fichiers" #: ../src/preferences.c:1961 msgid "Unknown icon" msgstr "Icône de type inconnu" #: ../src/preferences.c:1962 msgid "Directory icon" msgstr "Icône de répertoire" #: ../src/preferences.c:1966 msgid "User interface" msgstr "Interface utilisateur" #: ../src/preferences.c:1968 msgid "Dimensions" msgstr "Dimensions" #: ../src/preferences.c:1972 msgid "Restore last used dimensions" msgstr "Restaurer les dernières dimensions utilisées" #: ../src/preferences.c:1973 msgid "Initial sidebar width" msgstr "Largeur initiale du panneau latéral" #: ../src/preferences.c:1974 msgid "Initial window height" msgstr "Hauteur initiale de la fenêtre" #: ../src/preferences.c:1975 msgid "Initial window width" msgstr "Largeur initiale de la fenêtre" #: ../src/preferences.c:1979 msgid "General" msgstr "Général" #: ../src/preferences.c:1984 msgid "Make LaTeX dialogs transient" msgstr "Garder les boîtes de dialogue LaTeX au premier plan" #: ../src/preferences.c:1986 msgid "Notebook tab font (leave empty for gtk default)" msgstr "Police des onglets Notebook (ne pas remplir pour le GTK par défaut)" #: ../src/preferences.c:1988 msgid "Document notebook tab position" msgstr "Position de l'onglet" #: ../src/preferences.c:1989 msgid "Sidebar notebook tab position" msgstr "Position de l'onglet du panneau latéral" #: ../src/preferences.c:1990 msgid "Sidebar location" msgstr "Emplacement du panneau latéral" #: ../src/preferences.c:1994 ../src/preferences.c:1996 msgid "Filetypes" msgstr "Types de fichiers" #: ../src/preferences.c:2003 msgid "Filefilters" msgstr "Filtres de fichiers" #: ../src/preferences.c:2012 msgid "Highlighting" msgstr "Coloration syntaxique" #: ../src/preferences.c:2014 msgid "Patterns" msgstr "Modèles" #: ../src/preferences.c:2023 msgid "Viewers, Filters" msgstr "Visionneurs, filtres" #: ../src/preferences.c:2025 msgid "Viewers" msgstr "Visionneurs" #: ../src/preferences.c:2032 msgid "Utilities and Filters" msgstr "Utilitaires et Filtres" #: ../src/preferences.c:2039 ../src/preferences.c:2062 msgid "Information" msgstr "Information" #: ../src/preferences.c:2044 #, c-format msgid "" "%f: current filename\n" "%i: input (filters)\n" "%o: output filename (filters)\n" "%%: percent sign" msgstr "" "%f : nom du fichier actif\n" "%i : nom du fichier d'entrée (filtres)\n" "%o : nom du fichier de sortie (filtres)\n" "%%: signe pourcentage" #: ../src/preferences.c:2052 ../src/preferences.c:2054 msgid "TeXbox" msgstr "Boîte TeX" #: ../src/preferences.c:2071 msgid "AutoX" msgstr "Automation" #: ../src/preferences.c:2073 msgid "Autotext" msgstr "Texte automatique" #: ../src/preferences.c:2080 msgid "Word List (for Autocompletion)" msgstr "Liste de mots (pour la terminaison automatique)" #: ../src/preferences.c:2089 msgid "Miscellaneous" msgstr "Divers" #: ../src/preferences.c:2093 msgid "Templates Directory" msgstr "Répertoire des modèles" #: ../src/preferences.c:2102 msgid "Column Markers" msgstr "Marqueurs de colonnes" #: ../src/preferences.c:2107 msgid "Marker 1" msgstr "Marqueur 1" #: ../src/preferences.c:2108 msgid "Marker 2" msgstr "Marqueur 2" #: ../src/preferences.c:2109 msgid "Marker 3" msgstr "Marqueur 3" #: ../src/project.c:89 msgid "New project" msgstr "Créer un Projet" #: ../src/project.c:176 ../src/project.c:183 msgid "Enter Winefish project filename" msgstr "Saisir le nom du projet Winefish" #: ../src/project.c:224 msgid "/Project/Save" msgstr "/Projet/Enregistrer" #: ../src/project.c:225 msgid "/Project/Save as..." msgstr "/Projet/Enregistrer sous..." #: ../src/project.c:226 msgid "/Project/Save & close" msgstr "/Projet/Enregistrer et fermer" #: ../src/project.c:304 ../src/project.c:311 msgid "Select Winefish project filename" msgstr "Choisir le nom d'un projet Winefish" #: ../src/project.c:369 msgid "Do you want to save the project?" msgstr "Voulez-vous enregistrer le projet ?" #: ../src/project.c:498 msgid "" "The BaseDir must exist.\n" "The BaseFile must be located in BaseDir." msgstr "" "Le répertoire de base doit exister.\n" "Le fichier de base doit être situé dans le répertoire de base." #: ../src/project.c:525 msgid "Create New Project" msgstr "Créer un projet" #: ../src/project.c:528 msgid "Edit Project" msgstr "Éditer le projet" #: ../src/project.c:551 #, c-format msgid "This project contains %d files" msgstr "Ce projet contient %d fichiers" #: ../src/project.c:563 msgid "Project _Name:" msgstr "_Nom du projet :" #: ../src/project.c:567 msgid "_BaseDir:" msgstr "Répertoire de _base :" #: ../src/project.c:570 msgid "Browse..." msgstr "Parcourir..." #: ../src/project.c:573 msgid "BaseFile:" msgstr "Fichier de base :" #: ../src/project.c:579 msgid "_Template:" msgstr "_Modèle :" #: ../src/project.c:585 msgid "_Word wrap by default" msgstr "_Césure par défaut" #: ../src/project.c:597 msgid "Create _Project" msgstr "Créer un _projet" #: ../src/project.c:637 msgid "Create project" msgstr "Créer un projet" #: ../src/project.c:641 msgid "Create project with currently opened documents" msgstr "Créer un projet avec les documents ouverts" #: ../src/project.c:642 msgid "Create empty project" msgstr "Créer un projet vide" #: ../src/rcfile.c:500 msgid "DVI Viewer" msgstr "Visionneur DVI" #: ../src/rcfile.c:502 msgid "PDF Viewer" msgstr "Visionneur PDF" #: ../src/rcfile.c:504 msgid "EPS Viewer" msgstr "Visionneur EPS" #: ../src/rcfile.c:578 msgid "LaTeX" msgstr "LaTeX" #: ../src/rcfile.c:580 msgid "XML" msgstr "XML" #: ../src/rcfile.c:582 msgid "Images" msgstr "Images" #: ../src/rcfile.c:946 msgid "Untitled Project" msgstr "Projet sans titre" #: ../src/snr2.c:193 msgid "Regular expression error: " msgstr "Erreur d'expression régulière : " #: ../src/snr2.c:194 ../src/snr2.c:239 msgid "Search failed" msgstr "Échec de la recherche" #: ../src/snr2.c:238 #, c-format msgid "Regular expression error: %s at offset %d" msgstr "Erreur d'expression régulière : %s à la position %d" #: ../src/snr2.c:864 msgid "Confirm replace" msgstr "Confirmer le remplacement" #: ../src/snr2.c:876 msgid "Replace selected text?" msgstr "Remplacer le texte sélectionné ?" #: ../src/snr2.c:889 msgid "_Skip" msgstr "_Ignorer" #: ../src/snr2.c:891 msgid "Replace _all" msgstr "Tout rempl_acer" #: ../src/snr2.c:1136 ../src/snr2.c:1143 msgid "Search: no match found" msgstr "Recherche : aucun résultat trouvé" #: ../src/snr2.c:1369 msgid "_Search for: " msgstr "_Rechercher : " #: ../src/snr2.c:1395 msgid "_Replace with: " msgstr "Remplacer _par : " #: ../src/snr2.c:1405 msgid "\\0 refers to the first subsearch_pattern, \\1 to the second etc." msgstr "\\0 se réfère au premier sous-modèle, \\1 au deuxième, etc." #: ../src/snr2.c:1420 msgid "Beginning of document till end" msgstr "Du début à la fin du document" #: ../src/snr2.c:1420 msgid "Current position till end" msgstr "De la position du curseur jusqu'à la fin" #: ../src/snr2.c:1420 msgid "Beginning of selection till end of selection" msgstr "Du début à la fin de la sélection" #: ../src/snr2.c:1420 msgid "All opened files begin till end" msgstr "Du début à la fin de tous les fichiers ouverts" #: ../src/snr2.c:1421 msgid "Disabled" msgstr "Désactivée" #: ../src/snr2.c:1421 msgid "POSIX type" msgstr "De type POSIX" #: ../src/snr2.c:1421 msgid "PERL type" msgstr "De type PERL" #: ../src/snr2.c:1422 msgid "Starts at:" msgstr "Zone de recherche : " #: ../src/snr2.c:1434 msgid "Regular expression:" msgstr "Expression régulière : " #: ../src/snr2.c:1448 msgid "Normal" msgstr "Normal" #: ../src/snr2.c:1448 msgid "Uppercase" msgstr "Mettre en majuscules" #: ../src/snr2.c:1448 msgid "Lowercase" msgstr "Mettre en minuscules" #: ../src/snr2.c:1449 msgid "Replace type:" msgstr "Type de remplacement :" #: ../src/snr2.c:1462 msgid "_Patterns contain backslash escape sequences (\\n, \\t)" msgstr "Les _modèles contiennent des séquences d'échappement (\\n, \\t)" #: ../src/snr2.c:1463 msgid "_Match case" msgstr "Respecter la ca_sse" #: ../src/snr2.c:1464 msgid "O_verlap searches" msgstr "Recherches ré_cursives" #: ../src/snr2.c:1466 msgid "Prompt _before replace" msgstr "_Demander avant de remplacer" #: ../src/snr2.c:1467 msgid "Replace o_nce" msgstr "Remplacer _une seule fois" #: ../src/snr2.c:1469 msgid "Bookmark results" msgstr "Créer des signets" #: ../src/winefish.c:106 #, c-format msgid "" "\n" "Usage: %s [options] [filenames ...]\n" msgstr "" "\n" "Utilisation : %s [options] [nomdefichier ...]\n" #: ../src/winefish.c:107 msgid "" "\n" "Currently accepted options are:\n" msgstr "" "\n" "Les options actuellement acceptées sont :\n" #: ../src/winefish.c:108 msgid "-s skip root check\n" msgstr "-s Omettre la vérification root\n" #: ../src/winefish.c:109 msgid "-v current version\n" msgstr "-v Version actuelle\n" #: ../src/winefish.c:110 msgid "-n 0|1 open new window (1) or not (0)\n" msgstr "-n 0|1 ouvrir une nouvelle fenêtre (1) ou non (0)\n" #: ../src/winefish.c:111 msgid "-p filename open project\n" msgstr "-p nomdefichier ouvrir un projet\n" #: ../src/winefish.c:112 msgid "-l number set line. Negative value takes no effect.\n" msgstr "" "-l nombre definit le de lignes. Les valeurs négatives n'ont " "aucun effet.\n" #: ../src/winefish.c:113 msgid "-h this help screen\n" msgstr "-h Aide en ligne de commande\n" #: ../src/winefish.c:190 msgid "parsing highlighting file..." msgstr "Traitement de la coloration syntaxique du fichier..." #: ../src/winefish.c:201 msgid "compiling highlighting patterns..." msgstr "Compilation des modèles de coloration syntaxique..." #: ../src/winefish.c:205 msgid "initialize some other things..." msgstr "Initialisation diverses..." #: ../src/winefish.c:211 msgid "parsing autotext and words file..." msgstr "Analyse du texte automatique et du fichier de mots..." #: ../src/winefish.c:216 msgid "parsing custom menu file..." msgstr "Traitement du fichier de menu personnalisé..." #: ../src/winefish.c:230 msgid "creating main gui..." msgstr "Création de l'interface principale..." #: ../src/winefish.c:241 msgid "showing main gui..." msgstr "Affichage de l'interface principale..." #: ../src/wizards.c:139 #, c-format msgid "row %d col" msgstr "ligne % colonne" #: ../src/wizards.c:157 #, c-format msgid "%%%% row %d\n" msgstr "%%%% ligne %d\n" #: ../src/wizards.c:251 msgid "Table Wizard" msgstr "Assistant tableau" #: ../src/wizards.c:259 msgid "Number of _rows:" msgstr "Nombre de _lignes :" #: ../src/wizards.c:263 msgid "Number of colu_mns:" msgstr "No_mbre de colonnes :" #: ../src/wizards.c:267 msgid "Add Horizontal Rules:" msgstr "Ajouter des traits horizontaux :" #: ../src/wizards.c:287 msgid "Type (Environment):" msgstr "Type (environnement) :" #: ../src/wizards.c:297 msgid "Columns Alignmen:" msgstr "Alignement des colonnes :" #: ../src/wizards.c:311 msgid "Vertical Rules:" msgstr "Traits Verticaux :" #: ../src/wizards.c:408 msgid "Insert Time" msgstr "Insérer l'heure" #: ../src/wizards.c:416 #, c-format msgid " _Time (%i:%i:%i)" msgstr " _Heure (%i:%i:%i)" #: ../src/wizards.c:421 msgid " Day of the _week (Sunday)" msgstr " Jour de la _semaine (Dimanche)" #: ../src/wizards.c:424 msgid " Day of the _week (Monday)" msgstr " Jour de la _semaine (Lundi)" #: ../src/wizards.c:427 msgid " Day of the _week (Tuesday)" msgstr " Jour de la _semaine (Mardi)" #: ../src/wizards.c:430 msgid " Day of the _week (Wednesday)" msgstr " Jour de la _semaine (Mercredi)" #: ../src/wizards.c:433 msgid " Day of the _week (Thursday)" msgstr " Jour de la _semaine (Jeudi)" #: ../src/wizards.c:436 msgid " Day of the _week (Friday)" msgstr " Jour de la _semaine (Vendredi)" #: ../src/wizards.c:439 msgid " Day of the _week (Saturday)" msgstr " Jour de la _semaine (Samedi)" #: ../src/wizards.c:442 msgid "You appear to have a non existant day!\n" msgstr "Il semble que la date fournie n'existe pas !\n" #: ../src/wizards.c:450 #, c-format msgid " _Date (%i/%i/%i)" msgstr " _Date (%i/%i/%i)" #: ../src/wizards.c:453 #, c-format msgid " _Unix Time (%i)" msgstr " Heure au format _Unix (%i)" #: ../src/wizards.c:456 #, c-format msgid " Unix Date _String (%s" msgstr " Date au _format Unix (%s" #: ../src/wizards.c:518 msgid "Quick Start" msgstr "Démarrage rapide" #: ../src/wizards.c:533 msgid "Document _Class:" msgstr "_Classe du document :" #: ../src/wizards.c:551 msgid "_VnTeX Support:" msgstr "Gestion _VnTeX :" #: ../src/wizards.c:599 ../src/wizards.c:604 ../src/wizards.c:608 msgid "item" msgstr "Élément" #: ../src/wizards.c:628 msgid "Quick List" msgstr "Liste rapide" #: ../src/wizards.c:635 msgid "_Rows:" msgstr "_Lignes :" #: ../src/wizards.c:646 msgid "Type (_Environment):" msgstr "Type (_Environnement) :" winefish-1.3.3/po/it.po0000600000047200004720000020520410412002305013710 0ustar kyanhkyanh# Italian translation of Winefish. # Copyright (C) 2003, 2006 Free Software Foundation, Inc. # This file is distributed under the same license as the Winefish package. # Daniele Medri , 2005. # msgid "" msgstr "" "Project-Id-Version: Winefish 1.3.2.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-03-27 22:28+0700\n" "PO-Revision-Date: 2006-02-14 07:53+0100\n" "Last-Translator: Daniele Medri \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/about.c:60 #, c-format msgid "" "Winefish LaTeX Editor (based on Bluefish)\n" "\n" "* home: http://winefish.berlios.de/\n" "* open source development project\n" "* released under the GPL license\n" "\n" "* version: %s\n" "* maximum length\n" " latex command: %d\n" " autotext command: %d\n" "* recursive grep: %s\n" "* delimiters:\n" " %s\n" "* configured:\n" " $%s\n" msgstr "" #: ../src/about.c:77 msgid "" "developers:\n" "* kyanh \n" "\n" "translators:\n" "* French: Michèle Garoche \n" "* Italian: Daniele Medri \n" "* Vietnamese: kyanh \n" "\n" "THANKS to all who helped making this software available.\n" msgstr "" "sviluppatori:\n" "* kyanh \n" "\n" "traduttori:\n" "* Francese: Michèle Garoche \n" "* Italiano: Daniele Medri \n" "* Vietnamita: kyanh \n" "\n" "RINGRAZIAMENTI a tutti quelli che hanno contribuito a questo software.\n" #: ../src/about.c:88 msgid "About Winefish" msgstr "Informazioni su Winefish" #: ../src/about.c:123 ../src/fref.c:2318 ../src/fref.c:2333 msgid "info" msgstr "Informazioni" #: ../src/about.c:127 msgid "authors" msgstr "autori" #: ../src/about.c:139 msgid "oops..." msgstr "Chiudi" #: ../src/bf_lib.c:54 ../src/bf_lib.c:68 msgid "" "Winefish has trouble reading the filenames. Try to set the environment " "variable G_BROKEN_FILENAMES=1\n" msgstr "" "Winefish ha \"problemi\" nella lettura dei nomi dei file. Prova a impostare " "la variabile di ambiente G_BROKEN_FILENAMES=1\n" #: ../src/bfspell.c:428 msgid "Check Spelling" msgstr "Controllo ortografico" #: ../src/bfspell.c:432 msgid "Checking" msgstr "Controllo" #: ../src/bfspell.c:441 msgid "_Misspelled word:" msgstr "P_arola errata:" #: ../src/bfspell.c:445 msgid "Change _to:" msgstr "Cambia _in:" #: ../src/bfspell.c:448 msgid "I_gnore" msgstr "I_gnora" #: ../src/bfspell.c:449 ../src/snr2.c:890 msgid "_Replace" msgstr "_Sostituisci" #: ../src/bfspell.c:462 msgid "In _document" msgstr "Nel _documento" #: ../src/bfspell.c:463 msgid "I_n selection" msgstr "_Nella selezione" #: ../src/bfspell.c:472 msgid "personal dictionary" msgstr "dizionario personale" #: ../src/bfspell.c:475 msgid "session dictionary" msgstr "dizionario di sessione" #: ../src/bfspell.c:481 msgid "Dictionary:" msgstr "Dizionario:" #: ../src/bfspell.c:485 msgid "_Add" msgstr "_Aggiungi" #: ../src/bfspell.c:489 msgid "Language:" msgstr "Lingua:" #: ../src/bfspell.c:493 msgid "Set defa_ult" msgstr "Imposta come _predefinito" #: ../src/bfspell.c:497 msgid "Filter:" msgstr "Filtro:" #: ../src/bfspell.c:505 msgid "no filter" msgstr "nessun filtro" #: ../src/bfspell.c:507 msgid "TeX filter" msgstr "Filtro TeX" #: ../src/bfspell.c:509 msgid "html filter" msgstr "filtro html" #: ../src/bookmark.c:363 msgid "_Name:" msgstr "_Nome:" #: ../src/bookmark.c:368 msgid "_Description:" msgstr "_Descrizione:" #: ../src/bookmark.c:370 msgid "Temporary" msgstr "Temporaneo" #: ../src/bookmark.c:470 #, c-format msgid "Could not find the file \"%s\"." msgstr "Impossibile trovare il file·\"%s\"." #: ../src/bookmark.c:472 msgid "This bookmark is set in a file that no longer exists." msgstr "Questo segnalibro è impostato in un file che non esiste più." #: ../src/bookmark.c:607 #, c-format msgid "Do you really want to delete all bookmarks for %s?" msgstr "Vuoi eliminare tutti i segnalibri per %s?" #: ../src/bookmark.c:608 msgid "Delete bookmarks?" msgstr "Elimina segnalibri?" #: ../src/bookmark.c:638 #, c-format msgid "Do you really want to delete %s?" msgstr "Vuoi veramente eliminare %s?" #: ../src/bookmark.c:640 msgid "Delete permanent bookmark." msgstr "Elimina segnalibro permanente." #: ../src/bookmark.c:657 msgid "Edit bookmark" msgstr "Modifica segnalibri" #: ../src/bookmark.c:671 msgid "Goto bookmark" msgstr "Vai al segnalibro" #: ../src/bookmark.c:679 msgid "Edit" msgstr "Modifica" #: ../src/bookmark.c:683 msgid "Delete" msgstr "Elimina" #: ../src/bookmark.c:689 msgid "Delete all in document" msgstr "Elimina tutto nel documento" #: ../src/bookmark.c:694 msgid "Delete all" msgstr "Elimina tutti" #: ../src/bookmark.c:1275 ../src/bookmark.c:1292 ../src/bookmark.c:1330 #: ../src/document.c:2759 msgid "Add bookmark" msgstr "Aggiungi segnalibro" #: ../src/bookmark.c:1276 ../src/bookmark.c:1331 msgid "Cannot add bookmarks in unnamed files." msgstr "Impossibile aggiungere un segnalibro in un file senza nome." #: ../src/bookmark.c:1293 msgid "You already have a bookmark here!" msgstr "Hai già un segnalibro qui!" #: ../src/bookmark.c:1368 msgid "Delete all bookmarks." msgstr "Elimina tutti i segnalibri." #: ../src/bookmark.c:1368 msgid "Are you sure?" msgstr "Sei sicuro?" #: ../src/bookmark.c:1407 msgid "File size changed in file\n" msgstr "Dimensione del fine cambiata\n" #: ../src/bookmark.c:1408 msgid "Bookmarks positions could be incorrect. Delete bookmarks?" msgstr "" "La posizione dei segnalibri potrebbe essere errata. Eliminare i segnalibri?" #: ../src/document.c:322 ../src/document.c:3811 msgid "/Document/Highlight Syntax" msgstr "/Documento/Evidenzia sintassi" #: ../src/document.c:782 msgid "name: " msgstr "nome:" #: ../src/document.c:783 msgid "" "\n" "type: " msgstr "" "\n" "tipo: " #: ../src/document.c:784 msgid "" "\n" "encoding: " msgstr "" "\n" "codifica: " #: ../src/document.c:787 msgid "" "\n" "size (on disk): " msgstr "" "\n" "dimensione (su disco): " #: ../src/document.c:787 msgid " bytes" msgstr " byte" #: ../src/document.c:793 msgid "" "\n" "permissions: " msgstr "" "\n" "permessi: " #: ../src/document.c:800 msgid "" "\n" "last modified: " msgstr "" "\n" "ultima modifica: " #: ../src/document.c:826 #, c-format msgid "Untitled %d" msgstr "Senza nome %d" #: ../src/document.c:1492 msgid "Could not read file:\n" msgstr "Non è possibile leggere il file:\n" #: ../src/document.c:1523 msgid "Opening file " msgstr "Apertura file " #: ../src/document.c:1594 msgid "Cannot display file, unknown characters found." msgstr "Impossibile visualizzare il file, trovato carattere sconosciuto." #: ../src/document.c:2079 #, c-format msgid "deleted '%s'" msgstr "eliminato '%s'" #: ../src/document.c:2741 ../src/snr2.c:1340 msgid "Replace" msgstr "Sostituisci" #: ../src/document.c:2746 ../src/snr2.c:1343 msgid "Find" msgstr "Trova" #: ../src/document.c:2755 msgid "Delete bookmark" msgstr "Elimina segnalibro" #: ../src/document.c:2900 msgid "saving file" msgstr "salvataggio file" #: ../src/document.c:2924 ../src/document.c:2948 msgid "_Abort save" msgstr "Termin_a il salvataggio" #: ../src/document.c:2924 msgid "_Continue save" msgstr "_Continua il salvataggio" #: ../src/document.c:2926 #, c-format msgid "" "A backupfile for %s could not be created. If you continue, this file will be " "overwritten." msgstr "" "Un file di backup per %s non può essere creato. Se continui, questo file " "sarà sovrascritto." #: ../src/document.c:2927 msgid "File backup failure" msgstr "Backup del file non avvenuto" #: ../src/document.c:2948 msgid "_Continue save in UTF-8" msgstr "_Continua il salvataggio in UTF-8" #: ../src/document.c:2959 #, c-format msgid "" "Failed to convert %s to character encoding %s. Encoding failed on character " "'%s' at line %d column %d\n" "\n" "Continue saving in UTF-8 encoding?" msgstr "" #: ../src/document.c:2960 msgid "File encoding conversion failure" msgstr "Conversione non avvenuta della codifica del file" #: ../src/document.c:3115 msgid "Previously: " msgstr "Precedentemente: " #: ../src/document.c:3148 #, c-format msgid "Move/rename %s to" msgstr "Muovi/rinomina %s in" #: ../src/document.c:3148 #, c-format msgid "Save %s as" msgstr "Salva %s come" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/document.c:4387 ../src/project.c:194 msgid "_Cancel" msgstr "_Cancella" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/project.c:194 msgid "_Overwrite" msgstr "S_ovrascrivi" #: ../src/document.c:3213 #, c-format msgid "File %s exists and is opened, overwrite?" msgstr "Il file %s esiste ed è aperto, sovrascrivo?" #: ../src/document.c:3214 msgid "The file you have selected is being edited in Winefish." msgstr "Il file selezionato è stato modificato in Winefish." #: ../src/document.c:3228 ../src/project.c:195 #, c-format msgid "A file named \"%s\" already exists." msgstr "Un file chiamato \"%s\" esiste già." #: ../src/document.c:3230 ../src/project.c:197 msgid "Do you want to replace the existing file?" msgstr "Vuoi sostituire il file esistente?" #: ../src/document.c:3298 msgid "save as..." msgstr "salva come..." #: ../src/document.c:3339 #, c-format msgid "" "File: %s\n" "\n" "New modification time: %s\n" "Old modification time: %s" msgstr "" "File: %s\n" "\n" "Nuova data-ora di modifica: %s\n" "Vecchia data-ora di modifica: %s" #: ../src/document.c:3340 msgid "File has been modified by another process." msgstr "Il file è stato modificato da un altro processo." #: ../src/document.c:3353 #, c-format msgid "Saving %s" msgstr "Salvataggio in corso di %s" #: ../src/document.c:3369 msgid "" "Could not backup file:\n" "\"" msgstr "" "Non è possibile fare il backup del file:\n" "\"" #: ../src/document.c:3370 msgid "File save aborted.\n" msgstr "Salvataggio file non avvenuto.\n" #: ../src/document.c:3375 msgid "" "Could not write file:\n" "\"" msgstr "" "Non è possibile scrivere il file:\n" "\"" #: ../src/document.c:3376 msgid "File save error" msgstr "Errore durante il salvataggio" #: ../src/document.c:3435 #, c-format msgid "Save changes to \"%s\" before closing?." msgstr "Salva cambiamenti in \"%s\" prima di chiudere?." #: ../src/document.c:3442 ../src/project.c:362 msgid "Do_n't save" msgstr "No_n salvare" #: ../src/document.c:3444 ../src/document.c:4389 ../src/project.c:371 msgid "If you don't save your changes they will be lost." msgstr "Se non salvi i cambiamenti andranno persi." #: ../src/document.c:3814 msgid "/Document/Line Numbers" msgstr "/Documento/Numeri di linea" #: ../src/document.c:3817 msgid "/Document/AutoCompletion" msgstr "/Documento/Completamento automatico" #: ../src/document.c:3853 msgid "No filename" msgstr "Nessun nome file" #: ../src/document.c:4001 msgid "Loading files..." msgstr "Caricamento file..." #: ../src/document.c:4028 msgid "" "These files could not opened:\n" "\n" msgstr "" "Questi file non possono essere aperti:\n" "\n" #: ../src/document.c:4030 ../src/msg_queue.c:245 msgid "Unable to open file(s)\n" msgstr "Non è possibile aprire il file\n" #: ../src/document.c:4077 msgid "unable to open file" msgstr "non è possibile caricare il file" #: ../src/document.c:4133 msgid "_Reload" msgstr "_Ricarica" #: ../src/document.c:4133 msgid "_Ignore" msgstr "_Ignora" #: ../src/document.c:4137 #, c-format msgid "" "Filename: %s\n" "\n" "New modification time is: %s\n" "Old modification time is: %s" msgstr "" "Nome file: %s\n" "\n" "Orario ultima modifica: %s\n" "Orario precedente modifica: %s" #: ../src/document.c:4138 msgid "File has been modified by another process\n" msgstr "Il file è stato modificato da un altro processo\n" #: ../src/document.c:4272 ../src/gtk_easy.c:1629 msgid "Select files" msgstr "Seleziona file" #: ../src/document.c:4290 #, c-format msgid "Loading %d file(s)..." msgstr "Apertura di %d file..." #: ../src/document.c:4317 ../src/document.c:4325 msgid "Select file to insert" msgstr "Scegli file da inserire" #: ../src/document.c:4329 msgid "no file to insert" msgstr "nessun file da inserire" #: ../src/document.c:4387 msgid "_Save All" msgstr "_Salva tutto" #: ../src/document.c:4387 msgid "Close _All" msgstr "Chiudi _tutto" #: ../src/document.c:4387 msgid "Choose per _File" msgstr "Scegli il _file" #: ../src/document.c:4388 msgid "Multiple open files have been changed." msgstr "Molteplici file aperti sono stati modificati." #: ../src/document.c:4667 #, c-format msgid "Statistics: %d lines, %d words, %d characters" msgstr "Statistiche: %d linee, %d parole, %d caratteri" #: ../src/filebrowser.c:1019 msgid "Error creating path" msgstr "Errore nella creazione del percorso" #: ../src/filebrowser.c:1019 msgid "The specified pathname already exists." msgstr "Il percorso indicato esiste già." #: ../src/filebrowser.c:1085 msgid "File name" msgstr "Nome file" #: ../src/filebrowser.c:1087 msgid "Directory name" msgstr "Nome directory" #: ../src/filebrowser.c:1118 msgid "opening directory..." msgstr "apertura directory..." #: ../src/filebrowser.c:1211 msgid "Could not rename\n" msgstr "Impossibile rinominare\n" #: ../src/filebrowser.c:1253 #, c-format msgid "Are you sure you want to delete \"%s\" ?" msgstr "Sei sicuro di voler eliminare \"%s\"?" #: ../src/filebrowser.c:1254 msgid "If you delete this file, it will be permanently lost." msgstr "Se elimini questo file, sarà definitivamente perso." #: ../src/filebrowser.c:1262 msgid "Could not delete \n" msgstr "Impossibile eliminare\n" #: ../src/filebrowser.c:1400 msgid "/Open _Advanced..." msgstr "/Apri _avanzato..." #: ../src/filebrowser.c:1404 msgid "/_Refresh" msgstr "/_Aggiorna" #: ../src/filebrowser.c:1405 msgid "/_Set as basedir" msgstr "/Impo_sta come directory base" #: ../src/filebrowser.c:1409 msgid "/New _File" msgstr "/Nuovo _file" #: ../src/filebrowser.c:1410 msgid "/_New Directory" msgstr "/_Nuova directory" #: ../src/filebrowser.c:1415 msgid "/_Open" msgstr "/_Apri" #: ../src/filebrowser.c:1416 msgid "/Rena_me" msgstr "/Rino_mina" #: ../src/filebrowser.c:1417 msgid "/_Delete" msgstr "/_Elimina" #: ../src/filebrowser.c:1439 msgid "Show hidden files" msgstr "Mostra file nascosti" #: ../src/filebrowser.c:1444 msgid "Show backup files" msgstr "Mostra file backup" #: ../src/filebrowser.c:1450 msgid "Filter" msgstr "Filtro" #: ../src/filebrowser.c:1650 ../src/gtk_easy.c:1408 msgid "All files" msgstr "Tutti i file" #: ../src/filebrowser.c:1922 msgid "Show full tree" msgstr "Mostra tutto l'albero" #: ../src/filebrowser.c:1923 msgid "Follow focus" msgstr "Segui il focus" #: ../src/fref.c:1450 ../src/fref.c:1734 ../src/fref.c:1821 ../src/fref.c:1856 msgid "Info" msgstr "Informazioni" #: ../src/fref.c:1469 msgid "Close" msgstr "Chiudi" #: ../src/fref.c:1473 ../src/fref.c:1815 ../src/fref.c:1851 msgid "Dialog" msgstr "Maschera" #: ../src/fref.c:1474 ../src/fref.c:1818 ../src/fref.c:1845 msgid "Insert" msgstr "Inserisci" #: ../src/fref.c:1827 msgid "Options" msgstr "Opzioni" #: ../src/fref.c:1835 msgid "Rescan reference files" msgstr "Scansiona nuovamente file di riferimento" #: ../src/fref.c:1839 msgid "Left doubleclick action" msgstr "Azione di doppio clic sinistro" #: ../src/fref.c:1861 msgid "Info type" msgstr "Informazioni tipo" #: ../src/fref.c:1866 msgid "Description" msgstr "Descrizione" #: ../src/fref.c:1871 msgid "Attributes/Parameters" msgstr "Attributi/parametri" #: ../src/fref.c:1876 msgid "Notes" msgstr "Note" #: ../src/fref.c:2052 ../src/fref.c:2066 msgid "Reference search" msgstr "Ricerca riferimento" #: ../src/fref.c:2067 msgid "Reference not found" msgstr "Riferimento non trovato" #: ../src/fref.c:2084 msgid "Error" msgstr "Errore" #: ../src/fref.c:2086 msgid "" "Perhaps you didn't load a reference, or you did not select a reference to " "search in." msgstr "" #: ../src/fref.c:2328 msgid "d" msgstr "d" #: ../src/fref.c:2330 msgid "i" msgstr "i" #: ../src/fref.c:2331 msgid "s" msgstr "s" #: ../src/fref.c:2332 msgid "dialog" msgstr "maschera" #: ../src/fref.c:2334 msgid "search" msgstr "cerca" #: ../src/func_grep.c:270 msgid "searching files..." msgstr "ricerca file..." #: ../src/func_grep.c:283 ../src/func_grep.c:286 ../src/func_grep.c:313 msgid "grep" msgstr "grep" #: ../src/func_grep.c:338 msgid "func_grep: file(s) without filename" msgstr "" #: ../src/func_grep.c:340 msgid "please specify the pattern!" msgstr "" #: ../src/func_grep.c:344 msgid "func_grep: cannot create secure file" msgstr "" #: ../src/func_grep.c:346 msgid "no matching files found" msgstr "nessun file corrispondente trovato" #: ../src/func_grep.c:348 msgid "no directory specified" msgstr "dimensione cronologia di annulla" #: ../src/func_grep.c:373 ../src/project.c:445 ../src/project.c:452 msgid "Select basedir" msgstr "Seleziona directory base" #: ../src/func_grep.c:434 msgid "Grep Function" msgstr "Grep della funzione" #: ../src/func_grep.c:454 msgid "General" msgstr "Generale" #: ../src/func_grep.c:456 msgid "Base_dir:" msgstr "_Directory base:" #: ../src/func_grep.c:458 ../src/gtk_easy.c:1342 msgid "_Browse..." msgstr "_Scegli..." #: ../src/func_grep.c:461 msgid "<0: current file>" msgstr "" #: ../src/func_grep.c:462 ../src/func_grep.c:472 msgid "<1: all opened files>" msgstr "" #: ../src/func_grep.c:474 msgid "_File:" msgstr "_File:" #: ../src/func_grep.c:481 msgid "_Recursive:" msgstr "_Ricorsivo:" #: ../src/func_grep.c:485 msgid "_Open files:" msgstr "_Apri file:" #: ../src/func_grep.c:490 msgid "Contains" msgstr "Contiene" #: ../src/func_grep.c:508 msgid "_Pattern:" msgstr "" #: ../src/func_grep.c:513 msgid "_Case sensitive:" msgstr "Maius_colo/minuscolo" #: ../src/func_grep.c:517 msgid "Is rege_x:" msgstr "E' rege_x:" #: ../src/func_grep.c:521 msgid "Advanced" msgstr "Avanzate" #: ../src/func_grep.c:524 msgid "Skip _VCS dirs:" msgstr "Salta directory _VCS:" #: ../src/func_grep.c:593 ../src/func_grep.c:613 #, c-format msgid "loading %d file(s)..." msgstr "apertura di %d file..." #: ../src/func_grep.c:636 msgid "template" msgstr "modello" #: ../src/gtk_easy.c:1186 #, c-format msgid "%d of %d" msgstr "%d·di·%d" #: ../src/gtk_easy.c:1288 msgid "Select File" msgstr "Seleziona file" #: ../src/gtk_easy.c:1401 msgid "Show hidden" msgstr "Mostra nascosti" #: ../src/gtk_easy.c:1602 msgid "Select file" msgstr "Seleziona file" #: ../src/gui.c:231 msgid "tree" msgstr "albero" #: ../src/gui.c:232 msgid "functions" msgstr "definizione" #: ../src/gui.c:233 msgid "marks" msgstr "segnalibri" #: ../src/gui.c:617 msgid "New Winefish Window" msgstr "Nuova finestra Winefish" #: ../src/gui.c:681 msgid "Stand by..." msgstr "Attendere prego..." #: ../src/gui.c:877 msgid "Goto line" msgstr "Vai alla linea" #: ../src/gui.c:885 msgid "_Line number:" msgstr "Numero _linea:" #: ../src/gui.c:891 msgid "From _selection" msgstr "Dalla _selezione" #: ../src/gui.c:894 msgid "Keep _dialog" msgstr "" #: ../src/gui.c:960 msgid "starting winefish" msgstr "avvio di winefish" #: ../src/gui.c:1059 ../src/gui.c:1068 ../src/outputbox.c:127 #: ../src/outputbox.c:353 ../src/outputbox.c:470 msgid "/View/View Outputbox" msgstr "/Visualizza/Visualizza area esterna" #: ../src/gui.c:1073 ../src/gui.c:1079 msgid "/View/View Terminal" msgstr "/Visualizza/Visualizza barra laterale" #: ../src/highlight.c:391 ../src/highlight.c:403 ../src/highlight.c:430 #: ../src/highlight.c:444 msgid "Syntax highlighting error for " msgstr "Errore di evidenzazione sintassi per " #: ../src/highlight.c:392 #, c-format msgid "compiling pattern '%s': %s at offset %d" msgstr "" #: ../src/highlight.c:404 #, c-format msgid "studying pattern '%s': %s" msgstr "studio del pattern '%s': %s" #: ../src/highlight.c:431 #, c-format msgid "compiling 2nd pattern '%s': %s at offset %d" msgstr "" #: ../src/highlight.c:445 #, c-format msgid "studying 2nd pattern '%s': %s" msgstr "studio del secondo pattern '%s': %s" #: ../src/image.c:209 msgid "Insert image" msgstr "Inserisci immagine" #: ../src/image.c:216 msgid "Preview" msgstr "Anteprima" #: ../src/image.c:240 msgid "_Image location:" msgstr "Posizione _immagine:" #: ../src/image.c:246 msgid "Relative Path:" msgstr "Percorso relativo:" #: ../src/image.c:250 msgid "Label:" msgstr "Etichetta:" #: ../src/image.c:255 msgid "Caption:" msgstr "Didascalia:" #: ../src/menu.c:225 msgid "project mode: ON" msgstr "modalità progetto: ON" #: ../src/menu.c:227 msgid "project mode: OFF" msgstr "modalità progetto: OFF" #: ../src/menu.c:255 msgid "brace_finder: matching not found" msgstr "nessun file corrispondente trovato" #: ../src/menu.c:257 msgid "brace_finder: inside a commented line" msgstr "" #: ../src/menu.c:259 msgid "brace_finder: inside the selection" msgstr "ricerca di parentesi: nella selezione" #: ../src/menu.c:272 msgid "/_File" msgstr "/_File" #: ../src/menu.c:273 msgid "/File/tearoff1" msgstr "/File/tearoff1" #: ../src/menu.c:274 msgid "/File/_New" msgstr "/File/_Nuovo" #: ../src/menu.c:275 msgid "/File/New _Window" msgstr "/File/Nuova _finestra" #: ../src/menu.c:276 msgid "/File/_Open..." msgstr "/File/_Apri..." #: ../src/menu.c:277 msgid "/File/Open Recen_t" msgstr "/File/Apri recen_ti" #: ../src/menu.c:278 msgid "/File/Open Recent/tearoff1" msgstr "/File/Apri recenti/tearoff1" #: ../src/menu.c:281 msgid "/File/Open Ad_vanced..." msgstr "/File/Apri a_vanzato..." #: ../src/menu.c:284 msgid "/File/Open _from selection" msgstr "/File/Apri _da selezione" #: ../src/menu.c:285 msgid "/File/sep1" msgstr "/File/sep1" #: ../src/menu.c:286 msgid "/File/_Save" msgstr "/File/_Salva" #: ../src/menu.c:287 msgid "/File/Save _As..." msgstr "/File/Salva _come..." #: ../src/menu.c:288 msgid "/File/Sav_e All" msgstr "/File/Salv_a tutto" #: ../src/menu.c:289 msgid "/File/_Revert to Saved" msgstr "/File/_Ripristina alla versione salvata" #: ../src/menu.c:290 msgid "/File/sep2" msgstr "/File/sep2" #: ../src/menu.c:291 msgid "/File/_Insert..." msgstr "/File/_Inserisci..." #: ../src/menu.c:292 msgid "/File/Rena_me..." msgstr "/File/Rino_mina..." #: ../src/menu.c:293 msgid "/File/sep3" msgstr "/File/sep3" #: ../src/menu.c:294 msgid "/File/_Close" msgstr "/File/_Chiudi" #: ../src/menu.c:295 msgid "/File/Close A_ll" msgstr "/File/Chiudi tu_tto" #: ../src/menu.c:296 msgid "/File/Close Win_dow" msgstr "/File/Chiu_di finestra" #: ../src/menu.c:297 msgid "/File/sep4" msgstr "/File/sep4" #: ../src/menu.c:299 msgid "/File/_Quit" msgstr "/File/_Esci" #: ../src/menu.c:301 msgid "/_Edit" msgstr "/_Modifica" #: ../src/menu.c:302 msgid "/Edit/Tearoff1" msgstr "/Modifica/Tearoff1" #: ../src/menu.c:303 msgid "/Edit/_Undo" msgstr "/Modifica/_Annulla" #: ../src/menu.c:304 msgid "/Edit/_Redo" msgstr "/Modifica/_Ripeti" #: ../src/menu.c:305 msgid "/Edit/Undo All" msgstr "/Modifica/Annulla tutto" #: ../src/menu.c:306 msgid "/Edit/Redo All" msgstr "/Modifica/_Ripeti tutto" #: ../src/menu.c:307 msgid "/Edit/sep1" msgstr "/Modifica/sep1" #: ../src/menu.c:308 msgid "/Edit/Selection" msgstr "/Modifica/Seleziona _tutto" #: ../src/menu.c:309 msgid "/Edit/Selection/Tearoff1" msgstr "/Modifica/Selezione/Tearoff1" #: ../src/menu.c:310 msgid "/Edit/Selection/Cu_t" msgstr "/Modifica/Selezione/_Taglia" #: ../src/menu.c:311 msgid "/Edit/Selection/_Copy" msgstr "/Modifica/Selezione/_Copia" #: ../src/menu.c:312 msgid "/Edit/Selection/_Paste" msgstr "/Modifica/Selezione/_Incolla" #: ../src/menu.c:313 msgid "/Edit/Selection/sep2" msgstr "/Modifica/Seleziona _tutto/sep2" #: ../src/menu.c:314 msgid "/Edit/Selection/Select _All" msgstr "/Modifica/Selezione/Seleziona tutt_o" #: ../src/menu.c:315 msgid "/Edit/Find, Replace" msgstr "/Modifica/Trova, sostituisci" #: ../src/menu.c:316 msgid "/Edit/Find, Replace/Tearoff1" msgstr "/Modifica/Trova, sostituisci/Tearoff1" #: ../src/menu.c:317 msgid "/Edit/Find, Replace/Brace Finder (Forward)" msgstr "/Modifica/Trova, sostituisci/Parentesi (avanti)" #: ../src/menu.c:318 msgid "/Edit/Find, Replace/Brace Finder (Backward)" msgstr "/Modifica/Trova, sostituisci/Parentesi (indietro)" #: ../src/menu.c:319 msgid "/Edit/Find, Replace/sep0" msgstr "/Modifica/Trova, sostituisci/sep0" #: ../src/menu.c:320 msgid "/Edit/Find, Replace/_Find..." msgstr "/Modifica/Trova, sostituisci/_Trova..." #: ../src/menu.c:321 msgid "/Edit/Find, Replace/Find A_gain" msgstr "/Modifica/Trova, sostituisci/Trova a_ncora" #: ../src/menu.c:322 msgid "/Edit/Find, Replace/Find from selection" msgstr "/Modifica/Trova, sostituisci/Trova da selezione" #: ../src/menu.c:325 msgid "/Edit/Find, Replace/Find from Files" msgstr "/Modifica/Trova, sostituisci/Trova dai file" #: ../src/menu.c:326 msgid "/Edit/Find, Replace/Templates" msgstr "/Modifica/Trova, sostituisci/Modelli" #: ../src/menu.c:329 msgid "/Edit/Find, Replace/sep1" msgstr "/Modifica/Trova, sostituisci/sep1" #: ../src/menu.c:330 msgid "/Edit/Find, Replace/R_eplace..." msgstr "/Modifica/Trova, sostituisci/_Sostituisci..." #: ../src/menu.c:331 msgid "/Edit/Find, Replace/Replace Agai_n" msgstr "/Modifica/Trova, sostituisci/_Sostituisci ancora..." #: ../src/menu.c:332 msgid "/Edit/Find, Replace/sep2" msgstr "/Modifica/Trova, sostituisci/sep2" #: ../src/menu.c:334 msgid "/Edit/Find, Replace/To _Uppercase" msgstr "/Modifica/Trova, sostituisci/In m_aiuscole" #: ../src/menu.c:335 msgid "/Edit/Find, Replace/To _Lowercase" msgstr "/Modifica/Trova, sostituisci/In _minuscole" #: ../src/menu.c:336 msgid "/Edit/Find, Replace/sep3" msgstr "/Modifca/Trova, sostituisci/sep3" #: ../src/menu.c:337 msgid "/Edit/Find, Replace/ASCII to HTML entities" msgstr "/Modifica/Trova, sostituisci/ASCII in entità HTML" #: ../src/menu.c:338 msgid "/Edit/Find, Replace/ISO8859 to HTML entities" msgstr "/Modifica/Trova, sostituisci/ISO8859 in entità HTML" #: ../src/menu.c:339 msgid "/Edit/Find, Replace/ASCII & ISO8859 to HTML entities" msgstr "/Modifica/Trova, sostituisci/ASCII e ISO8859 in entità HTML" #: ../src/menu.c:341 msgid "/Edit/sep4" msgstr "/Modifica/sep4" #: ../src/menu.c:342 msgid "/Edit/Sh_ift Right" msgstr "/Modifica/Sposta a _destra" #: ../src/menu.c:343 msgid "/Edit/S_hift Left" msgstr "/Modifica/Spo_sta a sinistra" #: ../src/menu.c:344 msgid "/Edit/_Comment" msgstr "/Modifica/_Commenta" #: ../src/menu.c:345 msgid "/Edit/_UnComment" msgstr "/Modifica/T_ogli commento" #: ../src/menu.c:346 msgid "/Edit/_Hard Shift Left" msgstr "" #: ../src/menu.c:347 msgid "/Edit/Delete Current Line" msgstr "/Modifica/Elimina la linea corrente" #: ../src/menu.c:348 msgid "/Edit/sep5" msgstr "/Modifica/sep5" #: ../src/menu.c:349 msgid "/Edit/Add _Bookmark" msgstr "/Modifica/Aggiungi segnali_bro" #: ../src/menu.c:350 msgid "/_Insert" msgstr "/_Inserisci" #: ../src/menu.c:351 msgid "/Insert/Tearoff1" msgstr "/Inserisci/Tearoff1" #: ../src/menu.c:353 msgid "/Insert/T_ools" msgstr "/Inserisci/S_trumenti" #: ../src/menu.c:354 msgid "/Insert/Tools/Tearoff1" msgstr "/Inserisci/Strumenti/Tearoff1" #: ../src/menu.c:355 msgid "/Insert/Tools/Simple document (code)" msgstr "/Inserisci/Strumenti/Documento semplice (codice)" #: ../src/menu.c:356 msgid "/Insert/Tools/Figure" msgstr "/Inserisci/Strumenti/Figura" #: ../src/menu.c:357 msgid "/Insert/Tools/Time, Date" msgstr "/Inserisci/Strumenti/Tempo, data" #: ../src/menu.c:358 msgid "/Insert/Tools/Source Separator" msgstr "/Inserisci/Strumenti/Separatore sorgente" #: ../src/menu.c:360 msgid "/Insert/_Table, List" msgstr "/Inserisci/_Tabella, lista" #: ../src/menu.c:361 msgid "/Insert/Table, List/Tearoff1" msgstr "/Inserisci/Tabella, lista/Tearoff1" #: ../src/menu.c:362 msgid "/Insert/Table, List/_List" msgstr "/Inserisci/Tabella, lista/_Lista" #: ../src/menu.c:363 msgid "/Insert/Table, List/_Table, Array" msgstr "/Inserisci/Tabella, lista/_Tabella, array" #: ../src/menu.c:365 msgid "/Insert/_Headings" msgstr "/Inserisci/I_ntestazioni" #: ../src/menu.c:366 msgid "/Insert/Headings/Tearoff1" msgstr "/Inserisci/Intestazioni/Tearoff1" #: ../src/menu.c:367 msgid "/Insert/Headings/_part" msgstr "/Inserisci/Intestazioni/_part" #: ../src/menu.c:368 msgid "/Insert/Headings/_chapter" msgstr "/Inserisci/Intestazioni/_chapter" #: ../src/menu.c:369 msgid "/Insert/Headings/_section" msgstr "/Inserisci/Intestazioni/_section" #: ../src/menu.c:370 msgid "/Insert/Headings/s_ubsection" msgstr "/Inserisci/Intestazioni/s_otto-sezione" #: ../src/menu.c:371 msgid "/Insert/Headings/su_bsubsection" msgstr "/Inserisci/Intestazioni/sotto-so_tto-sezione" #: ../src/menu.c:372 msgid "/Insert/Headings/sep1" msgstr "/Inserisci/Intestazioni/sep1" #: ../src/menu.c:373 msgid "/Insert/Headings/parag_raph" msgstr "/Inserisci/Intestazioni/parag_raph" #: ../src/menu.c:374 msgid "/Insert/Headings/subparag_raph" msgstr "/Inserisci/Intestazioni/sotto-parag_rafo" #: ../src/menu.c:375 msgid "/Insert/Headings/sep2" msgstr "/Inserisci/Intestazioni/sep2" #: ../src/menu.c:376 msgid "/Insert/Headings/_part*" msgstr "/Inserisci/Intestazioni/_part*" #: ../src/menu.c:377 msgid "/Insert/Headings/_chapter*" msgstr "/Inserisci/Intestazioni/_chapter*" #: ../src/menu.c:378 msgid "/Insert/Headings/_section*" msgstr "/Inserisci/Intestazioni/_section*" #: ../src/menu.c:379 msgid "/Insert/Headings/s_ubsection*" msgstr "/Inserisci/Intestazioni/s_otto-sezione*" #: ../src/menu.c:380 msgid "/Insert/Headings/su_bsubsection*" msgstr "/Inserisci/Intestazioni/so_tto-sotto-sezione*" #: ../src/menu.c:382 msgid "/Insert/_Environments" msgstr "/Inserisci/Ambi_enti" #: ../src/menu.c:383 msgid "/Insert/Environments/tearoff1" msgstr "/Inserisci/Ambienti/tearoff1" #: ../src/menu.c:385 msgid "/Insert/Environments/flush_left" msgstr "/Inserisci/Ambienti/sposta a _sinistra" #: ../src/menu.c:386 msgid "/Insert/Environments/flush_right" msgstr "/Inserisci/Ambienti/sposta a _destra" #: ../src/menu.c:387 msgid "/Insert/Environments/_centering" msgstr "/Inserisci/Ambienti/_centratura" #: ../src/menu.c:388 msgid "/Insert/Environments/sep2" msgstr "/Inserisci/Ambienti/sep2" #: ../src/menu.c:389 msgid "/Insert/Environments/_verbatim" msgstr "/Inserisci/Ambienti/_verbatim" #: ../src/menu.c:390 msgid "/Insert/Environments/verbati_m*" msgstr "/Inserisci/Ambienti/_verbatim*" #: ../src/menu.c:391 msgid "/Insert/Environments/ver_se" msgstr "/Inserisci/Ambienti/ver_so" #: ../src/menu.c:392 msgid "/Insert/Environments/_quotation" msgstr "/Inserisci/Equazioni AMS/_quota" #: ../src/menu.c:395 msgid "/Insert/AMS equations" msgstr "/Inserisci/Equazioni AMS" #: ../src/menu.c:396 msgid "/Insert/AMS equations/tearoff1" msgstr "/Inserisci/Equazioni AMS/tearoff1" #: ../src/menu.c:397 msgid "/Insert/AMS equations/split" msgstr "/Inserisci/Equazioni AMS/dividi" #: ../src/menu.c:398 msgid "/Insert/AMS equations/cases" msgstr "/Inserisci/Equazioni AMS/casi" #: ../src/menu.c:399 msgid "/Insert/AMS equations/sep1" msgstr "/Inserisci/Equazioni AMS/sep1" #: ../src/menu.c:401 msgid "/Insert/AMS equations/aligned" msgstr "/Inserisci/Equazioni AMS/aligned" #: ../src/menu.c:402 msgid "/Insert/AMS equations/gathered" msgstr "/Inserisci/Equazioni AMS/gathered" #: ../src/menu.c:403 msgid "/Insert/AMS equations/sep2" msgstr "/Inserisci/Equazioni AMS/sep2" #: ../src/menu.c:405 msgid "/Insert/AMS equations/equation" msgstr "/Inserisci/Equazioni AMS/equazione" #: ../src/menu.c:406 msgid "/Insert/AMS equations/align" msgstr "/Inserisci/Equazioni AMS/align" #: ../src/menu.c:407 msgid "/Insert/AMS equations/subequations" msgstr "/Inserisci/Equazioni AMS/sotto-equazioni" #: ../src/menu.c:408 msgid "/Insert/AMS equations/gather" msgstr "/Inserisci/Equazioni AMS/gather" #: ../src/menu.c:409 msgid "/Insert/AMS equations/multline" msgstr "/Inserisci/Equazioni AMS/multi-linea" #: ../src/menu.c:411 msgid "/Insert/AMS equations/alignat" msgstr "/Inserisci/Equazioni AMS/alignat" #: ../src/menu.c:412 msgid "/Insert/AMS equations/sep3" msgstr "/Inserisci/Equazioni AMS/sep3" #: ../src/menu.c:414 msgid "/Insert/AMS equations/equation*" msgstr "/Inserisci/Equazioni AMS/equazioni*" #: ../src/menu.c:415 msgid "/Insert/AMS equations/align*" msgstr "/Inserisci/Equazioni AMS/align*" #: ../src/menu.c:416 msgid "/Insert/AMS equations/gather*" msgstr "/Inserisci/Equazioni AMS/gather*" #: ../src/menu.c:417 msgid "/Insert/AMS equations/multline*" msgstr "/Inserisci/Equazioni AMS/multi-linea*" #: ../src/menu.c:419 msgid "/Insert/AMS equations/alignat*" msgstr "/Inserisci/Equazioni AMS/alignat*" #: ../src/menu.c:421 msgid "/Insert/_Font style" msgstr "/Inserisci/Stile c_arattere" #: ../src/menu.c:424 msgid "/Insert/Font/Sizes" msgstr "/Inserisci/Carattere/Dimensioni" #: ../src/menu.c:425 msgid "/Insert/Font/Sizes/tearoff1" msgstr "/Inserisci/Carattere/Dimensioni/tearoff1" #: ../src/menu.c:426 msgid "/Insert/Font/Sizes/{\\\\tiny }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\tiny }" #: ../src/menu.c:427 msgid "/Insert/Font/Sizes/{\\\\scriptsize }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\scriptsize }" #: ../src/menu.c:428 msgid "/Insert/Font/Sizes/{\\\\footnotesize }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\footnotesize }" #: ../src/menu.c:429 msgid "/Insert/Font/Sizes/{\\\\small }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\small }" #: ../src/menu.c:430 msgid "/Insert/Font/Sizes/{\\\\normalsize }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\normalsize }" #: ../src/menu.c:431 msgid "/Insert/Font/Sizes/{\\\\large }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\large }" #: ../src/menu.c:432 msgid "/Insert/Font/Sizes/{\\\\Large }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\Large }" #: ../src/menu.c:433 msgid "/Insert/Font/Sizes/{\\\\huge }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\huge }" #: ../src/menu.c:434 msgid "/Insert/Font/Sizes/{\\\\Huge }" msgstr "/Inserisci/Carattere/Dimensioni/{\\\\Huge }" #: ../src/menu.c:438 msgid "/Insert/Font style/tearoff1" msgstr "/Inserisci/Carattere/Dimensioni/tearoff1" #: ../src/menu.c:439 msgid "/Insert/Font style/\\\\emph - _emphasized" msgstr "/Inserisci/Stile carattere/\\\\emph - _emphasized" #: ../src/menu.c:440 msgid "/Insert/Font style/\\\\underline - _underlined" msgstr "/Inserisci/Stile carattere/\\\\underline - _underlined" #: ../src/menu.c:441 msgid "/Insert/Font style/\\\\textit - _italic" msgstr "/Inserisci/Stile carattere/\\\\textit - _italic" #: ../src/menu.c:442 msgid "/Insert/Font style/\\\\textsl - _slanted" msgstr "/Inserisci/Stile carattere/\\\\textsl - _slanted" #: ../src/menu.c:443 msgid "/Insert/Font style/\\\\textbf - _boldface" msgstr "/Inserisci/Stile carattere/\\\\textbf - _boldface" #: ../src/menu.c:444 msgid "/Insert/Font style/\\\\texttt - _typewriter" msgstr "/Inserisci/Stile carattere/\\\\texttt - _typewriter" #: ../src/menu.c:445 msgid "/Insert/Font style/\\\\textsc - small_caps" msgstr "/Inserisci/Stile carattere/\\\\textsc - small_caps" #: ../src/menu.c:448 msgid "/Insert/Font/Maths" msgstr "/Inserisci/Carattere/Matematica" #: ../src/menu.c:449 msgid "/Insert/Font/Maths/tearoff1" msgstr "/Inserisci/Carattere/Matematica/tearoff1" #: ../src/menu.c:450 msgid "/Insert/Font/Maths/\\\\mathrm - Roman" msgstr "/Inserisci/Carattere/Matematica/\\\\mathrm - Roman" #: ../src/menu.c:451 msgid "/Insert/Font/Maths/\\\\mathit - Italic" msgstr "/Inserisci/Carattere/Matematica/\\\\mathit - Italic" #: ../src/menu.c:452 msgid "/Insert/Font/Maths/\\\\mathbf - Boldface" msgstr "/Inserisci/Carattere/Matematica/\\\\mathbf - Boldface" #: ../src/menu.c:453 msgid "/Insert/Font/Maths/\\\\mathsf - Sans serif" msgstr "/Inserisci/Carattere/Matematica/\\\\mathsf - Sans serif" #: ../src/menu.c:454 msgid "/Insert/Font/Maths/\\\\mathtt - Typewriter" msgstr "/Inserisci/Carattere/Matematica/\\\\mathtt - Typewriter" #: ../src/menu.c:455 msgid "/Insert/Font/Maths/sep1" msgstr "/Inserisci/Carattere/Matematica/sep1" #: ../src/menu.c:456 msgid "/Insert/Font/Maths/\\\\mathcal - Caligraphic" msgstr "/Inserisci/Carattere/Matematica/\\\\mathcal - Caligraphic" #: ../src/menu.c:457 msgid "/Insert/Font/Maths/\\\\mathbb - Blackboard" msgstr "/Inserisci/Carattere/Matematica/\\\\mathbb - Blackboard" #: ../src/menu.c:458 msgid "/Insert/Font/Maths/\\\\mathfrak - Fraktur" msgstr "/Inserisci/Carattere/Matematica/\\\\mathfrak - Fraktur" #: ../src/menu.c:500 msgid "/_Document" msgstr "/_Documento" #: ../src/menu.c:501 msgid "/Document/tearoff1" msgstr "/Documento/tearoff1" #: ../src/menu.c:502 msgid "/Document/_Increase Tabsize" msgstr "/Documento/_Aumenta la dimensione di tabulazione" #: ../src/menu.c:503 msgid "/Document/_Decrease Tabsize" msgstr "/Documento/_Diminuisci la dimensione di tabulazione" #: ../src/menu.c:504 msgid "/Document/_Auto Indent" msgstr "/Documento/Indentazione _automatica" #: ../src/menu.c:505 msgid "/Document/sep1" msgstr "/Documento/sep1" #: ../src/menu.c:506 msgid "/Document/Auto_Completion" msgstr "/Documento/_Completamento automatico" #: ../src/menu.c:507 msgid "/Document/_Wrap" msgstr "/Documento/_Vai a capo" #: ../src/menu.c:508 msgid "/Document/_Line Numbers" msgstr "/Documento/Numeri di _linea" #: ../src/menu.c:509 msgid "/Document/sep2" msgstr "/Documento/sep2" #: ../src/menu.c:510 msgid "/Document/_Highlight Syntax" msgstr "/Documento/_Evidenzia sintassi" #: ../src/menu.c:511 msgid "/Document/_Update Highlighting" msgstr "/Documento/_Aggiorna evidenziazione" #: ../src/menu.c:512 msgid "/Document/sep3" msgstr "/Documento/sep3" #: ../src/menu.c:513 msgid "/Document/Document Ty_pe" msgstr "/Documento/Ti_po di documento" #: ../src/menu.c:514 msgid "/Document/Document Type/tearoff1" msgstr "/Documento/Tipo di documento/tearoff1" #: ../src/menu.c:515 msgid "/Document/Character _Encoding" msgstr "/Documento/Codifica caratt_ere" #: ../src/menu.c:516 msgid "/Document/Character Encoding/tearoff1" msgstr "/Documento/Codifica carattere/tearoff1" #: ../src/menu.c:517 msgid "/Document/sep4" msgstr "/Documento/sep4" #: ../src/menu.c:519 msgid "/Document/Check _Spelling..." msgstr "/Documento/C_ontrollo ortografico..." #: ../src/menu.c:521 msgid "/Document/_Floating window" msgstr "/Documento/Finestra _fluttuante" #: ../src/menu.c:522 msgid "/Document/Word _Count" msgstr "/Documento/_Conteggio parole" #: ../src/menu.c:526 msgid "/E_xternal" msgstr "/E_sterno" #: ../src/menu.c:527 msgid "/External/tearoff1" msgstr "/Esterno/tearoff1" #: ../src/menu.c:528 ../src/menu.c:768 ../src/outputbox.c:627 #: ../src/outputbox.c:630 msgid "/External/Stop..." msgstr "/Esterno/Interrompi..." #: ../src/menu.c:529 msgid "/External/_Project mode" msgstr "/Esterno/Modalità _progetto" #: ../src/menu.c:531 msgid "/_Project" msgstr "/_Progetto" #: ../src/menu.c:532 msgid "/Project/tearoff1" msgstr "/Progetto/tearoff1" #: ../src/menu.c:533 msgid "/Project/_New" msgstr "/Progetto/_Nuovo" #: ../src/menu.c:534 msgid "/Project/_Open" msgstr "/Progetto/_Apri" #: ../src/menu.c:535 msgid "/Project/Open R_ecent" msgstr "/Progetto/Apri r_ecente" #: ../src/menu.c:536 msgid "/Project/Open Recent/tearoff1" msgstr "/Progetto/Apri recenti/tearoff1" #: ../src/menu.c:537 msgid "/Project/sep1" msgstr "/Progetto/sep1" #: ../src/menu.c:538 msgid "/Project/_Save" msgstr "/Progetto/_Salva" #: ../src/menu.c:539 msgid "/Project/Save _as..." msgstr "/Progetto/Salv_a come..." #: ../src/menu.c:540 msgid "/Project/Save & _close" msgstr "/Progetto/Salva e _chiudi" #: ../src/menu.c:541 msgid "/Project/sep2" msgstr "/Progetto/sep2" #: ../src/menu.c:542 ../src/project.c:227 msgid "/Project/Project options..." msgstr "/Progetto/Opzioni progetto..." #: ../src/menu.c:544 msgid "/_Go" msgstr "/_Vai" #: ../src/menu.c:545 msgid "/Go/tearoff1" msgstr "/Vai/tearoff1" #: ../src/menu.c:546 msgid "/Go/_Previous document" msgstr "/Vai/Documento _precedente" #: ../src/menu.c:547 msgid "/Go/_Next document" msgstr "/Vai/Documento s_uccessivo" #: ../src/menu.c:548 ../src/menu.c:551 msgid "/Go/sep1" msgstr "/Vai/sep1" #: ../src/menu.c:549 msgid "/Go/_First document" msgstr "/Vai/_Primo documento" #: ../src/menu.c:550 msgid "/Go/L_ast document" msgstr "/Vai/U_ltimo documento" #: ../src/menu.c:552 msgid "/Go/Goto _Line" msgstr "/Vai/Alla _linea" #: ../src/menu.c:553 msgid "/Go/Goto _Selection" msgstr "/Vai/Alla _selezione" #: ../src/menu.c:555 msgid "/_View" msgstr "/_Visualizza" #: ../src/menu.c:556 msgid "/View/tearoff1" msgstr "/Visualizza/tearoff1" #: ../src/menu.c:558 msgid "/View/View _Custom Menu" msgstr "/Visualizza/Visualizza menu per_sonalizzato" #: ../src/menu.c:559 msgid "/View/View _Sidebar" msgstr "/Visualizza/Visualizza barra l_aterale" #: ../src/menu.c:560 msgid "/View/View _Outputbox" msgstr "/Visualizza/Visualizza are_a risultati" #: ../src/menu.c:562 msgid "/View/View _Terminal" msgstr "/Visualizza/Visualizza barra l_aterale" #: ../src/menu.c:564 msgid "/_?" msgstr "/_Aiuto" #: ../src/menu.c:565 msgid "/?/_About..." msgstr "/Aiuto/_Informazioni..." #: ../src/menu.c:566 msgid "/?/sep1" msgstr "/Aiuto/sep1" #: ../src/menu.c:567 msgid "/?/_Save Settings" msgstr "/Aiuto/_Salva impostazioni" #: ../src/menu.c:568 msgid "/?/Save Shortcut _Keys" msgstr "/Aiuto/Salva tasti ra_pidi" #: ../src/menu.c:569 msgid "/?/_Preferences" msgstr "/?/_Preferenze..." #: ../src/menu.c:706 msgid "/Document/Document Type" msgstr "/Documento/Tipo di documento" #: ../src/menu.c:762 msgid "/View/View Custom Menu" msgstr "/Visualizza/Visualizza menu personalizzato" #: ../src/menu.c:763 msgid "/View/View Sidebar" msgstr "/Visualizza/Visualizza barra laterale" #: ../src/menu.c:764 msgid "/Document/Auto Indent" msgstr "/Documento/Indentazione automatica" #: ../src/menu.c:765 ../src/project.c:229 ../src/project.c:231 #: ../src/project.c:233 msgid "/External/Project mode" msgstr "/Esterno/Modalità progetto" #: ../src/menu.c:796 msgid "output" msgstr "risultato·#" #: ../src/menu.c:844 msgid "loading file(s)..." msgstr "apertura file..." #: ../src/menu.c:848 msgid "The filename was:\n" msgstr "Il nome file era:\n" #: ../src/menu.c:849 msgid "Could not open file\n" msgstr "Non è possibile aprire il file\n" #: ../src/menu.c:872 msgid "/Project/Open Recent" msgstr "/Progetto/Apri recente" #: ../src/menu.c:876 msgid "/File/Open Recent" msgstr "/File/Apri recenti" #: ../src/menu.c:1003 msgid "/Windows" msgstr "/Finestre" #: ../src/menu.c:1053 msgid "Could not view file in browser, the file does not yet have a name\n" msgstr "" "Non è possibile visualizzare il file nel browser, il file non ha ancora un " "nome\n" #: ../src/menu.c:1216 ../src/menu.c:1236 ../src/menu.c:1254 ../src/menu.c:1268 #: ../src/menu.c:1292 ../src/menu.c:1306 msgid "/External" msgstr "/Esterno" #: ../src/menu.c:1351 msgid "/Document/Character Encoding" msgstr "/Documento/Codifica carattere" #: ../src/menu.c:1617 msgid "This custom search and replace requires a selection" msgstr "Questa ricerca e sostituzione personalizzata richiede una selezione" #: ../src/menu.c:1715 msgid "/_Custom menu" msgstr "/Menu personaliz_zato" #: ../src/menu.c:1716 msgid "/Custom menu/sep" msgstr "/Menu personalizzato/sep" #: ../src/menu.c:1717 msgid "/Custom menu/Edit custom menu..." msgstr "/Menu personalizzato/Modifica menu personalizzato..." #: ../src/menu.c:1718 msgid "/Custom menu/Reset" msgstr "/Menu personalizzato/Annulla" #: ../src/menu.c:1719 msgid "/Custom menu/Load new" msgstr "/Menu personalizzato/Apri nuovo" #: ../src/menu.c:1935 msgid "Search Pattern" msgstr "Ricerca motivo" #: ../src/menu.c:1936 msgid "Replace String" msgstr "Sostituisci stringa" #: ../src/menu.c:1939 msgid "Formatstring Before" msgstr "" #: ../src/menu.c:1940 msgid "Formatstring After" msgstr "" #: ../src/menu.c:1987 msgid "The menupath you want to update does not exist yet" msgstr "" #: ../src/menu.c:1987 msgid "Try 'add' instead." msgstr "Prova \"aggiungi\" in alternativa." #: ../src/menu.c:1989 msgid "The menupath you want to add already exists." msgstr "Il percorso di menu che vuoi aggiungere esiste già." #: ../src/menu.c:1994 msgid "The menupath should start with a / character" msgstr "Il percorso menu dovrebbe iniziare con un carattere /" #: ../src/menu.c:2156 msgid "Custom Menu Editor" msgstr "Editor personalizzato di menu" #: ../src/menu.c:2167 msgid "Add New Menu Entry" msgstr "Aggiungi nuova voce di menu" #: ../src/menu.c:2169 msgid "Apply Changes" msgstr "Applica cambiamenti" #: ../src/menu.c:2171 msgid "Delete Menu Entry" msgstr "Elimina voce di menu" #: ../src/menu.c:2174 msgid "Close Discards Changes" msgstr "Annulla i cambiamenti fatti" #: ../src/menu.c:2176 msgid "Save Changes and Exit" msgstr "Salva i cambiamenti ed esci" #: ../src/menu.c:2186 msgid "_Menu Path:" msgstr "Percorso _menu" #: ../src/menu.c:2207 msgid "Menu path" msgstr "Percorso menu" #: ../src/menu.c:2227 msgid "Number of _Variables:" msgstr "Numero di _variabili:" #: ../src/menu.c:2235 msgid "Variables" msgstr "Variabili" #: ../src/menu.c:2254 msgid "Custom Dialo_g" msgstr "Maschera personalizzata" #: ../src/menu.c:2256 msgid "Custom Replace" msgstr "Sostituzione personalizzata" #: ../src/menu.c:2268 msgid "_Replace:" msgstr "_Sostituisci:" #: ../src/menu.c:2271 msgid "in current document" msgstr "nel documento corrente" #: ../src/menu.c:2271 msgid "from cursor" msgstr "dal cursore" #: ../src/menu.c:2271 msgid "in selection" msgstr "nella selezione" #: ../src/menu.c:2271 msgid "in all open documents" msgstr "in tutti i documenti aperti" #: ../src/menu.c:2279 msgid "Matc_hing:" msgstr "Confro_nta:" #: ../src/menu.c:2282 msgid "normal" msgstr "normale" #: ../src/menu.c:2282 msgid "posix regular expresions" msgstr "espressioni regolari posix" #: ../src/menu.c:2282 msgid "perl regular expresions" msgstr "espressioni regolari in perl" #: ../src/menu.c:2288 msgid "Case Se_nsitive" msgstr "Maiuscolo/mi_nuscolo" #: ../src/msg_queue.c:243 msgid "These files were not opened:\n" msgstr "Questi file non sono stati aperti:\n" #: ../src/outputbox.c:166 msgid "hide this box" msgstr "nascondi questa area" #: ../src/outputbox.c:172 msgid "copy this line" msgstr "copia questa linea" #: ../src/outputbox.c:192 #, c-format msgid "goto line %s, file = %s" msgstr "vai alla linea %s, file = %s" #: ../src/outputbox.c:194 #, c-format msgid "goto file = %s" msgstr "vai al file = %s" #: ../src/outputbox.c:198 #, c-format msgid "goto line %s, current file" msgstr "vai alla linea %s, file corrente" #: ../src/outputbox.c:203 #, c-format msgid "file: %s" msgstr "file: %s" #: ../src/outputbox.c:224 msgid "noop" msgstr "" #: ../src/outputbox.c:385 msgid "term" msgstr "elemento" #: ../src/outputbox.c:482 msgid "tool is running. press Escape to stop it first." msgstr "" #: ../src/outputbox.c:492 msgid "empty command" msgstr "comando assente" #: ../src/outputbox.c:498 #, c-format msgid "%s # project mode: ON" msgstr "%s # modalità progetto: ON" #: ../src/outputbox.c:500 #, c-format msgid "%s # project mode: OFF" msgstr "%s # modalità progetto: OFF" #: ../src/outputbox.c:509 msgid "file wasnot saved. tool canceled" msgstr "" #: ../src/outputbox.c:533 #, c-format msgid "failed to compile pattern %s" msgstr "" #: ../src/outputbox.c:586 msgid "stop request. stopping tool..." msgstr "" #: ../src/outputbox_bf.c:169 ../src/outputbox_bf.c:178 #, c-format msgid "some error happened creating fifo %s" msgstr "alcuni errori sono occorsi creando il fifo %s" #: ../src/outputbox_bf.c:391 #, c-format msgid "exit code: %d" msgstr "codice di uscita: %d" #: ../src/outputbox_bf.c:399 ../src/outputbox_ka.c:97 msgid "the child process exited abnormally" msgstr "il processo figlio è uscito in maniera anomala" #: ../src/outputbox_ka.c:93 #, c-format msgid "Exit code: %d" msgstr "Codice di uscita: %d" #: ../src/outputbox_ka.c:151 #, c-format msgid "IOChannel Error: %s" msgstr "Errore canale IO: %s" #: ../src/outputbox_ka.c:294 #, c-format msgid "Error: %s" msgstr "Errore: %s" #: ../src/outputbox_ka.c:297 msgid "hint: you may call the tool again" msgstr "suggerimento: puoi richiamare lo strumento ancora" #: ../src/outputbox_ka.c:300 msgid "tool finished." msgstr "strumento finito." #: ../src/outputbox_ka.c:306 msgid "error: cannot create PIPE file." msgstr "errore: non è possibile creare un file PIPE." #: ../src/outputbox_ka.c:311 msgid "error: cannot create temporarily file." msgstr "errore: non è possibile creare un file temporaneo." #: ../src/preferences.c:271 msgid "Untitled" msgstr "Senza nome" #: ../src/preferences.c:371 msgid "Select font" msgstr "Seleziona carattere" #: ../src/preferences.c:497 ../src/preferences.c:585 ../src/preferences.c:1070 #: ../src/preferences.c:1407 msgid "Label" msgstr "Etichetta" #: ../src/preferences.c:498 msgid "Extensions" msgstr "Estensione" #: ../src/preferences.c:499 msgid "Update chars" msgstr "Aggiorna caratteri" #: ../src/preferences.c:500 msgid "Icon" msgstr "Icona" #: ../src/preferences.c:501 msgid "Editable" msgstr "Modificabile" #: ../src/preferences.c:502 msgid "Content regex" msgstr "Contenuto regex" #: ../src/preferences.c:503 msgid "AutoCompletion" msgstr "Completamento automatico" #: ../src/preferences.c:586 msgid "Inverse filter" msgstr "Filtro inverso" #: ../src/preferences.c:587 msgid "Filetypes in filter" msgstr "Tipi file nel filtro" #: ../src/preferences.c:941 msgid "filetype" msgstr "tipofile" #: ../src/preferences.c:946 msgid "Reset" msgstr "Annulla" #: ../src/preferences.c:952 msgid "Pattern name" msgstr "Nome pattern" #: ../src/preferences.c:970 ../src/preferences.c:1497 msgid "Pattern" msgstr "Pattern" #: ../src/preferences.c:993 msgid "Start pattern and end pattern" msgstr "Inizio e fine motivo" #: ../src/preferences.c:995 msgid "Only start pattern" msgstr "" #: ../src/preferences.c:997 msgid "Subpattern from parent" msgstr "" #: ../src/preferences.c:1003 msgid "Start pattern" msgstr "Inizio motivo" #: ../src/preferences.c:1004 msgid "End pattern" msgstr "Fine motivo" #: ../src/preferences.c:1005 msgid "Case sensitive matching" msgstr "Confronto maiuscolo/minuscolo" #: ../src/preferences.c:1006 msgid "Parentmatch" msgstr "" #: ../src/preferences.c:1007 msgid "Foreground color" msgstr "Colore primo piano" #: ../src/preferences.c:1008 msgid "Background color" msgstr "Colore di sfondo" #: ../src/preferences.c:1016 msgid "don't change weight" msgstr "non cambiare il peso" #: ../src/preferences.c:1018 msgid "force non-bold weight" msgstr "" #: ../src/preferences.c:1020 msgid "force bold weight" msgstr "" #: ../src/preferences.c:1026 msgid "don't change style" msgstr "non cambiare stile" #: ../src/preferences.c:1028 msgid "force non-italic style" msgstr "" #: ../src/preferences.c:1030 msgid "force italic style" msgstr "forza allo stile corsivo" #: ../src/preferences.c:1071 ../src/preferences.c:1327 #: ../src/preferences.c:1408 ../src/preferences.c:1501 msgid "Command" msgstr "Comando" #: ../src/preferences.c:1175 ../src/preferences.c:1205 msgid "Warning:" msgstr "Avvertimento:" #: ../src/preferences.c:1175 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your autotext file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" #: ../src/preferences.c:1205 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your 'word-list' file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" #: ../src/preferences.c:1274 msgid "Definition" msgstr "Definizione" #: ../src/preferences.c:1275 msgid "Before" msgstr "Prima di" #: ../src/preferences.c:1276 msgid "After" msgstr "Dopo" #: ../src/preferences.c:1314 msgid "" "Add new autotext definition.\n" "Start finding the old one by pressing CTRL+F." msgstr "" #: ../src/preferences.c:1366 msgid "" "Add new word which should be started by '\\'.\n" "Start finding the old one by pressing CTRL+F." msgstr "" #: ../src/preferences.c:1496 msgid "Name" msgstr "Nome" #: ../src/preferences.c:1498 msgid "File #" msgstr "File·#" #: ../src/preferences.c:1499 msgid "Line #" msgstr "Linea·#" #: ../src/preferences.c:1500 msgid "Output #" msgstr "Risultato·#" #: ../src/preferences.c:1502 msgid "Save,Show" msgstr "Salva, Mostra" #: ../src/preferences.c:1541 msgid "" "%D: basedir of project\n" "%B: basefile (without extension) of project\n" "%d: current directory\n" "%b: basename (without extension) of current file\n" "%f: current file (full path)\n" "%l: current line\n" "%%: percent sign\n" "\n" "If there isn't any project, or project mode is off, we have\n" "\t%D=%d, %B=%b\n" "\n" "Save,Show:\n" "\tneed save file: 1\n" "\tshow all output: 2\n" "\tboth of them: 1+2 =3\n" "\tnone of them: 0" msgstr "" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "left" msgstr "sinistra" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "right" msgstr "destra" #: ../src/preferences.c:1856 msgid "top" msgstr "interrompi" #: ../src/preferences.c:1856 msgid "bottom" msgstr "in basso" #: ../src/preferences.c:1858 msgid "no check" msgstr "nessun controllo" #: ../src/preferences.c:1858 msgid "check mtime and size" msgstr "controlla mtime e dimensione" #: ../src/preferences.c:1858 msgid "check mtime" msgstr "controlla mtime" #: ../src/preferences.c:1858 msgid "check size" msgstr "controlla dimensione" #: ../src/preferences.c:1861 msgid "Edit preferences" msgstr "Modifica preferenze" #: ../src/preferences.c:1873 msgid "Editor" msgstr "Editor" #: ../src/preferences.c:1875 msgid "Editor options" msgstr "Opzioni editor" #: ../src/preferences.c:1880 msgid "Font" msgstr "Carattere" #: ../src/preferences.c:1881 msgid "Tab width" msgstr "Larghezza tabulazione" #: ../src/preferences.c:1882 msgid "Use spaces to indent, not tabs" msgstr "Utilizza gli spazi per indentare, non la tabulazione" #: ../src/preferences.c:1883 msgid "Word wrap default" msgstr "Rientro a capo predefinito" #: ../src/preferences.c:1885 msgid "Highlight syntax by default" msgstr "Evidenzia sintassi in maniera predefinita" #: ../src/preferences.c:1886 msgid "Highlight # lines" msgstr "Evidenzia # linee" #: ../src/preferences.c:1888 msgid "Undo" msgstr "Annulla" #: ../src/preferences.c:1893 msgid "Undo history size" msgstr "Dimensione cronologia di annulla" #: ../src/preferences.c:1894 msgid "Clear undo history on save" msgstr "Pulisci cronologia azioni durante il salvataggio" #: ../src/preferences.c:1896 msgid "Bookmark options" msgstr "Opzioni segnalibri" #: ../src/preferences.c:1901 msgid "Make permanent by default" msgstr "Rendilo permanente in maniera predefinita" #: ../src/preferences.c:1903 msgid "full path" msgstr "percorso completo" #: ../src/preferences.c:1903 msgid "path from basedir" msgstr "percorso da basedir" #: ../src/preferences.c:1903 msgid "filename" msgstr "nomefile" #: ../src/preferences.c:1904 msgid "Bookmarks filename display" msgstr "" #: ../src/preferences.c:1909 msgid "Files" msgstr "File" #: ../src/preferences.c:1911 msgid "Encoding" msgstr "Codifica" #: ../src/preferences.c:1923 msgid "Default character set" msgstr "Insieme di caratteri predefiniti" #: ../src/preferences.c:1929 msgid "Backup" msgstr "Backup" #: ../src/preferences.c:1933 msgid "Create backup on save" msgstr "Crea backup durante il salvataggio" #: ../src/preferences.c:1934 msgid "Backup file suffix" msgstr "Suffisso del file di backup" #: ../src/preferences.c:1936 msgid "save" msgstr "salva" #: ../src/preferences.c:1936 msgid "abort" msgstr "termina" #: ../src/preferences.c:1936 msgid "ask" msgstr "chiedi" #: ../src/preferences.c:1937 msgid "Action on backup failure" msgstr "Azioni durante un backup non avvenuto" #: ../src/preferences.c:1939 msgid "Remove backupfile on close" msgstr "Rimuovi file di backup in chiusura" #: ../src/preferences.c:1943 msgid "Misc" msgstr "Varie" #: ../src/preferences.c:1948 msgid "Allow multi instances of a file" msgstr "Permetti multiple istanze di un file" #: ../src/preferences.c:1950 msgid "Open files in already running winefish window" msgstr "Apri i file nelle finestre esistenti di winefish" #: ../src/preferences.c:1952 msgid "File modified on disk check " msgstr "File modificati durante il controllo disco" #: ../src/preferences.c:1953 msgid "Number of files in 'Open recent'" msgstr "Numero di file in 'Aperti di recente'" #: ../src/preferences.c:1955 msgid "File browser" msgstr "Navigazione file" #: ../src/preferences.c:1959 msgid "Default basedir" msgstr "Directory base predefinita" #: ../src/preferences.c:1960 msgid "Use separate file and directory view" msgstr "Utilizza viste separate per file e directory" #: ../src/preferences.c:1961 msgid "Unknown icon" msgstr "Icona sconosciuta" #: ../src/preferences.c:1962 msgid "Directory icon" msgstr "Icona directory" #: ../src/preferences.c:1966 msgid "User interface" msgstr "Interfaccia utente" #: ../src/preferences.c:1968 msgid "Dimensions" msgstr "Dimensioni" #: ../src/preferences.c:1972 msgid "Restore last used dimensions" msgstr "Ripristiina le ultime dimensioni" #: ../src/preferences.c:1973 msgid "Initial sidebar width" msgstr "Larghezza iniziale della barra laterale" #: ../src/preferences.c:1974 msgid "Initial window height" msgstr "Altezza iniziale della finestra" #: ../src/preferences.c:1975 msgid "Initial window width" msgstr "Larghezza iniziale della finestra" #: ../src/preferences.c:1979 msgid "General" msgstr "Generale" #: ../src/preferences.c:1984 msgid "Make LaTeX dialogs transient" msgstr "" #: ../src/preferences.c:1986 msgid "Notebook tab font (leave empty for gtk default)" msgstr "" #: ../src/preferences.c:1988 msgid "Document notebook tab position" msgstr "" #: ../src/preferences.c:1989 msgid "Sidebar notebook tab position" msgstr "" #: ../src/preferences.c:1990 msgid "Sidebar location" msgstr "Posizione della barra laterale" #: ../src/preferences.c:1994 ../src/preferences.c:1996 msgid "Filetypes" msgstr "Tipi file" #: ../src/preferences.c:2003 msgid "Filefilters" msgstr "Filtri" #: ../src/preferences.c:2012 msgid "Highlighting" msgstr "Evidenzia" #: ../src/preferences.c:2014 msgid "Patterns" msgstr "Pattern" #: ../src/preferences.c:2023 msgid "Viewers, Filters" msgstr "Visualizzatori, filtri" #: ../src/preferences.c:2025 msgid "Viewers" msgstr "Visualizzatori" #: ../src/preferences.c:2032 msgid "Utilities and Filters" msgstr "Utilità e filtri" #: ../src/preferences.c:2039 ../src/preferences.c:2062 msgid "Information" msgstr "Informazione" #: ../src/preferences.c:2044 #, c-format msgid "" "%f: current filename\n" "%i: input (filters)\n" "%o: output filename (filters)\n" "%%: percent sign" msgstr "" #: ../src/preferences.c:2052 ../src/preferences.c:2054 msgid "TeXbox" msgstr "Area TeX" #: ../src/preferences.c:2071 msgid "AutoX" msgstr "AutoX" #: ../src/preferences.c:2073 msgid "Autotext" msgstr "Autotext" #: ../src/preferences.c:2080 msgid "Word List (for Autocompletion)" msgstr "" #: ../src/preferences.c:2089 msgid "Miscellaneous" msgstr "Varie" #: ../src/preferences.c:2093 msgid "Templates Directory" msgstr "Directory dei modelli" #: ../src/preferences.c:2102 msgid "Column Markers" msgstr "" #: ../src/preferences.c:2107 msgid "Marker 1" msgstr "" #: ../src/preferences.c:2108 msgid "Marker 2" msgstr "" #: ../src/preferences.c:2109 msgid "Marker 3" msgstr "" #: ../src/project.c:89 msgid "New project" msgstr "Nuovo progetto" #: ../src/project.c:176 ../src/project.c:183 msgid "Enter Winefish project filename" msgstr "Inserisci il nome file del progetto Winefish" #: ../src/project.c:224 msgid "/Project/Save" msgstr "/Progetto/Salva" #: ../src/project.c:225 msgid "/Project/Save as..." msgstr "/Progetto/Salva come..." #: ../src/project.c:226 msgid "/Project/Save & close" msgstr "/Progetto/Salva e chiudi" #: ../src/project.c:304 ../src/project.c:311 msgid "Select Winefish project filename" msgstr "Seleziona il nome file del progetto Winefish" #: ../src/project.c:369 msgid "Do you want to save the project?" msgstr "Vuoi salvare il progetto?" #: ../src/project.c:498 msgid "" "The BaseDir must exist.\n" "The BaseFile must be located in BaseDir." msgstr "" #: ../src/project.c:525 msgid "Create New Project" msgstr "Crea nuovo progetto" #: ../src/project.c:528 msgid "Edit Project" msgstr "Modifica progetto" #: ../src/project.c:551 #, c-format msgid "This project contains %d files" msgstr "Questo progetto contiene %d file" #: ../src/project.c:563 msgid "Project _Name:" msgstr "_Nome progetto:" #: ../src/project.c:567 msgid "_BaseDir:" msgstr "Directory _base:" #: ../src/project.c:570 msgid "Browse..." msgstr "Scegli..." #: ../src/project.c:573 msgid "BaseFile:" msgstr "File base:" #: ../src/project.c:579 msgid "_Template:" msgstr "_Modello:" #: ../src/project.c:585 msgid "_Word wrap by default" msgstr "_Vai a capo in maniera predefinita" #: ../src/project.c:597 msgid "Create _Project" msgstr "Crea _progetto" #: ../src/project.c:637 msgid "Create project" msgstr "Crea progetto" #: ../src/project.c:641 msgid "Create project with currently opened documents" msgstr "Crea un progetto con i documenti attualmente aperti" #: ../src/project.c:642 msgid "Create empty project" msgstr "Crea progetto vuoto" #: ../src/rcfile.c:500 msgid "DVI Viewer" msgstr "Visualizzatore DVI" #: ../src/rcfile.c:502 msgid "PDF Viewer" msgstr "Visualizzatore PDF" #: ../src/rcfile.c:504 msgid "EPS Viewer" msgstr "Visualizzatore EPS" #: ../src/rcfile.c:578 msgid "LaTeX" msgstr "LaTeX" #: ../src/rcfile.c:580 msgid "XML" msgstr "XML" #: ../src/rcfile.c:582 msgid "Images" msgstr "Immagini" #: ../src/rcfile.c:946 msgid "Untitled Project" msgstr "Progetto senza nome" #: ../src/snr2.c:193 msgid "Regular expression error: " msgstr "Errore nell'espressione regolare: " #: ../src/snr2.c:194 ../src/snr2.c:239 msgid "Search failed" msgstr "Ricerca non avvenuta" #: ../src/snr2.c:238 #, c-format msgid "Regular expression error: %s at offset %d" msgstr "" #: ../src/snr2.c:864 msgid "Confirm replace" msgstr "Conferma sostituzione" #: ../src/snr2.c:876 msgid "Replace selected text?" msgstr "Sostituisci il testo selezionato?" #: ../src/snr2.c:889 msgid "_Skip" msgstr "_Salta" #: ../src/snr2.c:891 msgid "Replace _all" msgstr "Sostituisci _tutto" #: ../src/snr2.c:1136 ../src/snr2.c:1143 msgid "Search: no match found" msgstr "Ricerca: nessuna voce trovata" #: ../src/snr2.c:1369 msgid "_Search for: " msgstr "_Ricerca: " #: ../src/snr2.c:1395 msgid "_Replace with: " msgstr "_Sostituisci con: " #: ../src/snr2.c:1405 msgid "\\0 refers to the first subsearch_pattern, \\1 to the second etc." msgstr "" #: ../src/snr2.c:1420 msgid "Beginning of document till end" msgstr "Dall'inizio del documento fino alla fine" #: ../src/snr2.c:1420 msgid "Current position till end" msgstr "Dalla posizione attuale fino alla fine" #: ../src/snr2.c:1420 msgid "Beginning of selection till end of selection" msgstr "Dall'inizio della selezione fino alla fine" #: ../src/snr2.c:1420 msgid "All opened files begin till end" msgstr "Tutti i file aperti dall'inizio alla fine" #: ../src/snr2.c:1421 msgid "Disabled" msgstr "Disabilitato" #: ../src/snr2.c:1421 msgid "POSIX type" msgstr "Tipo POSIX" #: ../src/snr2.c:1421 msgid "PERL type" msgstr "Tipo PERL" #: ../src/snr2.c:1422 msgid "Starts at:" msgstr "Inizia da:" #: ../src/snr2.c:1434 msgid "Regular expression:" msgstr "Espressione regolare:" #: ../src/snr2.c:1448 msgid "Normal" msgstr "Normale" #: ../src/snr2.c:1448 msgid "Uppercase" msgstr "Maiuscolo" #: ../src/snr2.c:1448 msgid "Lowercase" msgstr "Minuscolo" #: ../src/snr2.c:1449 msgid "Replace type:" msgstr "Tipo di sostituzione:" #: ../src/snr2.c:1462 msgid "_Patterns contain backslash escape sequences (\\n, \\t)" msgstr "" #: ../src/snr2.c:1463 msgid "_Match case" msgstr "" #: ../src/snr2.c:1464 msgid "O_verlap searches" msgstr "" #: ../src/snr2.c:1466 msgid "Prompt _before replace" msgstr "Avvisa prima di sostituire" #: ../src/snr2.c:1467 msgid "Replace o_nce" msgstr "Sostituzione u_nica" #: ../src/snr2.c:1469 msgid "Bookmark results" msgstr "Risultati segnalibri" #: ../src/winefish.c:106 #, c-format msgid "" "\n" "Usage: %s [options] [filenames ...]\n" msgstr "" "\n" "Utilizzo: %s [opzioni] [nome file ...]\n" #: ../src/winefish.c:107 msgid "" "\n" "Currently accepted options are:\n" msgstr "" "\n" "Opzioni attualmente accettate:\n" #: ../src/winefish.c:108 msgid "-s skip root check\n" msgstr "" #: ../src/winefish.c:109 msgid "-v current version\n" msgstr "-v versione corrente\n" #: ../src/winefish.c:110 msgid "-n 0|1 open new window (1) or not (0)\n" msgstr "" #: ../src/winefish.c:111 msgid "-p filename open project\n" msgstr "" #: ../src/winefish.c:112 msgid "-l number set line. Negative value takes no effect.\n" msgstr "" #: ../src/winefish.c:113 msgid "-h this help screen\n" msgstr "" #: ../src/winefish.c:190 msgid "parsing highlighting file..." msgstr "" #: ../src/winefish.c:201 msgid "compiling highlighting patterns..." msgstr "" #: ../src/winefish.c:205 msgid "initialize some other things..." msgstr "varie inizializzazioni..." #: ../src/winefish.c:211 msgid "parsing autotext and words file..." msgstr "" #: ../src/winefish.c:216 msgid "parsing custom menu file..." msgstr "controllo del file di menu personalizzato..." #: ../src/winefish.c:230 msgid "creating main gui..." msgstr "creazione interfaccia principale..." #: ../src/winefish.c:241 msgid "showing main gui..." msgstr "mostro interfaccia principale..." #: ../src/wizards.c:139 #, c-format msgid "row %d col" msgstr "riga %d colonna" #: ../src/wizards.c:157 #, c-format msgid "%%%% row %d\n" msgstr "%%%% riga %d\n" #: ../src/wizards.c:251 msgid "Table Wizard" msgstr "Assistente di tabella" #: ../src/wizards.c:259 msgid "Number of _rows:" msgstr "Numero di _righe:" #: ../src/wizards.c:263 msgid "Number of colu_mns:" msgstr "Nu_mero di colonne:" #: ../src/wizards.c:267 msgid "Add Horizontal Rules:" msgstr "Aggiungi regole orizzontali:" #: ../src/wizards.c:287 msgid "Type (Environment):" msgstr "" #: ../src/wizards.c:297 msgid "Columns Alignmen:" msgstr "Allineamento colonne:" #: ../src/wizards.c:311 msgid "Vertical Rules:" msgstr "Regole verticali:" #: ../src/wizards.c:408 msgid "Insert Time" msgstr "Inserisci l'ora" #: ../src/wizards.c:416 #, c-format msgid " _Time (%i:%i:%i)" msgstr " _Tempo (%i:%i:%i)" #: ../src/wizards.c:421 msgid " Day of the _week (Sunday)" msgstr " Giorno della _settimana (domenica)" #: ../src/wizards.c:424 msgid " Day of the _week (Monday)" msgstr " Giorno della _settimana (lunedì)" #: ../src/wizards.c:427 msgid " Day of the _week (Tuesday)" msgstr " Giorno della settimana (martedì)" #: ../src/wizards.c:430 msgid " Day of the _week (Wednesday)" msgstr " Giorno della settimana (mercoledì)" #: ../src/wizards.c:433 msgid " Day of the _week (Thursday)" msgstr " Giorno della settimana (giovedì)" #: ../src/wizards.c:436 msgid " Day of the _week (Friday)" msgstr " Giorno della settimana (venerdì)" #: ../src/wizards.c:439 msgid " Day of the _week (Saturday)" msgstr " Giorno della _settimana (sabato)" #: ../src/wizards.c:442 msgid "You appear to have a non existant day!\n" msgstr "Sembra che tu non abbia un giorno esistente!\n" #: ../src/wizards.c:450 #, c-format msgid " _Date (%i/%i/%i)" msgstr " _Ora (%i/%i/%i)" #: ../src/wizards.c:453 #, c-format msgid " _Unix Time (%i)" msgstr " _Unix Time (%i)" #: ../src/wizards.c:456 #, c-format msgid " Unix Date _String (%s" msgstr " _Stringa data Unix (%s" #: ../src/wizards.c:518 msgid "Quick Start" msgstr "Avvio rapido" #: ../src/wizards.c:533 msgid "Document _Class:" msgstr "_Classe documento:" #: ../src/wizards.c:551 msgid "_VnTeX Support:" msgstr "Supporto _VnTeX:" #: ../src/wizards.c:599 ../src/wizards.c:604 ../src/wizards.c:608 msgid "item" msgstr "elemento" #: ../src/wizards.c:628 msgid "Quick List" msgstr "Lista elementi" #: ../src/wizards.c:635 msgid "_Rows:" msgstr "_Righe:" #: ../src/wizards.c:646 msgid "Type (_Environment):" msgstr "" #~ msgid "_File Type:" #~ msgstr "Tipo _file:" winefish-1.3.3/po/vi.po0000600000047200004720000021532110412002305013713 0ustar kyanhkyanh# translation of vi.po to Vietnamese # This file is distributed under the same license as the PACKAGE package. # Copyright (C) 2005-2006 kyanh . # msgid "" msgstr "" "Project-Id-Version: vi\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2006-03-27 22:28+0700\n" "PO-Revision-Date: 2006-02-18 14:49+0700\n" "Last-Translator: kyanh \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: unknown\n" #: ../src/about.c:60 #, c-format msgid "" "Winefish LaTeX Editor (based on Bluefish)\n" "\n" "* home: http://winefish.berlios.de/\n" "* open source development project\n" "* released under the GPL license\n" "\n" "* version: %s\n" "* maximum length\n" " latex command: %d\n" " autotext command: %d\n" "* recursive grep: %s\n" "* delimiters:\n" " %s\n" "* configured:\n" " $%s\n" msgstr "" "Winefish LaTeX Editor (dựa trên Bluefish)\n" "\n" "* trang nhà: http://winefish.berlios.de/\n" "* dự án mã nguồn mở\n" "* phân phối theo giấy phép GPL\n" "\n" "* phiên bản: %s\n" "* chiều dài tối đa:\n" " lệnh latex: %d\n" " lệnh autotext: %d\n" "* tìm đệ quy: %s\n" "* dấu phân cách:\n" " %s\n" "* cấu hình:\n" " $%s\n" #: ../src/about.c:77 msgid "" "developers:\n" "* kyanh \n" "\n" "translators:\n" "* French: Michèle Garoche \n" "* Italian: Daniele Medri \n" "* Vietnamese: kyanh \n" "\n" "THANKS to all who helped making this software available.\n" msgstr "" "phát triển:\n" "* kyanh \n" "\n" "chuyển ngữ:\n" "* tiếng Pháp: Michèle Garoche \n" "* tiếng Ý: Daniele Medri \n" "* tiếng Việt: kyanh \n" "\n" "Cám ơn bạn sử dụng phần mềm này.\n" #: ../src/about.c:88 msgid "About Winefish" msgstr "Giới thiệu Winefish" #: ../src/about.c:123 ../src/fref.c:2318 ../src/fref.c:2333 msgid "info" msgstr "thông tin" #: ../src/about.c:127 msgid "authors" msgstr "tác giả" #: ../src/about.c:139 msgid "oops..." msgstr "" #: ../src/bf_lib.c:54 ../src/bf_lib.c:68 msgid "" "Winefish has trouble reading the filenames. Try to set the environment " "variable G_BROKEN_FILENAMES=1\n" msgstr "" "Winefish gặp trục trặc khi đọc tên tập tin. Hãy thử đặc biến môi trường " "G_BROKEN_FILENAMES=1\n" #: ../src/bfspell.c:428 msgid "Check Spelling" msgstr "Kiểm tra chính tả" #: ../src/bfspell.c:432 msgid "Checking" msgstr "Đang kiểm tra" #: ../src/bfspell.c:441 msgid "_Misspelled word:" msgstr "_Các từ gõ sai:" #: ../src/bfspell.c:445 msgid "Change _to:" msgstr "Đổi thành:" #: ../src/bfspell.c:448 msgid "I_gnore" msgstr "_Bỏ qua" #: ../src/bfspell.c:449 ../src/snr2.c:890 msgid "_Replace" msgstr "_Thay thế" #: ../src/bfspell.c:462 msgid "In _document" msgstr "Trong tài _liệu" #: ../src/bfspell.c:463 msgid "I_n selection" msgstr "Trong phần đang _chọn" #: ../src/bfspell.c:472 msgid "personal dictionary" msgstr "Tự điển cá nhân" #: ../src/bfspell.c:475 msgid "session dictionary" msgstr "Tự điển tạm thời" #: ../src/bfspell.c:481 msgid "Dictionary:" msgstr "Tự điển:" #: ../src/bfspell.c:485 msgid "_Add" msgstr "Thê_m" #: ../src/bfspell.c:489 msgid "Language:" msgstr "Ngôn ngữ:" #: ../src/bfspell.c:493 msgid "Set defa_ult" msgstr "Mặc định" #: ../src/bfspell.c:497 msgid "Filter:" msgstr "Lọc:" #: ../src/bfspell.c:505 msgid "no filter" msgstr "(không)" #: ../src/bfspell.c:507 msgid "TeX filter" msgstr "lọc kiểu TeX" #: ../src/bfspell.c:509 msgid "html filter" msgstr "Lọc HTML" #: ../src/bookmark.c:363 msgid "_Name:" msgstr "_Tên:" #: ../src/bookmark.c:368 msgid "_Description:" msgstr "_Mô tả:" #: ../src/bookmark.c:370 msgid "Temporary" msgstr "Tạm thời" #: ../src/bookmark.c:470 #, c-format msgid "Could not find the file \"%s\"." msgstr "Không tìm thấy tập tin \"%s\"." #: ../src/bookmark.c:472 msgid "This bookmark is set in a file that no longer exists." msgstr "Dấu này được đặt cho tận tin không còn tồn tại." #: ../src/bookmark.c:607 #, c-format msgid "Do you really want to delete all bookmarks for %s?" msgstr "Bạn thật sự muốn xóa mọi đánh dấu trong tài liệu %s?" #: ../src/bookmark.c:608 msgid "Delete bookmarks?" msgstr "Xóa đánh dấu?" #: ../src/bookmark.c:638 #, c-format msgid "Do you really want to delete %s?" msgstr "Bạn thật sự muốn xóa %s?" #: ../src/bookmark.c:640 msgid "Delete permanent bookmark." msgstr "Xóa đánh dấu." #: ../src/bookmark.c:657 msgid "Edit bookmark" msgstr "Thay đổi đánh đấu" #: ../src/bookmark.c:671 msgid "Goto bookmark" msgstr "Đi đến đánh dấu" #: ../src/bookmark.c:679 msgid "Edit" msgstr "Soạn, sửa" #: ../src/bookmark.c:683 msgid "Delete" msgstr "Xóa" #: ../src/bookmark.c:689 msgid "Delete all in document" msgstr "Xóa tất cả đánh dấu trong tài liệu" #: ../src/bookmark.c:694 msgid "Delete all" msgstr "Xóa tất cả" #: ../src/bookmark.c:1275 ../src/bookmark.c:1292 ../src/bookmark.c:1330 #: ../src/document.c:2759 msgid "Add bookmark" msgstr "Thêm đánh dấu" #: ../src/bookmark.c:1276 ../src/bookmark.c:1331 msgid "Cannot add bookmarks in unnamed files." msgstr "Không thể đánh dấu cho tập tin chưa có tên." #: ../src/bookmark.c:1293 msgid "You already have a bookmark here!" msgstr "Bạn đã đánh dấu ở đây rồi!" #: ../src/bookmark.c:1368 msgid "Delete all bookmarks." msgstr "Xóa mọi đánh dáu." #: ../src/bookmark.c:1368 msgid "Are you sure?" msgstr "Bạn chắn chắn chứ?" #: ../src/bookmark.c:1407 msgid "File size changed in file\n" msgstr "Cỡ tập tin đã thay đổi\n" #: ../src/bookmark.c:1408 msgid "Bookmarks positions could be incorrect. Delete bookmarks?" msgstr "Các đánh dấu có thể bị sai. Xóa các đánh dấu?" #: ../src/document.c:322 ../src/document.c:3811 msgid "/Document/Highlight Syntax" msgstr "/Tài liệu/Tô màu" #: ../src/document.c:782 msgid "name: " msgstr "tên: " #: ../src/document.c:783 msgid "" "\n" "type: " msgstr "" "\n" "kiểu: " #: ../src/document.c:784 msgid "" "\n" "encoding: " msgstr "" "\n" "bảng mã: " #: ../src/document.c:787 msgid "" "\n" "size (on disk): " msgstr "" "\n" "cỡ (trên đĩa): " #: ../src/document.c:787 msgid " bytes" msgstr "bytes" #: ../src/document.c:793 msgid "" "\n" "permissions: " msgstr "" "\n" "quyền: " #: ../src/document.c:800 msgid "" "\n" "last modified: " msgstr "" "\n" "thay đổi cuối: " #: ../src/document.c:826 #, c-format msgid "Untitled %d" msgstr "Không tên %d" #: ../src/document.c:1492 msgid "Could not read file:\n" msgstr "Không thể đọc tập tin:\n" #: ../src/document.c:1523 msgid "Opening file " msgstr "Đang mở tập tin" #: ../src/document.c:1594 msgid "Cannot display file, unknown characters found." msgstr "Không thể mở tập tin, có các ký tự lạ." #: ../src/document.c:2079 #, c-format msgid "deleted '%s'" msgstr "xóa '%s'" #: ../src/document.c:2741 ../src/snr2.c:1340 msgid "Replace" msgstr "Thay thế" #: ../src/document.c:2746 ../src/snr2.c:1343 msgid "Find" msgstr "Tìm kiếm" #: ../src/document.c:2755 msgid "Delete bookmark" msgstr "Xóa đánh dấu" #: ../src/document.c:2900 msgid "saving file" msgstr "đang lưu tập tin" #: ../src/document.c:2924 ../src/document.c:2948 msgid "_Abort save" msgstr "Dừng việc lưu tập tin" #: ../src/document.c:2924 msgid "_Continue save" msgstr "_Tiếp tục lưu" #: ../src/document.c:2926 #, c-format msgid "" "A backupfile for %s could not be created. If you continue, this file will be " "overwritten." msgstr "Bản sao lưu %s không thể tạo ra. Nếu tiếp tục, tập tin sẽ bị ghi đè." #: ../src/document.c:2927 msgid "File backup failure" msgstr "Sao lưu không thành công" #: ../src/document.c:2948 msgid "_Continue save in UTF-8" msgstr "_Tiếp tục lưu ở dạng UTF-8" #: ../src/document.c:2959 #, c-format msgid "" "Failed to convert %s to character encoding %s. Encoding failed on character " "'%s' at line %d column %d\n" "\n" "Continue saving in UTF-8 encoding?" msgstr "" "Thất bại khi chuyển từ bảng mã %s sang bảng mã %s. Gặp trục trặc ở ký tự '%" "s' ở dòng %d cột %d\n" "Tiếp tục lưu với bảng mã UTF-8?" #: ../src/document.c:2960 msgid "File encoding conversion failure" msgstr "Thất bại khi chuyển bảng mã" #: ../src/document.c:3115 msgid "Previously: " msgstr "Trước: " #: ../src/document.c:3148 #, c-format msgid "Move/rename %s to" msgstr "Đổi tên %s thành" #: ../src/document.c:3148 #, c-format msgid "Save %s as" msgstr "Lưu %s với tên khác là" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/document.c:4387 ../src/project.c:194 msgid "_Cancel" msgstr "_Bỏ qua" #: ../src/document.c:3212 ../src/document.c:3227 ../src/document.c:3335 #: ../src/project.c:194 msgid "_Overwrite" msgstr "_Ghi đè" #: ../src/document.c:3213 #, c-format msgid "File %s exists and is opened, overwrite?" msgstr "Tập tin %s đã có và đang được mở. Ghi đè lên?" #: ../src/document.c:3214 msgid "The file you have selected is being edited in Winefish." msgstr "Tập tin bạn vừa chọn đang được mở trong Winefish." #: ../src/document.c:3228 ../src/project.c:195 #, c-format msgid "A file named \"%s\" already exists." msgstr "Tập tin với tên \"%s\" đã tồn tại." #: ../src/document.c:3230 ../src/project.c:197 msgid "Do you want to replace the existing file?" msgstr "Bạn có muốn thay thế tập tin đã tồn tại không?" #: ../src/document.c:3298 msgid "save as..." msgstr "lưu với tên khác..." #: ../src/document.c:3339 #, c-format msgid "" "File: %s\n" "\n" "New modification time: %s\n" "Old modification time: %s" msgstr "" "Tập tin: %s\n" "\n" "Giờ thay đổi mới: %s\n" "Giời thay đổi cũ: %s" #: ../src/document.c:3340 msgid "File has been modified by another process." msgstr "Tập tin vừa được thay đổi bởi tiến trình nào đó." #: ../src/document.c:3353 #, c-format msgid "Saving %s" msgstr "Đang lưu %s" #: ../src/document.c:3369 msgid "" "Could not backup file:\n" "\"" msgstr "" "Không thể sao lưu tập tin:\n" "\"" #: ../src/document.c:3370 msgid "File save aborted.\n" msgstr "Việc lưu tập tin bị ngắt giữa chừng.\n" #: ../src/document.c:3375 msgid "" "Could not write file:\n" "\"" msgstr "" "Không thể ghi vào tập tin:\n" "\"" #: ../src/document.c:3376 msgid "File save error" msgstr "Việc lưu tập tin bị lỗi" #: ../src/document.c:3435 #, c-format msgid "Save changes to \"%s\" before closing?." msgstr "Lưu tập tin vào \"%s\" trước khi thoát?." #: ../src/document.c:3442 ../src/project.c:362 msgid "Do_n't save" msgstr "Không lưu" #: ../src/document.c:3444 ../src/document.c:4389 ../src/project.c:371 msgid "If you don't save your changes they will be lost." msgstr "Nếu bạn không lưu, những thay đổi với tập tin sẽ bị mất." #: ../src/document.c:3814 msgid "/Document/Line Numbers" msgstr "/Tài liệu/Số chỉ dòng" #: ../src/document.c:3817 msgid "/Document/AutoCompletion" msgstr "/Tài liệu/Hoàn thành lệnh" #: ../src/document.c:3853 msgid "No filename" msgstr "Chưa có tên" #: ../src/document.c:4001 msgid "Loading files..." msgstr "Đang nạp tận tin..." #: ../src/document.c:4028 msgid "" "These files could not opened:\n" "\n" msgstr "" "Các tập tin sau không thể mở:\n" "\n" #: ../src/document.c:4030 ../src/msg_queue.c:245 msgid "Unable to open file(s)\n" msgstr "Không thể mở các tập tin sau\n" #: ../src/document.c:4077 msgid "unable to open file" msgstr "không thể mở tập tin" #: ../src/document.c:4133 msgid "_Reload" msgstr "Đọc lại nội dung tập tin trên đĩa" #: ../src/document.c:4133 msgid "_Ignore" msgstr "_Bỏ qua" #: ../src/document.c:4137 #, c-format msgid "" "Filename: %s\n" "\n" "New modification time is: %s\n" "Old modification time is: %s" msgstr "" "Tập tin: %s\n" "\n" "Giờ thay đổi mới: %s\n" "Giời thay đổi cũ: %s" #: ../src/document.c:4138 msgid "File has been modified by another process\n" msgstr "Tập tin vừa được thay đổi bởi tiến trình nào đó\n" #: ../src/document.c:4272 ../src/gtk_easy.c:1629 msgid "Select files" msgstr "Chọn tập tin" #: ../src/document.c:4290 #, c-format msgid "Loading %d file(s)..." msgstr "Đang nạp %d tập tin..." #: ../src/document.c:4317 ../src/document.c:4325 msgid "Select file to insert" msgstr "Chọn tập tin để chèn" #: ../src/document.c:4329 msgid "no file to insert" msgstr "không có tập tin nào" #: ../src/document.c:4387 msgid "_Save All" msgstr "Lưu tất cả" #: ../src/document.c:4387 msgid "Close _All" msgstr "Đóng tất cả" #: ../src/document.c:4387 msgid "Choose per _File" msgstr "Hỏi từng tập tin" #: ../src/document.c:4388 msgid "Multiple open files have been changed." msgstr "Nhiều tập tin đang mở đã thay đổi nội dung." #: ../src/document.c:4667 #, c-format msgid "Statistics: %d lines, %d words, %d characters" msgstr "Thống kê: %d dòng, %d từ, %d ký tự" #: ../src/filebrowser.c:1019 msgid "Error creating path" msgstr "Lỗi trong khi tạo đường dẫn" #: ../src/filebrowser.c:1019 msgid "The specified pathname already exists." msgstr "Đường dẫn chỉ ra đã tồn tại." #: ../src/filebrowser.c:1085 msgid "File name" msgstr "Tên tập tin" #: ../src/filebrowser.c:1087 msgid "Directory name" msgstr "Tên thư mục" #: ../src/filebrowser.c:1118 msgid "opening directory..." msgstr "đang mở thư mục..." #: ../src/filebrowser.c:1211 msgid "Could not rename\n" msgstr "Không thể đổi tên\n" #: ../src/filebrowser.c:1253 #, c-format msgid "Are you sure you want to delete \"%s\" ?" msgstr "Bạn thật sự muốn xóa \"%s\" ?" #: ../src/filebrowser.c:1254 msgid "If you delete this file, it will be permanently lost." msgstr "Nếu bạn xóa, nội dung tập tin sẽ mất không thể phục hồi được." #: ../src/filebrowser.c:1262 msgid "Could not delete \n" msgstr "Không thể xóa\n" #: ../src/filebrowser.c:1400 msgid "/Open _Advanced..." msgstr "/Mở (nâng cao)..." #: ../src/filebrowser.c:1404 msgid "/_Refresh" msgstr "/_Cập nhật" #: ../src/filebrowser.c:1405 msgid "/_Set as basedir" msgstr "/Đặt làm thư mục chính" #: ../src/filebrowser.c:1409 msgid "/New _File" msgstr "/Tập tin _mới" #: ../src/filebrowser.c:1410 msgid "/_New Directory" msgstr "/_Thư mục mới" #: ../src/filebrowser.c:1415 msgid "/_Open" msgstr "/_Mở" #: ../src/filebrowser.c:1416 msgid "/Rena_me" msgstr "/Đổi _tên" #: ../src/filebrowser.c:1417 msgid "/_Delete" msgstr "/_Xóa" #: ../src/filebrowser.c:1439 msgid "Show hidden files" msgstr "Xem tập tin ẩn" #: ../src/filebrowser.c:1444 msgid "Show backup files" msgstr "Xem tập tin sao lưu" #: ../src/filebrowser.c:1450 msgid "Filter" msgstr "Lọc" #: ../src/filebrowser.c:1650 ../src/gtk_easy.c:1408 msgid "All files" msgstr "Mọi tập tin" #: ../src/filebrowser.c:1922 msgid "Show full tree" msgstr "Đường dẫn đầy đủ" #: ../src/filebrowser.c:1923 msgid "Follow focus" msgstr "" #: ../src/fref.c:1450 ../src/fref.c:1734 ../src/fref.c:1821 ../src/fref.c:1856 msgid "Info" msgstr "Thông tin" #: ../src/fref.c:1469 msgid "Close" msgstr "Đóng" #: ../src/fref.c:1473 ../src/fref.c:1815 ../src/fref.c:1851 msgid "Dialog" msgstr "Hộp thoại" #: ../src/fref.c:1474 ../src/fref.c:1818 ../src/fref.c:1845 msgid "Insert" msgstr "Chèn" #: ../src/fref.c:1827 msgid "Options" msgstr "Tùy chọn" #: ../src/fref.c:1835 msgid "Rescan reference files" msgstr "Nạp lại các sách tham khảo" #: ../src/fref.c:1839 msgid "Left doubleclick action" msgstr "" #: ../src/fref.c:1861 msgid "Info type" msgstr "Thông tin" #: ../src/fref.c:1866 msgid "Description" msgstr "Mô tả" #: ../src/fref.c:1871 msgid "Attributes/Parameters" msgstr "Tính chất/Tham số" #: ../src/fref.c:1876 msgid "Notes" msgstr "Chú ý" #: ../src/fref.c:2052 ../src/fref.c:2066 msgid "Reference search" msgstr "Tìm kiếm trong sách tham khảo" #: ../src/fref.c:2067 msgid "Reference not found" msgstr "Không tìm ra sách" #: ../src/fref.c:2084 msgid "Error" msgstr "Lỗi" #: ../src/fref.c:2086 msgid "" "Perhaps you didn't load a reference, or you did not select a reference to " "search in." msgstr "Có lẽ bạn chưa nạp sách nào, hoặc chưa chọn sách nào để tìm kiếm." #: ../src/fref.c:2328 msgid "d" msgstr "" #: ../src/fref.c:2330 msgid "i" msgstr "" #: ../src/fref.c:2331 msgid "s" msgstr "" #: ../src/fref.c:2332 msgid "dialog" msgstr "hộp thoại" #: ../src/fref.c:2334 msgid "search" msgstr "tìm kiếm" #: ../src/func_grep.c:270 msgid "searching files..." msgstr "đang tìm kiếm tập tin..." #: ../src/func_grep.c:283 ../src/func_grep.c:286 ../src/func_grep.c:313 msgid "grep" msgstr "tìm" #: ../src/func_grep.c:338 msgid "func_grep: file(s) without filename" msgstr "func_grep: các tập tin chưa có tên" #: ../src/func_grep.c:340 msgid "please specify the pattern!" msgstr "vui lòng chỉ ra pattern tìm kiếm!" #: ../src/func_grep.c:344 msgid "func_grep: cannot create secure file" msgstr "func_grep: không thể tạo tập tin tạm" #: ../src/func_grep.c:346 msgid "no matching files found" msgstr "không có tập tin nào" #: ../src/func_grep.c:348 msgid "no directory specified" msgstr "không có thư mục nào được chỉ ra" #: ../src/func_grep.c:373 ../src/project.c:445 ../src/project.c:452 msgid "Select basedir" msgstr "Chọn thư mục chính" #: ../src/func_grep.c:434 msgid "Grep Function" msgstr "Tìm kiếm trong tập tin" #: ../src/func_grep.c:454 msgid "General" msgstr "Tổng quát" #: ../src/func_grep.c:456 msgid "Base_dir:" msgstr "thư _mục chính:" #: ../src/func_grep.c:458 ../src/gtk_easy.c:1342 msgid "_Browse..." msgstr "_Thư mục..." #: ../src/func_grep.c:461 msgid "<0: current file>" msgstr "<0: tập tin đang mở>" #: ../src/func_grep.c:462 ../src/func_grep.c:472 msgid "<1: all opened files>" msgstr "<1: mọi tập tin đang mở>" #: ../src/func_grep.c:474 msgid "_File:" msgstr "_Tập tin:" #: ../src/func_grep.c:481 msgid "_Recursive:" msgstr "đệ qu_y:" #: ../src/func_grep.c:485 msgid "_Open files:" msgstr "_mở tập tin" #: ../src/func_grep.c:490 msgid "Contains" msgstr "Chứa" #: ../src/func_grep.c:508 msgid "_Pattern:" msgstr "_mẫu tìm:" #: ../src/func_grep.c:513 msgid "_Case sensitive:" msgstr "phân biệt hoa thường" #: ../src/func_grep.c:517 msgid "Is rege_x:" msgstr "chính _quy:" #: ../src/func_grep.c:521 msgid "Advanced" msgstr "Nâng cao" #: ../src/func_grep.c:524 msgid "Skip _VCS dirs:" msgstr "bỏ qua thư mục _VCS:" #: ../src/func_grep.c:593 ../src/func_grep.c:613 #, c-format msgid "loading %d file(s)..." msgstr "đang nạp %d tập tin..." #: ../src/func_grep.c:636 msgid "template" msgstr "mẫu" #: ../src/gtk_easy.c:1186 #, c-format msgid "%d of %d" msgstr "%d trên %d" #: ../src/gtk_easy.c:1288 msgid "Select File" msgstr "Chọn tập tin" #: ../src/gtk_easy.c:1401 msgid "Show hidden" msgstr "Xem tập tin ẩn" #: ../src/gtk_easy.c:1602 msgid "Select file" msgstr "Chọn tập tin" #: ../src/gui.c:231 msgid "tree" msgstr "cây" #: ../src/gui.c:232 msgid "functions" msgstr "hàm" #: ../src/gui.c:233 msgid "marks" msgstr "đánh dấu" #: ../src/gui.c:617 msgid "New Winefish Window" msgstr "Cửa sổ mới" #: ../src/gui.c:681 msgid "Stand by..." msgstr "Đang treo..." #: ../src/gui.c:877 msgid "Goto line" msgstr "Đi đến dòng" #: ../src/gui.c:885 msgid "_Line number:" msgstr "Số _dòng:" #: ../src/gui.c:891 msgid "From _selection" msgstr "Từ phần đang chọn" #: ../src/gui.c:894 msgid "Keep _dialog" msgstr "Giữ hộp thoại này" #: ../src/gui.c:960 msgid "starting winefish" msgstr "bắt đầu chạy Winefish" #: ../src/gui.c:1059 ../src/gui.c:1068 ../src/outputbox.c:127 #: ../src/outputbox.c:353 ../src/outputbox.c:470 msgid "/View/View Outputbox" msgstr "/Xem/Kết quả xuất" #: ../src/gui.c:1073 ../src/gui.c:1079 msgid "/View/View Terminal" msgstr "/Xem/Xem Terminal" #: ../src/highlight.c:391 ../src/highlight.c:403 ../src/highlight.c:430 #: ../src/highlight.c:444 msgid "Syntax highlighting error for " msgstr "Cú pháp tô màu bị lỗi khi" #: ../src/highlight.c:392 #, c-format msgid "compiling pattern '%s': %s at offset %d" msgstr "biên dịch mẫu '%s': %s ở vị trí %d" #: ../src/highlight.c:404 #, c-format msgid "studying pattern '%s': %s" msgstr "tiếp nhận mẫu '%s': %s" #: ../src/highlight.c:431 #, c-format msgid "compiling 2nd pattern '%s': %s at offset %d" msgstr "biên dịch mẫu thứ hai '%s': %s ở vị trí %d" #: ../src/highlight.c:445 #, c-format msgid "studying 2nd pattern '%s': %s" msgstr "tiếp nhận mẫu '%s': %s" #: ../src/image.c:209 msgid "Insert image" msgstr "Chèn hình" #: ../src/image.c:216 msgid "Preview" msgstr "Xem trước" #: ../src/image.c:240 msgid "_Image location:" msgstr "Đường dẫn:" #: ../src/image.c:246 msgid "Relative Path:" msgstr "Đường dẫn tương đối:" #: ../src/image.c:250 msgid "Label:" msgstr "Nhãn:" #: ../src/image.c:255 msgid "Caption:" msgstr "Chú thích:" #: ../src/menu.c:225 msgid "project mode: ON" msgstr "chế độ dự án: mở" #: ../src/menu.c:227 msgid "project mode: OFF" msgstr "chế độ dự án: tắt" #: ../src/menu.c:255 msgid "brace_finder: matching not found" msgstr "brace_finder: không tìm thấy dấu ngoặc đi cùng" #: ../src/menu.c:257 msgid "brace_finder: inside a commented line" msgstr "brace_finder: đang trong dòng chú thích" #: ../src/menu.c:259 msgid "brace_finder: inside the selection" msgstr "brace_finder: đang trong chế độ chọn" #: ../src/menu.c:272 msgid "/_File" msgstr "/_Tập tin" #: ../src/menu.c:273 msgid "/File/tearoff1" msgstr "/Tập tin/tearoff1" #: ../src/menu.c:274 msgid "/File/_New" msgstr "/Tập tin/_Mới" #: ../src/menu.c:275 msgid "/File/New _Window" msgstr "/Tập tin/_Cửa sổ mới" #: ../src/menu.c:276 msgid "/File/_Open..." msgstr "/Tập tin/Mở..." #: ../src/menu.c:277 msgid "/File/Open Recen_t" msgstr "/Tập tin/_Vừa mở" #: ../src/menu.c:278 msgid "/File/Open Recent/tearoff1" msgstr "/Tập tin/Vừa mở/tearoff1" #: ../src/menu.c:281 msgid "/File/Open Ad_vanced..." msgstr "/Tập tin/Mở nâng cao..." #: ../src/menu.c:284 msgid "/File/Open _from selection" msgstr "/Tập tin/Mở từ phần được chọn" #: ../src/menu.c:285 msgid "/File/sep1" msgstr "/Tập tin/sep1" #: ../src/menu.c:286 msgid "/File/_Save" msgstr "/Tập tin/_Lưu" #: ../src/menu.c:287 msgid "/File/Save _As..." msgstr "/Tập tin/Lưu với tên khác..." #: ../src/menu.c:288 msgid "/File/Sav_e All" msgstr "/Tập tin/Lưu tất cả" #: ../src/menu.c:289 msgid "/File/_Revert to Saved" msgstr "/Tập tin/_Revert to Saved" #: ../src/menu.c:290 msgid "/File/sep2" msgstr "/Tập tin/sep1" #: ../src/menu.c:291 msgid "/File/_Insert..." msgstr "/Tập tin/Chè_n..." #: ../src/menu.c:292 msgid "/File/Rena_me..." msgstr "/Tập tin/Đổi tên..." #: ../src/menu.c:293 msgid "/File/sep3" msgstr "/Tập tin/sep3" #: ../src/menu.c:294 msgid "/File/_Close" msgstr "/Tập tin/Đóng" #: ../src/menu.c:295 msgid "/File/Close A_ll" msgstr "/Tập tin/Đóng tất cả" #: ../src/menu.c:296 msgid "/File/Close Win_dow" msgstr "/Tập tin/Đóng cửa sổ" #: ../src/menu.c:297 msgid "/File/sep4" msgstr "/Tập tin/sep4" #: ../src/menu.c:299 msgid "/File/_Quit" msgstr "/Tập tin/Thoát" #: ../src/menu.c:301 msgid "/_Edit" msgstr "/_Soạn thảo" #: ../src/menu.c:302 msgid "/Edit/Tearoff1" msgstr "/Soạn thảo/Tearoff1" #: ../src/menu.c:303 msgid "/Edit/_Undo" msgstr "/Soạn thảo/_Undo" #: ../src/menu.c:304 msgid "/Edit/_Redo" msgstr "/Soạn thảo/_Redo" #: ../src/menu.c:305 msgid "/Edit/Undo All" msgstr "/Soạn thảo/Undo tất cả" #: ../src/menu.c:306 msgid "/Edit/Redo All" msgstr "/Soạn thảo/Redo tất cả" #: ../src/menu.c:307 msgid "/Edit/sep1" msgstr "/Soạn thảo/sep1" #: ../src/menu.c:308 msgid "/Edit/Selection" msgstr "/Soạn thảo/Phần đang chọn" #: ../src/menu.c:309 msgid "/Edit/Selection/Tearoff1" msgstr "/Soạn thảo/Phần đang chọn/Tearoff1" #: ../src/menu.c:310 msgid "/Edit/Selection/Cu_t" msgstr "/Soạn thảo/Phần đang chọn/Cắt" #: ../src/menu.c:311 msgid "/Edit/Selection/_Copy" msgstr "/Soạn thảo/Phần đang chọn/Sao chép" #: ../src/menu.c:312 msgid "/Edit/Selection/_Paste" msgstr "/Soạn thảo/Phần đang chọn/Dán" #: ../src/menu.c:313 msgid "/Edit/Selection/sep2" msgstr "/Soạn thảo/Phần đang chọn/sep2" #: ../src/menu.c:314 msgid "/Edit/Selection/Select _All" msgstr "/Soạn thảo/Phần đang chọn/Chọn tất cả" #: ../src/menu.c:315 msgid "/Edit/Find, Replace" msgstr "/Soạn thảo/Tìm, Thay thế" #: ../src/menu.c:316 msgid "/Edit/Find, Replace/Tearoff1" msgstr "/Soạn thảo/Tìm, Thay thế/tearoff1" #: ../src/menu.c:317 msgid "/Edit/Find, Replace/Brace Finder (Forward)" msgstr "/Soạn thảo/Tìm, Thay thế/Tìm dấu ngoặc (về phía trước)" #: ../src/menu.c:318 msgid "/Edit/Find, Replace/Brace Finder (Backward)" msgstr "/Soạn thảo/Tìm, Thay thế/Tìm dấu ngoặc (về phía sau)" #: ../src/menu.c:319 msgid "/Edit/Find, Replace/sep0" msgstr "/Soạn thảo/Tìm, Thay thế/sep0" #: ../src/menu.c:320 msgid "/Edit/Find, Replace/_Find..." msgstr "/Soạn thảo/Tìm, Thay thế/_Thay thế..." #: ../src/menu.c:321 msgid "/Edit/Find, Replace/Find A_gain" msgstr "/Soạn thảo/Tìm, Thay thế/Thay thế lần nữa" #: ../src/menu.c:322 msgid "/Edit/Find, Replace/Find from selection" msgstr "/Soạn thảo/Tìm, Thay thế/Trong phần đang chọn" #: ../src/menu.c:325 msgid "/Edit/Find, Replace/Find from Files" msgstr "/Soạn thảo/Tìm, Thay thế/Tìm trong tập tin" #: ../src/menu.c:326 msgid "/Edit/Find, Replace/Templates" msgstr "/Soạn thảo/Tìm, Thay thế/Liệt kê các mẫu" #: ../src/menu.c:329 msgid "/Edit/Find, Replace/sep1" msgstr "/Soạn thảo/Tìm, Thay thế/sep1" #: ../src/menu.c:330 msgid "/Edit/Find, Replace/R_eplace..." msgstr "/Soạn thảo/Tìm, Thay thế/_Thay thế..." #: ../src/menu.c:331 msgid "/Edit/Find, Replace/Replace Agai_n" msgstr "/Soạn thảo/Tìm, Thay thế/Thay thế lần nữa" #: ../src/menu.c:332 msgid "/Edit/Find, Replace/sep2" msgstr "/Soạn thảo/Tìm, Thay thế/sep2" #: ../src/menu.c:334 msgid "/Edit/Find, Replace/To _Uppercase" msgstr "/Soạn thảo/Tìm, Thay thế/Thành chữ _hoa" #: ../src/menu.c:335 msgid "/Edit/Find, Replace/To _Lowercase" msgstr "/Soạn thảo/Tìm, Thay thế/Thành chữ _thường" #: ../src/menu.c:336 msgid "/Edit/Find, Replace/sep3" msgstr "/Soạn thảo/Tìm, Thay thế/sep3" #: ../src/menu.c:337 msgid "/Edit/Find, Replace/ASCII to HTML entities" msgstr "/Soạn thảo/Tìm, Thay thế/ASCII thành HTML" #: ../src/menu.c:338 msgid "/Edit/Find, Replace/ISO8859 to HTML entities" msgstr "Soạn thảo/Tìm, Thay thế/ISO8859 thành HTML" #: ../src/menu.c:339 msgid "/Edit/Find, Replace/ASCII & ISO8859 to HTML entities" msgstr "/ESoạn thảo/Tìm, Thay thế/ASCII, ISO8859 thành HTML" #: ../src/menu.c:341 msgid "/Edit/sep4" msgstr "/Soạn thảo/sep4" #: ../src/menu.c:342 msgid "/Edit/Sh_ift Right" msgstr "/Soạn thảo/Dịch qua phải" #: ../src/menu.c:343 msgid "/Edit/S_hift Left" msgstr "/Soạn thảo/Dịch qua trái" #: ../src/menu.c:344 msgid "/Edit/_Comment" msgstr "/Soạn thảo/_Chú thích" #: ../src/menu.c:345 msgid "/Edit/_UnComment" msgstr "/Soạn thảo/Bỏ chú thích" #: ../src/menu.c:346 msgid "/Edit/_Hard Shift Left" msgstr "/Soạn thảo/Xóa-dịch trái" #: ../src/menu.c:347 msgid "/Edit/Delete Current Line" msgstr "/Soạn thảo/Xóa dòng hiện tại" #: ../src/menu.c:348 msgid "/Edit/sep5" msgstr "/Soạn thảo/sep5" #: ../src/menu.c:349 msgid "/Edit/Add _Bookmark" msgstr "/Soạn thảo/Đánh _dấu" #: ../src/menu.c:350 msgid "/_Insert" msgstr "/_Chèn" #: ../src/menu.c:351 msgid "/Insert/Tearoff1" msgstr "/Chèn/Tearoff1" #: ../src/menu.c:353 msgid "/Insert/T_ools" msgstr "/Chèn/_Công cụ" #: ../src/menu.c:354 msgid "/Insert/Tools/Tearoff1" msgstr "/Chèn/Công cụ/Tearoff1" #: ../src/menu.c:355 msgid "/Insert/Tools/Simple document (code)" msgstr "/Chèn/Công cụ/Mã tài liện đơn giản" #: ../src/menu.c:356 msgid "/Insert/Tools/Figure" msgstr "/Chèn/Công cụ/_Hình ảnh" #: ../src/menu.c:357 msgid "/Insert/Tools/Time, Date" msgstr "/Chèn/Công cụ/Ngày tháng" #: ../src/menu.c:358 msgid "/Insert/Tools/Source Separator" msgstr "/Chèn/Công cụ/Phân cách mã nguồn" #: ../src/menu.c:360 msgid "/Insert/_Table, List" msgstr "/Chèn/Bảng, Danh sách" #: ../src/menu.c:361 msgid "/Insert/Table, List/Tearoff1" msgstr "/Chèn/Bảng, Danh sách/tearoff1" #: ../src/menu.c:362 msgid "/Insert/Table, List/_List" msgstr "/Chèn/Bảng, Danh sách/_Danh sách" #: ../src/menu.c:363 msgid "/Insert/Table, List/_Table, Array" msgstr "/Chèn/Bảng, Danh sách/Bảng, Mảng" #: ../src/menu.c:365 msgid "/Insert/_Headings" msgstr "/Chèn/Mục" #: ../src/menu.c:366 msgid "/Insert/Headings/Tearoff1" msgstr "/Chèn/Mục/Tearoff1" #: ../src/menu.c:367 msgid "/Insert/Headings/_part" msgstr "/Chèn/Mục/phần (part)" #: ../src/menu.c:368 msgid "/Insert/Headings/_chapter" msgstr "/Chèn/Mục/chương (chapter)" #: ../src/menu.c:369 msgid "/Insert/Headings/_section" msgstr "/Chèn/Mục/mục" #: ../src/menu.c:370 msgid "/Insert/Headings/s_ubsection" msgstr "/Chèn/Mục/mục con (subsection)" #: ../src/menu.c:371 msgid "/Insert/Headings/su_bsubsection" msgstr "/Chèn/Mục/mục con nữa (subsubsection)" #: ../src/menu.c:372 msgid "/Insert/Headings/sep1" msgstr "/Chèn/Mục/sep1" #: ../src/menu.c:373 msgid "/Insert/Headings/parag_raph" msgstr "/Chèn/Mục/đoạn văn (paragraph)" #: ../src/menu.c:374 msgid "/Insert/Headings/subparag_raph" msgstr "/Chèn/Mục/đoạn văn con (subparagraph)" #: ../src/menu.c:375 msgid "/Insert/Headings/sep2" msgstr "/Chèn/Mục/sep2" #: ../src/menu.c:376 msgid "/Insert/Headings/_part*" msgstr "/Chèn/Mục/phần (part) *" #: ../src/menu.c:377 msgid "/Insert/Headings/_chapter*" msgstr "/Chèn/Mục/chương (chapter) *" #: ../src/menu.c:378 msgid "/Insert/Headings/_section*" msgstr "/Chèn/Mục/mục (section) *" #: ../src/menu.c:379 msgid "/Insert/Headings/s_ubsection*" msgstr "/Chèn/Mục/mục con (subsection) *" #: ../src/menu.c:380 msgid "/Insert/Headings/su_bsubsection*" msgstr "/Chèn/Mục/su_bsubsection*" #: ../src/menu.c:382 msgid "/Insert/_Environments" msgstr "/Chèn/_Môi trường" #: ../src/menu.c:383 msgid "/Insert/Environments/tearoff1" msgstr "/Chèn/Môi trường/tearoff1" #: ../src/menu.c:385 msgid "/Insert/Environments/flush_left" msgstr "/Chèn/Môi trường/canh trái (flush_left)" #: ../src/menu.c:386 msgid "/Insert/Environments/flush_right" msgstr "/Chèn/Môi trường/canh phải (flush_right)" #: ../src/menu.c:387 msgid "/Insert/Environments/_centering" msgstr "/Chèn/Môi trường/canh giữa (_centering)" #: ../src/menu.c:388 msgid "/Insert/Environments/sep2" msgstr "/Chèn/Môi trường/sep2" #: ../src/menu.c:389 msgid "/Insert/Environments/_verbatim" msgstr "/Chèn/Môi trường/_verbatim" #: ../src/menu.c:390 msgid "/Insert/Environments/verbati_m*" msgstr "/Chèn/Môi trường/verbati_m*" #: ../src/menu.c:391 msgid "/Insert/Environments/ver_se" msgstr "/Chèn/Môi trường/thơ (ver_se)" #: ../src/menu.c:392 msgid "/Insert/Environments/_quotation" msgstr "/Chèn/Môi trường/trích dẫn (_quotation)" #: ../src/menu.c:395 msgid "/Insert/AMS equations" msgstr "/Chèn/Gói _AMS" #: ../src/menu.c:396 msgid "/Insert/AMS equations/tearoff1" msgstr "/Chèn/Gói AMS/tearoff1" #: ../src/menu.c:397 msgid "/Insert/AMS equations/split" msgstr "/Chèn/Gói AMS/split" #: ../src/menu.c:398 msgid "/Insert/AMS equations/cases" msgstr "/Chèn/Gói AMS/trường hợp (cases)" #: ../src/menu.c:399 msgid "/Insert/AMS equations/sep1" msgstr "/Chèn/Gói AMS/sep1" #: ../src/menu.c:401 msgid "/Insert/AMS equations/aligned" msgstr "/Chèn/Gói AMS/aligned" #: ../src/menu.c:402 msgid "/Insert/AMS equations/gathered" msgstr "/Chèn/Gói AMS/gathered" #: ../src/menu.c:403 msgid "/Insert/AMS equations/sep2" msgstr "/Chèn/Gói AMS/sep2" #: ../src/menu.c:405 msgid "/Insert/AMS equations/equation" msgstr "/Chèn/Gói AMS/phương trình (equation)" #: ../src/menu.c:406 msgid "/Insert/AMS equations/align" msgstr "/Chèn/Gói AMS/align" #: ../src/menu.c:407 msgid "/Insert/AMS equations/subequations" msgstr "/Chèn/Gói AMS/phương trình con (subequations)" #: ../src/menu.c:408 msgid "/Insert/AMS equations/gather" msgstr "/Chèn/Gói AMS/gather" #: ../src/menu.c:409 msgid "/Insert/AMS equations/multline" msgstr "/Chèn/Gói AMS/nhiều dòng (multline)" #: ../src/menu.c:411 msgid "/Insert/AMS equations/alignat" msgstr "/Chèn/Gói AMS/alignat" #: ../src/menu.c:412 msgid "/Insert/AMS equations/sep3" msgstr "/Chèn/Gói AMS/sep3" #: ../src/menu.c:414 msgid "/Insert/AMS equations/equation*" msgstr "/Chèn/Gói AMS/equation*" #: ../src/menu.c:415 msgid "/Insert/AMS equations/align*" msgstr "/Chèn/Gói AMS/align" #: ../src/menu.c:416 msgid "/Insert/AMS equations/gather*" msgstr "/Chèn/Gói AMS/gather*" #: ../src/menu.c:417 msgid "/Insert/AMS equations/multline*" msgstr "/Chèn/Gói AMS/multline*" #: ../src/menu.c:419 msgid "/Insert/AMS equations/alignat*" msgstr "/Chèn/Gói AMS/alignat*" #: ../src/menu.c:421 msgid "/Insert/_Font style" msgstr "/Chèn/_Phông chữ" #: ../src/menu.c:424 msgid "/Insert/Font/Sizes" msgstr "/Chèn/cỡ _phông (si)" #: ../src/menu.c:425 msgid "/Insert/Font/Sizes/tearoff1" msgstr "/Chèn/Phông chữ/Cỡ/tearoff1" #: ../src/menu.c:426 msgid "/Insert/Font/Sizes/{\\\\tiny }" msgstr "/Chèn/Phông chữ/Toán/{\\\\tiny }" #: ../src/menu.c:427 msgid "/Insert/Font/Sizes/{\\\\scriptsize }" msgstr "/Chèn/Phông chữ/Toán/{\\\\scriptsize }" #: ../src/menu.c:428 msgid "/Insert/Font/Sizes/{\\\\footnotesize }" msgstr "/Chèn/Phông chữ/Toán/{\\\\footnote}" #: ../src/menu.c:429 msgid "/Insert/Font/Sizes/{\\\\small }" msgstr "/Chèn/Phông chữ/Toán/{\\\\small }" #: ../src/menu.c:430 msgid "/Insert/Font/Sizes/{\\\\normalsize }" msgstr "/Chèn/Phông chữ/Toán/{\\\\normalsize}" #: ../src/menu.c:431 msgid "/Insert/Font/Sizes/{\\\\large }" msgstr "/Chèn/Phông chữ/Toán/{\\\\large}" #: ../src/menu.c:432 msgid "/Insert/Font/Sizes/{\\\\Large }" msgstr "/Chèn/Phông chữ/Toán/{\\\\Large}" #: ../src/menu.c:433 msgid "/Insert/Font/Sizes/{\\\\huge }" msgstr "/Chèn/Phông chữ/Toán/{\\\\huge }" #: ../src/menu.c:434 msgid "/Insert/Font/Sizes/{\\\\Huge }" msgstr "/Chèn/Phông chữ/Toán/{\\\\Huge }" #: ../src/menu.c:438 msgid "/Insert/Font style/tearoff1" msgstr "/Chèn/Phông chữ/tearoff1" #: ../src/menu.c:439 msgid "/Insert/Font style/\\\\emph - _emphasized" msgstr "/Chèn/Phông chữ/\\\\_emph - nhấn mạnh" #: ../src/menu.c:440 msgid "/Insert/Font style/\\\\underline - _underlined" msgstr "/Chèn/Phông chữ/\\\\_underline - gạch chân" #: ../src/menu.c:441 msgid "/Insert/Font style/\\\\textit - _italic" msgstr "/Chèn/Phông chữ/\\\\textit - nghiêng" #: ../src/menu.c:442 msgid "/Insert/Font style/\\\\textsl - _slanted" msgstr "/Chèn/Phông chữ/\\\\texttt - slanted" #: ../src/menu.c:443 msgid "/Insert/Font style/\\\\textbf - _boldface" msgstr "/Chèn/Phông chữ/\\\\text_bf - đậm" #: ../src/menu.c:444 msgid "/Insert/Font style/\\\\texttt - _typewriter" msgstr "/Chèn/Phông chữ/\\\\_texttt - kiểu đánh máy" #: ../src/menu.c:445 msgid "/Insert/Font style/\\\\textsc - small_caps" msgstr "/Chèn/Phông chữ/\\\\texts_c - chữ hoa nhỏ" #: ../src/menu.c:448 msgid "/Insert/Font/Maths" msgstr "/Chèn/Phông _chữ/Toán" #: ../src/menu.c:449 msgid "/Insert/Font/Maths/tearoff1" msgstr "/Chèn/Phông chữ/Toán/tearoff1" #: ../src/menu.c:450 msgid "/Insert/Font/Maths/\\\\mathrm - Roman" msgstr "/Chèn/Phông chữ/Toán/\\\\mathrm - roman" #: ../src/menu.c:451 msgid "/Insert/Font/Maths/\\\\mathit - Italic" msgstr "/Chèn/Phông toán/Toán/\\\\mathit - nghiêng" #: ../src/menu.c:452 msgid "/Insert/Font/Maths/\\\\mathbf - Boldface" msgstr "/Chèn/Phông chữ/Toán/\\\\mathbf - đậm" #: ../src/menu.c:453 msgid "/Insert/Font/Maths/\\\\mathsf - Sans serif" msgstr "/Chèn/Phông chữ/Toán/\\\\mathsf - Không chân" #: ../src/menu.c:454 msgid "/Insert/Font/Maths/\\\\mathtt - Typewriter" msgstr "/Chèn/Phông chữ/Toán/\\\\mathtt - Kiểu đánh máy" #: ../src/menu.c:455 msgid "/Insert/Font/Maths/sep1" msgstr "/Chèn/Phông chữ/Toán//sep1" #: ../src/menu.c:456 msgid "/Insert/Font/Maths/\\\\mathcal - Caligraphic" msgstr "/Chèn/Phông chữ/Toán/\\\\mathcal - caligraphic" #: ../src/menu.c:457 msgid "/Insert/Font/Maths/\\\\mathbb - Blackboard" msgstr "/Chèn/Phông chữ/Toán/\\\\mathbb - Blackboard" #: ../src/menu.c:458 msgid "/Insert/Font/Maths/\\\\mathfrak - Fraktur" msgstr "/Chèn/Phông chữ/Toán/\\\\mathfrak - Fraktur" #: ../src/menu.c:500 msgid "/_Document" msgstr "/Tài liệ_u" #: ../src/menu.c:501 msgid "/Document/tearoff1" msgstr "/Tài liệu/tearoff1" #: ../src/menu.c:502 msgid "/Document/_Increase Tabsize" msgstr "/Tài liệu/_Tăng cỡ tab" #: ../src/menu.c:503 msgid "/Document/_Decrease Tabsize" msgstr "/Tài liệu/_Giảm cỡ tab" #: ../src/menu.c:504 msgid "/Document/_Auto Indent" msgstr "/Tài liệu/Tự động _canh dòng" #: ../src/menu.c:505 msgid "/Document/sep1" msgstr "/Tài liệu/sep1" #: ../src/menu.c:506 msgid "/Document/Auto_Completion" msgstr "/Tài liệu/Hoàn thành lệnh" #: ../src/menu.c:507 msgid "/Document/_Wrap" msgstr "/Tài liệu/Ngắt dòng" #: ../src/menu.c:508 msgid "/Document/_Line Numbers" msgstr "/Tài liệu/Số chỉ dòng" #: ../src/menu.c:509 msgid "/Document/sep2" msgstr "/Tài liệu/sep2" #: ../src/menu.c:510 msgid "/Document/_Highlight Syntax" msgstr "/Tài liệu/Tô _màu" #: ../src/menu.c:511 msgid "/Document/_Update Highlighting" msgstr "/Tài liệu/Cập nhật tô màu" #: ../src/menu.c:512 msgid "/Document/sep3" msgstr "/Tài liệu/sep3" #: ../src/menu.c:513 msgid "/Document/Document Ty_pe" msgstr "/Tài liệu/_Kiểu tài liệu" #: ../src/menu.c:514 msgid "/Document/Document Type/tearoff1" msgstr "/Tài liệu/Kiểu tài liệu/tearoff1" #: ../src/menu.c:515 msgid "/Document/Character _Encoding" msgstr "/Tài liệu/Bảng _mã" #: ../src/menu.c:516 msgid "/Document/Character Encoding/tearoff1" msgstr "/Tài liệu/Bảng mã/tearoff1" #: ../src/menu.c:517 msgid "/Document/sep4" msgstr "/Tài liệu/sep4" #: ../src/menu.c:519 msgid "/Document/Check _Spelling..." msgstr "/Tài liệu/Kiểm tranh _chính tả..." #: ../src/menu.c:521 msgid "/Document/_Floating window" msgstr "/Tài liệu/Cửa sổ động" #: ../src/menu.c:522 msgid "/Document/Word _Count" msgstr "/Tài liệu/_Số từ" #: ../src/menu.c:526 msgid "/E_xternal" msgstr "/Côn_g cụ" #: ../src/menu.c:527 msgid "/External/tearoff1" msgstr "/Công cụ/tearoff1" #: ../src/menu.c:528 ../src/menu.c:768 ../src/outputbox.c:627 #: ../src/outputbox.c:630 msgid "/External/Stop..." msgstr "/Công cụ/Dừng..." #: ../src/menu.c:529 msgid "/External/_Project mode" msgstr "/Công cụ/_Chế độ dự án" #: ../src/menu.c:531 msgid "/_Project" msgstr "/_Dự án" #: ../src/menu.c:532 msgid "/Project/tearoff1" msgstr "/Dự án/tearoff1" #: ../src/menu.c:533 msgid "/Project/_New" msgstr "/Dự án/_Tạo mới" #: ../src/menu.c:534 msgid "/Project/_Open" msgstr "/Dự án/_Mở" #: ../src/menu.c:535 msgid "/Project/Open R_ecent" msgstr "/Dự án/_Hiện tại" #: ../src/menu.c:536 msgid "/Project/Open Recent/tearoff1" msgstr "/Dự án/Hiện tại/tearoff1" #: ../src/menu.c:537 msgid "/Project/sep1" msgstr "/Dự án/sep1" #: ../src/menu.c:538 msgid "/Project/_Save" msgstr "/Dự án/_Lưu" #: ../src/menu.c:539 msgid "/Project/Save _as..." msgstr "/Dự án/Lưu với tên _khác..." #: ../src/menu.c:540 msgid "/Project/Save & _close" msgstr "/Dự án/Lưu _và đóng dự án" #: ../src/menu.c:541 msgid "/Project/sep2" msgstr "/Dự án/sep2" #: ../src/menu.c:542 ../src/project.c:227 msgid "/Project/Project options..." msgstr "/Dự án/Cấu hình" #: ../src/menu.c:544 msgid "/_Go" msgstr "/Di chuyể_n" #: ../src/menu.c:545 msgid "/Go/tearoff1" msgstr "/Di chuyển/tearoff1" #: ../src/menu.c:546 msgid "/Go/_Previous document" msgstr "/Di chuyển/Tài liệu _trước" #: ../src/menu.c:547 msgid "/Go/_Next document" msgstr "/Di chuyển/Tài liệu _sau" #: ../src/menu.c:548 ../src/menu.c:551 msgid "/Go/sep1" msgstr "/Di chuyển/sep1" #: ../src/menu.c:549 msgid "/Go/_First document" msgstr "/Di chuyển/Tài liệu đầu tiê_n" #: ../src/menu.c:550 msgid "/Go/L_ast document" msgstr "/Di chuyển/Tài liệu _cuối cùng" #: ../src/menu.c:552 msgid "/Go/Goto _Line" msgstr "/Di chuyển/Đến _dòng" #: ../src/menu.c:553 msgid "/Go/Goto _Selection" msgstr "/Di chuyển/Vị trí con trỏ" #: ../src/menu.c:555 msgid "/_View" msgstr "/_Xem" #: ../src/menu.c:556 msgid "/View/tearoff1" msgstr "/Xem/tearoff1" #: ../src/menu.c:558 msgid "/View/View _Custom Menu" msgstr "/Xem/Menu độ_ng" #: ../src/menu.c:559 msgid "/View/View _Sidebar" msgstr "/Xem/Sidebar" #: ../src/menu.c:560 msgid "/View/View _Outputbox" msgstr "/Xem/Kết quả _xuất" #: ../src/menu.c:562 msgid "/View/View _Terminal" msgstr "/Xem/Xem _Terminal" #: ../src/menu.c:564 msgid "/_?" msgstr "" #: ../src/menu.c:565 msgid "/?/_About..." msgstr "/?/_Giới thiệu..." #: ../src/menu.c:566 msgid "/?/sep1" msgstr "" #: ../src/menu.c:567 msgid "/?/_Save Settings" msgstr "/?/Lưu cấu hình" #: ../src/menu.c:568 msgid "/?/Save Shortcut _Keys" msgstr "/?/Lưu phím nóng" #: ../src/menu.c:569 msgid "/?/_Preferences" msgstr "/?/Cấu hình" #: ../src/menu.c:706 msgid "/Document/Document Type" msgstr "/Tài liệu/Kiểu tài liệu" #: ../src/menu.c:762 msgid "/View/View Custom Menu" msgstr "/Xem/Menu động" #: ../src/menu.c:763 msgid "/View/View Sidebar" msgstr "/Xem/Sidebar" #: ../src/menu.c:764 msgid "/Document/Auto Indent" msgstr "/Tài liệu/Tự động canh dòng" #: ../src/menu.c:765 ../src/project.c:229 ../src/project.c:231 #: ../src/project.c:233 msgid "/External/Project mode" msgstr "/Công cụ/Chế độ dự án" #: ../src/menu.c:796 msgid "output" msgstr "xuất" #: ../src/menu.c:844 msgid "loading file(s)..." msgstr "đang tải tập tin..." #: ../src/menu.c:848 msgid "The filename was:\n" msgstr "Tên tập tin là:\n" #: ../src/menu.c:849 msgid "Could not open file\n" msgstr "Không thể mở tập tin\n" #: ../src/menu.c:872 msgid "/Project/Open Recent" msgstr "/Dự án/Vừa mở" #: ../src/menu.c:876 msgid "/File/Open Recent" msgstr "/Tập tin/Vừa mở" #: ../src/menu.c:1003 msgid "/Windows" msgstr "/Cửa sổ" #: ../src/menu.c:1053 msgid "Could not view file in browser, the file does not yet have a name\n" msgstr "Không thể xem: không có tập tin nào có tên như vậy\n" #: ../src/menu.c:1216 ../src/menu.c:1236 ../src/menu.c:1254 ../src/menu.c:1268 #: ../src/menu.c:1292 ../src/menu.c:1306 msgid "/External" msgstr "/Công cụ" #: ../src/menu.c:1351 msgid "/Document/Character Encoding" msgstr "/Tài liệu/Bản mã" #: ../src/menu.c:1617 msgid "This custom search and replace requires a selection" msgstr "Cần chọn trước phần tài liệu nào đó" #: ../src/menu.c:1715 msgid "/_Custom menu" msgstr "/Menu độ_ng" #: ../src/menu.c:1716 msgid "/Custom menu/sep" msgstr "/Menu động/sep" #: ../src/menu.c:1717 msgid "/Custom menu/Edit custom menu..." msgstr "/Menu động/Thay đổi..." #: ../src/menu.c:1718 msgid "/Custom menu/Reset" msgstr "/Menu động/Cập nhật" #: ../src/menu.c:1719 msgid "/Custom menu/Load new" msgstr "/Menu động/Tải mới" #: ../src/menu.c:1935 msgid "Search Pattern" msgstr "Mẫu tìm kiếm" #: ../src/menu.c:1936 msgid "Replace String" msgstr "Chuỗi thay thế" #: ../src/menu.c:1939 msgid "Formatstring Before" msgstr "Chuỗi định dạng (trước)" #: ../src/menu.c:1940 msgid "Formatstring After" msgstr "Chuỗi định dạng (sau)" #: ../src/menu.c:1987 msgid "The menupath you want to update does not exist yet" msgstr "Đường dẫn menu để cập nhật không tồn tại" #: ../src/menu.c:1987 msgid "Try 'add' instead." msgstr "Hãy thử 'thêm' (add)." #: ../src/menu.c:1989 msgid "The menupath you want to add already exists." msgstr "Đường dẫn menu đã tồn tại." #: ../src/menu.c:1994 msgid "The menupath should start with a / character" msgstr "Đường dẫn menu phải bắt đầu bằng dấu /" #: ../src/menu.c:2156 msgid "Custom Menu Editor" msgstr "Chỉnh sửa menu động" #: ../src/menu.c:2167 msgid "Add New Menu Entry" msgstr "Thêm phần tử Menu mới" #: ../src/menu.c:2169 msgid "Apply Changes" msgstr "Cập nhật thay đổi" #: ../src/menu.c:2171 msgid "Delete Menu Entry" msgstr "Xóa phần tử của menu" #: ../src/menu.c:2174 msgid "Close Discards Changes" msgstr "Đóng bỏ qua các thay đổi" #: ../src/menu.c:2176 msgid "Save Changes and Exit" msgstr "Lưu và thoát" #: ../src/menu.c:2186 msgid "_Menu Path:" msgstr "Đường _dẫn menu:" #: ../src/menu.c:2207 msgid "Menu path" msgstr "Đường dẫn menu" #: ../src/menu.c:2227 msgid "Number of _Variables:" msgstr "_Số biến số:" #: ../src/menu.c:2235 msgid "Variables" msgstr "Biến số" #: ../src/menu.c:2254 msgid "Custom Dialo_g" msgstr "Hộp thoại" #: ../src/menu.c:2256 msgid "Custom Replace" msgstr "Thay thế" #: ../src/menu.c:2268 msgid "_Replace:" msgstr "_Thay thế:" #: ../src/menu.c:2271 msgid "in current document" msgstr "trong tài liệu đang soạn" #: ../src/menu.c:2271 msgid "from cursor" msgstr "từ vị trí con trỏ" #: ../src/menu.c:2271 msgid "in selection" msgstr "trong phần được chọn" #: ../src/menu.c:2271 msgid "in all open documents" msgstr "trong mọi tài liệu đang mở" #: ../src/menu.c:2279 msgid "Matc_hing:" msgstr "So _khớp:" #: ../src/menu.c:2282 msgid "normal" msgstr "bình thường" #: ../src/menu.c:2282 msgid "posix regular expresions" msgstr "biểu thức POSIX" #: ../src/menu.c:2282 msgid "perl regular expresions" msgstr "biểu thức PERL" #: ../src/menu.c:2288 msgid "Case Se_nsitive" msgstr "Phân biệt hoa thường" #: ../src/msg_queue.c:243 msgid "These files were not opened:\n" msgstr "" "Các tập tin sau không được mở:\n" "mở:\n" #: ../src/outputbox.c:166 msgid "hide this box" msgstr "giấu hộp này" #: ../src/outputbox.c:172 msgid "copy this line" msgstr "chép dòng này" #: ../src/outputbox.c:192 #, c-format msgid "goto line %s, file = %s" msgstr "đến dòng %s, tập tin = %s" #: ../src/outputbox.c:194 #, c-format msgid "goto file = %s" msgstr "đến tập tin = %s" #: ../src/outputbox.c:198 #, c-format msgid "goto line %s, current file" msgstr "đến dòng %s, tập tin hiện hành" #: ../src/outputbox.c:203 #, c-format msgid "file: %s" msgstr "tập tin: %s" #: ../src/outputbox.c:224 msgid "noop" msgstr "" #: ../src/outputbox.c:385 msgid "term" msgstr "" #: ../src/outputbox.c:482 msgid "tool is running. press Escape to stop it first." msgstr "đang chạy. nhấn phím Escape để dừng." #: ../src/outputbox.c:492 msgid "empty command" msgstr "lệnh rỗng" #: ../src/outputbox.c:498 #, c-format msgid "%s # project mode: ON" msgstr "%s # chế độ dự án: Mở" #: ../src/outputbox.c:500 #, c-format msgid "%s # project mode: OFF" msgstr "%s # chế độ dự án: Tắt" #: ../src/outputbox.c:509 msgid "file wasnot saved. tool canceled" msgstr "tập tin cần được lưu trước khi thi hành công cụ" #: ../src/outputbox.c:533 #, c-format msgid "failed to compile pattern %s" msgstr "" #: ../src/outputbox.c:586 msgid "stop request. stopping tool..." msgstr "yêu cầu ngắt. đang dừng công cụ..." #: ../src/outputbox_bf.c:169 ../src/outputbox_bf.c:178 #, c-format msgid "some error happened creating fifo %s" msgstr "lỗi xảy ra khi tạp fifo %s" #: ../src/outputbox_bf.c:391 #, c-format msgid "exit code: %d" msgstr "mã lỗi: %d" #: ../src/outputbox_bf.c:399 ../src/outputbox_ka.c:97 msgid "the child process exited abnormally" msgstr "tiến trình con thoát bất thường" #: ../src/outputbox_ka.c:93 #, c-format msgid "Exit code: %d" msgstr "Mã lỗi: %d" #: ../src/outputbox_ka.c:151 #, c-format msgid "IOChannel Error: %s" msgstr "Lỗi kênh IO: %s" #: ../src/outputbox_ka.c:294 #, c-format msgid "Error: %s" msgstr "Lỗi: %s" #: ../src/outputbox_ka.c:297 msgid "hint: you may call the tool again" msgstr "mẹo: bạn có thể chạy lại" #: ../src/outputbox_ka.c:300 msgid "tool finished." msgstr "công cụ kết thúc." #: ../src/outputbox_ka.c:306 msgid "error: cannot create PIPE file." msgstr "lỗi: không thể tạo PIPE." #: ../src/outputbox_ka.c:311 msgid "error: cannot create temporarily file." msgstr "lỗi: không thể tạo tập tin tạm." #: ../src/preferences.c:271 msgid "Untitled" msgstr "Không tên" #: ../src/preferences.c:371 msgid "Select font" msgstr "Chọn phông" #: ../src/preferences.c:497 ../src/preferences.c:585 ../src/preferences.c:1070 #: ../src/preferences.c:1407 msgid "Label" msgstr "Nhãn" #: ../src/preferences.c:498 msgid "Extensions" msgstr "Mở rộng" #: ../src/preferences.c:499 msgid "Update chars" msgstr "Ký tự cập nhật" #: ../src/preferences.c:500 msgid "Icon" msgstr "Biểu tượng" #: ../src/preferences.c:501 msgid "Editable" msgstr "Soạn thảo được" #: ../src/preferences.c:502 msgid "Content regex" msgstr "Biểu thức nhận dạng" #: ../src/preferences.c:503 msgid "AutoCompletion" msgstr "Hoàn thành lệnh" #: ../src/preferences.c:586 msgid "Inverse filter" msgstr "Lọc ngược" #: ../src/preferences.c:587 msgid "Filetypes in filter" msgstr "Kiểu tập tin trong lọc" #: ../src/preferences.c:941 msgid "filetype" msgstr "kiểu tập tin" #: ../src/preferences.c:946 msgid "Reset" msgstr "" #: ../src/preferences.c:952 msgid "Pattern name" msgstr "Tên mẫu" #: ../src/preferences.c:970 ../src/preferences.c:1497 msgid "Pattern" msgstr "Mẫu" #: ../src/preferences.c:993 msgid "Start pattern and end pattern" msgstr "Mẫu bắt đầu và kết thúc" #: ../src/preferences.c:995 msgid "Only start pattern" msgstr "Chỉ có mẫu bắt đầu" #: ../src/preferences.c:997 msgid "Subpattern from parent" msgstr "Con của mẫu mẹ" #: ../src/preferences.c:1003 msgid "Start pattern" msgstr "Mẫu bắt đầu" #: ../src/preferences.c:1004 msgid "End pattern" msgstr "Mẫu kết thúc" #: ../src/preferences.c:1005 msgid "Case sensitive matching" msgstr "Phân biệt hoa thường" #: ../src/preferences.c:1006 msgid "Parentmatch" msgstr "So khớp mẹ" #: ../src/preferences.c:1007 msgid "Foreground color" msgstr "Màu chữ" #: ../src/preferences.c:1008 msgid "Background color" msgstr "Màu nền" #: ../src/preferences.c:1016 msgid "don't change weight" msgstr "không thay đổi (tô đậm)" #: ../src/preferences.c:1018 msgid "force non-bold weight" msgstr "luôn không tô đậm" #: ../src/preferences.c:1020 msgid "force bold weight" msgstr "luôn tô đậm" #: ../src/preferences.c:1026 msgid "don't change style" msgstr "không thay đổi (in nghiêng)" #: ../src/preferences.c:1028 msgid "force non-italic style" msgstr "không luôn in nghiêng" #: ../src/preferences.c:1030 msgid "force italic style" msgstr "luôn in nghiêng" #: ../src/preferences.c:1071 ../src/preferences.c:1327 #: ../src/preferences.c:1408 ../src/preferences.c:1501 msgid "Command" msgstr "Lệnh" #: ../src/preferences.c:1175 ../src/preferences.c:1205 msgid "Warning:" msgstr "Chú ý:" #: ../src/preferences.c:1175 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your autotext file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" "Vui lòng cập nhật danh sách trước khi thêm!\n" "\n" "Vì lý do tốc độ, Winefish không tự động nạp danh sách các từ hoàn thành. Bạn " "có thể làm điều này bằng cách click chuột vào nút 'Cập nhật' ngay bây giờ. " "Chú ý rằng, việc cập nhật có thể tốn nhiều thời gian." #: ../src/preferences.c:1205 msgid "" "Please refresh the list before adding any item!\n" "\n" "Because of peformance reason, Winefish doesnot load your 'word-list' file " "automatically. You may do it manually by choosing 'Refresh' now. *Note* that " "this may take a quite long time." msgstr "" "Vui lòng cập nhật danh sách trước khi thêm!\n" "\n" "Vì lý do tốc độ, Winefish không tự động nạp danh sách các từ hoàn thành. Bạn " "có thể làm điều này bằng cách click chuột vào nút 'Cập nhật' ngay bây giờ. " "Chú ý rằng, việc cập nhật có thể tốn nhiều thời gian." #: ../src/preferences.c:1274 msgid "Definition" msgstr "Định nghĩa" #: ../src/preferences.c:1275 msgid "Before" msgstr "Trước" #: ../src/preferences.c:1276 msgid "After" msgstr "Sau" #: ../src/preferences.c:1314 msgid "" "Add new autotext definition.\n" "Start finding the old one by pressing CTRL+F." msgstr "" "Thêm định nghĩa mới.\n" "Nhấn CTRL+F để tìm kiếm." #: ../src/preferences.c:1366 msgid "" "Add new word which should be started by '\\'.\n" "Start finding the old one by pressing CTRL+F." msgstr "" "Thêm lệnh mới (bắt đầu bằng'\\') .\n" "Nhấn CTRL+F để tìm kiếm." #: ../src/preferences.c:1496 msgid "Name" msgstr "Tên" #: ../src/preferences.c:1498 msgid "File #" msgstr "Tập tin #" #: ../src/preferences.c:1499 msgid "Line #" msgstr "Dòng #" #: ../src/preferences.c:1500 msgid "Output #" msgstr "Kết xuất #" #: ../src/preferences.c:1502 msgid "Save,Show" msgstr "Lưu,Xem" #: ../src/preferences.c:1541 msgid "" "%D: basedir of project\n" "%B: basefile (without extension) of project\n" "%d: current directory\n" "%b: basename (without extension) of current file\n" "%f: current file (full path)\n" "%l: current line\n" "%%: percent sign\n" "\n" "If there isn't any project, or project mode is off, we have\n" "\t%D=%d, %B=%b\n" "\n" "Save,Show:\n" "\tneed save file: 1\n" "\tshow all output: 2\n" "\tboth of them: 1+2 =3\n" "\tnone of them: 0" msgstr "" "%D: thư mục chính của dự án\n" "%B: tập tin chính (không có phần mở rộng) của dự án\n" "%d: thư mục hiện tại\n" "%b: tập tin hiện tại (dạng ngắn gọn, không có phần mở rộng)\n" "%f: tập tin hiện tại (với đường dẫn đầy đủ)\n" "%l: số dòng chỉ vị trí hiện tại của con trỏ\n" "%%: dấu phần trăm\n" "\n" "nếu không có dự án nào được mở, hoặc chế độ dự án đã tắt, thì\n" "\t%D=%d, %B=%b\n" "Lưu,Xem:\n" "\tlưu tập tin trước khi chạy: 1\n" "\txem mọi dòng xuất: 2\n" "\tcả hai: 1+2 =3\n" "\tkhông cả hai: 0" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "left" msgstr "trái" #: ../src/preferences.c:1856 ../src/preferences.c:1857 msgid "right" msgstr "phải" #: ../src/preferences.c:1856 msgid "top" msgstr "trên" #: ../src/preferences.c:1856 msgid "bottom" msgstr "dưới" #: ../src/preferences.c:1858 msgid "no check" msgstr "không kiểm tra" #: ../src/preferences.c:1858 msgid "check mtime and size" msgstr "kiểm tra thời gian và cỡ" #: ../src/preferences.c:1858 msgid "check mtime" msgstr "kiểm tra thời gian" #: ../src/preferences.c:1858 msgid "check size" msgstr "kiểm tra cỡ" #: ../src/preferences.c:1861 msgid "Edit preferences" msgstr "Thay đổi cấu hình Winefish" #: ../src/preferences.c:1873 msgid "Editor" msgstr "Soạn thảo" #: ../src/preferences.c:1875 msgid "Editor options" msgstr "Tùy chọn soạn thảo" #: ../src/preferences.c:1880 msgid "Font" msgstr "Phông" #: ../src/preferences.c:1881 msgid "Tab width" msgstr "Cỡ tab" #: ../src/preferences.c:1882 msgid "Use spaces to indent, not tabs" msgstr "Thay thế tab bởi khoảng trắng" #: ../src/preferences.c:1883 msgid "Word wrap default" msgstr "Mặc định ngắt dòng" #: ../src/preferences.c:1885 msgid "Highlight syntax by default" msgstr "Mặc định tô màu" #: ../src/preferences.c:1886 msgid "Highlight # lines" msgstr "Tô màu # dòng" #: ../src/preferences.c:1888 msgid "Undo" msgstr "" #: ../src/preferences.c:1893 msgid "Undo history size" msgstr "Cỡ bộ đệm lịch sử" #: ../src/preferences.c:1894 msgid "Clear undo history on save" msgstr "Xó bỏ bộ đệm lịch sử khi lưu" #: ../src/preferences.c:1896 msgid "Bookmark options" msgstr "Tùy chọn đánh dấu" #: ../src/preferences.c:1901 msgid "Make permanent by default" msgstr "" #: ../src/preferences.c:1903 msgid "full path" msgstr "đường dẫn đầy đủ" #: ../src/preferences.c:1903 msgid "path from basedir" msgstr "đường dẫn từ thư mục chính" #: ../src/preferences.c:1903 msgid "filename" msgstr "tập tin" #: ../src/preferences.c:1904 msgid "Bookmarks filename display" msgstr "Hiển thị tập tin chứa đánh dấu" #: ../src/preferences.c:1909 msgid "Files" msgstr "Tập tin" #: ../src/preferences.c:1911 msgid "Encoding" msgstr "Bảng mã" #: ../src/preferences.c:1923 msgid "Default character set" msgstr "Bảng mã mặc định" #: ../src/preferences.c:1929 msgid "Backup" msgstr "Sao lưu" #: ../src/preferences.c:1933 msgid "Create backup on save" msgstr "Sao lưu mỗi khi lưu tài liệu" #: ../src/preferences.c:1934 msgid "Backup file suffix" msgstr "Hậu tố sao lưu" #: ../src/preferences.c:1936 msgid "save" msgstr "lưu" #: ../src/preferences.c:1936 msgid "abort" msgstr "thoát" #: ../src/preferences.c:1936 msgid "ask" msgstr "hỏi" #: ../src/preferences.c:1937 msgid "Action on backup failure" msgstr "Nếu sao lưu thất bại" #: ../src/preferences.c:1939 msgid "Remove backupfile on close" msgstr "Xóa tập tin sao lưu khi thoát" #: ../src/preferences.c:1943 msgid "Misc" msgstr "Linh tinh" #: ../src/preferences.c:1948 msgid "Allow multi instances of a file" msgstr "Mở cùng một tài liệu ở nhiều cửa sổ" #: ../src/preferences.c:1950 msgid "Open files in already running winefish window" msgstr "Mở tài liệu trong cửa sổ Winefish đã mở" #: ../src/preferences.c:1952 msgid "File modified on disk check " msgstr "Kiểm tra sự thay đổi tập tin trên đĩa" #: ../src/preferences.c:1953 msgid "Number of files in 'Open recent'" msgstr "Số tập tin lưu vào lịch sử Winefish" #: ../src/preferences.c:1955 msgid "File browser" msgstr "Cây thư mục" #: ../src/preferences.c:1959 msgid "Default basedir" msgstr "Thư mục chính mặc định" #: ../src/preferences.c:1960 msgid "Use separate file and directory view" msgstr "Tách riêng tập tin và thư mục" #: ../src/preferences.c:1961 msgid "Unknown icon" msgstr "Biểu tượng 'không biết'" #: ../src/preferences.c:1962 msgid "Directory icon" msgstr "Biểu tượng thư mục" #: ../src/preferences.c:1966 msgid "User interface" msgstr "Giao diện" #: ../src/preferences.c:1968 msgid "Dimensions" msgstr "Kích thước" #: ../src/preferences.c:1972 msgid "Restore last used dimensions" msgstr "Khôi phục kích thước cũ" #: ../src/preferences.c:1973 msgid "Initial sidebar width" msgstr "Chiều rộng sidebar (khởi tạo)" #: ../src/preferences.c:1974 msgid "Initial window height" msgstr "Chiều cao cửa sổ (khởi tạo)" #: ../src/preferences.c:1975 msgid "Initial window width" msgstr "Chiều rộng cửa sổ (khởi tạo)" #: ../src/preferences.c:1979 msgid "General" msgstr "Tổng quát" #: ../src/preferences.c:1984 msgid "Make LaTeX dialogs transient" msgstr "" #: ../src/preferences.c:1986 msgid "Notebook tab font (leave empty for gtk default)" msgstr "Phông cho notebook (để trống để dùng mặc định)" #: ../src/preferences.c:1988 msgid "Document notebook tab position" msgstr "Vị trí của notebook tài liệu" #: ../src/preferences.c:1989 msgid "Sidebar notebook tab position" msgstr "Vị trí của notebook sidebar" #: ../src/preferences.c:1990 msgid "Sidebar location" msgstr "Ví trí của sidebar" #: ../src/preferences.c:1994 ../src/preferences.c:1996 msgid "Filetypes" msgstr "Kiểu tập tin" #: ../src/preferences.c:2003 msgid "Filefilters" msgstr "Lọc tập tin" #: ../src/preferences.c:2012 msgid "Highlighting" msgstr "Tô màu" #: ../src/preferences.c:2014 msgid "Patterns" msgstr "Biểu thức" #: ../src/preferences.c:2023 msgid "Viewers, Filters" msgstr "Trình xem, Lọc" #: ../src/preferences.c:2025 msgid "Viewers" msgstr "Trình xem" #: ../src/preferences.c:2032 msgid "Utilities and Filters" msgstr "Công cụ, Lọc" #: ../src/preferences.c:2039 ../src/preferences.c:2062 msgid "Information" msgstr "Thông tin" #: ../src/preferences.c:2044 #, c-format msgid "" "%f: current filename\n" "%i: input (filters)\n" "%o: output filename (filters)\n" "%%: percent sign" msgstr "" "%f: tập tin hiện tại\n" "%i: chỉ tập tin vào (lọc)\n" "%o: chỉ tập tin ra (lọc)\n" "%%: dấu phần trăm" #: ../src/preferences.c:2052 ../src/preferences.c:2054 msgid "TeXbox" msgstr "" #: ../src/preferences.c:2071 msgid "AutoX" msgstr "Thay thế" #: ../src/preferences.c:2073 msgid "Autotext" msgstr "Chuỗi thay thế" #: ../src/preferences.c:2080 msgid "Word List (for Autocompletion)" msgstr "Chuỗi hoàn thành" #: ../src/preferences.c:2089 msgid "Miscellaneous" msgstr "Linh tinh" #: ../src/preferences.c:2093 msgid "Templates Directory" msgstr "Thư mục chứa các mẫu" #: ../src/preferences.c:2102 msgid "Column Markers" msgstr "Đánh dấu cột" #: ../src/preferences.c:2107 msgid "Marker 1" msgstr "Cột 1" #: ../src/preferences.c:2108 msgid "Marker 2" msgstr "Cột 2" #: ../src/preferences.c:2109 msgid "Marker 3" msgstr "Cột 3" #: ../src/project.c:89 msgid "New project" msgstr "Dự án mới" #: ../src/project.c:176 ../src/project.c:183 msgid "Enter Winefish project filename" msgstr "Cho biết tên dự án" #: ../src/project.c:224 msgid "/Project/Save" msgstr "/Dự án/Lưu" #: ../src/project.c:225 msgid "/Project/Save as..." msgstr "/Dự án/Lưu với tên _khác..." #: ../src/project.c:226 msgid "/Project/Save & close" msgstr "/Dự án/Lưu và đóng dự án" #: ../src/project.c:304 ../src/project.c:311 msgid "Select Winefish project filename" msgstr "Chọn tên dự án Winefish" #: ../src/project.c:369 msgid "Do you want to save the project?" msgstr "Bạn có muốn lưu dự án?" #: ../src/project.c:498 msgid "" "The BaseDir must exist.\n" "The BaseFile must be located in BaseDir." msgstr "Thư mục chính phải tồn tại, tập tin chính phải có trong thư mục chính." #: ../src/project.c:525 msgid "Create New Project" msgstr "Tạo dự án mới" #: ../src/project.c:528 msgid "Edit Project" msgstr "Sử thông tin của dự án" #: ../src/project.c:551 #, c-format msgid "This project contains %d files" msgstr "Dự án này có %d tập tin" #: ../src/project.c:563 msgid "Project _Name:" msgstr "_Tên dự án:" #: ../src/project.c:567 msgid "_BaseDir:" msgstr "Thư mục chính:" #: ../src/project.c:570 msgid "Browse..." msgstr "Tìm..." #: ../src/project.c:573 msgid "BaseFile:" msgstr "Tập tin chính:" #: ../src/project.c:579 msgid "_Template:" msgstr "_Mẫu tài liệu mới:" #: ../src/project.c:585 msgid "_Word wrap by default" msgstr "_Ngắt dòng (mặc định)" #: ../src/project.c:597 msgid "Create _Project" msgstr "Tạo Dự án" #: ../src/project.c:637 msgid "Create project" msgstr "Tạo dự án" #: ../src/project.c:641 msgid "Create project with currently opened documents" msgstr "Tạo dự án với các tài liệu đang mở" #: ../src/project.c:642 msgid "Create empty project" msgstr "Tạo dự án mới hoàn toàn" #: ../src/rcfile.c:500 msgid "DVI Viewer" msgstr "Xem kết quả DVI" #: ../src/rcfile.c:502 msgid "PDF Viewer" msgstr "Xem kết quả PDF" #: ../src/rcfile.c:504 msgid "EPS Viewer" msgstr "Xem kết quả EPS" #: ../src/rcfile.c:578 msgid "LaTeX" msgstr "" #: ../src/rcfile.c:580 msgid "XML" msgstr "" #: ../src/rcfile.c:582 msgid "Images" msgstr "Hình" #: ../src/rcfile.c:946 msgid "Untitled Project" msgstr "Dự án không tên" #: ../src/snr2.c:193 msgid "Regular expression error: " msgstr "Biểu thức chính quy bị lỗi: " #: ../src/snr2.c:194 ../src/snr2.c:239 msgid "Search failed" msgstr "Thất bại trong tìm kiếm" #: ../src/snr2.c:238 #, c-format msgid "Regular expression error: %s at offset %d" msgstr "Biểu thức chính quy không hợp lệ %s (vị trí %d)" #: ../src/snr2.c:864 msgid "Confirm replace" msgstr "Khẳng định việc thay thế" #: ../src/snr2.c:876 msgid "Replace selected text?" msgstr "Thay thế phần được chọn?" #: ../src/snr2.c:889 msgid "_Skip" msgstr "_Bỏ qua" #: ../src/snr2.c:891 msgid "Replace _all" msgstr "Thay thế tất cả" #: ../src/snr2.c:1136 ../src/snr2.c:1143 msgid "Search: no match found" msgstr "Không tìm ra" #: ../src/snr2.c:1369 msgid "_Search for: " msgstr "_Tìm: " #: ../src/snr2.c:1395 msgid "_Replace with: " msgstr "_Thay bởi: " #: ../src/snr2.c:1405 msgid "\\0 refers to the first subsearch_pattern, \\1 to the second etc." msgstr "\\0 chỉ biểu thức con đầu tiên, \\1 chỉ biểu thức con thứ hai." #: ../src/snr2.c:1420 msgid "Beginning of document till end" msgstr "Từ đầu đến cuối tài liệu" #: ../src/snr2.c:1420 msgid "Current position till end" msgstr "Từ vị trí hiện tại cho đến cuối tài liệu" #: ../src/snr2.c:1420 msgid "Beginning of selection till end of selection" msgstr "Trong phần được chọn" #: ../src/snr2.c:1420 msgid "All opened files begin till end" msgstr "Trong mọi tài liệu đang mở" #: ../src/snr2.c:1421 msgid "Disabled" msgstr "(không)" #: ../src/snr2.c:1421 msgid "POSIX type" msgstr "Kiểu POSIX" #: ../src/snr2.c:1421 msgid "PERL type" msgstr "Kiểu PERL" #: ../src/snr2.c:1422 msgid "Starts at:" msgstr "Bắt đầu:" #: ../src/snr2.c:1434 msgid "Regular expression:" msgstr "Biểu thức chính quy:" #: ../src/snr2.c:1448 msgid "Normal" msgstr "Bình thường" #: ../src/snr2.c:1448 msgid "Uppercase" msgstr "Chữ hoa" #: ../src/snr2.c:1448 msgid "Lowercase" msgstr "Chữ thường" #: ../src/snr2.c:1449 msgid "Replace type:" msgstr "Kiểu thay thế:" #: ../src/snr2.c:1462 msgid "_Patterns contain backslash escape sequences (\\n, \\t)" msgstr "Biểu thức chấp nhận chuỗi thoát (\\n, \\t)" #: ../src/snr2.c:1463 msgid "_Match case" msgstr "Phân biệt hoa thường" #: ../src/snr2.c:1464 msgid "O_verlap searches" msgstr "Tìm kiếm xoay vòng" #: ../src/snr2.c:1466 msgid "Prompt _before replace" msgstr "Nhắc nhở trước khi thay thế" #: ../src/snr2.c:1467 msgid "Replace o_nce" msgstr "Thay thế đúng một lần" #: ../src/snr2.c:1469 msgid "Bookmark results" msgstr "Đánh dấu kết quả" #: ../src/winefish.c:106 #, c-format msgid "" "\n" "Usage: %s [options] [filenames ...]\n" msgstr "" "\n" "Sử dụng: %s [tùy chọn] [tập tin...]\n" #: ../src/winefish.c:107 msgid "" "\n" "Currently accepted options are:\n" msgstr "" "\n" "Các tùy chọn được chấp nhận:\n" #: ../src/winefish.c:108 msgid "-s skip root check\n" msgstr "-s bỏ qua kiểm tra root\n" #: ../src/winefish.c:109 msgid "-v current version\n" msgstr "-v phiên bản hiện tại\n" #: ../src/winefish.c:110 msgid "-n 0|1 open new window (1) or not (0)\n" msgstr "-n 0|1 tạo cửa sổ mới (1) hoặc không (0)\n" #: ../src/winefish.c:111 msgid "-p filename open project\n" msgstr "-p filename mở dự án\n" #: ../src/winefish.c:112 msgid "-l number set line. Negative value takes no effect.\n" msgstr "" "-l number đặt con trỏ vào dòng ''. Số âm không có tác dụng.\n" #: ../src/winefish.c:113 msgid "-h this help screen\n" msgstr "-h thông tin này\n" #: ../src/winefish.c:190 msgid "parsing highlighting file..." msgstr "đọc cấu hình tô màu..." #: ../src/winefish.c:201 msgid "compiling highlighting patterns..." msgstr "biên dịch các biểu thứ chính quy tô màu..." #: ../src/winefish.c:205 msgid "initialize some other things..." msgstr "khởi động vài thứ khác..." #: ../src/winefish.c:211 msgid "parsing autotext and words file..." msgstr "đọc thông tin về autox..." #: ../src/winefish.c:216 msgid "parsing custom menu file..." msgstr "đọc thông tin về hệ thống menu..." #: ../src/winefish.c:230 msgid "creating main gui..." msgstr "tạo giao diện chính..." #: ../src/winefish.c:241 msgid "showing main gui..." msgstr "hiển thị giao diện chính..." #: ../src/wizards.c:139 #, c-format msgid "row %d col" msgstr "dòng %d cột" #: ../src/wizards.c:157 #, c-format msgid "%%%% row %d\n" msgstr "%%%% dòng %d\n" #: ../src/wizards.c:251 msgid "Table Wizard" msgstr "Wizard tạo bảng" #: ../src/wizards.c:259 msgid "Number of _rows:" msgstr "Số _hàng:" #: ../src/wizards.c:263 msgid "Number of colu_mns:" msgstr "Số _cột:" #: ../src/wizards.c:267 msgid "Add Horizontal Rules:" msgstr "Thêm đường nằm ngang:" #: ../src/wizards.c:287 msgid "Type (Environment):" msgstr "Môi trường:" #: ../src/wizards.c:297 msgid "Columns Alignmen:" msgstr "Canh cột:" #: ../src/wizards.c:311 msgid "Vertical Rules:" msgstr "Thước thẳng đứng:" #: ../src/wizards.c:408 msgid "Insert Time" msgstr "Chèn thông tin về giờ" #: ../src/wizards.c:416 #, c-format msgid " _Time (%i:%i:%i)" msgstr "_Giờ (%i:%i:%i)" #: ../src/wizards.c:421 msgid " Day of the _week (Sunday)" msgstr "Chủ nhật" #: ../src/wizards.c:424 msgid " Day of the _week (Monday)" msgstr "Thứ Hai" #: ../src/wizards.c:427 msgid " Day of the _week (Tuesday)" msgstr "Thứ Ba" #: ../src/wizards.c:430 msgid " Day of the _week (Wednesday)" msgstr "Thứ Tư" #: ../src/wizards.c:433 msgid " Day of the _week (Thursday)" msgstr "Thứ Năm" #: ../src/wizards.c:436 msgid " Day of the _week (Friday)" msgstr "Thứ Sáu" #: ../src/wizards.c:439 msgid " Day of the _week (Saturday)" msgstr "Thứ Bảy" #: ../src/wizards.c:442 msgid "You appear to have a non existant day!\n" msgstr "Dường như ngày bạn chỉ ra không hợp lệ!\n" #: ../src/wizards.c:450 #, c-format msgid " _Date (%i/%i/%i)" msgstr " _Ngày (%i/%i/%i)" #: ../src/wizards.c:453 #, c-format msgid " _Unix Time (%i)" msgstr " Giờ kiểu Unix (%i)" #: ../src/wizards.c:456 #, c-format msgid " Unix Date _String (%s" msgstr " Ngày kiểu Unix (%s" #: ../src/wizards.c:518 msgid "Quick Start" msgstr "Tạo nhanh tài liệu mới" #: ../src/wizards.c:533 msgid "Document _Class:" msgstr "_Lớp tài liệu:" #: ../src/wizards.c:551 msgid "_VnTeX Support:" msgstr "Hỗ trợ _VnTeX:" #: ../src/wizards.c:599 ../src/wizards.c:604 ../src/wizards.c:608 msgid "item" msgstr "phần tử" #: ../src/wizards.c:628 msgid "Quick List" msgstr "Danh sách (nhanh)" #: ../src/wizards.c:635 msgid "_Rows:" msgstr "_Hàng:" #: ../src/wizards.c:646 msgid "Type (_Environment):" msgstr "Kiểu (_Môi trường):" winefish-1.3.3/po/README0000600000047200004720000000144410374331640013632 0ustar kyanhkyanhHi, If you would like to translate Winefish into your language, please following instructions: * Configure winefish from source directory: $ autoconf # if needed $ ./configure # or something like this $ cd po # change to `po' directory * In this 'po' directory, try: $ rm -fv winefish.po; make winefish.po * If there's already LANG.po files, please try $ make update-po * If not, copying winefish.po to LANG.po $ cp winefish.po LANG.po * Using KBabel,gTranslator,... to open the LANG.po file and start/continue the translation. * Please mailto your work (LANG.po) to kyanh@o2.pl. Your contribution will be part of next minor Winefish release. Thank you in advance for your contribution. You make Winefish live! Regards, kyanh PS: 20060123: i wonder if anyone read this file ;) winefish-1.3.3/NEWS0000600000047200004720000000107410412067630013030 0ustar kyanhkyanh1.3.2 vs 1.2.1 * brace finder * grep function (file in files) * improved outputbox with clone operation * template support * TeX filter for spell checker * column marker (--enable-column-marker when `configure'ing) * delete latex command directly from popup menu * resource file: /.winefish/rcfile (former: rcfile2) * hilight current line * new color scheme for syntax hilighting * HTML version of documentation (doc/winefish.html) * translation: (English,) French, Italian, Vietnamese * menu reordered * toolbars dropped * many bugs fixed * ROADMAP changed winefish-1.3.3/aclocal.m40000600000047200004720000005341710373411041014174 0ustar kyanhkyanhdnl aclocal.m4 generated automatically by aclocal 1.4-p6 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. #serial 1 # This test replaces the one in autoconf. # Currently this macro should have the same name as the autoconf macro # because gettext's gettext.m4 (distributed in the automake package) # still uses it. Otherwise, the use in gettext.m4 makes autoheader # give these diagnostics: # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX undefine([AC_ISC_POSIX]) AC_DEFUN([AC_ISC_POSIX], [ dnl This test replaces the obsolescent AC_ISC_POSIX kludge. AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) ] ) # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License or the GNU Library General Public License but which still want # to provide support for the GNU gettext functionality. # Please note that the actual code of the GNU gettext library is covered # by the GNU Library General Public License, and the rest of the GNU # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. # serial 10 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). Otherwise, a static library dnl $(top_builddir)/intl/libintl.a will be created. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. dnl LIBDIR is used to find the intl libraries. If empty, dnl the value `$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_WITH_NLS], [AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no INTLLIBS= dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if translation of program messages to the user's native language is requested.]) AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. CATOBJEXT=NONE dnl Add a version number to the cache macros. define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) AC_CHECK_HEADER(libintl.h, [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, [AC_TRY_LINK([#include extern int _nl_msg_cat_cntr;], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], gt_cv_func_gnugettext_libc=yes, gt_cv_func_gnugettext_libc=no)]) if test "$gt_cv_func_gnugettext_libc" != "yes"; then AC_CACHE_CHECK([for GNU gettext in libintl], gt_cv_func_gnugettext_libintl, [gt_save_LIBS="$LIBS" LIBS="$LIBS -lintl $LIBICONV" AC_TRY_LINK([#include extern int _nl_msg_cat_cntr;], [bindtextdomain ("", ""); return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], gt_cv_func_gnugettext_libintl=yes, gt_cv_func_gnugettext_libintl=no) LIBS="$gt_save_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if test "$gt_cv_func_gnugettext_libc" = "yes" \ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ && test "$PACKAGE" != gettext; }; then AC_DEFINE(HAVE_GETTEXT, 1, [Define if the GNU gettext() function is already present or preinstalled.]) if test "$gt_cv_func_gnugettext_libintl" = "yes"; then dnl If iconv() is in a separate libiconv library, then anyone dnl linking with libintl{.a,.so} also needs to link with dnl libiconv. INTLLIBS="-lintl $LIBICONV" fi gt_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" AC_CHECK_FUNCS(dcgettext) LIBS="$gt_save_LIBS" dnl Search for GNU msgfmt in the PATH. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) dnl Search for GNU xgettext in the PATH. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) CATOBJEXT=.gmo fi ]) if test "$CATOBJEXT" = "NONE"; then dnl GNU gettext is not found in the C library. dnl Fall back on GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. INTLOBJS="\$(GETTOBJS)" AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) AC_SUBST(MSGFMT) BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU msgfmt. if test "$GMSGFMT" != ":"; then dnl If it is no GNU msgfmt we define it as : so that the dnl Makefiles still can work. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then : ; else AC_MSG_RESULT( [found msgfmt program is not GNU msgfmt; ignore it]) GMSGFMT=":" fi fi dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is no GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi dnl We need to process the po/ directory. POSUB=po fi AC_OUTPUT_COMMANDS( [for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" fi ;; esac done]) dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext; then BUILD_INCLUDED_LIBINTL=yes fi dnl intl/plural.c is generated from intl/plural.y. It requires bison, dnl because plural.y uses bison specific features. It requires at least dnl bison-1.26 because earlier versions generate a plural.c that doesn't dnl compile. dnl bison is only needed for the maintainer (who touches plural.y). But in dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put dnl the rule in general Makefile. Now, some people carelessly touch the dnl files or have a broken "make" program, hence the plural.c rule will dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not dnl present or too old. AC_CHECK_PROGS([INTLBISON], [bison]) if test -z "$INTLBISON"; then ac_verc_fail=yes else dnl Found it, now check the version. AC_MSG_CHECKING([version of bison]) changequote(<<,>>)dnl ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) changequote([,])dnl ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; esac AC_MSG_RESULT([$ac_prog_version]) fi if test $ac_verc_fail = yes; then INTLBISON=: fi dnl These rules are solely for the distribution goal. While doing this dnl we only have to keep exactly one list of the available catalogs dnl in configure.in. for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done dnl Make all variables we use known to autoconf. AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(GMOFILES) AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) AC_SUBST(POFILES) AC_SUBST(POSUB) dnl For backward compatibility. Some configure.ins may be using this. nls_cv_header_intl= nls_cv_header_libgt= dnl For backward compatibility. Some Makefiles may be using this. DATADIRNAME=share AC_SUBST(DATADIRNAME) dnl For backward compatibility. Some Makefiles may be using this. INSTOBJEXT=.mo AC_SUBST(INSTOBJEXT) dnl For backward compatibility. Some Makefiles may be using this. GENCAT=gencat AC_SUBST(GENCAT) ]) dnl Usage: Just like AM_WITH_NLS, which see. AC_DEFUN([AM_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([jm_GLIBC21])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ stdlib.h string.h unistd.h sys/param.h]) AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) AM_ICONV AM_LANGINFO_CODESET AM_LC_MESSAGES AM_WITH_NLS([$1],[$2],[$3]) if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but $(top_srcdir). dnl Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) dnl Enable libtool support if the surrounding package wishes it. INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) # Search path for a program which passes the given test. # Ulrich Drepper , 1996. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License or the GNU Library General Public License but which still want # to provide support for the GNU gettext functionality. # Please note that the actual code of the GNU gettext library is covered # by the GNU Library General Public License, and the rest of the GNU # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. # serial 2 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) #serial 2 # Test for the GNU C Library, version 2.1 or newer. # From Bruno Haible. AC_DEFUN([jm_GLIBC21], [ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, ac_cv_gnu_library_2_1, [AC_EGREP_CPP([Lucky GNU user], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) Lucky GNU user #endif #endif ], ac_cv_gnu_library_2_1=yes, ac_cv_gnu_library_2_1=no) ] ) AC_SUBST(GLIBC21) GLIBC21="$ac_cv_gnu_library_2_1" ] ) #serial AM2 dnl From Bruno Haible. AC_DEFUN([AM_ICONV], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_ARG_WITH([libiconv-prefix], [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ for dir in `echo "$withval" | tr : ' '`; do if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi done ]) AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([$]{ac_t:- }[$]am_cv_proto_iconv) AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, [Define as const if the declaration of iconv() needs const.]) fi LIBICONV= if test "$am_cv_lib_iconv" = yes; then LIBICONV="-liconv" fi AC_SUBST(LIBICONV) ]) #serial AM1 dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU General Public # License or the GNU Library General Public License but which still want # to provide support for the GNU gettext functionality. # Please note that the actual code of the GNU gettext library is covered # by the GNU Library General Public License, and the rest of the GNU # gettext package package is covered by the GNU General Public License. # They are *not* in the public domain. # serial 2 AC_DEFUN([AM_LC_MESSAGES], [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi fi]) AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])])winefish-1.3.3/install-sh0000700000047200004720000001272010376503762014345 0ustar kyanhkyanh#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0