File: powershell.h

package info (click to toggle)
powershell 0.9-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 496 kB
  • ctags: 341
  • sloc: ansic: 3,159; sh: 180; makefile: 108
file content (241 lines) | stat: -rw-r--r-- 6,038 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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
  /*  powershell.h - powershell
   *  Copyright (C) 1999  Matt Spong <spong@glue.umd.edu>
   *  Based from zterm.c by Michael Zucci from the libzvt docs
   *
   *  A big, puffy lotsa-shells-in-one app. 
   *
   *  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.
   */

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <pwd.h>
#include <stdlib.h>
#include <assert.h>

#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkprivate.h>
#include <gdk/gdkkeysyms.h>

#include <gnome.h>

#include <zvt/zvtterm.h>

#include "config.h"

int scrollbacklines;


#define POWERSHELL_VERSION "0.9.1"
#define CONFIG_FILE ".pshellrc"

enum palette_enum {
        PALETTE_LINUX,
        PALETTE_XTERM,
        PALETTE_RXVT,
        PALETTE_CUSTOM
};

/* structures */

typedef struct _shortcut_key
{
  gint key;
  gint modifiers;
} shortcut_key;

typedef struct _key_preferences
{
  shortcut_key cycle_forwards;
  shortcut_key cycle_backwards;

  shortcut_key move_forwards;
  shortcut_key move_backwards;

  shortcut_key specific_term[20];

  shortcut_key quit;
  shortcut_key close;
  shortcut_key rename;
  shortcut_key run;

} key_preferences;


typedef struct _appentry
{
  char * tab_title;
  char * command;
  char * menu_item_title;

  char * menu_title;
  char ** menu_entries;

  int run_on_startup;

  shortcut_key shortcut;

  GtkWidget * menubar;

} appentry;

typedef struct _preferences
{
  char http_handler[256], ftp_handler[256], 
    mail_handler[256], telnet_handler[256];

  int use_pixmap, transparent, shaded;
  char bg_pixmap[512];

  char fontname[512];
  GdkFont * font;
  char wordchars[64];

  int colors[16][16][16];

  int disablebold;
  int scrollbacklines;  
  int ask_ssh_password;

  int use_matching;
  GtkPositionType notebookpos;
  int hidemenubar;
  int hidestatusbar;
  int hidetabswhensingle;

  int scrollbarpos;
  int run_def_shell;

} preferences;

typedef struct _color_settings
{
  int initialized;
  gushort red[18], green[18], blue[18];
  gushort fg[3], bg[3];
  guint palette;
  gushort blink, bell, scroll_keystroke, scroll_output, del_bs_switch;
} color_settings;



/* globals */
extern char      **environ;       
extern char **env;
extern char **env_copy;
extern int winid_pos;
extern GtkWidget * window;
extern GtkWidget * notebook;
extern appentry * app_entries;
extern int num_apps;
extern int terms_open;
extern preferences Prefs;
extern color_settings ColorPrefs;
extern key_preferences keyprefs;
extern ZvtTerm * current_term;
extern GtkWidget * popup_file;
extern GnomeUIInfo * file_menu;
extern GtkItemFactoryEntry * menu_items;

extern GtkTargetEntry target_table[];

extern gushort linux_red[], linux_grn[], linux_blu[];
extern gushort xterm_red[], xterm_grn[], xterm_blu[];
extern gushort rxvt_red[], rxvt_grn[], rxvt_blu[];

extern int window_shown;
extern char * config_file;
extern char * window_title;

/* signal handlers */
void child_died_event (ZvtTerm *term);
void term_died_event (ZvtTerm *term);
void quit_proggie (GtkWidget * widget, GdkEvent * event, gpointer data);
void title_changed_event (ZvtTerm *term, VTTITLE_TYPE type, 
				 char *newtitle);
void set_hints (GtkWidget *widget);

gboolean term_key_event (GtkWidget * widget, GdkEventKey * event, gpointer user_data);

void NotebookHandler (GtkNotebook * notebook, GtkNotebookPage * page,
		      gint page_num, gpointer user_data);
void MenuHandler (GtkWidget * w, gchar * data);

gint term_click_event (GtkWidget * widget, GdkEventButton * event);

void  
drag_data_received  (GtkWidget *widget, GdkDragContext *context, 
                     gint x, gint y,
                     GtkSelectionData *selection_data, guint info,
                     guint time);

void windowmoved (GtkWidget * widget, gpointer data);

gint notebook_click_event (GtkWidget * widget, GdkEventButton * event,
			   gpointer user_data);

/* program functions */

GtkWidget * new_term (GtkWidget * notebook, gchar * command, gchar * args, gchar * title);
GtkWidget * new_term_x (GtkWidget * notebook, gchar * command, gchar * args, gchar * title,
			int w, int h);

void get_main_menu (GtkWidget * window, GtkWidget **menubar);
int InitMenus (GtkWidget * window);
int InitRCFile ();
int WriteRCFile ();
int DoPreferences();
void RenameTerm();
void RenameTerm2();
void AboutDialog();
void FileRun();
void FontSel();
void UpdateTerm(ZvtTerm * term);
void UpdateAllTerms();
ZvtTerm * get_nth_zvt (GtkNotebook * notebook, gint n);
void QuickMessage (gchar * message);
void drag_data_received (GtkWidget * widget, GdkDragContext * context,
			 gint x, gint y, GtkSelectionData * data,
			 guint info, guint time);
void RunArbitrary();
void set_color_scheme (ZvtTerm * term, color_settings cs);
void DisconnectTerm();
void InitIPC(int pid);

int CreatePrefsAppearance (GtkContainer * area);
int CreatePrefsColors (GtkContainer * area);
int CreatePrefsMenus (GtkContainer * area);
int CreatePrefsHandlers (GtkContainer * area);
int CreatePrefsShortcuts (GtkContainer * area);

int ApplyPrefsAppearance();
int ApplyPrefsColors();

int ApplyPrefsMenus();
int ApplyPrefsHandlers();
int ApplyPrefsShortcuts();

void property_changed (GtkWidget * w, gpointer user_data);

void GetKeyText (char * buf, int modifiers, int key);