home *** CD-ROM | disk | FTP | other *** search
- /*
- * This sourcecode is part of FileSpy, a logfile observing utility.
- * Copyright (C) 1996 Felix Rauch
- *
- * 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.
- *
- * Notice that this program may not be possessed, used, copied,
- * distributed or modified by people having to do with nuclear
- * weapons. See the file CONDITIONS for details.
- *
- * 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.
- *
- * To contact the original author, try:
- * e-mail: Felix.Rauch@nice.ch
- * Traditional mail: Felix Rauch
- * Sempacherstrasse 33
- * 8032 Zurich
- * Switzerland
- */
-
- #import <appkit/appkit.h>
-
- #import <sys/types.h>
- #ifndef pid_t
- typedef int pid_t; // this should be defined in <sys/types.h>!?!
- #endif
- #import <sys/dir.h>
- #import <sys/stat.h>
- #import <errno.h>
- #import <stdio.h>
- #import <string.h>
- #import <time.h> // for timestamp-thing
-
- #ifdef DEBUG
- #include <assert.h>
- #endif
-
- #import "Document.h"
- #import "Controller.h"
-
- #define MAXFILENAMELENGHT MAXNAMLEN
- #define RADIO_ENTIRE 0
- #define RADIO_NEW 1
- #define FILETYPE_NOTHING 0
- #define FILETYPE_FILE 1
- #define FILETYPE_DIR 2
-
- typedef struct nodedesc {
- struct nodedesc *next;
- char *string;
- } nodedesc;
- typedef nodedesc *node;
-
- enum superFilenameState {ONCE, EACHLINE, NONE};
-
- @interface SpyTextFieldCell:TextFieldCell
- {
- long int lastFileLenght, fileLenght;
- BOOL fileex, textloaded, permissionOK, dirloaded;
- id myText, myWindow, myScrollView, myFont;
- id myDoc;
- id myDelegate;
- NXRect textRect, windowRect, scrollViewRect;
- int fileMode, fileType;
- BOOL autoPopUp, beepOnChange, logToSuperlog, useFilter;
- BOOL dontCopySuperlog; // don't copy to superlog on startup
- BOOL timeStamp; // print timestamp in log or not
- unsigned int superCopyFilename; // whether filename should be copied in superlog
- int maxLines; // maxLines for windows, 0 if not active
- id dirStore;
- time_t mtime, lastmtime;
- short int firstTime;
- NXColor color;
- BOOL zeroFlag; // to avoid unnecessary 'File <...> reduced size to 0 bytes' msg
- unsigned short int spytype; // spy for contents and/or existence?
- BOOL oldfileex; // did the file exist last time we checked?
- BOOL oldpermissionOK; // was the permission ok when we last checked?
- BOOL showTime; // show duration of change in ExistenceLog
- id exMatrix, exCell; // existenceMatrix, existenceTextFieldCell
- id EImage;
- unsigned int nrEINVAL; // for nfs-errors
- }
-
- + (void)setSharedTmpList:newList;
- + sharedTmpList;
- - init;
- - delete;
- - free;
- - (long int)lastFileLenght;
- - setLastFileLenght:(long int)lenght;
- - (BOOL)fileExists;
- - updateFile;
- - updateText;
- - readText;
- - readDir;
- - addText:(char *)givenString;
- - appendText:(char *)string unfilteredString:(char *)ufString didChange:(BOOL)changed;
- - (BOOL)changedState;
- - displayWindow;
- - moveWindowTo:(NXCoord)x:(NXCoord)y;
- - setFileMode:(int)mode;
- - (int)fileMode;
- - setAutoPopUp:(BOOL)state;
- - (BOOL)autoPopUp;
- - window;
- - setMyDelegate:sender;
- - myDelegate;
- - setBeepOnChange:(BOOL)state;
- - (BOOL)beepOnChange;
- - setLogToSuperlog:(BOOL)state;
- - (BOOL)logToSuperlog;
- - setUseFilter:(BOOL)state;
- - (BOOL)useFilter;
- - setDontCopy:(BOOL)state; // don't copy to superlog on startup
- - (BOOL)dontCopy;
- - setSuperCopyFilename:(unsigned int)state;
- - (unsigned int)superCopyFilename;
- - setTimeStamp:(BOOL)state;
- - (BOOL)timeStamp;
- - setSpytype:(unsigned short int)type;
- - (unsigned short int)spytype;
- - updateExistence;
- - clearBuffer:sender;
- - contentChanged;
- - fileRemoved;
- - windowDidBecomeKey:sender;
- - text;
- - (NXColor)color;
- - setColor:(NXColor)color;
- - setSpyFont:newFont; // do NOT use setFont:! (method inherited from a superclass)
- - spyFont; // do NOT use font!
- - addTimeStamp:(char **)string; // insert timeStamp on each line of string
- - setMaxLines:(int)lines; // set the max. lines per window
- - shortText; // make text shorter
- - (BOOL)permissionOk;
- - setShowTime:(BOOL)state;
- - (BOOL)showTime;
- - (BOOL)askUpdateTime;
-
- // overriden methods
- - setStringValue:(const char*)str;
- // overriden methods for special drawing
- - drawInside:(const NXRect *)cellFrame inView:controlView;
- - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
-
- @end
-