1 /********************************************************************************
2 *                                                                               *
3 *                     T h e   A d i e   T e x t   E d i t o r                   *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 1998,2021 by Jeroen van der Zijp.   All Rights Reserved.        *
7 *********************************************************************************
8 * This program is free software: you can redistribute it and/or modify          *
9 * it under the terms of the GNU General Public License as published by          *
10 * the Free Software Foundation, either version 3 of the License, or             *
11 * (at your option) any later version.                                           *
12 *                                                                               *
13 * This program is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
16 * GNU General Public License for more details.                                  *
17 *                                                                               *
18 * You should have received a copy of the GNU General Public License             *
19 * along with this program.  If not, see <http://www.gnu.org/licenses/>.         *
20 ********************************************************************************/
21 #ifndef ADIE_H
22 #define ADIE_H
23 
24 
25 // Version
26 #define VERSION_MAJOR 3
27 #define VERSION_MINOR 5
28 #define VERSION_PATCH 0
29 
30 
31 class HelpWindow;
32 class Preferences;
33 class TextWindow;
34 struct ParseInfo;
35 
36 
37 // Main Application class
38 class Adie : public FXApp {
39   FXDECLARE(Adie)
40   friend class TextWindow;
41 protected:
42   TextWindowList      windowlist;               // Window list
43   FXFileAssociations *associations;             // File association table
44   SyntaxList          syntaxes;                 // List of syntax patterns
45   FXString            syntaxpaths;              // Where to look for syntax file
46   FXIcon             *bigicon;                  // Big application icon
47   FXIcon             *smallicon;                // Small application icon
48   FXIcon             *newicon;
49   FXIcon             *reloadicon;
50   FXIcon             *openicon;
51   FXIcon             *saveicon;
52   FXIcon             *saveasicon;
53   FXIcon             *savetoicon;
54   FXIcon             *printicon;
55   FXIcon             *cuticon;
56   FXIcon             *copyicon;
57   FXIcon             *pasteicon;
58   FXIcon             *deleteicon;
59   FXIcon             *undoicon;
60   FXIcon             *redoicon;
61   FXIcon             *fontsicon;
62   FXIcon             *helpicon;
63   FXIcon             *quiticon;
64   FXIcon             *searchicon;
65   FXIcon             *replaceicon;
66   FXIcon             *searchnexticon;
67   FXIcon             *searchprevicon;
68   FXIcon             *bookseticon;
69   FXIcon             *booknexticon;
70   FXIcon             *bookprevicon;
71   FXIcon             *bookdelicon;
72   FXIcon             *shiftlefticon;
73   FXIcon             *shiftrighticon;
74   FXIcon             *configicon;
75   FXIcon             *browsericon;
76   FXIcon             *nobrowsericon;
77   FXIcon             *loggericon;
78   FXIcon             *nologgericon;
79   FXIcon             *uppercaseicon;
80   FXIcon             *lowercaseicon;
81   FXIcon             *backwardicon;
82   FXIcon             *forwardicon;
83   FXIcon             *shownicon;
84   FXIcon             *hiddenicon;
85 private:
Adie()86   Adie(){}
87   Adie(const Adie&);
88   Adie& operator=(const Adie&);
89 public:
90   enum{
91     ID_CLOSEALL=FXApp::ID_LAST,
92     ID_SYNTAXPATHS,
93     ID_HARVEST,
94     ID_LAST
95     };
96 public:
97   long onSigHarvest(FXObject*,FXSelector,void*);
98   long onCmdCloseAll(FXObject*,FXSelector,void*);
99   long onCmdSyntaxPaths(FXObject*,FXSelector,void*);
100   long onUpdSyntaxPaths(FXObject*,FXSelector,void*);
101 public:
102 
103   // Construct application object
104   Adie(const FXString& name);
105 
106   // Run the application
107   FXint start(int argc,char** argv);
108 
109   // Set syntax paths
setSyntaxPaths(const FXString & paths)110   void setSyntaxPaths(const FXString& paths){ syntaxpaths=paths; }
111 
112   // Get syntax paths
getSyntaxPaths()113   const FXString& getSyntaxPaths() const { return syntaxpaths; }
114 
115   // Find an as yet untitled, unedited window
116   TextWindow* findUnused() const;
117 
118   // Generate unique name from given path
119   FXString unique(const FXString& path) const;
120 
121   // Find window, if any, currently editing the given file
122   TextWindow* findWindow(const FXString& file) const;
123 
124   // Open file and jump to line, or just jump to line/column if already open
125   TextWindow* openFileWindow(const FXString& file,FXint lineno=0,FXint column=0);
126 
127   // Get syntax for language name
128   Syntax* getSyntaxByName(const FXString& lang);
129 
130   // Get syntax by consulting registry
131   Syntax* getSyntaxByRegistry(const FXString& file);
132 
133   // Get syntax by matching pattern
134   Syntax* getSyntaxByPattern(const FXString& file);
135 
136   // Get syntax by contents
137   Syntax* getSyntaxByContents(const FXString& contents);
138 
139   // Delete application object
140   virtual ~Adie();
141   };
142 
143 #endif
144 
145