1
/* tilp - a linking program for TI graphing calculators
2
* Copyright (C) 1999-2002 Romain Lievin
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32
Note: callbacks are in gtk_tilp_cb.c
36
GdkFont* load_ti_font()
40
#if defined(__LINUX__)
41
font = gdk_font_load("-lpg-tixx-calc-r-expanded--10-100-75-75-m-80-iso8859-1");
42
#elif defined(__WIN32__)
44
Thank to Timothy Singer for her fonts. Timothy Singer is the developper
45
of FastLink, another linking program for Windows.
48
switch(options.lp.calc_type)
53
font = gdk_font_load("-*-Fastlink TI%2d83-normal-r-normal--*-13-*-*-m-*-iso8859-1");
57
font = gdk_font_load("-*-Fastlink TI%2d86-normal-r-normal--*-13-*-*-m-*-iso8859-1");
62
font = gdk_font_load("-*-Fastlink TI%2d89-normal-r-normal--*-13-*-*-m-*-iso8859-1");
72
/* Refresh the ctree */
75
GdkPixmap *pixmap1, *pixmap2, *pixmap3, *pixmap4;
76
GdkPixmap *pixmap5, *pixmap6, *pixmap7;
77
GdkBitmap *mask1, *mask2, *mask3, *mask4;
78
GdkBitmap *mask5, *mask6, *mask7;
79
GtkCTreeNode *vars_node = NULL;
80
GtkCTreeNode *apps_node = NULL;
81
GtkCTreeNode *parent_node = NULL;
82
GtkCTreeNode *child_node = NULL;
87
gchar *tab[4] = { 0 };
89
gchar *prev_app = g_strdup("");
91
gchar *vars[] = { N_("Variables"), N_(""), N_(""), N_("") };
92
gchar *apps[] = { N_("Applications"), N_(""), N_(""), N_("") };
96
style = gtk_style_copy(GTK_WIDGET(ctree_wnd)->style);
97
font = load_ti_font();
101
DISPLAY(_("** Warning: unable to load the 'tifont' font. Use default font instead.\n"));
104
switch(options.ctree_sort)
107
sort_cfiles_by_name(ctree_win.varlist);
110
sort_cfiles_by_info(ctree_win.varlist);
113
sort_cfiles_by_type(ctree_win.varlist);
116
sort_cfiles_by_size(ctree_win.varlist);
120
gtk_clist_freeze(GTK_CLIST (ctree_wnd));
121
gtk_clist_clear(GTK_CLIST (ctree_wnd));
122
gtk_widget_realize(main_wnd);
125
open_xpm("dir_closed.xpm", main_wnd, &pixmap1, &mask1);
126
open_xpm("dir_opened.xpm", main_wnd, &pixmap3, &mask3);
127
open_xpm("doc.xpm", main_wnd, &pixmap2, &mask2);
128
open_xpm("locked.xpm", main_wnd, &pixmap4, &mask4);
129
open_xpm("archived.xpm", main_wnd, &pixmap5, &mask5);
130
open_xpm("screen_mini.xpm", main_wnd, &pixmap6, &mask6);
131
open_xpm("keyboard_mini.xpm", main_wnd, &pixmap7, &mask7);
134
vars_node=gtk_ctree_insert_node (GTK_CTREE (ctree_wnd), NULL, NULL, vars,
135
5, pixmap1, mask1, pixmap2, mask2,
137
gtk_ctree_node_set_row_data (GTK_CTREE(ctree_wnd), vars_node,
139
gtk_ctree_node_set_selectable(GTK_CTREE(ctree_wnd), vars_node, 0);
142
apps_node=gtk_ctree_insert_node (GTK_CTREE (ctree_wnd), NULL, NULL, apps,
143
5, pixmap1, mask1, pixmap2, mask2,
145
gtk_ctree_node_set_row_data (GTK_CTREE(ctree_wnd), apps_node,
147
gtk_ctree_node_set_selectable(GTK_CTREE(ctree_wnd), apps_node, 0);
151
parent_node = vars_node;
154
q=(struct varinfo *)(p->data);
156
/* Skip varnames with FLASH apps */
157
if(q->vartype == ticalc_flash_type(options.lp.calc_type))
162
tab[0] = g_strdup(q->translate);
163
if(q->is_folder == FOLDER)
167
parent_node=gtk_ctree_insert_node (GTK_CTREE (ctree_wnd), vars_node,
169
pixmap1, mask1, pixmap3, mask3,
171
gtk_ctree_node_set_row_data (GTK_CTREE(ctree_wnd), parent_node,
173
gtk_ctree_node_set_selectable(GTK_CTREE(ctree_wnd), parent_node, 0);
177
tab[2] = g_strdup_printf("%s", ti_calc.byte2type(q->vartype));
178
tab[3] = g_strdup_printf("%u", (int)(q->varsize));
179
child_node=gtk_ctree_insert_node(GTK_CTREE (ctree_wnd), parent_node,
181
pixmap1, mask1, pixmap2, mask2,
186
gtk_ctree_node_set_pixmap(GTK_CTREE (ctree_wnd),
187
child_node, 1, pixmap4, mask4);
190
gtk_ctree_node_set_pixmap(GTK_CTREE (ctree_wnd),
191
child_node, 1, pixmap5, mask5);
194
gtk_ctree_node_set_row_data (GTK_CTREE(ctree_wnd),
195
child_node, (gpointer)q);
196
gtk_ctree_node_set_cell_style(GTK_CTREE(ctree_wnd),
197
child_node, 0, style);
201
for(i=0; i<4; i++) g_free(tab[i]);
206
parent_node=apps_node;
209
q=(struct varinfo *)(p->data);
211
/* Skip varnames which are not FLASH apps */
212
if(q->vartype != ticalc_flash_type(options.lp.calc_type))
217
if(!strcmp(q->translate, prev_app))
223
tab[0] = g_strdup(q->translate);
224
g_free(prev_app); prev_app = g_strdup(q->translate);
226
tab[2] = g_strdup_printf("%s", ti_calc.byte2type(q->vartype));
227
tab[3] = g_strdup_printf("%u", (int)(q->varsize));
228
child_node=gtk_ctree_insert_node(GTK_CTREE (ctree_wnd), parent_node,
230
pixmap1, mask1, pixmap2, mask2,
235
gtk_ctree_node_set_pixmap(GTK_CTREE (ctree_wnd),
236
child_node, 1, pixmap4, mask4);
239
gtk_ctree_node_set_pixmap(GTK_CTREE (ctree_wnd),
240
child_node, 1, pixmap5, mask5);
243
gtk_ctree_node_set_row_data (GTK_CTREE(ctree_wnd),
244
child_node, (gpointer)q);
245
gtk_ctree_node_set_cell_style(GTK_CTREE(ctree_wnd),
246
child_node, 0, style);
249
for(i=0; i<4; i++) g_free(tab[i]);
252
gdk_pixmap_unref(pixmap1);
253
gdk_pixmap_unref(pixmap2);
254
gdk_pixmap_unref(pixmap3);
255
gdk_pixmap_unref(pixmap4);
256
gdk_pixmap_unref(pixmap5);
258
gtk_clist_thaw(GTK_CLIST (ctree_wnd));
262
/* Refresh the selection of the ctree window */
263
void ctree_selection_refresh(void)
269
s1 = g_list_copy(ctree_win.selection);
270
s2 = g_list_copy(ctree_win.selection2);
272
DISPLAY("ctree_selection_refresh\n");
273
for(i=0; i<g_list_length(s1); i++)
275
p = g_list_nth(ctree_win.selection, i);
276
DISPLAY("varname=%s\n", ((VariableInfo *)(p->data))->varname);
277
DISPLAY("%p %p %p\n", p->prev, p->data, p->next);
280
if(ctree_wnd == NULL) return;
281
gtk_clist_unselect_all(GTK_CLIST(ctree_wnd));
282
ctree_selection_destroy();
288
row=gtk_clist_find_row_from_data(GTK_CLIST (ctree_wnd), p->data);
292
fprintf(stderr, "Context debugging:\n");
293
fprintf(stderr, "Filename: %s\n", ((struct file_info *)(p->data))->filename);
294
fprintf(stderr, "Selection error: please report this bug.\n");
296
gtk_clist_select_row(GTK_CLIST (ctree_wnd), row, 1);
305
row=gtk_clist_find_row_from_data(GTK_CLIST (ctree_wnd), p->data);
308
fprintf(stderr, "Context debugging:\n");
309
fprintf(stderr, "Filename: %s\n", ((struct file_info *)(p->data))->filename);
310
fprintf(stderr, "Selection error: please report this bug.\n");
312
gtk_clist_select_row(GTK_CLIST (ctree_wnd), row, 1);