1 /* Hey EMACS -*- linux-c -*- */
2 /* $Id$ */
3 
4 /*  TiLP - Tilp Is a Linking Program
5  *  Copyright (C) 1999-2006  Romain Lievin
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software Foundation,
19  *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /*
23 	Structure definitions.
24 */
25 
26 #ifndef __TILP_STRUCT__
27 #define __TILP_STRUCT__
28 
29 #include <glib.h>
30 #include "tilibs.h"
31 
32 #include <sys/types.h>
33 #include <sys/stat.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #define MAXCHARS 256
40 
41 /* This struct contains the general options to configure the program */
42 typedef struct
43 {
44 	// device
45 	int		cable_model;
46 	int		cable_port;
47 	int		cable_timeout;
48 	int		cable_delay;
49 	int		calc_model;
50 
51 	// gui
52 	int		pane_x_size;
53 	int		pane_y_size;
54 
55 	int		wnd_x_size1;
56 	int		wnd_y_size1;
57 
58 	int		wnd_x_size2;
59 	int		wnd_y_size2;
60 
61 	int		local_sort;
62 	int		local_sort_order;
63 	int		remote_sort;
64 	int		remote_sort_order;
65 
66 	int		filesel_type;
67 	int		fs_type; // internal
68 	int		full_gui;
69 
70 	// options
71 	int		auto_detect;
72 	int		local_path;
73 	int		show_all;
74 	int		overwrite;
75 	int		recv_as_group;
76 	int		backup_as_tigroup;
77 
78 	char*	working_dir;
79 
80 	// screen
81 	int		screen_format;
82 	int		screen_scaling;
83 	int		screen_clipping;
84 	int		screen_blurry;
85 
86 	// fonts
87 	char*	remote_font_name;
88 	char*	local_font_name;
89 
90 	int		usb_avail;
91 
92 } TilpOptions;
93 
94 
95 /* Used by the local directory list function */
96 typedef struct
97 {
98 	// used for entries
99 	char *name;
100 	time_t date;
101 	off_t size;
102 #ifdef __WIN32__
103 	int user;
104 	int group;
105 	int attrib;
106 #else
107 	uid_t user;
108 	gid_t group;
109 	mode_t attrib;
110 #endif
111 
112 	// used for actions
113 	FileContent*	content1;	// file content to send or NULL
114 	FlashContent*	content2;	// flash content to send or NULL
115 	TigContent*		content3;	// unused (NULL)
116 	int				selected;	// entry is selected
117 } FileEntry;
118 
119 /* Used to retrieve stats on the on-calc memory usage */
120 typedef struct
121 {
122 	uint32_t n_folders;		// number of folders
123 	uint32_t n_vars;		// number of vars
124 	uint32_t n_apps;		// number of FLASH apps
125 
126 	uint32_t ram_used;
127 	uint32_t flash_used;
128 
129 	uint32_t ram_free;
130 	uint32_t flash_free;
131 } TilpMem;
132 
133 
134 /* This struct is used by the CList window */
135 typedef struct
136 {
137 	GList* dirlist;			// linked list of files & directories
138 	gchar* cwdir;			// current active directory
139 
140 	GList* selection0;		// selection of regular files (data: FileEntry*)
141 	GList* selection1;		// selection of single files  (data: FileEntry* but exploded)
142 
143 	GList* selection2;		// selection of flash files   (data: FileEntry*)
144 	GList* selection3;		// selection of flash files   (data: FileEntry* but exploded)
145 
146 	GList* selection4;		// selection of backup files  (data: FileEntry*)
147 
148 	GList* selection5;		// selection of TIGroup files (data: FileEntry* but not loaded)
149 
150 	GList* file_selection;	// selection of files (data: char*)
151 
152 	int copy_cut;			// action type
153 } TilpLocal;
154 
155 
156 /* This struct is used by the CTree window */
157 typedef struct
158 {
159 	GNode*	var_tree;		// future use: tree of vars
160 	GNode*	app_tree;		// future use: tree of apps
161 
162 	TilpMem	memory;			// memory free or used by calc
163 
164 	GList*	selection1;		// selection of variables    (data: VarEntry)
165 	GList*	selection2;		// selection of applications (data: VarEntry)
166 } TilpRemote;
167 
168 /* Global variables */
169 
170 extern CableHandle* cable_handle;
171 extern CalcHandle*  calc_handle;
172 
173 extern TilpOptions	options;
174 extern TilpLocal	local;
175 extern TilpRemote	remote;
176 
177 extern int			working_mode;
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 #endif
183