Codepage messages related translated & other stuff...
[midnight-commander.git] / src / dialog.c
blob1f276e38685635698691c21dd74c90716dde63ef
1 /* Dialog managing.
2 Copyright (C) 1994 Miguel de Icaza.
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. */
18 #include <config.h>
19 #include "tty.h"
20 #include <stdio.h>
21 #include <stdarg.h>
22 #include <sys/types.h>
23 #include <string.h>
24 #include "global.h"
25 #include "x.h"
26 #include "dialog.h"
27 #include "color.h"
28 #include "win.h"
29 #include "mouse.h"
30 #include "main.h"
31 #include "key.h" /* For mi_getch() */
32 #include "dlg.h" /* draw_box, yes I know, it's silly */
33 #include "fileopctx.h"
35 /* "$Id$" */
37 Refresh *refresh_list = 0;
39 void push_refresh (void (*new_refresh)(void *), void *parameter, int flags)
41 Refresh *new;
43 new = g_new (Refresh, 1);
44 new->next = (struct Refresh *) refresh_list;
45 new->refresh_fn = new_refresh;
46 new->parameter = parameter;
47 new->flags = flags;
48 refresh_list = new;
51 void pop_refresh (void)
53 Refresh *old;
55 if (!refresh_list)
56 fprintf (stderr, _("\n\n\nrefresh stack underflow!\n\n\n"));
57 else {
58 old = refresh_list;
59 refresh_list = refresh_list->next;
60 g_free (old);
64 static void do_complete_refresh (Refresh *refresh_list)
66 if (!refresh_list)
67 return;
69 if (refresh_list->flags != REFRESH_COVERS_ALL)
70 do_complete_refresh (refresh_list->next);
72 (*(refresh_list->refresh_fn))(refresh_list->parameter);
75 void do_refresh (void)
77 if (we_are_background)
78 return;
80 #ifndef HAVE_GNOME
81 if (!refresh_list)
82 return;
83 else {
84 if (fast_refresh)
85 (*(refresh_list->refresh_fn))(refresh_list->parameter);
86 else {
87 do_complete_refresh (refresh_list);
90 #endif