]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_gui_misc.C
citation patch from Angus
[lyx.git] / src / lyx_gui_misc.C
index 1df880a7ae69a46e0a5c7518d9301559aecc06f7..449c9b64421f091a4fa33d4be968677414aec13b 100644 (file)
 
 #include <config.h>
 
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
 #include <cerrno>
 #include "lyx_gui_misc.h"
 #include "BufferView.h"
@@ -20,7 +24,7 @@
 #include "form1.h"
 #include "gettext.h"
 #include "include_form.h"
-#include "latexoptions.h"
+#include "log_form.h"
 #include "layout_forms.h"
 #include "lyx.h"
 #include "lyx_cb.h"
@@ -29,7 +33,6 @@
 #include "minibuffer.h"
 #include "print_form.h"
 #include "sp_form.h"
-#include "insets/insetindex.h"
 #include "LyXView.h"
 #include "bufferview_funcs.h"
 #include "support/filetools.h"
@@ -48,11 +51,8 @@ extern FD_form_table_options * fd_form_table_options;
 extern FD_form_quotes * fd_form_quotes;
 extern FD_form_preamble * fd_form_preamble;
 extern FD_form_table * fd_form_table;
-extern FD_form_print * fd_form_print;
 extern FD_form_sendto * fd_form_sendto;
 extern FD_form_figure * fd_form_figure;
-extern FD_form_toc * fd_form_toc;
-extern FD_form_ref * fd_form_ref;
 extern FD_form_paragraph_extra * fd_form_paragraph_extra;
 extern FD_LaTeXLog * fd_latex_log;
 extern FD_form_spell_check * fd_form_spell_check;
@@ -62,12 +62,9 @@ extern FD_delim  * fd_delim;
 extern FD_deco   * fd_deco;
 extern FD_space  * fd_space;
 extern FD_matrix * fd_matrix;
-extern FD_citation_form * citation_form;
 extern FD_bibitem_form * bibitem_form;
 extern FD_include * form;
-extern FD_index_form * index_form;
 
-extern void TocUpdateCB();
 extern void HideFiguresPopups();
 
 // Prevents LyX from being killed when the close box is pressed in a popup.
@@ -88,7 +85,7 @@ extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *)
 // This is also one of the functions that we _really_ dont want
 // we should try to finds way to help us with that.
 // The signal/slot mechanism can probably help. 
-void CloseAllBufferRelatedPopups()
+void CloseAllBufferRelatedDialogs()
 {
        // don't forget to check that dynamically created forms
        // have been created otherwise hiding one could cause a crash
@@ -103,36 +100,36 @@ void CloseAllBufferRelatedPopups()
        if (fd_form_character->form_character->visible) {
                fl_hide_form(fd_form_character->form_character);
        }
+#ifdef USE_OLD_DOCUMENT_LAYOUT
        if (fd_form_document->form_document->visible) {
                fl_hide_form(fd_form_document->form_document);
        }
        if (fd_form_quotes->form_quotes->visible) {
                fl_hide_form(fd_form_quotes->form_quotes);
        }
-       if (fd_form_preamble->form_preamble->visible) {
-               fl_hide_form(fd_form_preamble->form_preamble);
+       if (fd_form_paper->form_paper->visible) {
+               fl_hide_form(fd_form_paper->form_paper);
        }
-       if (fd_form_table->form_table->visible) {
-               fl_hide_form(fd_form_table->form_table);
+       if (fd_form_bullet) {
+               if (fd_form_bullet->form_bullet->visible) {
+                       fl_hide_form(fd_form_bullet->form_bullet);
+               }
        }
-       if (fd_form_print->form_print->visible) {
-               fl_hide_form(fd_form_print->form_print);
+#endif
+       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_toc->form_toc->visible) {
-               fl_hide_form(fd_form_toc->form_toc);
-       }
-       if (fd_form_ref->form_ref->visible) {
-               fl_hide_form(fd_form_ref->form_ref);
-       }
-       if (fd_form_paper->form_paper->visible) {
-               fl_hide_form(fd_form_paper->form_paper);
+#ifndef NEW_TABULAR
+       if (fd_form_table->form_table->visible) {
+               fl_hide_form(fd_form_table->form_table);
        }
        if (fd_form_table_options->form_table_options->visible) {
                fl_hide_form(fd_form_table_options->form_table_options);
        }
+#endif
        if (fd_form_sendto->form_sendto->visible) {
                fl_hide_form(fd_form_sendto->form_sendto);
        }
@@ -144,11 +141,6 @@ void CloseAllBufferRelatedPopups()
                        fl_trigger_object(fd_form_spell_check->done);
                }
        }
-       if (fd_form_bullet) {
-               if (fd_form_bullet->form_bullet->visible) {
-                       fl_hide_form(fd_form_bullet->form_bullet);
-               }
-       }
        if (fd_panel) {
                if (fd_panel->panel->visible) {
                        fl_hide_form(fd_panel->panel);
@@ -174,11 +166,6 @@ void CloseAllBufferRelatedPopups()
                        fl_hide_form(fd_matrix->matrix);
                }
        }
-       if (citation_form) {
-               if (citation_form->citation_form->visible) {
-                       fl_hide_form(citation_form->citation_form);
-               }
-       }
        if (bibitem_form) {
                if (bibitem_form->bibitem_form->visible) {
                        fl_hide_form(bibitem_form->bibitem_form);
@@ -189,74 +176,92 @@ void CloseAllBufferRelatedPopups()
                        fl_hide_form(form->include);
                }
        }
-       if (index_form) {
-               if (index_form->index_form->visible) {
-                       fl_hide_form(index_form->index_form);
-               }
-       }
        HideFiguresPopups();
 }
 
 // This is another function we really don't want.
 // Again the Signal/Slot mechanism is tailor made for this task.
-void updateAllVisibleBufferRelatedPopups()
+void updateAllVisibleBufferRelatedDialogs()
 {
+#ifdef USE_OLD_DOCUMENT_LAYOUT
        if (fd_form_document->form_document->visible) {
                UpdateLayoutDocument();
        }
-       if (fd_form_preamble->form_preamble->visible) {
-               UpdateLayoutPreamble();
-       }
        if (fd_form_quotes->form_quotes->visible) {
                UpdateLayoutQuotes();
        }
+       if (fd_form_paper->form_paper->visible) {
+               UpdateLayoutPaper();
+       }
+#endif
+       if (fd_form_preamble->form_preamble->visible) {
+               UpdateLayoutPreamble();
+       }
        if (fd_form_paragraph->form_paragraph->visible) {
                UpdateLayoutParagraph();
        }
        if (fd_form_paragraph_extra->form_paragraph_extra->visible) {
                UpdateParagraphExtra();
        }
-       if (fd_form_paper->form_paper->visible) {
-               UpdateLayoutPaper();
-       }
+#ifndef NEW_TABULAR
        if (fd_form_table_options->form_table_options->visible) {
                UpdateLayoutTable(1); // just like a right mouse click
        }
+#endif
        if (fd_form_bullet) {
                if (fd_form_bullet->form_bullet->visible) {
                        updateBulletForm();
                }
        }
-       if (fd_form_toc->browser_toc->visible) {
-               TocUpdateCB(0, 0);
-       }
-#ifdef ALWAYS_UPDATE_REF
-       // Ideally, the RefUpdateCB should be modified so that if the
-       // current document is a subdocument the reference list should come
-       // from master document (or even be a merger of references from all
-       // its sibling documents).  For now this has effectively been
-       // commented out to ensure that users of multipart documents can
-       // access the reference list of a different document.  This is
-       // of course a compromise and an annoyance for users switching
-       // between separate documents.  ARRae 241198
-       if (fd_form_ref->form_ref->visible) {
-               RefUpdateCB(0, 0);
+       if (fd_latex_log->LaTeXLog->visible) {
+               LatexLogUpdate(0,0);
        }
-#endif
        if (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 NEW_TABULAR
                if (fd_form_table->form_table->visible) {
                        fl_hide_form(fd_form_table->form_table);
                }
+#endif
+#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);
@@ -282,11 +287,7 @@ void updateAllVisibleBufferRelatedPopups()
                        fl_hide_form(fd_matrix->matrix);
                }
        }
-       if (citation_form) {
-               if (citation_form->citation_form->visible) {
-                       fl_hide_form(citation_form->citation_form);
-               }
-       }
+#endif
        if (bibitem_form) {
                if (bibitem_form->bibitem_form->visible) {
                        fl_hide_form(bibitem_form->bibitem_form);
@@ -297,11 +298,6 @@ void updateAllVisibleBufferRelatedPopups()
                        fl_hide_form(form->include);
                }
        }
-       if (index_form) {
-               if (index_form->index_form->visible) {
-                       fl_hide_form(index_form->index_form);
-               }
-       }
        HideFiguresPopups();
 }
 
@@ -389,7 +385,8 @@ int AskConfirmation(string const & s1, string const & s2, string const & s3)
 
 
 // Asks for a text
-pair<bool, string> askForText(string const & msg, string const & dflt)
+pair<bool, string> const
+askForText(string const & msg, string const & dflt)
 {
        fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
        fl_set_resource("flInput.ok.label", idex(_("OK|#O")));