Commit 6cce273c authored by Jacob Leach's avatar Jacob Leach

the obligatory update-all-copyright-headers (because they were no longer

consistent with the one from COPYING), and removing some backup files
from cvs repos.
parent 30d3c760
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/*
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -13,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __COMMANDS_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
* Copyright (C) 1998, 1999 Alex Roberts and Evan Lawrence
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -15,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
* Copyright (C) 1998, 1999 Alex Roberts and Evan Lawrence
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -15,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DOCUMENT_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit - File Input/Output routines
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,10 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Chema Celorio <chema@celorio.com>
*/
#include <config.h>
......
......@@ -2,6 +2,8 @@
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,10 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Chema Celorio <chema@celorio.com>
*/
#ifndef __FILE_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* gedit
* Copyright (C) 1998 Alex Roberts and Evan Lawrence
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
* Copyright (C) 1998, 1999 Alex Roberts and Evan Lawrence
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -15,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GEDIT_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit - Menu definitions
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MENUS_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit
* Copyright (C) 1998, 1999, 2000 Alex Roberts, Evan Lawrence,
* and Chris Lahey
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -16,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
/* Plugins system based on that used in Gnumeric */
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit
* Copyright (C) 1998, 1999, 2000 Alex Roberts, Evan Lawrence,
* and Chris Lahey
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -15,23 +16,25 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GEDIT_PLUGIN_H__
#define __GEDIT_PLUGIN_H__
typedef struct _PluginData PluginData;
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
#include <gmodule.h>
enum {
enum
{
PLUGIN_OK,
PLUGIN_ERROR,
PLUGIN_DEAD
};
struct _PluginData {
typedef struct _PluginData PluginData;
struct _PluginData
{
gchar *file;
GModule *handle;
......@@ -58,4 +61,4 @@ void plugin_unload (PluginData *pd);
void gedit_plugins_window_add (GnomeApp *app);
#endif /* __GEDIT_PLUGIN_H__ */
#endif /* __PLUGIN_H__ */
......@@ -2,6 +2,8 @@
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
/* TODO:
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PREFS_H__
......
......@@ -2,7 +2,7 @@
/*
* gedit
*
* print.c - Printing Routines.
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -16,11 +16,11 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Printing code by : Chema Celorio <chema@celorio.com>
*/
* Authors:
* Chema Celorio <chema@celorio.com>
*/
#define PRINT_DEBUG_ON
#undef PRINT_DEBUG_ON
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* gE_print.h - Print Functions h file.
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -13,16 +16,17 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Printing code by : Chema Celorio <chema@celorio.com>
*/
* Authors:
* Chema Celorio <chema@celorio.com>
*/
#ifndef __GEDIT_PRINT_H__
#define __GEDIT_PRINT_H__
#ifndef __PRINT_H__
#define __PRINT_H__
/*void file_print_cb (GtkWidget *widget, gpointer cbdata);*/
void file_print_cb (GtkWidget *widget, gpointer data, gint file_printpreview);
void file_print_preview_cb (GtkWidget *widget, gpointer data);
#endif /* __GEDIT_PRINT_H__ */
#endif /* __PRINT_H__ */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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 __RECENT_H__
#define __RECENT_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit - Find/Replace/Find Line and stuff
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
/*
* gedit
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
*
* 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
......@@ -14,7 +16,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SEARCH_H__
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit - Find/Replace/Find Line and stuff
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* I have included this files in the CVS because I am
goint to delete some search finctions that we might
want to implement as plugins in the future */
#include <config.h>
#include <gnome.h>
#include "window.h"
#include "gedit.h"
#include "view.h"
#include "document.h"
#include "search.h"
#include "utils.h"
void add_search_options (GtkWidget *dialog);
static void find_line_clicked_cb (GtkWidget *widget,
gint button,
Document *doc);
static void replace_dialog_button_cb (GtkWidget *widget,
gint button,
Document *doc);
static gboolean search (GtkEditable *text,
gchar *str,
gint pos,
gulong options);
/*
* find in files variable declarations
*/
GtkWidget *find_in_files_dialog;
typedef struct _gedit_clist_data
{
gchar *fname;
gchar *contents;
gint line;
gint index;
} gedit_clist_data;
/*
* find in files function declerations
*/
static GtkWidget* create_find_in_files_dialog (void);
static void show_search_result_window (void);
void search_results_clist_insert (gchar *fname,
gchar *contents,
gint line,
gint index);
static void find_in_files_dialog_button_cb (GtkWidget *widget,
gint button,
gpointer data);
static void search_for_text_in_files (gchar *text);
static GtkWidget* create_find_in_files_dialog (void);
static gchar* get_line_as_text (View *view, gint pos);
static int find_in_file_search (View *view, gchar *str);
static void search_for_text_in_files (gchar *text);
static void find_in_files_dialog_button_cb (GtkWidget *widget,
gint button,
gpointer data);
static void show_search_result_window (void);
static void destroy_clist_data (gpointer data);
gint
pos_to_line (Document *doc, gint pos, gint *numlines)
{
View *view = VIEW (mdi->active_view);
gulong lines = 0, i, current_line = 0;
gchar *c;
gedit_debug_mess ("F:pos 2 line.\n", DEBUG_SEARCH);
for (i = 0; i < gtk_text_get_length (GTK_TEXT(view->text)); i++)
{
c = gtk_editable_get_chars (GTK_EDITABLE(view->text), i, i + 1);
if (!strcmp (c, "\n"))
lines++;
if (i == pos)
current_line = lines;
g_free (c);
}
*numlines = lines;
return current_line;
}
gint
line_to_pos (Document *doc, gint line, gint *numlines)
{
View *view = VIEW (mdi->active_view);
gulong lines = 1, i, current = 0;
gchar *c;
gedit_debug_mess ("F:line 2 pos.\n", DEBUG_SEARCH);
if (gtk_text_get_length (GTK_TEXT (view->text)) == 0)
return 0;
for (i = 1; i < gtk_text_get_length (GTK_TEXT(view->text)) - 1; i++)
{
c = gtk_editable_get_chars (GTK_EDITABLE(view->text), i - 1, i);
if (!strcmp (c, "\n"))
lines++;
g_free (c);
if (lines == line)
current = i;
}
*numlines = lines;
return current;
}
gint
get_line_count (Document *doc)
{
View *view = VIEW (mdi->active_view);
gulong lines = 1, i;
gchar *c;
gedit_debug_mess ("F:get line count.\n", DEBUG_SEARCH);
if (gtk_text_get_length (GTK_TEXT(view->text)) == 0)
return 0;
for (i = 1; i < gtk_text_get_length (GTK_TEXT(view->text)) - 1; i++)
{
c = gtk_editable_get_chars (GTK_EDITABLE(view->text), i - 1, i);
if (!strcmp (c, "\n"))
lines++;
g_free (c);
}
return lines;
}
void
seek_to_line (Document *doc, gint line, gint numlines)
{
View *view = VIEW (mdi->active_view);
/* gfloat value, ln, tl; */
int a, b;
int len;
char *buf;
char *haystack;
char *needle;
int linenum = line;
int numlines2 = 1;
gedit_debug_mess ("F:seek to line.\n", DEBUG_SEARCH);
len = gtk_text_get_length (GTK_TEXT (view->text));
buf = gtk_editable_get_chars (GTK_EDITABLE (view->text), 1, len);
a = 1;
b = len;
haystack = buf;
do {
needle = strchr (haystack, '\n');
if (needle) {
haystack = needle + 1;
if (linenum == numlines2)
b = needle - buf + 1;
numlines2++;
if (linenum == numlines2)
a = needle - buf + 1;
}
} while (needle != NULL);
g_free (buf);
gtk_text_set_point (GTK_TEXT (view->text), a + 1);
gtk_editable_set_position (GTK_EDITABLE (view->text), a + 1);
gtk_editable_select_region (GTK_EDITABLE (view->text), a, b);
if (numlines < 0)
numlines = get_line_count (doc);
if (numlines < 3)
return;
if (line > numlines)
line = numlines;