2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: FileMgr.h /main/6 1996/10/07 13:45:03 mustafa $ */
24 /************************************<+>*************************************
25 ****************************************************************************
29 * COMPONENT_NAME: Desktop File Manager
31 * DESCRIPTION: Public include file for the main window of the
34 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
35 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
36 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
37 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
39 ****************************************************************************
40 ************************************<+>*************************************/
45 #include <sys/types.h>
51 #define SELECTION_LIST "selectionList"
52 #define BRANCH_LIST "branchList"
54 /* Used in all the dialogs as its userData value for OK and Cancel buttons */
57 #define FLAG_RESET 0x33
59 /* Menu button sensitivity defines */
61 #define RENAME (1 << 1)
63 #define DUPLICATE (1 << 3)
65 #define TRASH (1 << 5)
66 #define MODIFY (1 << 6)
67 #define CHANGEDIR (1 << 7)
68 #define PREFERENCES (1 << 8)
69 #define FILTER (1 << 9)
70 #define FIND (1 << 10)
71 #define CREATE_DIR (1 << 11)
72 #define CREATE_FILE (1 << 12)
73 #define SETTINGS (1 << 13)
74 #define PUTBACK (1 << 14)
75 #define PUT_ON_DESKTOP (1 << 15)
76 #define CLEAN_UP (1 << 16)
77 #define MOVE_UP (1 << 17)
78 #define HOME (1 << 18)
79 #define CHANGE_DIR (1 << 19)
80 #define TERMINAL (1 << 20)
81 /* CLEAN_UP_OP is not really a menu state.
82 It's a flag to let GetFileData in FileMgr.c (call when the directory
83 is being reread) not to reload icon positions from the .!dt<userid> file.
85 #define CLEAN_UP_OP (1 << 21)
90 #define NOT_DESKTOP_DIR 2
92 #define TRASH_DIRECTORY 4
94 /* the number of columns standard in the fast change to text widget */
95 #define FAST_CHANGE_COLUMNS 35
97 /* Forward structure pointer declaration */
98 typedef struct _ObjectPosition * ObjectPtr;
100 /* Structure for containing the data for 1 file */
102 typedef struct _FileData
104 struct _FileData * next;
105 char * file_name; /* name of the file */
106 char * action_name; /* if it is an Action, the LABEL name */
107 unsigned char physical_type; /* file, directory, device, pipe, ... */
108 char * logical_type; /* data type from data typing db */
109 int errnum; /* error code */
110 struct stat stat; /* file status */
111 char * link; /* value of symbolic link */
112 char * final_link; /* last of a chain of symbolic links */
113 Boolean is_subdir; /* directory other than "." or ".." */
114 Boolean is_broken; /* broken link */
117 typedef struct _FileData2
119 struct _FileData2 * next;
120 short file_name; /* name of the file */
121 short action_name; /* if it is an Action, the LABEL name */
122 unsigned char physical_type; /* file, directory, device, pipe, ... */
123 short logical_type; /* data type from data typing db */
124 int errnum; /* error code */
125 struct stat stat; /* file status */
126 short link; /* value of symbolic link */
127 short final_link; /* last of a chain of symbolic links */
128 Boolean is_subdir; /* directory other than "." or ".." */
129 Boolean is_broken; /* broken link */
134 /* position info read from the position info file */
144 /* tree branch expansion states */
146 tsNotRead, /* directory not yet read */
147 tsError, /* error reading directory */
148 tsReading, /* directory currently being read for the first time */
149 tsNone, /* no contents shown */
150 tsDirs, /* only sub directories shown */
151 tsAll /* all contents shown */
154 typedef struct _FileViewData
156 XtPointer directory_set;
157 FileData * file_data;
158 struct _FileViewData *parent; /* ptr to dir containing this entry */
159 struct _FileViewData *next; /* ptr to next entry in the same dir */
160 struct _FileViewData *desc; /* if this is a dir: list of entries */
161 Boolean filtered; /* True if file is filtered */
162 Boolean selected; /* True if file is selected */
163 Boolean displayed; /* False if filtered or collapsed tree branch*/
164 TreeShow ts; /* how much to show in tree mode */
165 int ndir; /* no of sub directories */
166 int nfile; /* no of non-dir files */
167 int nnew; /* no of new files */
168 Widget widget; /* icon gadget for this entry */
169 Widget treebtn; /* button gadget for tree branch expand */
170 Boolean need_update; /* False until widget created and up-to-date */
171 Boolean registered; /* True if drop zone registered */
172 Position x, y; /* bottom left corner of icon gadget */
173 char *label; /* icon label string */
174 long icon_mtime; /* modified time of instance icon */
175 ObjectPtr position_info;
179 /* Structure for containing a set of directories */
184 FileViewData * sub_root; /* root of the sub-tree */
186 FileViewData ** file_view_data;
187 FileViewData ** order_list;
188 int filtered_file_count;
189 int invisible_file_count;
190 XtPointer file_mgr_data;
194 /* Structure for containing desktop object position information */
196 typedef struct _ObjectPosition {
203 FileViewData * file_view_data;
208 /* External definitions for the file manager dialog class */
210 extern DialogClass * fileMgrClass;
214 not_busy = 0, /* not busy */
215 busy_readdir, /* busy reading directory */
216 initiating_readdir /* inside call to ReadDir */
221 /* first 5 fields must be identical to DialogInstanceData struct */
232 unsigned char show_type; /* single directory or directory tree? */
233 unsigned char tree_files; /* show only subdirs or files as well? */
234 short tree_preread_level; /* how many levels to pre-read */
235 short tree_show_level; /* how many levels to show initially */
240 char * current_directory;
243 unsigned char view; /* current view */
244 unsigned char view_single; /* view for singlge directory */
245 unsigned char view_tree; /* view for tree mode */
246 unsigned char order; /* sort order */
247 unsigned char direction; /* sort direction */
248 unsigned char positionEnabled; /* random positioning vs sorted grid */
251 char * restricted_directory;
259 DirectorySet ** directory_set;
260 FileViewData * tree_root; /* root of the tree */
262 FileViewData * renaming;
264 FileViewData ** selection_list;
265 char ** selection_table;
266 int selected_file_count;
268 Boolean show_iconic_path;
269 Boolean show_current_dir;
270 Boolean show_status_line;
271 Boolean fast_cd_enabled;
272 Boolean show_hid_enabled;
275 XtIntervalId msg_timer_id;
278 XFontStruct * cd_font;
280 XmFontType cd_fonttype;
285 GC tree_solid_thin_gc;
286 GC tree_solid_thick_gc;
287 GC tree_dash_thin_gc;
288 GC tree_dash_thick_gc;
290 XtPointer file_mgr_rec;
291 FileViewData * popup_menu_icon;
292 FileViewData * drag_file_view_data;
295 DialogData * attribute;
296 DialogData * change_dir;
297 DialogData * preferences;
298 DialogData * filter_active;
299 DialogData * filter_edit;
300 DialogData ** attr_dialog_list;
301 int attr_dialog_count;
302 DialogData ** secondaryHelpDialogList;
303 int secondaryHelpDialogCount;
304 DialogData * primaryHelpDialog;
306 ObjectPosition ** object_positions;
308 Dimension grid_height;
309 Dimension grid_width;
311 /* When user creates new file or directory, we want to store
312 away the new file info so we can scroll to it later.
314 char * scrollToThisFile;
315 char * scrollToThisDirectory;
317 XtPointer layout_data;
319 } FileMgrData, * FileMgrDataPtr;
328 Widget header_separator;
329 Widget iconic_path_da;
330 Widget current_directory_frame;
331 Widget current_directory_drop;
332 Widget current_directory_icon;
333 Widget current_directory;
334 Widget current_directory_text;
336 Widget scroll_window;
337 Widget horizontal_scroll_bar;
338 Widget vertical_scroll_bar;
342 Widget directoryBarBtn;
343 Dimension iconic_path_width;
344 char * action_pane_file_type;
345 unsigned int menuStates;
347 Widget create_directoryBtn_child;
348 Widget create_dataBtn_child;
349 Widget findBtn_child;
350 Widget change_directoryBtn_child;
351 Widget preferencesBtn_child;
352 Widget defaultEnvBtn_child;
353 Widget filterBtn_child;
358 char * action_pane_file_type;
363 Widget trash_objPopup[2];
364 Widget action_separator;
369 Widget dialog_widget;
371 Widget dir_text_widget;
372 Widget file_text_widget;
373 Widget file_type_widget;
379 int original_physical_type;
380 char * original_logical_type;
382 char * directory_name;
385 FileMgrRec * file_mgr_rec;
386 char * previous_file_type;
387 FileMgrData * file_mgr_data;
388 } DialogCallbackStruct;
390 /* Local structure used for passing callback data */
395 DialogCallbackStruct *call_struct;
397 unsigned int btnMask;
405 DialogCallbackStruct *call_struct;
407 unsigned int btnMask;
410 /* data for doing icon update and layout */
413 /* ordered list of all files */
414 FileViewData ** order_list;
417 /* icon layout parameters */
420 Dimension pixmap_width;
421 Dimension pixmap_height;
422 Dimension char_width;
426 unsigned char alignment;
427 unsigned char pixmap_position;
440 /* widgets to be re-used */
443 Widget *next_icon_to_use;
444 Widget *next_btn_to_use;
445 Widget dup_icon_widget;
449 /* DisplayWorkProc */
450 XtWorkProcId work_id;
454 Boolean visible_done;
463 #define FM_POPUP_CHILDREN 17
464 #define FM_POPUP_CHILDREN_NA 15
468 #define OBJ_BTNS_NA 4
469 #define TRASH_OBJ_BTNS 2
471 #define BTN_PROPERTIES 0
473 /* white space buttons */
475 #define BTN_CLEANUP 2
476 #define BTN_SELECTALL 3
477 #define BTN_UNSELECTALL 4
478 #define BTN_SHOWHIDDEN 5
485 /* trash object buttons */
486 #define BTN_RESTORE 0
489 #endif /* _FileMgr_h */
490 /* DON'T ADD ANYTHING AFTER THIS #endif */