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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
|
#ifndef __DATA_TREE_H__
#define __DATA_TREE_H__
/*
* vi:ts=4:sw=4:
*
* Project : "Linux Explorer"
* Copyright 1996. All Rights Reserved.
*
* $RCSfile: data_tree.h,v $
*
* $Revision: 1.3 $
*
* $Author: ruben $
*
* $Locker: $
*
* $State: Exp $
*
*
* COPYRIGHT
* =========
*
*
* 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.
*
* OVERVIEW
* ========
*
* $Log: data_tree.h,v $
* Revision 1.3 1997/06/09 12:59:23 ruben
* switched rcs commands again I think...
* compiled with -Wall -Werror, fixed bugs and potential bugs
* fixed Mister Data bugs
*
* Revision 1.2 1997/05/27 09:02:10 ruben
* reworked include strategy for developers ease
* also some indent done
*
* Revision 1.2 1997/05/27 09:02:10 ruben
* reworked include strategy for developers ease
* also some indent done
*
* Revision 1.1 1997/03/28 17:48:16 ruben
* Initial revision
*
*/
#include <qobject.h>
#include <qwindow.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qframe.h>
#include <qscrbar.h>
#include <qpushbt.h>
#include <qtablevw.h>
#include <qapp.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include "vars.h"
//>------ define node types
#define NODE_CHILD 0
#define NODE_NEXT 1
//>------ size defines
#define NODE_WIDTH 18
#define NODE_OFFSET 22
#define NODE_HEIGHT 18 // total height of icon
#define BUTTON_HEIGHT 16
#define EXP_SIZE 9 // size of the +/- icon
#define CONN_SIZE 8 // length of the connection line
#define X_BORDER 5
#define Y_BORDER 5
#define Y_DISTANCE 5
//>------ defines if the node should display all that lies beneath
#define NODE_CONTRACTED 0
#define NODE_EXPANDED 1
#define ND_PLUS 0
#define ND_MIN 1
#define ND_NUL 2
#define ND_NL1 30
#define ND_NL2 31
//>------ node types
#define NODE_EXPLORER 3
#define NODE_DESKTOP 4
#define NODE_FLOPPY 5
#define NODE_DISK 6
#define NODE_CDROM 7
#define NODE_FILECLOSED 8
#define NODE_FILEOPEN 9
#define NODE_GENERAL 10
#define NODE_BOGUS 11
#define NODE_TEXT 12
#define NODE_HTML 13
#define NODE_LINK 14
#define NODE_LINK_DSBL 15
#define NODE_CONSOLE 16
#define NODE_SOCKET 17
#define NODE_DIRLINK 18
#define ICON_01 19
#define ICON_02 20
#define ICON_03 21
#define ICON_04 22
#define ICON_05 23
#define ICON_06 24
#define ICON_07 25
#define ICON_08 26
#define ICON_09 27
#define ICON_10 28
#define ICON_11 29
#define ICON_12 30
#define NODE_PLUGIN 32
//>------- file types
#define NODE_ISFILE 0
#define NODE_ISDIR 1
//>------- ERROR defines
#define NOERROR 0
#define OPERROR 1
extern int x_offset; // offset caused by last icon placing
extern int y_offset; // offset caused by last icon placing
extern int y_off_left; // offset caused by scrollbar movement
extern int y_off_right; // offset caused by scrollbar movement
extern int nr_x_direction;
extern int nr_x_temp;
extern char compose_dir[];
extern char operation_busy;
class FileTreeNode : public QObject
{
Q_OBJECT
public:
FileTreeNode(FileTreeNode *, char, char, char, char *);
~FileTreeNode (void);
void remove_tree (void);
void demode(register unsigned, register char *);
void show_node_tree (QPaintEvent *, QWidget *, int, char);
void show_node_tree_target (QPaintEvent *, QWidget *, int);
void show_node_tree_selected(QPaintEvent *, QWidget *, int, char);
void show_node_list (QPaintEvent *, QWidget *, int, char);
void show_node_list_target (QPaintEvent *, QWidget *, int, char);
void show_node_list_selected(QPaintEvent *, QWidget *, int, char);
void show_size_list (QPaintEvent *, QWidget *, int);
void show_rights_list (QPaintEvent *, QWidget *, int);
void select_node(char);
char node_selected(void);
char is_node_expandable(void);
FileTreeNode *find_expanding_node(QWidget *, int, int);
FileTreeNode *find_selected_node_tree(int, int);
void find_selected_node_tree_m(int, int, int, int);
FileTreeNode *find_selected_node_list(int, int);
void find_selected_node_list_m(int, int, int, int);
void deselect_nodes();
// >---------- atomic functions
int get_x();
int get_y();
char *get_node_name();
char get_node_type();
char get_file_type();
char get_expandable();
char has_access(void);
char is_expanded();
char get_op_target (void);
void set_op_target (char);
void remove_targets (void);
void set_target(char);
void set_child(FileTreeNode *);
void set_next(FileTreeNode *);
void set_expandable(char);
void set_expanded(char);
void recalc_tree(void);
void recalc_list(void);
unsigned long get_rights (void);
FileTreeNode *get_target (void);
FileTreeNode *get_current(void);
FileTreeNode *get_next(void);
FileTreeNode *get_tree_top(void);
FileTreeNode *get_parent(void);
// >---------- elaborate functions
void set_file_info(const char *, unsigned long, off_t, char, char);
void set_file_rights (unsigned long);
char compose_directory();
char copy_tree_op ();
char move_tree_op ();
char remove_tree_op ();
/*
* FileTreeNode *path2node (char *);
* void node2path (void);
*/
private:
char op_target; // target when used to determen copy/move
unsigned int node_id;
char node_type; // icon type
char selected; // true / false
char node_status; // expanded / contracted
char is_expandable; // can the current directory be traversed
char target; // used when trying to expand directories
int x_place,
y_place;
FileTreeNode *parent;
FileTreeNode *last;
FileTreeNode *next;
FileTreeNode *tree_top;
FileTreeNode *tree_node;
char *node_name;
// >----------- Additional vars for file info
char file_type; // see defines
unsigned long file_prot; // rwx bits
off_t file_size; // in bytes
signals:
void create_directory (char *,unsigned long);
void read_directory (FileTreeNode *,char *);
void copy_a_file (char *,char *);
void remove_a_file (char *);
void remove_a_dir (char *);
};
extern FileTreeNode *root_node; // absolute root node of the tree
#endif // __DATA_TREE_H__
|