home *** CD-ROM | disk | FTP | other *** search
- /* panel.h -- the data structures and function prototypes used in panel.c. */
-
- /* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
-
- 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, 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. */
-
- /* Written by Tudor Hulubei and Andrei Pitis. */
-
-
- #ifndef _GIT_PANEL_H
- #define _GIT_PANEL_H
-
-
- #include <sys/types.h>
- #include <limits.h>
- #include <stddef.h>
-
-
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
-
- #if HAVE_DIRENT_H
- #include <dirent.h>
- #define NAMLEN(dirent) strlen((dirent)->d_name)
- #else /* !HAVE_DIRENT_H */
- #define dirent direct
- #define NAMLEN(dirent) (dirent)->d_namlen
- #ifdef HAVE_SYS_NDIR_H
- #include <sys/ndir.h>
- #endif /* HAVE_SYS_NDIR_H */
- #ifdef HAVE_SYS_DIR_H
- #include <sys/dir.h>
- #endif /* HAVE_SYS_DIR_H */
- #ifdef HAVE_NDIR_H
- #include <ndir.h>
- #endif /* HAVE_NDIR_H */
- #endif /* !HAVE_DIRENT_H */
-
- #include "stdc.h"
- #include "xstack.h"
-
-
- /* Panel actions. */
- #define act_NOACTION 0
- #define act_ENTER 1
- #define act_COPY 2
- #define act_DELETE 3
- #define act_SELECT 4
- #define act_SELECT_ALL 5
- #define act_UNSELECT_ALL 6
- #define act_TOGGLE 7
-
- #define act_DISPLAY_NEXT_MODE 8
- #define act_DISPLAY_OWNER_GROUP 9
- #define act_DISPLAY_DATE_TIME 10
- #define act_DISPLAY_SIZE 11
- #define act_DISPLAY_MODE 12
- #define act_DISPLAY_FULL_NAME 13
- #define act_DISPLAY_ALL 14
-
- #define act_SORT_NEXT_METHOD 15
- #define act_SORT_BY_NAME 16
- #define act_SORT_BY_EXTENSION 17
- #define act_SORT_BY_SIZE 18
- #define act_SORT_BY_DATE 19
- #define act_SORT_BY_MODE 20
- #define act_SORT_BY_OWNER_ID 21
- #define act_SORT_BY_GROUP_ID 22
- #define act_SORT_BY_OWNER_NAME 23
- #define act_SORT_BY_GROUP_NAME 24
-
- #define act_MKDIR 25
- #define act_MOVE 26
- #define act_UP 27
- #define act_DOWN 28
- #define act_PGUP 29
- #define act_PGDOWN 30
- #define act_HOME 31
- #define act_END 32
- #define act_CHDIR 33
- #define act_REFRESH 34
- #define act_SWITCH 35
-
- #define act_PATTERN_SELECT 36
- #define act_PATTERN_UNSELECT 37
-
- #define act_SET_SCROLL_STEP 38
-
- #define act_ISEARCH_BEGIN 39
- #define act_ISEARCH_BACKWARD 40
- #define act_ISEARCH_FORWARD 41
- #define act_ISEARCH_END 42
-
-
- /* File sort methods. */
- #define SORT_BY_NAME 0
- #define SORT_BY_EXTENSION 1
- #define SORT_BY_SIZE 2
- #define SORT_BY_DATE 3
- #define SORT_BY_MODE 4
- #define SORT_BY_OWNER_ID 5
- #define SORT_BY_GROUP_ID 6
- #define SORT_BY_OWNER_NAME 7
- #define SORT_BY_GROUP_NAME 8
-
-
- /* File display modes. */
- #define DISPLAY_OWNER_GROUP 0
- #define DISPLAY_DATE_TIME 1
- #define DISPLAY_SIZE 2
- #define DISPLAY_MODE 3
- #define DISPLAY_FULL_NAME 4
- #define DISPLAY_ALL 5
-
-
- /* File types. */
- #define DIR_ENTRY 0
- #define FILE_ENTRY 1
- #define SYMLINK_ENTRY 2
- #define FIFO_ENTRY 3
- #define SOCKET_ENTRY 4
-
-
- #define ACTIVE_PANEL_MARKER '>'
- #define INACTIVE_PANEL_MARKER '*'
-
-
- /* Internal structure, used by the push/pop functions to keep track of
- isearched entries. */
- typedef struct
- {
- int entry; /* the panel entry number. */
- size_t length; /* isearch_length at match time. See below. */
- } isearch_t;
-
-
- /* Structure used to pass isearch-specific parameters to panel_action. */
- typedef struct
- {
- int action; /* the action to be performed. */
- char *string; /* the current isearched string. */
- size_t length; /* the new length of the isearched string. */
- } isearch_aux_t;
-
-
- typedef struct
- {
- char *name;
- size_t size;
- mode_t mode;
- uid_t uid;
- gid_t gid;
- time_t mtime;
- char *owner;
- char *group;
- char date[16];
- unsigned selected : 1,
- type : 4,
- executable : 1;
- } dir_entry_t;
-
-
- typedef struct
- {
- DIR *dir; /* the current directory. */
- window_t *window; /* the panel window. */
- #ifdef HAVE_LINUX
- int msdosfs; /* the current panel directory resides
- on a MSDOG direrctory. Argh... */
- #endif /* HAVE_LINUX */
- int on_screen; /* # of files on the screen. */
- char *path; /* the current path. */
- char *temp; /* a temporary string. */
- int current_entry; /* the current file entry #. */
- int first_on_screen; /* the # of the entry displayed in the
- panel's first line. */
- size_t maxname; /* don't bother :-) */
- dir_entry_t *dir_entry; /* a record for each file in the
- current directory. */
- size_t isearch_length; /* the current length of the string
- used in incremental search. */
- xstack_t *isearch_stack; /* the isearch stack. */
- int last_index; /* used in the iterator. */
- int multiple_files; /* a flag used in the iterator. */
- int lines, columns; /* the panel is that big. */
- int x, y; /* the panel's position. */
- int entries; /* the # of files/directories. */
- char focus; /* the panel's focus flag. */
- char visible; /* the panel's visible flag. */
- char wrapped_isearch; /* the wrapped isearch_flag. */
- size_t selected_files; /* the # of selected files. */
- size_t pathlen; /* the path length. */
- int display_mode; /* the current display mode. */
- int sort_method; /* the current sort method. */
- int scroll_step; /* the scroll step. */
- int chkdest; /* don't bother :-) */
- } panel_t;
-
-
- extern panel_t *panel_init __P((int, int, int, int, char *));
- extern void panel_end __P((panel_t *));
- extern void panel_init_iterator __P((panel_t *));
- extern void panel_select_all __P((panel_t *));
- extern void panel_unselect_all __P((panel_t *));
- extern int panel_get_next __P((panel_t *));
- extern void panel_set_focus __P((panel_t *, int));
- extern void panel_no_optimizations __P((panel_t *));
- extern int panel_action __P((panel_t *, int, panel_t *, void *, int));
- extern char *panel_get_path __P((panel_t *));
- extern char *panel_get_current_file_name __P((panel_t *));
- extern uid_t panel_get_current_file_uid __P((panel_t *));
- extern gid_t panel_get_current_file_gid __P((panel_t *));
- extern mode_t panel_get_current_file_mode __P((panel_t *));
- extern int panel_get_current_file_type __P((panel_t *));
- extern void panel_resize __P((panel_t *, int, int, int, int));
- extern void panel_activate __P((panel_t *));
- extern void panel_deactivate __P((panel_t *));
- extern void panel_update __P((panel_t *));
- extern void panel_set_wrapped_isearch_flag __P((panel_t *));
-
-
- #endif /* _GIT_PANEL_H */
-