]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_gui_misc.C
Fix working of the spellchecker dialog with ispell when there are no
[lyx.git] / src / lyx_gui_misc.C
index 9d1dd98389e0d6343d7be1aed6bffc154833f706..dc4c6ca53734e13cab33fbfd70e6eb2cfed4863a 100644 (file)
@@ -1,11 +1,10 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  * 
  *           LyX, The Document Processor
  *        
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
 #include <cerrno>
 #include "lyx_gui_misc.h"
 #include "BufferView.h"
-#include "bibforms.h"
 #include "buffer.h"
-#include "form1.h"
 #include "gettext.h"
-#include "include_form.h"
-#include "log_form.h"
-#include "layout_forms.h"
-#include "lyx.h"
+#include "figure_form.h"
 #include "lyx_cb.h"
 #include "lyx_main.h"
-#include "mathed/math_forms.h"
-#include "minibuffer.h"
 #include "print_form.h"
-#include "sp_form.h"
 #include "LyXView.h"
 #include "bufferview_funcs.h"
 #include "support/filetools.h"
 #include "lyxrc.h"
+#include "debug.h"
 
 using std::pair;
 using std::make_pair;
@@ -43,36 +35,32 @@ using std::endl;
 
 extern BufferView * current_view;
 
-extern FD_form_character * fd_form_character;
-extern FD_form_preamble * fd_form_preamble;
-extern FD_form_sendto * fd_form_sendto;
 extern FD_form_figure * fd_form_figure;
-extern FD_LaTeXLog * fd_latex_log;
-extern FD_form_spell_check * fd_form_spell_check;
-extern FD_panel  * fd_panel;
-extern FD_delim  * fd_delim;
-extern FD_deco   * fd_deco;
-extern FD_space  * fd_space;
-extern FD_matrix * fd_matrix;
-extern FD_bibitem_form * bibitem_form;
-extern FD_include * form;
+extern FD_form_sendto * fd_form_sendto;
 
 extern void HideFiguresPopups();
 
+
 // Prevents LyX from being killed when the close box is pressed in a popup.
-extern "C" int CancelCloseBoxCB(FL_FORM *, void *)
+extern "C"
+int CancelCloseBoxCB(FL_FORM *, void *)
 {
        return FL_CANCEL;
 }
 
 
-// Prevents LyX from being killed when the close box is pressed in a popup.
-extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *)
+// Redraw the form (on receipt of a Signal indicating, for example,
+// that the xform colors have been re-mapped).
+void RedrawAllBufferRelatedDialogs()
 {
-       return FL_IGNORE;
+       if (fd_form_figure->form_figure->visible) {
+               fl_redraw_form(fd_form_figure->form_figure);
+       }
+       if (fd_form_sendto->form_sendto->visible) {
+               fl_redraw_form(fd_form_sendto->form_sendto);
+       }
 }
 
-
 // Prevents LyX from crashing when no buffers available
 // This is also one of the functions that we _really_ dont want
 // we should try to finds way to help us with that.
@@ -83,61 +71,12 @@ void CloseAllBufferRelatedDialogs()
        // have been created otherwise hiding one could cause a crash
        // need the visible check otherwise XForms prints a warning
        // if hiding an invisible form
-       if (fd_form_character->form_character->visible) {
-               fl_hide_form(fd_form_character->form_character);
-       }
-       if (fd_form_preamble->form_preamble->visible) {
-               fl_hide_form(fd_form_preamble->form_preamble);
-       }
        if (fd_form_figure->form_figure->visible) {
                fl_hide_form(fd_form_figure->form_figure);
        }
        if (fd_form_sendto->form_sendto->visible) {
                fl_hide_form(fd_form_sendto->form_sendto);
        }
-       if (fd_latex_log->LaTeXLog->visible) {
-               fl_hide_form(fd_latex_log->LaTeXLog);
-       }
-       if (fd_form_spell_check) {
-               if (fd_form_spell_check->form_spell_check->visible) {
-                       fl_trigger_object(fd_form_spell_check->done);
-               }
-       }
-       if (fd_panel) {
-               if (fd_panel->panel->visible) {
-                       fl_hide_form(fd_panel->panel);
-               }
-       }
-       if (fd_delim) {
-               if (fd_delim->delim->visible) {
-                       fl_hide_form(fd_delim->delim);
-               }
-       }
-       if (fd_deco) {
-               if (fd_deco->deco->visible) {
-                       fl_hide_form(fd_deco->deco);
-               }
-       }
-       if (fd_space) {
-               if (fd_space->space->visible) {
-                       fl_hide_form(fd_space->space);
-               }
-       }
-       if (fd_matrix) {
-               if (fd_matrix->matrix->visible) {
-                       fl_hide_form(fd_matrix->matrix);
-               }
-       }
-       if (bibitem_form) {
-               if (bibitem_form->bibitem_form->visible) {
-                       fl_hide_form(bibitem_form->bibitem_form);
-               }
-       }
-       if (form) {
-               if (form->include->visible) {
-                       fl_hide_form(form->include);
-               }
-       }
        HideFiguresPopups();
 }
 
@@ -145,89 +84,6 @@ void CloseAllBufferRelatedDialogs()
 // Again the Signal/Slot mechanism is tailor made for this task.
 void updateAllVisibleBufferRelatedDialogs(bool)
 {
-       if (fd_form_preamble->form_preamble->visible) {
-               UpdateLayoutPreamble();
-       }
-       if (fd_latex_log->LaTeXLog->visible) {
-               LatexLogUpdate(0,0);
-       }
-       if (current_view->buffer() &&  current_view->buffer()->isReadonly()) {
-               // a little crude perhaps but it works. ARRae
-               if (fd_form_character->form_character->visible) {
-                       fl_hide_form(fd_form_character->form_character);
-               }
-#ifndef ALWAYS_CLOSE_MATH_PANELS
-               // The math popups should be closed only if we switch
-               // to a readonly buffer
-               if (fd_panel) {
-                       if (fd_panel->panel->visible) {
-                               fl_hide_form(fd_panel->panel);
-                       }
-               }
-               if (fd_delim) {
-                       if (fd_delim->delim->visible) {
-                               fl_hide_form(fd_delim->delim);
-                       }
-               }
-               if (fd_deco) {
-                       if (fd_deco->deco->visible) {
-                               fl_hide_form(fd_deco->deco);
-                       }
-               }
-               if (fd_space) {
-                       if (fd_space->space->visible) {
-                               fl_hide_form(fd_space->space);
-                       }
-               }
-               if (fd_matrix) {
-                       if (fd_matrix->matrix->visible) {
-                               fl_hide_form(fd_matrix->matrix);
-                       }
-               }
-#endif
-       }
-
-       // We have either changed buffers or changed the readonly status
-       // so the safest thing to do is hide all inset popups that
-       // are editting insets from the previous buffer or aren't
-       // allowed in readonly docs.
-#ifdef ALWAYS_CLOSE_MATH_PANELS
-       if (fd_panel) {
-               if (fd_panel->panel->visible) {
-                       fl_hide_form(fd_panel->panel);
-               }
-       }
-       if (fd_delim) {
-               if (fd_delim->delim->visible) {
-                       fl_hide_form(fd_delim->delim);
-               }
-       }
-       if (fd_deco) {
-               if (fd_deco->deco->visible) {
-                       fl_hide_form(fd_deco->deco);
-               }
-       }
-       if (fd_space) {
-               if (fd_space->space->visible) {
-                       fl_hide_form(fd_space->space);
-               }
-       }
-       if (fd_matrix) {
-               if (fd_matrix->matrix->visible) {
-                       fl_hide_form(fd_matrix->matrix);
-               }
-       }
-#endif
-       if (bibitem_form) {
-               if (bibitem_form->bibitem_form->visible) {
-                       fl_hide_form(bibitem_form->bibitem_form);
-               }
-       }
-       if (form) {
-               if (form->include->visible) {
-                       fl_hide_form(form->include);
-               }
-       }
        HideFiguresPopups();
 }
 
@@ -267,29 +123,20 @@ char const * flyx_ident_extract(char const * sc)
 }
 
 
-void WriteStatus(MiniBuffer * minib, string const & s)
-{
-       if (minib) {
-               minib->Set(s);
-               minib->Store();
-       } else
-               lyxerr << s << endl;
-}
-
-
 //
 void WriteAlert(string const & s1, string const & s2, string const & s3)
 {
-       MiniBuffer * minibuffer = 0;
+       LyXView * lview = 0;
        if (current_view && current_view->owner())
-               minibuffer = current_view->owner()->getMiniBuffer();
-       if (minibuffer) {
+               lview = current_view->owner();
+       if (lview) {
                /// Write to minibuffer
-               ProhibitInput(current_view);
-               minibuffer->Set(s1, s2, s3);
+               lview->prohibitInput();
+               string const msg = s1 + ' ' + s2 + ' ' + s3;
+               lview->message(msg);
                fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
                fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
-               AllowInput(current_view);
+               lview->allowInput();
        } else {
                /// Write to lyxerr
                lyxerr << "----------------------------------------" << endl