Browse Source

Use events for update panels

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Slava Zanko 14 years ago
parent
commit
c2dfb82f61

+ 24 - 5
lib/widget/dialog-switch.c

@@ -28,14 +28,14 @@
 
 #include "lib/global.h"
 #include "lib/tty/tty.h"        /* LINES, COLS */
+#include "lib/tty/color.h"      /* tty_set_normal_attrs() */
 #include "lib/widget.h"
-
-/* TODO: these includes should be removed! */
-#include "src/filemanager/layout.h"     /* repaint_screen() */
-#include "src/filemanager/midnight.h"   /* midnight_dlg */
+#include "lib/event.h"
 
 /*** global variables ****************************************************************************/
 
+Dlg_head *midnight_dlg = NULL;
+
 /*** file scope macro definitions ****************************************************************/
 
 /*** file scope type declarations ****************************************************************/
@@ -242,7 +242,7 @@ dialog_switch_process_pending (void)
             if (mc_global.mc_run_mode == MC_RUN_FULL)
             {
                 mc_current = g_list_find (mc_dialogs, midnight_dlg);
-                update_panels (UP_OPTIMIZE, UP_KEEPSEL);
+                mc_event_raise (MCEVENT_GROUP_FILEMANAGER, "update_panels", NULL);
             }
         }
     }
@@ -279,3 +279,22 @@ dialog_switch_shutdown (void)
 }
 
 /* --------------------------------------------------------------------------------------------- */
+
+void
+clr_scr (void)
+{
+    tty_set_normal_attrs ();
+    tty_fill_region (0, 0, LINES, COLS, ' ');
+    tty_refresh ();
+}
+
+/* --------------------------------------------------------------------------------------------- */
+
+void
+repaint_screen (void)
+{
+    do_refresh ();
+    tty_refresh ();
+}
+
+/* --------------------------------------------------------------------------------------------- */

+ 7 - 0
lib/widget/dialog-switch.h

@@ -12,6 +12,8 @@
 
 /*** global variables defined in .c file *********************************************************/
 
+extern Dlg_head *midnight_dlg;
+
 /*** declarations of public functions ************************************************************/
 
 void dialog_switch_add (struct Dlg_head *h);
@@ -26,5 +28,10 @@ int dialog_switch_process_pending (void);
 void dialog_switch_got_winch (void);
 void dialog_switch_shutdown (void);
 
+/* Clear screen */
+void clr_scr (void);
+void repaint_screen (void);
+
 /*** inline functions ****************************************************************************/
+
 #endif /* MC__DIALOG_SWITCH_H */

+ 0 - 1
src/background.c

@@ -47,7 +47,6 @@
 #include "lib/tty/key.h"        /* add_select_channel(), delete_select_channel() */
 #include "lib/widget.h"         /* message() */
 
-#include "filemanager/layout.h" /* repaint_screen() */
 #include "filemanager/fileopctx.h"      /* FileOpContext */
 
 #include "background.h"

+ 2 - 2
src/editor/editcmd.c

@@ -57,8 +57,6 @@
 #include "lib/widget.h"
 #include "lib/charsets.h"
 
-#include "src/filemanager/layout.h"     /* clr_scr() */
-
 #include "src/history.h"
 #include "src/setup.h"          /* option_tab_spacing */
 #include "src/help.h"           /* interactive_display() */
@@ -66,6 +64,8 @@
 #include "src/keybind-defaults.h"
 #include "src/clipboard.h"      /* copy_file_to_ext_clip, paste_to_file_from_ext_clip */
 #include "src/util.h"           /* check_for_default() */
+#include "src/filemanager/layout.h"     /* mc_refresh()  */
+
 
 #include "edit-impl.h"
 #include "edit-widget.h"

+ 0 - 1
src/filemanager/achown.c

@@ -46,7 +46,6 @@
 #include "dir.h"
 #include "midnight.h"           /* current_panel */
 #include "chmod.h"
-#include "layout.h"             /* repaint_screen() */
 
 #include "achown.h"
 

+ 0 - 1
src/filemanager/chmod.c

@@ -41,7 +41,6 @@
 #include "lib/widget.h"
 
 #include "midnight.h"           /* current_panel */
-#include "layout.h"             /* repaint_screen() */
 #include "chmod.h"
 
 /*** global variables ****************************************************************************/

+ 0 - 1
src/filemanager/chown.c

@@ -46,7 +46,6 @@
 /* Needed for the extern declarations of integer parameters */
 #include "chmod.h"
 #include "midnight.h"           /* current_panel */
-#include "layout.h"             /* repaint_screen() */
 
 #include "chown.h"
 

+ 0 - 1
src/filemanager/find.c

@@ -52,7 +52,6 @@
 #include "cmd.h"                /* view_file_at_line */
 #include "midnight.h"           /* current_panel */
 #include "boxes.h"
-#include "layout.h"             /* mc_refresh() */
 
 #include "find.h"
 

+ 0 - 1
src/filemanager/hotlist.c

@@ -56,7 +56,6 @@
 #include "src/history.h"
 
 #include "midnight.h"           /* current_panel */
-#include "layout.h"             /* repaint_screen() */
 #include "command.h"            /* cmdline */
 
 #include "hotlist.h"

+ 0 - 19
src/filemanager/layout.c

@@ -688,25 +688,6 @@ layout_box (void)
 
 /* --------------------------------------------------------------------------------------------- */
 
-void
-clr_scr (void)
-{
-    tty_set_normal_attrs ();
-    tty_fill_region (0, 0, LINES, COLS, ' ');
-    tty_refresh ();
-}
-
-/* --------------------------------------------------------------------------------------------- */
-
-void
-repaint_screen (void)
-{
-    do_refresh ();
-    tty_refresh ();
-}
-
-/* --------------------------------------------------------------------------------------------- */
-
 void
 mc_refresh (void)
 {

Some files were not shown because too many files changed in this diff