]> git.lyx.org Git - features.git/commitdiff
Move LaTeX and VC logs to GUI-I on xforms
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Feb 2001 17:41:42 +0000 (17:41 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 6 Feb 2001 17:41:42 +0000 (17:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1451 a592a061-630c-0410-9148-cb99ea01b6c8

32 files changed:
forms/ChangeLog
forms/log_form.fd [deleted file]
po/POTFILES.in
src/ChangeLog
src/LaTeXLog.C [deleted file]
src/Makefile.am
src/buffer.C
src/buffer.h
src/frontends/ButtonPolicies.C
src/frontends/ButtonPolicies.h
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormBrowser.C [new file with mode: 0644]
src/frontends/xforms/FormBrowser.h [new file with mode: 0644]
src/frontends/xforms/FormLog.C [new file with mode: 0644]
src/frontends/xforms/FormLog.h [new file with mode: 0644]
src/frontends/xforms/FormVCLog.C [new file with mode: 0644]
src/frontends/xforms/FormVCLog.h [new file with mode: 0644]
src/frontends/xforms/Makefile.am
src/frontends/xforms/form_browser.C [new file with mode: 0644]
src/frontends/xforms/form_browser.h [new file with mode: 0644]
src/frontends/xforms/forms/form_browser.fd [new file with mode: 0644]
src/frontends/xforms/forms/makefile
src/log_form.C [deleted file]
src/log_form.h [deleted file]
src/lyx_gui.C
src/lyx_gui_misc.C
src/lyxfunc.C
src/lyxvc.C
src/lyxvc.h

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..34b21d6b94986610a166e32373acf67d17d62e1e 100644 (file)
@@ -0,0 +1,3 @@
+2001-02-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * log_form.fd: deleted
diff --git a/forms/log_form.fd b/forms/log_form.fd
deleted file mode 100644 (file)
index f06ba45..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-Magic: 13000
-
-Internal Form Definition File
-    (do not change)
-
-Number of forms: 1
-Unit of measure: FL_COORD_PIXEL
-
-=============== FORM ===============
-Name: LaTeXLog
-Width: 470
-Height: 380
-Number of Objects: 4
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 470 380
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_BROWSER
-type: NORMAL_BROWSER
-box: 10 10 450 320
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_BOTTOM
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_SouthEast
-name: browser_latexlog
-callback: 
-argument: 
-
---------------------
-class: FL_BUTTON
-type: RETURN_BUTTON
-box: 270 340 90 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Close
-shortcut: ^M
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: 
-callback: LatexLogClose
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 370 340 90 30
-boxtype: FL_UP_BOX
-colors: FL_COL1 FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Update|#Uu
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: 
-callback: LatexLogUpdate
-argument: 0
-
-==============================
-create_the_forms
index 05a6c7333c72c35fbe17ddd3bcc98810b474e5b1..28523b982e7b07d1600c0e87a087f1aed863a977 100644 (file)
@@ -63,6 +63,7 @@ src/frontends/kde/tocdlg.C
 src/frontends/kde/urldlg.C
 src/frontends/qt2/FormCopyright.C
 src/frontends/xforms/FormBase.h
+src/frontends/xforms/form_browser.C
 src/frontends/xforms/FormCitation.C
 src/frontends/xforms/form_citation.C
 src/frontends/xforms/FormCopyright.C
@@ -76,6 +77,7 @@ src/frontends/xforms/form_graphics.C
 src/frontends/xforms/FormIndex.C
 src/frontends/xforms/form_index.C
 src/frontends/xforms/FormInset.h
+src/frontends/xforms/FormLog.C
 src/frontends/xforms/FormParagraph.C
 src/frontends/xforms/form_paragraph.C
 src/frontends/xforms/FormPreferences.C
@@ -92,6 +94,7 @@ src/frontends/xforms/FormToc.C
 src/frontends/xforms/form_toc.C
 src/frontends/xforms/FormUrl.C
 src/frontends/xforms/form_url.C
+src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/input_validators.C
 src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xform_helpers.C
@@ -124,11 +127,9 @@ src/intl.C
 src/kbsequence.C
 src/language.C
 src/LaTeX.C
-src/LaTeXLog.C
 src/layout.C
 src/layout_forms.C
 src/LColor.C
-src/log_form.C
 src/LyXAction.C
 src/lyx.C
 src/lyx_cb.C
index 0af7f8205b32d7f665be01613d15c1fa6e575c78..ffb44fa7750d21e4e62ee51ce12844cc01e5a48d 100644 (file)
@@ -1,3 +1,18 @@
+2001-02-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Makefile.am: remove LaTeXLog.C, log_form.[Ch]
+
+       * LaTeXLog.C: deleted, useful code moved to Buffer
+
+       * buffer.h:
+       * buffer.C: new function getLatexLogName()
+
+       * lyx_gui_misc.C:
+       * lyx_gui.C:
+       * lyxvc.C:
+       * lyxvc.h:
+       * lyxfunc.C: use frontends for LaTeX and VC logs
+
 2001-02-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * LaTeX.h: yet another std:: that Allan forgot.
diff --git a/src/LaTeXLog.C b/src/LaTeXLog.C
deleted file mode 100644 (file)
index 349498d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <config.h>
-
-#include <cstdlib>
-#include FORMS_H_LOCATION
-#include "buffer.h"
-#include "log_form.h"
-#include "lyx_main.h"
-#include "LString.h"
-#include "support/FileInfo.h"
-#include "support/filetools.h"
-#include "support/path.h"
-#include "lyxrc.h"
-#include "BufferView.h"
-#include "gettext.h"
-#include "converter.h"
-
-extern FD_LaTeXLog *fd_latex_log;
-extern BufferView *current_view;
-
-void ShowLatexLog()
-{
-       string filename, fname, bname, path;
-       bool use_build = false;
-       static int ow = -1, oh;
-
-       filename = current_view->buffer()->getLatexName();
-       if (!filename.empty()) {
-               fname = OnlyFilename(ChangeExtension(filename, ".log"));
-               bname = OnlyFilename(ChangeExtension(filename,
-                                    formats.Extension("literate") + ".out"));
-               path = OnlyPath(filename);
-               if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
-                       path = current_view->buffer()->tmppath;
-               }
-               FileInfo f_fi(path + fname), b_fi(path + bname);
-               if (b_fi.exist())
-                       if (!f_fi.exist()
-                           || f_fi.getModificationTime() < b_fi.getModificationTime())
-                               use_build = true; // If no Latex log or Build log is newer, show Build log
-               Path p(path); // path to LaTeX file
-               if (!fl_load_browser(fd_latex_log->browser_latexlog,
-                                    use_build ? bname.c_str() : fname.c_str()))
-                       fl_add_browser_line(fd_latex_log->browser_latexlog,
-                                           _("No LaTeX log file found"));
-       } else {
-               fl_add_browser_line(fd_latex_log->browser_latexlog,
-                              _("No LaTeX log file found"));
-       }
-       if (fd_latex_log->LaTeXLog->visible) {
-               fl_raise_form(fd_latex_log->LaTeXLog);
-       } else {
-               fl_show_form(fd_latex_log->LaTeXLog,
-                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
-                            use_build ? _("Build Program Log") : _("LaTeX Log"));
-               if (ow < 0) {
-                       ow = fd_latex_log->LaTeXLog->w;
-                       oh = fd_latex_log->LaTeXLog->h;
-               }
-               fl_set_form_minsize(fd_latex_log->LaTeXLog, ow, oh);
-       }
-}
-
-void LatexLogClose(FL_OBJECT *, long)
-{
-    fl_hide_form(fd_latex_log->LaTeXLog);
-}
-
-void LatexLogUpdate(FL_OBJECT *, long)
-{
-    ShowLatexLog();
-}
index 5c0f9c271478ed4b1cc00c45a8750015346172fe..1d0c8447fed5564f5bb5fe7eb2b991a2a5f17181 100644 (file)
@@ -53,7 +53,6 @@ lyx_SOURCES = \
        LaTeX.h \
        LaTeXFeatures.C \
        LaTeXFeatures.h \
-       LaTeXLog.C \
        Lsstream.h \
        LyXAction.C \
        LyXAction.h \
@@ -143,8 +142,6 @@ lyx_SOURCES = \
        layout.h \
        layout_forms.C \
        layout_forms.h \
-       log_form.C \
-       log_form.h \
        lyx.C \
        lyx.h \
        lyx_cb.C \
index 754477906bf7fdc5c629e5ffcc78cfbb2924ea46..ed641b4110167318c298565ce2160c920d3babd0 100644 (file)
@@ -94,6 +94,7 @@
 #include "encoding.h"
 #include "exporter.h"
 #include "Lsstream.h"
+#include "converter.h"
 
 using std::ostream;
 using std::ofstream;
@@ -177,6 +178,33 @@ string const Buffer::getLatexName(bool no_path) const
                                       ".tex"); 
 }
 
+string const Buffer::getLatexLogName(void) const
+{
+       string filename, fname, bname, path;
+
+       filename = getLatexName(false);
+
+       if (filename.empty())
+               return string();
+
+       fname = OnlyFilename(ChangeExtension(filename, ".log"));
+       bname = OnlyFilename(ChangeExtension(filename,
+               formats.Extension("literate") + ".out"));
+       path = OnlyPath(filename);
+
+       if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1))
+               path = tmppath + "/";
+
+       lyxerr[Debug::FILES] << "LaTeX Log calculated as : " << path + fname << endl;
+
+       // If no Latex log or Build log is newer, show Build log
+       FileInfo f_fi(path + fname), b_fi(path + bname);
+       if (b_fi.exist() &&
+               (!f_fi.exist() || f_fi.getModificationTime() < b_fi.getModificationTime()))
+               return path + bname;
+       else
+               return path + fname;
+}
 
 void Buffer::setReadonly(bool flag)
 {
index 371f2fe30293117f4136e38552db4fa050a77970..b717a78051e385feb9f6126ba84316cc4fc270be 100644 (file)
@@ -240,6 +240,11 @@ public:
        */
        string const getLatexName(bool no_path = true) const;
 
+       /**
+        * get the name of the LaTeX log
+        */
+       string const getLatexLogName(void) const;
        /// Change name of buffer. Updates "read-only" flag.
        void setFileName(string const & newfile);
 
index bde5f93816bed603e4c7823877f18bcb2c5e0b90..3598dcc2062e59d202ae2ff523e18d7feb37d5a0 100644 (file)
@@ -118,6 +118,25 @@ void PreferencesPolicy::input(SMInput input)
 }
 
 
+/*-------------------------------OkViewPolicy------------------------------*/
+
+
+OkViewPolicy::OkViewPolicy()
+       : state_(INITIAL),
+         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
+         state_machine_(INVALID + 1,
+                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
+{
+}
+
+
+
+void OkViewPolicy::input(SMInput)
+{
+       state_ = VALID;
+}
+
+
 /*-------------------------------OkCancelPolicy------------------------------*/
 
 
index 94f3eea983a740da1d9d82ce03352d6574d302db..56755f433b1a9076f4a7181d6d43530da74f09a3 100644 (file)
@@ -216,7 +216,32 @@ private:
        StateMachine state_machine_;
 };
 
-
+/** OK button policy for dialogs that can't mutate the document,
+    and are always valid
+ */ 
+class OkViewPolicy : public ButtonPolicy {
+public:
+       ///
+       OkViewPolicy();
+       /// Trigger a transition with this input
+       virtual void input(SMInput);
+       /// activation status
+       virtual bool buttonStatus(Button button) const {
+               return button & outputs_[state_];
+       }
+       /// are we in a read-only state ?
+       virtual bool isReadOnly() const { 
+               return false;
+       }
+private:
+       /// current state
+       State state_;
+       /// which buttons are active
+       StateOutputs outputs_;
+       ///
+       StateMachine state_machine_;
+};
 /** Ok and Cancel buttons for dialogs where read-only operation is blocked.
     The state machine design for this policy allows changes to occur within
     the dialog while a file is read-only -- the okay button is disabled until
index 5486d986d2514a1c2e521f31ce96004ad5d8d8be..d096f4ed6c24adc52857210af6b1e28cef8c8a16 100644 (file)
@@ -1,3 +1,10 @@
+2001-02-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * ButtonPolicies.C:
+       * ButtonPolicies.h: add OkViewPolicy
+
+       * src/frontends/Dialogs.h: add showVCLogFile signal
+
 2001-01-24  John Levon  <moz@compsoc.man.ac.uk>
 
        * Makefile.am: add qt2 frontend
index 8e7511842f901d07d0d9b729e150ecbf902f90f6..1e66fd118b2f642278ff0ec46eccd224eaa72f47 100644 (file)
@@ -114,7 +114,9 @@ public:
        Signal0<void> showLayoutDocument;
        ///
        Signal0<void> showLayoutParagraph;
-       ///
+       /// show the version control log
+       Signal0<void> showVCLogFile;
+       /// show the LaTeX log or build file
        Signal0<void> showLogFile;
        ///
        Signal0<void> showPreamble;
index 1f32a823ba2cb64714030dd0f9cf29c2321c3c4a..016b5c09de5083b45639f892c02532a7a7775dd3 100644 (file)
@@ -1,3 +1,20 @@
+2001-02-06  John Levon  <moz@compsoc.man.ac.uk>
+
+       * form_browser.h:
+       * form_browser.C:
+       * forms/form_browser.fd:
+       * forms/makefile:
+       * FormBrowser.C:
+       * FormBrowser.h: readonly browser form
+
+       * FormLog.C:
+       * FormLog.h:
+       * FormVCLog.C:
+       * FormVCLog.h:
+       * Dialogs.C: add Log and VCLog
+
+       * Makefile.am: add Log and VCLog, add updatesrc target
+
 2001-01-31  Dekel Tsur  <dekelts@tau.ac.il>
 
        * Menubar_pimpl.C (add_toc2): Add shortcut to the TOC menu.
index aa300df61d7dc60758ef741e349c80b9c74d7f77..00f65c45261180d4318c18289e23737dfaa234d6 100644 (file)
@@ -18,6 +18,7 @@
 #include "FormError.h"
 #include "FormGraphics.h"
 #include "FormIndex.h"
+#include "FormLog.h"
 #include "FormParagraph.h"
 #include "FormPreferences.h"
 #include "FormPrint.h"
@@ -26,7 +27,7 @@
 #include "FormTabularCreate.h"
 #include "FormToc.h"
 #include "FormUrl.h"
-//#include "debug.h"
+#include "FormVCLog.h"
 
 #ifdef __GNUG__
 #pragma implementation
@@ -51,6 +52,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormError(lv, this));
        dialogs_.push_back(new FormGraphics(lv, this));
        dialogs_.push_back(new FormIndex(lv, this));
+       dialogs_.push_back(new FormLog(lv, this));
        dialogs_.push_back(new FormParagraph(lv, this));
        dialogs_.push_back(new FormPreferences(lv, this));
        dialogs_.push_back(new FormPrint(lv, this));
@@ -59,6 +61,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormTabularCreate(lv, this));
        dialogs_.push_back(new FormToc(lv, this));
        dialogs_.push_back(new FormUrl(lv, this));
+       dialogs_.push_back(new FormVCLog(lv, this));
 
        showCredits.connect(slot(ShowCredits));
 
@@ -73,7 +76,6 @@ Dialogs::~Dialogs()
        for (vector<DialogBase *>::iterator iter = dialogs_.begin();
             iter != dialogs_.end();
             ++iter) {
-               //lyxerr << "delete *iter" << endl;
                delete *iter;
        }
 }
diff --git a/src/frontends/xforms/FormBrowser.C b/src/frontends/xforms/FormBrowser.C
new file mode 100644 (file)
index 0000000..96b35f9
--- /dev/null
@@ -0,0 +1,65 @@
+/* FormBrowser.C
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "gettext.h"
+#include "FormBrowser.h"
+#include "form_browser.h"
+#include "LyXView.h"
+#include "Dialogs.h"
+#include "lyxrc.h"
+#include "buffer.h"
+
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::slot;
+#endif
+
+FormBrowser::FormBrowser(LyXView * lv, Dialogs * d, const string & name)
+       : FormBaseBD(lv, d, name, new OkViewPolicy),
+         dialog_(0)
+{
+}
+
+FormBrowser::~FormBrowser()
+{
+       delete dialog_;
+}
+
+void FormBrowser::build()
+{
+       dialog_ = build_browser();
+
+       // Workaround dumb xforms sizing bug
+       minw_ = form()->w;
+       minh_ = form()->h;
+
+       // Manage the close button
+       bc_.setOK(dialog_->button_close);
+       bc_.refresh();
+}
+
+FL_FORM * FormBrowser::form() const
+{
+       if (dialog_)
+               return dialog_->form;
+       return 0;
+}
+
+void FormBrowser::update()
+{
+}
+
+bool FormBrowser::input(FL_OBJECT *, long)
+{
+       update();
+       return true;
+}
diff --git a/src/frontends/xforms/FormBrowser.h b/src/frontends/xforms/FormBrowser.h
new file mode 100644 (file)
index 0000000..5adda12
--- /dev/null
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+/*
+ * FormBrowser.h
+ *
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#ifndef FORMBROWSER_H
+#define FORMBROWSER_H
+
+#include "FormBase.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+class LyXView;
+class Dialogs;
+struct FD_form_browser;
+
+/**
+ * This class provides an XForms implementation of a read only
+ * text browser.
+ */
+class FormBrowser : public FormBaseBD {
+public:
+       FormBrowser(LyXView *, Dialogs *, const string &);
+       ~FormBrowser();
+
+protected:
+       /// Update the dialog.
+       virtual void update();
+
+       /// Real GUI implementation.
+       FD_form_browser * dialog_;
+
+private:
+       /// Pointer to the actual instantiation of the xform's form
+       virtual FL_FORM * form() const;
+       /// Filter the inputs on callback from xforms
+       virtual bool input(FL_OBJECT *, long);
+       /// Build the dialog
+       virtual void build();
+
+       /// generated build function
+       FD_form_browser * build_browser();
+};
+
+#endif
diff --git a/src/frontends/xforms/FormLog.C b/src/frontends/xforms/FormLog.C
new file mode 100644 (file)
index 0000000..e85e324
--- /dev/null
@@ -0,0 +1,50 @@
+/* FormLog.C
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "gettext.h" 
+#include "FormLog.h"
+#include "form_browser.h"
+#include "LyXView.h"
+#include "Dialogs.h"
+#include "lyxrc.h"
+#include "buffer.h"
+
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::slot;
+#endif
+
+FormLog::FormLog(LyXView * lv, Dialogs * d)
+       : FormBrowser(lv, d, _("LaTeX Log"))
+{
+       // let the dialog be shown
+       // This is a permanent connection so we won't bother
+       // storing a copy because we won't be disconnecting.
+       d->showLogFile.connect(slot(this, &FormLog::show));
+}
+
+FormLog::~FormLog()
+{
+}
+
+void FormLog::update()
+{
+       if (!dialog_ || !lv_->view()->available())
+               return;
+       string const logfile = lv_->view()->buffer()->getLatexLogName();
+
+       fl_clear_browser(dialog_->browser);
+
+       if (!fl_load_browser(dialog_->browser, logfile.c_str()))
+               fl_add_browser_line(dialog_->browser, _("No LaTeX log file found"));
+}
diff --git a/src/frontends/xforms/FormLog.h b/src/frontends/xforms/FormLog.h
new file mode 100644 (file)
index 0000000..9cb9ded
--- /dev/null
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+/*
+ * FormLog.h
+ *
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#ifndef FORMLOG_H
+#define FORMLOG_H
+
+#include "FormBase.h"
+#include "FormBrowser.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+class LyXView;
+class Dialogs;
+
+/**
+ * This class provides an XForms implementation of the LaTeX log dialog
+ * for viewing the last LaTeX log file.
+ */
+class FormLog : public FormBrowser {
+public:
+       FormLog(LyXView *, Dialogs *);
+       ~FormLog();
+
+private:
+       /// Update the dialog.
+       virtual void update();
+};
+
+#endif
diff --git a/src/frontends/xforms/FormVCLog.C b/src/frontends/xforms/FormVCLog.C
new file mode 100644 (file)
index 0000000..997cdcf
--- /dev/null
@@ -0,0 +1,52 @@
+/* FormVCLog.C
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "gettext.h" 
+#include "FormVCLog.h"
+#include "form_browser.h"
+#include "LyXView.h"
+#include "Dialogs.h"
+#include "lyxrc.h"
+#include "buffer.h"
+
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::slot;
+#endif
+
+FormVCLog::FormVCLog(LyXView * lv, Dialogs * d)
+       : FormBrowser(lv, d, _("Version Control Log"))
+{
+       // let the dialog be shown
+       // This is a permanent connection so we won't bother
+       // storing a copy because we won't be disconnecting.
+       d->showVCLogFile.connect(slot(this, &FormVCLog::show));
+}
+
+FormVCLog::~FormVCLog()
+{
+}
+
+void FormVCLog::update()
+{
+       if (!dialog_ || !lv_->view()->available())
+               return;
+       const string logfile = lv_->view()->buffer()->lyxvc.getLogFile();
+
+       fl_clear_browser(dialog_->browser);
+
+       if (logfile=="" || !fl_load_browser(dialog_->browser, logfile.c_str()))
+               fl_add_browser_line(dialog_->browser, _("No version control log file available"));
+
+       lyx::unlink(logfile); 
+}
diff --git a/src/frontends/xforms/FormVCLog.h b/src/frontends/xforms/FormVCLog.h
new file mode 100644 (file)
index 0000000..345c856
--- /dev/null
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+/*
+ * FormVCLog.h
+ *
+ * (C) 2001 LyX Team
+ * John Levon, moz@compsoc.man.ac.uk
+ */
+
+#ifndef FORMVCLOG_H
+#define FORMVCLOG_H
+
+#include "FormBase.h"
+#include "FormBrowser.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+class LyXView;
+class Dialogs;
+
+/**
+ * This class provides an XForms implementation of the Version Control
+ * log viewer
+ */
+class FormVCLog : public FormBrowser {
+public:
+       FormVCLog(LyXView *, Dialogs *);
+       ~FormVCLog();
+
+private:
+       /// Update the dialog.
+       virtual void update();
+};
+
+#endif
index 17d5023ca86fbab38031ac3b7f6e2205ca678aed..0ada31c4f43efddde750eb3e1a8f7c78dd07cbf3 100644 (file)
@@ -20,6 +20,10 @@ libxforms_la_SOURCES = \
        GUIRunTime.C \
        FormBase.C \
        FormBase.h \
+       FormBrowser.C \
+       FormBrowser.h \
+       form_browser.C \
+       form_browser.h \
        FormCitation.C \
        FormCitation.h \
        form_citation.C \
@@ -46,6 +50,8 @@ libxforms_la_SOURCES = \
        form_index.h \
        FormInset.C \
        FormInset.h \
+       FormLog.C \
+       FormLog.h \
        FormParagraph.C \
        FormParagraph.h \
        form_paragraph.C \
@@ -78,6 +84,8 @@ libxforms_la_SOURCES = \
        FormUrl.h \
        form_url.C \
        form_url.h \
+       FormVCLog.C \
+       FormVCLog.h \
        input_validators.h \
        input_validators.C \
        Menubar_pimpl.C \
@@ -96,6 +104,10 @@ libxforms_la_SOURCES = \
 #      GUI_runtime.C \
 #      GUI_applymenu.C
 
+# for convenience only
+updatesrc:
+       $(MAKE) -C forms updatesrc
 # just copied from old lyx repository
 dist-hook:
        for subdir in $(LYXDATADIRS) ; do \
diff --git a/src/frontends/xforms/form_browser.C b/src/frontends/xforms/form_browser.C
new file mode 100644 (file)
index 0000000..73bf6d5
--- /dev/null
@@ -0,0 +1,49 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <stdlib.h>
+#include "form_browser.h"
+#include "FormBrowser.h"
+
+FD_form_browser::~FD_form_browser()
+{
+  if ( form->visible ) fl_hide_form( form );
+  fl_free_form( form );
+}
+
+
+FD_form_browser * FormBrowser::build_browser()
+{
+  FL_OBJECT *obj;
+  FD_form_browser *fdui = new FD_form_browser;
+
+  fdui->form = fl_bgn_form(FL_NO_BOX, 470, 380);
+  fdui->form->u_vdata = this;
+  obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
+  fdui->browser = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
+    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
+  fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 370, 340, 90, 30, _("Close"));
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+    fl_set_object_callback(obj, C_FormBaseOKCB, 0);
+  {
+    char const * const dummy = N_("Update|#Uu");
+    fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 340, 90, 30, idex(_(dummy)));
+    fl_set_button_shortcut(obj, scex(_(dummy)), 1);
+  }
+    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+    fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+  fl_end_form();
+
+  fdui->form->fdui = fdui;
+
+  return fdui;
+}
+/*---------------------------------------*/
+
diff --git a/src/frontends/xforms/form_browser.h b/src/frontends/xforms/form_browser.h
new file mode 100644 (file)
index 0000000..4f061c4
--- /dev/null
@@ -0,0 +1,22 @@
+// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
+/** Header file generated with fdesign **/
+
+#ifndef FD_form_browser_h_
+#define FD_form_browser_h_
+
+/** Callbacks, globals and object handlers **/
+extern  "C" void C_FormBaseOKCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+
+/**** Forms and Objects ****/
+struct FD_form_browser {
+       ~FD_form_browser();
+
+       FL_FORM *form;
+       FL_OBJECT *browser;
+       FL_OBJECT *button_close;
+       FL_OBJECT *button_update;
+};
+
+#endif /* FD_form_browser_h_ */
diff --git a/src/frontends/xforms/forms/form_browser.fd b/src/frontends/xforms/forms/form_browser.fd
new file mode 100644 (file)
index 0000000..525ee0b
--- /dev/null
@@ -0,0 +1,88 @@
+Magic: 13000
+
+Internal Form Definition File
+    (do not change)
+
+Number of forms: 1
+Unit of measure: FL_COORD_PIXEL
+
+=============== FORM ===============
+Name: form_browser
+Width: 470
+Height: 380
+Number of Objects: 4
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 470 380
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_BROWSER
+type: NORMAL_BROWSER
+box: 10 10 450 320
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_BOTTOM
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_SouthEast
+name: browser
+callback: 
+argument: 
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 370 340 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Close
+shortcut: ^M
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_close
+callback: C_FormBaseOKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 270 340 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Update|#Uu
+shortcut: 
+resize: FL_RESIZE_NONE
+gravity: FL_SouthEast FL_SouthEast
+name: button_update
+callback: C_FormBaseInputCB
+argument: 0
+
+==============================
+create_the_forms
index 02ef562811438bfb0a1c6244589ceb72d0e20924..16555d36bf9836adacbf06d1578a80ec7d18e169 100644 (file)
@@ -23,6 +23,7 @@ SRCS := form_citation.fd \
        form_error.fd \
        form_graphics.fd \
        form_index.fd \
+       form_browser.fd \
        form_paragraph.fd \
        form_preferences.fd \
        form_print.fd \
diff --git a/src/log_form.C b/src/log_form.C
deleted file mode 100644 (file)
index bdf00bc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// File modified by fdfix.sh for use by lyx (with xforms > 0.88) and gettext
-#include <config.h>
-#include "lyx_gui_misc.h"
-#include "gettext.h"
-
-/* Form definition file generated with fdesign. */
-
-#include FORMS_H_LOCATION
-#include <cstdlib>
-#include "log_form.h"
-
-FD_LaTeXLog *create_form_LaTeXLog(void)
-{
-  FL_OBJECT *obj;
-  FD_LaTeXLog *fdui = (FD_LaTeXLog *) fl_calloc(1, sizeof(FD_LaTeXLog));
-
-  fdui->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
-  obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
-  fdui->browser_latexlog = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
-    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-  obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, LatexLogClose, 0);
-  obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30, idex(_("Update|#Uu")));fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, LatexLogUpdate, 0);
-  fl_end_form();
-
-  fdui->LaTeXLog->fdui = fdui;
-
-  return fdui;
-}
-/*---------------------------------------*/
-
diff --git a/src/log_form.h b/src/log_form.h
deleted file mode 100644 (file)
index 5fb5c3a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/** Header file generated with fdesign **/
-
-#ifndef FD_LaTeXLog_h_
-#define FD_LaTeXLog_h_
-
-/** Callbacks, globals and object handlers **/
-extern "C" void LatexLogClose(FL_OBJECT *, long);
-extern "C" void LatexLogUpdate(FL_OBJECT *, long);
-
-
-/**** Forms and Objects ****/
-typedef struct {
-       FL_FORM *LaTeXLog;
-       void *vdata;
-       char *cdata;
-       long  ldata;
-       FL_OBJECT *browser_latexlog;
-} FD_LaTeXLog;
-
-extern FD_LaTeXLog * create_form_LaTeXLog(void);
-
-#endif /* FD_LaTeXLog_h_ */
index b014e3faa5d0f9cf2cb1f249d7c5c2ebc06b3b4b..bd5e9915a0477f64be43d42ab589423f2cad570b 100644 (file)
@@ -27,7 +27,6 @@
 #include "print_form.h"
 #include "tex-strings.h"
 #include "lyx_main.h"
-#include "log_form.h"
 #include "debug.h"
 #include "version.h"
 #include "LyXView.h"
@@ -52,7 +51,6 @@ FD_form_character * fd_form_character;
 FD_form_preamble * fd_form_preamble;
 FD_form_sendto * fd_form_sendto;
 FD_form_figure * fd_form_figure;
-FD_LaTeXLog * fd_latex_log; // from log_form.h
 Combox * combo_language;
 Combox * combo_language2;
 
@@ -369,11 +367,6 @@ void LyXGUI::create_forms()
                            CancelCloseBoxCB, 0);
        fl_set_button(fd_form_figure->radio_postscript, 1);
 
-       // the latex log form
-       fd_latex_log = create_form_LaTeXLog();
-       fl_set_form_atclose(fd_latex_log->LaTeXLog,
-                           CancelCloseBoxCB, 0);
-
        // This is probably as good a time as any to map the xform colours,
        // should a mapping exist.
        {
index bb067c0e02fd9b8a810d876b9fffb673bdd168e3..63ea295635faf5f9164c70f84b6583b08be28908 100644 (file)
@@ -24,7 +24,6 @@
 #include "form1.h"
 #include "gettext.h"
 #include "include_form.h"
-#include "log_form.h"
 #include "layout_forms.h"
 #include "lyx.h"
 #include "lyx_cb.h"
@@ -51,7 +50,6 @@ extern FD_form_preamble * fd_form_preamble;
 extern FD_form_sendto * fd_form_sendto;
 extern FD_form_spell_check * fd_form_spell_check;
 extern FD_form_spell_options * fd_form_spell_options;
-extern FD_LaTeXLog * fd_latex_log;
 extern FD_panel  * fd_panel;
 extern FD_delim  * fd_delim;
 extern FD_deco   * fd_deco;
@@ -103,9 +101,6 @@ void RedrawAllBufferRelatedDialogs()
            fd_form_spell_options->form_spell_options->visible) {
                fl_redraw_form(fd_form_spell_options->form_spell_options);
        }
-       if (fd_latex_log->LaTeXLog->visible) {
-               fl_redraw_form(fd_latex_log->LaTeXLog);
-       }
        if (fd_matrix && fd_matrix->matrix->visible) {
                fl_redraw_form(fd_matrix->matrix);
        }
@@ -142,9 +137,6 @@ void CloseAllBufferRelatedDialogs()
        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);
@@ -195,9 +187,6 @@ void updateAllVisibleBufferRelatedDialogs(bool)
        if (fd_form_preamble->form_preamble->visible) {
                UpdateLayoutPreamble(current_view);
        }
-       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) {
index 40f53c1eac44fca4325ee74e619dddd14dfd90b2..63670cc57bfc71b362980a0452f30410817a44cd 100644 (file)
@@ -1178,7 +1178,7 @@ string const LyXFunc::Dispatch(int ac,
                
        case LFUN_VC_HISTORY:
        {
-               owner->buffer()->lyxvc.showLog();
+               owner->getDialogs()->showVCLogFile();
                break;
        }
        
@@ -1216,7 +1216,7 @@ string const LyXFunc::Dispatch(int ac,
                break;
 
        case LFUN_LATEX_LOG:
-               ShowLatexLog();
+               owner->getDialogs()->showLogFile();
                break;
                
        case LFUN_LAYOUTNO:
index eded1682963cb2f8568ccf3366fe50a6ee37448f..eae96b08e9827cbe72f2642190ae910b44ca0d9b 100644 (file)
@@ -24,18 +24,12 @@ using std::pair;
 LyXVC::LyXVC()
 {
        vcs = 0;
-       browser = 0;
        owner_ = 0;
 }
 
 
 LyXVC::~LyXVC()
 {
-       if (browser) {
-               if (browser->LaTeXLog->visible)
-                       fl_hide_form(browser->LaTeXLog);
-               fl_free_form(browser->LaTeXLog);
-       }
        delete vcs;
 }
 
@@ -218,83 +212,13 @@ string const & LyXVC::locker() const
 }
 
 
-// This is a hack anyway so I'll put it here in the mean time.
-void LyXVC::logClose(FL_OBJECT * obj, long)
+const string LyXVC::getLogFile() const
 {
-       LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
-       fl_hide_form(This->browser->LaTeXLog);
-}
-
-
-// and, hack over hack, here is a C wrapper :)
-extern "C" void C_LyXVC_logClose(FL_OBJECT * ob, long data)
-{
-       LyXVC::logClose(ob, data);
-}
-
-
-void LyXVC::logUpdate(FL_OBJECT * obj, long)
-{
-       LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
-       This->showLog();
-}
-
-extern "C" void C_LyXVC_logUpdate(FL_OBJECT *ob, long data)
-{
-       LyXVC::logUpdate(ob, data);
-}
+       if (!vcs)
+               return string();
 
-
-void LyXVC::viewLog(string const & fil)
-{
-       static int ow = -1, oh;
-
-       if (!browser) {
-               FL_OBJECT * obj;
-               browser = (FD_LaTeXLog *) fl_calloc(1, sizeof(*browser));
-               
-               browser->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
-               browser->LaTeXLog->u_vdata = this;
-               obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
-               browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER,
-                                                          10, 10,
-                                                          450, 320, "");
-               obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30,
-                                   _("Close"));
-               fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-               fl_set_object_callback(obj, C_LyXVC_logClose, 0);
-               obj = fl_add_button(FL_NORMAL_BUTTON, 370, 340, 90, 30,
-                                   idex(_("Update|#Uu")));
-               fl_set_button_shortcut(obj, scex(_("Update|#Uu")), 1);
-               fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-               fl_set_object_callback(obj, C_LyXVC_logUpdate, 0);
-               fl_end_form();
-               fl_set_form_atclose(browser->LaTeXLog, CancelCloseBoxCB, 0);
-       }
-
-       if (!fl_load_browser(browser->browser_latexlog, fil.c_str()))
-               fl_add_browser_line(browser->browser_latexlog,
-                                   _("No VC History!"));
-       
-       if (browser->LaTeXLog->visible) {
-               fl_raise_form(browser->LaTeXLog);
-       } else {
-               fl_show_form(browser->LaTeXLog,
-                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
-                            _("VC History"));
-               if (ow < 0) {
-                       ow = browser->LaTeXLog->w;
-                       oh = browser->LaTeXLog->h;
-               }
-               fl_set_form_minsize(browser->LaTeXLog, ow, oh);
-       }
-}
-
-
-void LyXVC::showLog()
-{
        string tmpf = lyx::tempName(string(), "lyxvclog");
+       lyxerr[Debug::LYXVC] << "Generating logfile " << tmpf << endl;
        vcs->getLog(tmpf);
-       viewLog(tmpf);
-       lyx::unlink(tmpf);
+       return tmpf;
 }
index 8f3272f699923a642ae4a46605fc9117cab7eefe..a0d8227ae6940060b4a1345a303d31b1b201ed80 100644 (file)
@@ -8,7 +8,6 @@
 #endif
 
 #include "LString.h"
-#include "log_form.h"
 
 class VCS;
 class Buffer;
@@ -69,11 +68,8 @@ public:
        /// Undo last check-in.
        void undoLast();
 
-       ///
-       void viewLog(string const &);
-
-       ///
-       void showLog();
+       /// generate a log file and return the filename
+       const string getLogFile() const;
 
        /// 
        void toggleReadOnly();
@@ -87,20 +83,12 @@ public:
        /// Returns the userid of the person who has locked the doc.
        string const & locker() const;
 
-       ///
-       static void logClose(FL_OBJECT *, long);
-       ///
-       static void logUpdate(FL_OBJECT *, long);
 private:
        ///
        Buffer * owner_;
        
        ///
        VCS * vcs;
-
-       ///
-       FD_LaTeXLog * browser; // FD_LaTeXLog is just a browser with a
-       // close button. Unfortunately we can not use the standard callbacks.
 };
 
 #endif