vte.h 4.53 KB
Newer Older
1 2 3
/*
 *      vte.h - this file is part of Geany, a fast and lightweight IDE
 *
4 5
 *      Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
 *      Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 *      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.
 *
 * $Id$
 */


#ifndef GEANY_VTE_H
#define GEANY_VTE_H 1

28 29
#ifdef HAVE_VTE

30 31
/* include stdlib.h AND unistd.h, because on GNU/Linux pid_t seems to be
 * in stdlib.h, on FreeBSD in unistd.h */
32
#include <stdlib.h>
33
#include <unistd.h>
34

35

36
typedef struct
37 38 39 40 41 42 43 44
{
	gboolean load_vte;
	gboolean have_vte;
	gchar	*lib_vte;
	gchar	*dir;
} VteInfo;

extern VteInfo vte_info;
45 46 47 48 49 50 51 52 53 54 55


typedef struct
{
	GtkWidget *vte;
	GtkWidget *menu;
	GtkWidget *im_submenu;
	gboolean scroll_on_key;
	gboolean scroll_on_out;
	gboolean ignore_menu_bar_accel;
	gboolean follow_path;
56
	gboolean run_in_vte;
57 58 59 60 61 62 63 64
	gint scrollback_lines;
	gchar *emulation;
	gchar *shell;
	gchar *font;
	GdkColor *colour_fore;
	GdkColor *colour_back;
} VteConfig;
VteConfig *vc;
65 66


67 68 69 70
void vte_init(void);

void vte_close(void);

71 72
void vte_apply_user_settings(void);

73 74
void vte_send_cmd(const gchar *cmd);

75 76
const gchar* vte_get_working_directory(void);

77
void vte_cwd(const gchar *filename, gboolean force);
78

79 80
void vte_append_preferences_tab();

81 82 83 84 85 86 87
/*
void vte_drag_data_received(GtkWidget *widget, GdkDragContext  *drag_context, gint x, gint y,
							GtkSelectionData *data, guint info, guint time);

gboolean vte_drag_drop(GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, guint time,
					   gpointer user_data);
*/
88 89 90 91 92 93 94 95 96 97 98 99 100

/* taken from original vte.h to make my life easier ;-) */

typedef struct _VteTerminalPrivate VteTerminalPrivate;

typedef struct _VteTerminal VteTerminal;
struct _VteTerminal
{
	GtkWidget widget;
	GtkAdjustment *adjustment;
	glong char_width, char_height;
	glong char_ascent, char_descent;
	glong row_count, column_count;
101 102
	gchar *window_title;
	gchar *icon_title;
103 104 105 106 107 108
	VteTerminalPrivate *pvt;
};


/* store function pointers in a struct to avoid a strange segfault if they are stored directly
 * if accessed directly, gdb says the segfault arrives at old_tab_width(prefs.c), don't ask me */
109
struct VteFunctions
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
{
	GtkWidget* (*vte_terminal_new) (void);
	pid_t (*vte_terminal_fork_command) (VteTerminal *terminal, const char *command, char **argv,
										char **envv, const char *directory, gboolean lastlog,
										gboolean utmp, gboolean wtmp);
	void (*vte_terminal_set_size) (VteTerminal *terminal, glong columns, glong rows);
	void (*vte_terminal_set_word_chars) (VteTerminal *terminal, const char *spec);
	void (*vte_terminal_set_mouse_autohide) (VteTerminal *terminal, gboolean setting);
	void (*vte_terminal_reset) (VteTerminal *terminal, gboolean full, gboolean clear_history);
	void (*vte_terminal_set_encoding) (VteTerminal *terminal, const char *codeset);
	void (*vte_terminal_set_cursor_blinks) (VteTerminal *terminal, gboolean blink);
	GtkType (*vte_terminal_get_type) (void);
	void (*vte_terminal_set_scroll_on_output) (VteTerminal *terminal, gboolean scroll);
	void (*vte_terminal_set_scroll_on_keystroke) (VteTerminal *terminal, gboolean scroll);
	void (*vte_terminal_set_font_from_string) (VteTerminal *terminal, const char *name);
	void (*vte_terminal_set_scrollback_lines) (VteTerminal *terminal, glong lines);
	gboolean (*vte_terminal_get_has_selection) (VteTerminal *terminal);
127 128 129
	void (*vte_terminal_copy_clipboard) (VteTerminal *terminal);
	void (*vte_terminal_paste_clipboard) (VteTerminal *terminal);
	void (*vte_terminal_set_emulation) (VteTerminal *terminal, const gchar *emulation);
130
	void (*vte_terminal_set_color_foreground) (VteTerminal *terminal, const GdkColor *foreground);
131
	void (*vte_terminal_set_color_background) (VteTerminal *terminal, const GdkColor *background);
132
	void (*vte_terminal_feed_child) (VteTerminal *terminal, const char *data, glong length);
133
	void (*vte_terminal_im_append_menuitems) (VteTerminal *terminal, GtkMenuShell *menushell);
134 135
};

136
#endif
137 138

#endif