1 /* $XConsortium: FileMgr.h /main/6 1996/10/07 13:45:03 mustafa $ */
2 /************************************<+>*************************************
3 ****************************************************************************
7 * COMPONENT_NAME: Desktop File Manager
9 * DESCRIPTION: Public include file for the main window of the
12 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
13 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
14 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
15 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
17 ****************************************************************************
18 ************************************<+>*************************************/
23 #include <sys/types.h>
29 #define SELECTION_LIST "selectionList"
30 #define BRANCH_LIST "branchList"
32 /* Used in all the dialogs as its userData value for OK and Cancel buttons */
35 #define FLAG_RESET 0x33
37 /* Menu button sensitivity defines */
39 #define RENAME (1 << 1)
41 #define DUPLICATE (1 << 3)
43 #define TRASH (1 << 5)
44 #define MODIFY (1 << 6)
45 #define CHANGEDIR (1 << 7)
46 #define PREFERENCES (1 << 8)
47 #define FILTER (1 << 9)
48 #define FIND (1 << 10)
49 #define CREATE_DIR (1 << 11)
50 #define CREATE_FILE (1 << 12)
51 #define SETTINGS (1 << 13)
52 #define PUTBACK (1 << 14)
53 #define PUT_ON_DESKTOP (1 << 15)
54 #define CLEAN_UP (1 << 16)
55 #define MOVE_UP (1 << 17)
56 #define HOME (1 << 18)
57 #define CHANGE_DIR (1 << 19)
58 #define TERMINAL (1 << 20)
59 /* CLEAN_UP_OP is not really a menu state.
60 It's a flag to let GetFileData in FileMgr.c (call when the directory
61 is being reread) not to reload icon positions from the .!dt<userid> file.
63 #define CLEAN_UP_OP (1 << 21)
68 #define NOT_DESKTOP_DIR 2
70 #define TRASH_DIRECTORY 4
72 /* the number of columns standard in the fast change to text widget */
73 #define FAST_CHANGE_COLUMNS 35
75 /* Forward structure pointer declaration */
76 typedef struct _ObjectPosition * ObjectPtr;
78 /* Structure for containing the data for 1 file */
80 typedef struct _FileData
82 struct _FileData * next;
83 char * file_name; /* name of the file */
84 char * action_name; /* if it is an Action, the LABEL name */
85 unsigned char physical_type; /* file, directory, device, pipe, ... */
86 char * logical_type; /* data type from data typing db */
87 int errnum; /* error code */
88 struct stat stat; /* file status */
89 char * link; /* value of symbolic link */
90 char * final_link; /* last of a chain of symbolic links */
91 Boolean is_subdir; /* directory other than "." or ".." */
92 Boolean is_broken; /* broken link */
95 typedef struct _FileData2
97 struct _FileData2 * next;
98 short file_name; /* name of the file */
99 short action_name; /* if it is an Action, the LABEL name */
100 unsigned char physical_type; /* file, directory, device, pipe, ... */
101 short logical_type; /* data type from data typing db */
102 int errnum; /* error code */
103 struct stat stat; /* file status */
104 short link; /* value of symbolic link */
105 short final_link; /* last of a chain of symbolic links */
106 Boolean is_subdir; /* directory other than "." or ".." */
107 Boolean is_broken; /* broken link */
112 /* position info read from the position info file */
122 /* tree branch expansion states */
124 tsNotRead, /* directory not yet read */
125 tsError, /* error reading directory */
126 tsReading, /* directory currently being read for the first time */
127 tsNone, /* no contents shown */
128 tsDirs, /* only sub directories shown */
129 tsAll /* all contents shown */
132 typedef struct _FileViewData
134 XtPointer directory_set;
135 FileData * file_data;
136 struct _FileViewData *parent; /* ptr to dir containing this entry */
137 struct _FileViewData *next; /* ptr to next entry in the same dir */
138 struct _FileViewData *desc; /* if this is a dir: list of entries */
139 Boolean filtered; /* True if file is filtered */
140 Boolean selected; /* True if file is selected */
141 Boolean displayed; /* False if filtered or collapsed tree branch*/
142 TreeShow ts; /* how much to show in tree mode */
143 int ndir; /* no of sub directories */
144 int nfile; /* no of non-dir files */
145 int nnew; /* no of new files */
146 Widget widget; /* icon gadget for this entry */
147 Widget treebtn; /* button gadget for tree branch expand */
148 Boolean need_update; /* False until widget created and up-to-date */
149 Boolean registered; /* True if drop zone registered */
150 Position x, y; /* bottom left corner of icon gadget */
151 char *label; /* icon label string */
152 long icon_mtime; /* modified time of instance icon */
153 ObjectPtr position_info;
157 /* Structure for containing a set of directories */
162 FileViewData * sub_root; /* root of the sub-tree */
164 FileViewData ** file_view_data;
165 FileViewData ** order_list;
166 int filtered_file_count;
167 int invisible_file_count;
168 XtPointer file_mgr_data;
172 /* Structure for containing desktop object position information */
174 typedef struct _ObjectPosition {
181 FileViewData * file_view_data;
186 /* External definitions for the file manager dialog class */
188 extern DialogClass * fileMgrClass;
192 not_busy = 0, /* not busy */
193 busy_readdir, /* busy reading directory */
194 initiating_readdir /* inside call to ReadDir */
199 /* first 5 fields must be identical to DialogInstanceData struct */
210 unsigned char show_type; /* single directory or directory tree? */
211 unsigned char tree_files; /* show only subdirs or files as well? */
212 short tree_preread_level; /* how many levels to pre-read */
213 short tree_show_level; /* how many levels to show initially */
218 char * current_directory;
221 unsigned char view; /* current view */
222 unsigned char view_single; /* view for singlge directory */
223 unsigned char view_tree; /* view for tree mode */
224 unsigned char order; /* sort order */
225 unsigned char direction; /* sort direction */
226 unsigned char positionEnabled; /* random positioning vs sorted grid */
229 char * restricted_directory;
237 DirectorySet ** directory_set;
238 FileViewData * tree_root; /* root of the tree */
240 FileViewData * renaming;
242 FileViewData ** selection_list;
243 char ** selection_table;
244 int selected_file_count;
246 Boolean show_iconic_path;
247 Boolean show_current_dir;
248 Boolean show_status_line;
249 Boolean fast_cd_enabled;
250 Boolean show_hid_enabled;
253 XtIntervalId msg_timer_id;
256 XFontStruct * cd_font;
258 XmFontType cd_fonttype;
263 GC tree_solid_thin_gc;
264 GC tree_solid_thick_gc;
265 GC tree_dash_thin_gc;
266 GC tree_dash_thick_gc;
268 XtPointer file_mgr_rec;
269 FileViewData * popup_menu_icon;
270 FileViewData * drag_file_view_data;
273 DialogData * attribute;
274 DialogData * change_dir;
275 DialogData * preferences;
276 DialogData * filter_active;
277 DialogData * filter_edit;
278 DialogData ** attr_dialog_list;
279 int attr_dialog_count;
280 DialogData ** secondaryHelpDialogList;
281 int secondaryHelpDialogCount;
282 DialogData * primaryHelpDialog;
284 ObjectPosition ** object_positions;
286 Dimension grid_height;
287 Dimension grid_width;
289 /* When user creates new file or directory, we want to store
290 away the new file info so we can scroll to it later.
292 char * scrollToThisFile;
293 char * scrollToThisDirectory;
295 XtPointer layout_data;
297 } FileMgrData, * FileMgrDataPtr;
306 Widget header_separator;
307 Widget iconic_path_da;
308 Widget current_directory_frame;
309 Widget current_directory_drop;
310 Widget current_directory_icon;
311 Widget current_directory;
312 Widget current_directory_text;
314 Widget scroll_window;
315 Widget horizontal_scroll_bar;
316 Widget vertical_scroll_bar;
320 Widget directoryBarBtn;
321 Dimension iconic_path_width;
322 char * action_pane_file_type;
323 unsigned int menuStates;
325 Widget create_directoryBtn_child;
326 Widget create_dataBtn_child;
327 Widget findBtn_child;
328 Widget change_directoryBtn_child;
329 Widget preferencesBtn_child;
330 Widget defaultEnvBtn_child;
331 Widget filterBtn_child;
336 char * action_pane_file_type;
341 Widget trash_objPopup[2];
342 Widget action_separator;
347 Widget dialog_widget;
349 Widget dir_text_widget;
350 Widget file_text_widget;
351 Widget file_type_widget;
357 int original_physical_type;
358 char * original_logical_type;
360 char * directory_name;
363 FileMgrRec * file_mgr_rec;
364 char * previous_file_type;
365 FileMgrData * file_mgr_data;
366 } DialogCallbackStruct;
368 /* Local structure used for passing callback data */
373 DialogCallbackStruct *call_struct;
375 unsigned int btnMask;
383 DialogCallbackStruct *call_struct;
385 unsigned int btnMask;
388 /* data for doing icon update and layout */
391 /* ordered list of all files */
392 FileViewData ** order_list;
395 /* icon layout parameters */
398 Dimension pixmap_width;
399 Dimension pixmap_height;
400 Dimension char_width;
404 unsigned char alignment;
405 unsigned char pixmap_position;
418 /* widgets to be re-used */
421 Widget *next_icon_to_use;
422 Widget *next_btn_to_use;
423 Widget dup_icon_widget;
427 /* DisplayWorkProc */
428 XtWorkProcId work_id;
432 Boolean visible_done;
441 #define FM_POPUP_CHILDREN 17
442 #define FM_POPUP_CHILDREN_NA 15
446 #define OBJ_BTNS_NA 4
447 #define TRASH_OBJ_BTNS 2
449 #define BTN_PROPERTIES 0
451 /* white space buttons */
453 #define BTN_CLEANUP 2
454 #define BTN_SELECTALL 3
455 #define BTN_UNSELECTALL 4
456 #define BTN_SHOWHIDDEN 5
463 /* trash object buttons */
464 #define BTN_RESTORE 0
467 #endif /* _FileMgr_h */
468 /* DON'T ADD ANYTHING AFTER THIS #endif */