Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

htapp.h

Go to the documentation of this file.
00001 /*
00002  *      HT Editor
00003  *      htapp.h
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifndef __HTAPP_H__
00022 #define __HTAPP_H__
00023 
00024 #include "htctrl.h"
00025 #include "htdialog.h"
00026 #include "htformat.h"
00027 
00028 // file open modes
00029 
00030 #define FOM_AUTO                                        0
00031 #define FOM_BIN                                 1
00032 #define FOM_TEXT                                        2
00033 
00034 //
00035 #define VIEWERGROUP_NAME                                "viewergroup"
00036 
00037 /*
00038  *      CLASS ht_status
00039  */
00040 
00041 #define STATUS_DEFAULT_FORMAT "%a %L %t %d"
00042 #define STATUS_ESCAPE '%'
00043 #define STATUS_ANALY_ACTIVE 'a'
00044 #define STATUS_ANALY_LINES 'L'
00045 #define STATUS_TIME 't'
00046 #define STATUS_DATE 'd'
00047 #define STATUS_WORKBUFLEN 80
00048 
00049 /*
00050  *      CLASS ht_status
00051  */
00052 
00053 class ht_status: public ht_view {
00054 protected:
00055         int             idle_count;
00056         char            *format;
00057         char            workbuf[STATUS_WORKBUFLEN];
00058         int             clear_len;
00059         int             analy_ani;
00060 public:
00061                         void init(bounds *b);
00062         virtual void done();
00063         virtual void draw();
00064         virtual void handlemsg(htmsg *msg);
00065         virtual bool idle();
00066 private:
00067                         void render();
00068         virtual char *defaultpalette();
00069 };
00070 
00071 /*
00072  *      CLASS ht_keyline
00073  */
00074 
00075 class ht_keyline: public ht_view {
00076 public:
00077                         void init(bounds *b);
00078         virtual void done();
00079 /* overwritten */
00080         virtual void draw();
00081         virtual void handlemsg(htmsg *msg);
00082         virtual char *defaultpalette();
00083 };
00084 
00085 /*
00086  *      CLASS ht_desktop
00087  */
00088 
00089 class ht_desktop: public ht_view {
00090 public:
00091                         void init(bounds *b);
00092         virtual void done();
00093 /* overwritten */
00094         virtual void draw();
00095         virtual char *defaultpalette();
00096 };
00097 
00098 /*
00099  *      CLASS ht_logviewer
00100  */
00101 
00102 class ht_log_msg: public Object {
00103 public:
00104         vcp color;
00105         char *msg;
00106         ht_log_msg(vcp Color, char *Msg);
00107         ~ht_log_msg();
00108 };
00109 
00110 typedef unsigned int LogColor;
00111 
00112 class ht_log: public ht_clist {
00113 protected:
00114         UINT maxlinecount;
00115 
00116         void deletefirstline();
00117         void    insertline(LogColor c, char *line);
00118 public:
00119                         void init(compare_keys_func_ptr compare_keys = 0);
00120 /* new */
00121                         void log(LogColor c, char *line);
00122 };
00123 
00124 class ht_logviewer: public ht_viewer {
00125 private:
00126         ht_log *lines;
00127         bool own_lines;
00128         int ofs, xofs;
00129         ht_window *window;
00130 
00131 /* new */
00132         int cursor_up(int n);
00133         int cursor_down(int n);
00134         bool get_vscrollbar_pos(int *pstart, int *psize);
00135         void update();
00136 public:
00137                         void init(bounds *b, ht_window *window, ht_log *log, bool own_log);
00138         virtual void done();
00139 /* overwritten */
00140         virtual void draw();
00141         virtual void handlemsg(htmsg *msg);
00142 };
00143 
00144 /*
00145  *      CLASS ht_vstate_history_entry
00146  */
00147 
00148 class ht_vstate_history_entry: public Object {
00149 public:
00150         Object *data;
00151         ht_view *view;
00152 
00153         ht_vstate_history_entry(Object *data, ht_view *view);
00154         ~ht_vstate_history_entry();
00155 };
00156 
00157 /*
00158  *      CLASS ht_file_window
00159  */
00160 
00161 class ht_file_window: public ht_window {
00162 protected:
00163         ht_list *vstate_history;
00164         int vstate_history_pos;
00165         
00166                         void add_vstate_history(ht_vstate_history_entry *e);
00167 public:
00168         ht_streamfile   *file;
00169 
00170                         void    init(bounds *b, char *desc, UINT framestyle, UINT number, ht_streamfile *file);
00171         virtual void done();
00172 /* overwritten */
00173         virtual void handlemsg(htmsg *msg);
00174 };
00175 
00176 /*
00177  *      CLASS ht_project
00178  */
00179 
00180 class ht_project: public ht_sorted_list {
00181 protected:
00182         char *filename;
00183 public:
00184                    void init(char *filename);
00185         virtual void done();
00186 /* overwritten */
00187         virtual int     load(ht_object_stream *s);
00188         virtual OBJECT_ID object_id() const;
00189         virtual void    store(ht_object_stream *s);
00190 /* new */
00191                    char *get_filename();
00192 };
00193 
00194 /*
00195  *      CLASS ht_project_item
00196  */
00197 
00198 class ht_project_item: public Object {
00199 protected:
00200         char *filename;
00201         char *path;
00202 public:
00203                    void init(char *filename, char *path);
00204         virtual void done();
00205 /* overwritten */
00206         virtual int     load(ht_object_stream *s);
00207         virtual OBJECT_ID object_id() const;
00208         virtual void    store(ht_object_stream *s);
00209 /* new */
00210         const char *get_filename();
00211         const char *get_path();
00212 };
00213 
00214 /*
00215  *      CLASS ht_project_listbox
00216  */
00217 
00218 class ht_project_listbox: public ht_listbox {
00219 protected:
00220         ht_project *project;
00221         UINT colwidths[4];
00222         
00223 public:
00224                         void            init(bounds *b, ht_project *project);
00225                         
00226         virtual int             calcCount();
00227         virtual void            draw();
00228         virtual void *  getFirst();
00229         virtual void *  getLast();
00230         virtual void *  getNext(void *entry);
00231         virtual void *  getPrev(void *entry);
00232         virtual char *  getStr(int col, void *entry);
00233         virtual void            handlemsg(htmsg *msg);
00234         virtual int             numColumns();
00235         virtual void *  quickfind(char *s);
00236         virtual char *  quickfindCompletition(char *s);
00237         virtual bool            selectEntry(void *entry);
00238 /* new */
00239                         char *  func(UINT i, bool execute);
00240                         void            set_project(ht_project *project);
00241 };
00242 
00243 /*
00244  *      CLASS ht_project_window
00245  */
00246 
00247 class ht_project_window: public ht_window {
00248 protected:
00249         ht_project **project;
00250         ht_project_listbox *plb;
00251         char wtitle[128];
00252 public:
00253 
00254                         void    init(bounds *b, char *desc, UINT framestyle, UINT number, ht_project **project);
00255         virtual void done();
00256 /* overwritten */
00257         virtual void handlemsg(htmsg *msg);
00258 };
00259 
00260 /*
00261  *      CLASS ht_app_window_entry
00262  */
00263 
00264 #define AWT_LOG         0
00265 #define AWT_CLIPBOARD   1
00266 #define AWT_HELP                2
00267 #define AWT_FILE                3
00268 #define AWT_OFM         4
00269 #define AWT_PROJECT             5
00270 #define AWT_TERM                6
00271 
00272 class ht_app_window_entry: public Object {
00273 public:
00274         UINT type;
00275         ht_window *window;
00276         bool minimized;
00277         UINT number;
00278         bool isfile;
00279         ht_layer_streamfile *layer;
00280 
00281         ht_app_window_entry(ht_window *window, UINT number, UINT type, bool minimized, bool isfile, ht_layer_streamfile *layer);
00282         ~ht_app_window_entry();
00283 };
00284 
00285 /*
00286  *      CLASS ht_app
00287  */
00288 
00289 class ht_app: public ht_dialog {
00290 protected:
00291         ht_sorted_list *windows;
00292 
00293         ht_list *syntax_lexers;
00294 
00295         ht_keyline *keyline;
00296         ht_desktop *desktop;
00297 
00298         ht_group *battlefield;
00299         
00300         bool exit_program;
00301 
00302 /* new */
00303                         ht_window *create_window_file_bin(bounds *b, ht_layer_streamfile *file, char *title, bool isfile);
00304                         ht_window *create_window_file_text(bounds *b, ht_layer_streamfile *file, char *title, bool isfile);
00305                         
00306                         bool accept_close_all_windows();
00307                         UINT find_free_window_number();
00308                         
00309                         UINT get_window_number(ht_window *window);
00310                         UINT get_window_listindex(ht_window *window);
00311 
00312                         void get_stdbounds_file(bounds *b);
00313                         void get_stdbounds_tool(bounds *b);
00314                         
00315                         int popup_view_list_dump(ht_view *view, ht_text_listbox *listbox, ht_list *structure, int depth, int *currenti, ht_view *currentv);
00316 /* overwritten */
00317         virtual char *defaultpalette();
00318         virtual char *defaultpaletteclass();
00319 public:
00320         ht_view *menu;
00321                 void insert_window(ht_window *window, UINT type, bool minimized, bool isfile, ht_layer_streamfile *layer);
00322 
00323                 void init(bounds *b);
00324         virtual void done();
00325 /* overwritten */
00326         virtual void draw();
00327         virtual int focus(ht_view *view);
00328         virtual char *func(UINT i, bool execute);
00329         virtual void handlemsg(htmsg *msg);
00330         virtual int load(ht_object_stream *f);
00331         virtual OBJECT_ID object_id() const;
00332         virtual int run(bool modal);
00333         virtual void store(ht_object_stream *f);
00334 /* new */
00335                         ht_window *create_window_clipboard();
00336                         ht_window *create_window_file(char *filename, UINT mode, bool allow_duplicates);
00337                         ht_window *create_window_file_bin(char *filename, bool allow_duplicates);
00338                         ht_window *create_window_file_text(char *filename, bool allow_duplicates);
00339                         ht_window *create_window_help(char *file, char *node);
00340                         ht_window *create_window_log();
00341                         ht_window *create_window_ofm(char *url1, char *url2);
00342                         ht_window *create_window_project();
00343                         ht_window *create_window_term(const char *cmd);
00344                         void delete_window(ht_window *window);
00345                         ht_window *get_window_by_filename(char *filename);
00346                         ht_window *get_window_by_number(UINT number);
00347                         ht_window *get_window_by_type(UINT type);
00348                         ht_view *popup_view_list(char *dialog_title);
00349                         ht_window *popup_window_list(char *dialog_title);
00350                         void project_opencreate(char *filename);
00351 };
00352 
00353 extern ht_log *loglines;
00354 
00355 /*
00356  *      INIT
00357  */
00358 
00359 bool init_app();
00360 
00361 /*
00362  *      DONE
00363  */
00364 
00365 void done_app();
00366 
00367 #endif /* __HTAPP_H__ */

Generated on Fri May 7 21:15:31 2004 by doxygen 1.3.5