]> git.lyx.org Git - lyx.git/commitdiff
controller-view split of FormLog and FormVCLog.
authorAngus Leeming <leeming@lyx.org>
Tue, 20 Mar 2001 10:14:03 +0000 (10:14 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 20 Mar 2001 10:14:03 +0000 (10:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1796 a592a061-630c-0410-9148-cb99ea01b6c8

36 files changed:
src/frontends/ButtonPolicies.C [deleted file]
src/frontends/ButtonPolicies.h [deleted file]
src/frontends/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlBibitem.C
src/frontends/controllers/ControlBibitem.h
src/frontends/controllers/ControlBibtex.C
src/frontends/controllers/ControlBibtex.h
src/frontends/controllers/ControlCommand.C
src/frontends/controllers/ControlLog.C [new file with mode: 0644]
src/frontends/controllers/ControlLog.h [new file with mode: 0644]
src/frontends/controllers/ControlVCLog.C [new file with mode: 0644]
src/frontends/controllers/ControlVCLog.h [new file with mode: 0644]
src/frontends/controllers/Makefile.am
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBase.h
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/FormBibitem.h
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormBibtex.h
src/frontends/xforms/FormBrowser.C
src/frontends/xforms/FormBrowser.h
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCitation.h
src/frontends/xforms/FormLog.C
src/frontends/xforms/FormLog.h
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/FormVCLog.h
src/frontends/xforms/form_browser.C
src/frontends/xforms/form_browser.h
src/frontends/xforms/forms/form_browser.fd
src/insets/ChangeLog
src/insets/figinset.C

diff --git a/src/frontends/ButtonPolicies.C b/src/frontends/ButtonPolicies.C
deleted file mode 100644 (file)
index 89c0901..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-// -*- C++ -*-
-/* ButtonPolicies.C
- * Provides a state machine implementation of the various button policies
- * used by the dialogs.
- * Author: Allan Rae <rae@lyx.org>
- * This file is part of
- * ======================================================
- *
- *           LyX, The Document Processor
- *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
- *
- *           This file Copyright 2000
- *           Allan Rae
- * ======================================================
- */
-
-#include <config.h>
-
-#include "ButtonPolicies.h"
-#include "debug.h"
-
-using std::endl;
-
-/// Helper function
-namespace {
-
-inline
-void nextState(ButtonPolicy::State & state,
-              ButtonPolicy::SMInput in,
-              ButtonPolicy::StateMachine const & s_m,
-              char const * function_name = "nextState")
-{
-       ButtonPolicy::State tmp = s_m[state][in];
-       if (ButtonPolicy::BOGUS != tmp) {
-               state = tmp;
-       } else {
-               lyxerr << function_name
-                      << ": No transition for input "
-                      << in
-                      << " from state "
-                      << state
-                      << endl;
-       }
-}
-
-} // namespace anon
-
-
-/*-----------------------------PreferencesPolicy-----------------------------*/
-
-
-PreferencesPolicy::PreferencesPolicy()
-       : state_(INITIAL),
-         outputs_(APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(APPLIED + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-       outputs_[APPLIED] = OKAY | CLOSE;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input().  This won't necessarily be true for all
-       //        policies though so I'll leave those two as distinct
-       //        inputs rather than merge them.  For example, a dialog
-       //        that doesn't update it's input fields when reshown
-       //        after being hidden needs a policy where CANCEL and
-       //        HIDE are treated differently.
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL;
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_ONLY] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_APPLY] = APPLIED;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       // State::INVALID
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_ONLY] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-       // State::APPLIED
-       state_machine_[APPLIED][SMI_VALID] = VALID;
-       state_machine_[APPLIED][SMI_INVALID] = INVALID;
-       state_machine_[APPLIED][SMI_OKAY] = INITIAL;
-       state_machine_[APPLIED][SMI_READ_ONLY] = APPLIED;
-       state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED;
-}
-
-
-void PreferencesPolicy::input(SMInput input)
-{
-       //lyxerr << "PreferencesPolicy::input" << endl;
-       // CANCEL and HIDE always take us to INITIAL for all cases.
-       // Note that I didn't put that special case in the helper function
-       // because it doesn't belong there.  Some other 
-       // This is probably optimising for the wrong case since it occurs as the
-       // dialog will be hidden.  It would have saved a little memory in the
-       // state machine if I could have gotten map working. ARRae 20000813
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "PreferencesPolicy");
-       }
-}
-
-
-/*-------------------------------OkCancelPolicy------------------------------*/
-
-
-OkCancelPolicy::OkCancelPolicy()
-       : state_(INITIAL),
-         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(INVALID + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL;
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_ONLY] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       // State::INVALID
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_ONLY] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-}
-
-
-
-void OkCancelPolicy::input(SMInput input)
-{
-       //lyxerr << "OkCancelPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_, input, state_machine_, "OkCancelPolicy");
-       }
-}
-
-
-/*---------------------------OkCancelReadOnlyPolicy-------------------------*/
-
-
-OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
-       : state_(INITIAL),
-         outputs_(RO_INVALID + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(RO_INVALID + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_INITIAL] = CLOSE;
-       outputs_[RO_VALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_INVALID] = UNDO_ALL | CANCEL;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[VALID][SMI_READ_ONLY] = RO_VALID;
-       // State::INVALID
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID;
-       // State::RO_INITIAL
-       state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL;
-       // State::RO_VALID
-       state_machine_[RO_VALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID;
-       state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[RO_VALID][SMI_UNDO_ALL] = RO_INITIAL;
-       // State::RO_INVALID
-       state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[RO_INVALID][SMI_UNDO_ALL] = RO_INITIAL;
-}
-
-
-void OkCancelReadOnlyPolicy::input(SMInput input)
-{
-       //lyxerr << "OkCancelReadOnlyPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "OkCancelReadOnlyPolicy");
-       }
-}
-
-
-/*--------------------------NoRepeatedApplyReadOnlyPolicy----------------------*/
-
-
-NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
-       : state_(INITIAL),
-         outputs_(RO_INVALID + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(RO_INVALID + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_INITIAL] = CLOSE;
-       outputs_[RO_VALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_INVALID] = UNDO_ALL | CANCEL;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_APPLY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[VALID][SMI_READ_ONLY] = RO_VALID;
-       // State::INVALID
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID;
-       // State::RO_INITIAL
-       state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL;
-       // State::RO_VALID
-       state_machine_[RO_VALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID;
-       state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[RO_VALID][SMI_UNDO_ALL] = RO_INITIAL;
-       // State::RO_INVALID
-       state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[RO_INVALID][SMI_UNDO_ALL] = RO_INITIAL;
-}
-
-
-void NoRepeatedApplyReadOnlyPolicy::input(SMInput input)
-{
-       //lyxerr << "NoReapeatedApplyReadOnlyPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "NoRepeatedApplyReadOnlyPolicy");
-       }
-}
-
-
-/*--------------------------OkApplyCancelReadOnlyPolicy----------------------*/
-
-
-OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
-       : state_(INITIAL),
-         outputs_(RO_APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(RO_APPLIED + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-       outputs_[APPLIED] = OKAY | APPLY | CLOSE;
-       outputs_[RO_INITIAL] = CLOSE;
-       outputs_[RO_VALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_INVALID] = UNDO_ALL | CANCEL;
-       outputs_[RO_APPLIED] = CLOSE;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[VALID][SMI_APPLY] = APPLIED;
-       state_machine_[VALID][SMI_READ_ONLY] = RO_VALID;
-       // State::INVALID
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID;
-       // State::APPLIED
-       state_machine_[APPLIED][SMI_APPLY] = APPLIED;
-       state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED;
-       state_machine_[APPLIED][SMI_VALID] = VALID;
-       state_machine_[APPLIED][SMI_INVALID] = INVALID;
-       state_machine_[APPLIED][SMI_OKAY] = INITIAL;
-       state_machine_[APPLIED][SMI_READ_ONLY] = RO_APPLIED;
-       // State::RO_INITIAL
-       state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL;
-       state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL;
-       // State::RO_VALID
-       state_machine_[RO_VALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID;
-       state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[RO_VALID][SMI_UNDO_ALL] = RO_INITIAL;
-       // State::RO_INVALID
-       state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID;
-       state_machine_[RO_INVALID][SMI_VALID] = RO_VALID;
-       state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[RO_INVALID][SMI_UNDO_ALL] = RO_INITIAL;
-       // State::RO_APPLIED
-       state_machine_[RO_APPLIED][SMI_READ_ONLY] = RO_APPLIED;
-       state_machine_[RO_APPLIED][SMI_INVALID] = RO_INVALID;
-       state_machine_[RO_APPLIED][SMI_VALID] = RO_VALID;
-       state_machine_[RO_APPLIED][SMI_READ_WRITE] = APPLIED;
-}
-
-
-void OkApplyCancelReadOnlyPolicy::input(SMInput input)
-{
-       //lyxerr << "OkApplyCancelReadOnlyPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "OkApplyCancelReadOnlyPolicy");
-       }
-}
-
-
-/*--------------------------OkApplyCancelPolicy----------------------*/
-
-
-OkApplyCancelPolicy::OkApplyCancelPolicy()
-       : state_(INITIAL),
-         outputs_(APPLIED + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(APPLIED + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-       outputs_[APPLIED] = OKAY | APPLY | CLOSE;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL;
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_ONLY] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       state_machine_[VALID][SMI_APPLY] = APPLIED;
-       // State::INVALID
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_ONLY] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-       // State::APPLIED
-       state_machine_[APPLIED][SMI_APPLY] = APPLIED;
-       state_machine_[APPLIED][SMI_READ_ONLY] = APPLIED;
-       state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED;
-       state_machine_[APPLIED][SMI_VALID] = VALID;
-       state_machine_[APPLIED][SMI_INVALID] = INVALID;
-       state_machine_[APPLIED][SMI_OKAY] = INITIAL;
-}
-
-
-void OkApplyCancelPolicy::input(SMInput input)
-{
-       //lyxerr << "OkApplyCancelPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "OkApplyCancelPolicy");
-       }
-}
-
-
-/*--------------------------NoRepeatedApplyPolicy----------------------*/
-
-
-NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
-       : state_(INITIAL),
-         outputs_(INVALID + 1, ButtonPolicy::ALL_BUTTONS),
-         state_machine_(INVALID + 1,
-                        StateArray(int(SMI_TOTAL), ButtonPolicy::BOGUS))
-{
-       // Build the state output map
-       outputs_[INITIAL] = CLOSE;
-       outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL;
-       outputs_[INVALID] = UNDO_ALL | CANCEL;
-
-       // Build the state machine one state at a time
-       // NOTE:  Since CANCEL and HIDE always go to INITIAL they are
-       //        left out of the state machine and handled explicitly
-       //        in input()
-       //
-       // State::INITIAL
-       state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL;
-       state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL;
-       state_machine_[INITIAL][SMI_VALID] = VALID;
-       state_machine_[INITIAL][SMI_INVALID] = INVALID;
-       // State::VALID
-       state_machine_[VALID][SMI_VALID] = VALID;
-       state_machine_[VALID][SMI_READ_ONLY] = VALID;
-       state_machine_[VALID][SMI_READ_WRITE] = VALID;
-       state_machine_[VALID][SMI_INVALID] = INVALID;
-       state_machine_[VALID][SMI_OKAY] = INITIAL;
-       state_machine_[VALID][SMI_APPLY] = INITIAL;
-       state_machine_[VALID][SMI_UNDO_ALL] = INITIAL;
-       // State::INVALID
-       state_machine_[INVALID][SMI_INVALID] = INVALID;
-       state_machine_[INVALID][SMI_READ_ONLY] = INVALID;
-       state_machine_[INVALID][SMI_READ_WRITE] = INVALID;
-       state_machine_[INVALID][SMI_VALID] = VALID;
-       state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL;
-}
-
-
-void NoRepeatedApplyPolicy::input(SMInput input)
-{
-       //lyxerr << "NoRepeatedApplyPolicy::input" << endl;
-       
-       // CANCEL and HIDE always take us to INITIAL for all cases
-       if (SMI_CANCEL == input
-           || SMI_HIDE == input) {
-               state_ = INITIAL;
-       } else {
-               nextState(state_,
-                         input,
-                         state_machine_,
-                         "NoRepeatedApplyPolicy");
-       }
-}
diff --git a/src/frontends/ButtonPolicies.h b/src/frontends/ButtonPolicies.h
deleted file mode 100644 (file)
index a3603b6..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-// -*- C++ -*-
-/* ButtonPolicies.h
- * Provides a state machine implementation of the various button policies
- * used by the dialogs.
- * Author: Allan Rae <rae@lyx.org>
- * This file is part of
- * ======================================================
- *
- *           LyX, The Document Processor
- *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
- *
- *           This file Copyright 2000
- *           Allan Rae
- * ======================================================
- */
-
-#ifndef BUTTONPOLICIES_H
-#define BUTTONPOLICIES_H
-
-
-#include <vector>
-#include <boost/utility.hpp>
-
-#include "support/LOstream.h"
-
-/** An abstract base class for button policies.
-    A state machine implementation of the various button policies used by the
-    dialogs. Only the policy is implemented here.  Separate ButtonController
-    classes are needed for each GUI implementation.
-
-               Policy          | ReadOnly | Apply Button | Repeated Apply
-    ========================================================================
-    OkCancel                   |       N  |    N         |     -
-    OkCancelReadOnly           |       Y  |    N         |     -
-    OkApplyCancel              |       N  |    Y         |     Y
-    OkApplyCancelReadOnly      |       Y  |    Y         |     Y
-    NoRepeatedApply            |       N  |    Y         |     N
-    NoRepeatedApplyReadOnly    |       Y  |    Y         |     N
-    Preferences                        |       N  |    Y         | No (Ok-Close)
-    Ignorant                   |      N/A |    N/A       |    N/A
-    ========================================================================
-
-    Policy
-       The name of the policy
-    ReadOnly
-       Does the policy treat read-only docs differently to read-write docs?
-       This usually means that when an SMI_READ_ONLY input arrives then
-       all the buttons are disabled except Cancel/Close.  The state
-       machine tracks the inputs (valid/invalid) and has states for all
-       combinations. When an SMI_READ_WRITE input arrives the appropriate
-       machine state is entered (just as if the document had always been
-       read-write).
-       NOTE: If a dialog doesn't care about the read-only status of a document
-       (and uses an appropriate policy) it can never get into a read-only state
-       so isReadOnly() can only ever return false even though the document may
-       be read-only.
-    Repeated Apply
-       Simply means that it is alright to use the Apply button multiple times
-       without requiring a change of the dialog contents.  If no repeating is
-       allowed the Ok+Apply buttons are deactivated.  The Preferences dialog
-       has its own special version of repeated apply handling because its Ok
-       button is actually a Save button -- its always reasonable to Save the
-       preferences if the dialog has changed since the last save.
-
-    The IgnorantPolicy is a special case that allows anything.
- */
-class ButtonPolicy : public boost::noncopyable {
-public:
-       ///
-       virtual ~ButtonPolicy() {}
-
-       /** The various possible state names.
-           Not all state-machines have this many states.  However, we need
-           to define them all here so we can share the code.
-       */
-       enum State {
-               ///
-               INITIAL = 0,
-               ///
-               VALID,
-               ///
-               INVALID,
-               ///
-               APPLIED,
-               ///
-               RO_INITIAL,
-               ///
-               RO_VALID,
-               ///
-               RO_INVALID,
-               ///
-               RO_APPLIED,
-               ///
-               BOGUS = 55
-       };
-       
-       /// The various button types.
-       enum Button {
-               ///
-               CLOSE    = 0,  // Not a real button, but effectively !CANCEL
-               ///
-               OKAY     = 1,
-               ///
-               APPLY    = 2,
-               ///
-               CANCEL   = 4,
-               ///
-               UNDO_ALL = 8
-       };
-       ///
-       static const Button ALL_BUTTONS =
-               Button(OKAY | APPLY | CANCEL | UNDO_ALL);
-  
-       /** State machine inputs.
-           All the policies so far have both CANCEL and HIDE always going to
-           INITIAL. This won't necessarily be true for all [future] policies
-           though so I'll leave those two as distinct inputs rather than merge
-           them.  For example, a dialog that doesn't update it's input fields
-           when reshown after being hidden needs a policy where CANCEL and
-           HIDE are treated differently.
-        */
-       enum SMInput {
-               ///
-               SMI_VALID = 0,
-               ///
-               SMI_INVALID,
-               ///
-               SMI_OKAY,
-               ///
-               SMI_APPLY,
-               ///
-               SMI_CANCEL,
-               ///
-               SMI_UNDO_ALL,
-               ///
-               SMI_HIDE,
-               ///
-               SMI_READ_ONLY,
-               ///
-               SMI_READ_WRITE,
-               ///
-               SMI_TOTAL       // not a real input
-       };
-
-       /// Trigger a transition with this input.
-       virtual void input(SMInput) = 0;
-       /// Activation status of a button
-       virtual bool buttonStatus(Button) const = 0;
-       /// Are we in a read-only state?
-       virtual bool isReadOnly() const = 0;
-
-       /// Transition map of the state machine.
-       typedef std::vector<State> StateArray;
-       ///
-       typedef std::vector<StateArray> StateMachine;
-       /// The state outputs are the status of the buttons.
-       typedef std::vector<int> StateOutputs;
-};
-
-
-inline
-std::ostream & operator<<(std::ostream & os, ButtonPolicy::State st)
-{
-       os << int(st);
-       return os;
-}
-
-
-inline
-std::ostream & operator<<(std::ostream & os, ButtonPolicy::SMInput smi)
-{
-       os << int(smi);
-       return os;
-}
-
-
-//--------------------- Actual Policy Classes -----------------------------
-
-/** Ok and Cancel buttons for dialogs with read-only operation.
-    Note: This scheme supports the relabelling of Cancel to Close and
-    vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class OkCancelPolicy : public ButtonPolicy {
-public:
-       ///
-       OkCancelPolicy();
-       ///
-       //virtual ~OkCancelPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /** Activation status of a button.
-           We assume that we haven't gotten into an undefined state.
-           This is reasonable since we can only reach states defined
-           in the state machine and they should all have been defined in
-           the outputs_ variable.  Perhaps we can do something at compile
-           time to check that all the states have corresponding outputs.
-        */
-       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 for a given state.
-       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
-    a read-write input is given.  When the file is made read-write the dialog
-    will then be in the correct state (as if the file had always been
-    read-write).
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class OkCancelReadOnlyPolicy : public ButtonPolicy {
-public:
-       ///
-       OkCancelReadOnlyPolicy();
-       ///
-       //virtual ~OkCancelReadOnlyPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       virtual bool buttonStatus(Button button) const {
-               return button & outputs_[state_];
-       }
-       /// Are we in a read-only state?
-       virtual bool isReadOnly() const {
-               return RO_INITIAL == state_
-                       || RO_VALID == state_
-                       || RO_INVALID == state_
-                       || RO_APPLIED == state_;
-       }
-private:
-       /// Current state.
-       State state_;
-       /// Which buttons are active for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Ok, Apply and Cancel buttons for dialogs where read-only operation
-    is blocked.
-    Repeated Apply are not allowed.  Likewise,  Ok cannot follow Apply without
-    some valid input. That is, the dialog contents must change between
-    each Apply or Apply and Ok.
-    The state machine design for this policy allows changes to occur within
-    the dialog while a file is read-only -- the Ok+Apply buttons are disabled
-    until a read-write input is given.  When the file is made read-write the
-    dialog will then be in the correct state (as if the file had always been
-    read-write).
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy
-{
-public:
-       ///
-       NoRepeatedApplyReadOnlyPolicy();
-       ///
-       //virtual ~NoRepeatedApplyReadOnlyPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       virtual bool buttonStatus(Button button) const {
-               return button & outputs_[state_];
-       }
-       /// Are we in a read-only state?
-       virtual bool isReadOnly() const {
-               return RO_INITIAL == state_
-                       || RO_VALID == state_
-                       || RO_INVALID == state_
-                       || RO_APPLIED == state_;
-       }
-private:
-       /// Current state.
-       State state_;
-       /// Which buttons are active for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Ok, Apply and Cancel buttons for dialogs where read-only
-    operation is blocked.
-    Repeated Apply is allowed.  Likewise,  Ok can follow Apply.
-    The state machine design for this policy allows changes to occur within
-    the dialog while a file is read-only -- the Ok+Apply buttons are disabled
-    until a read-write input is given.  When the file is made read-write the
-    dialog will then be in the correct state (as if the file had always been
-    read-write).
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class OkApplyCancelReadOnlyPolicy : public ButtonPolicy {
-public:
-       ///
-       OkApplyCancelReadOnlyPolicy();
-       ///
-       //virtual ~OkApplyCancelReadOnlyPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       virtual bool buttonStatus(Button button) const {
-               return button & outputs_[state_];
-       }
-       /// Are we in a read-only state?
-       virtual bool isReadOnly() const {
-               return RO_INITIAL == state_
-                       || RO_VALID == state_
-                       || RO_INVALID == state_
-                       || RO_APPLIED == state_;
-       }
-private:
-       /// Current state.
-       State state_;
-       /// Which buttons are active for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Ok, Apply and Cancel buttons for dialogs where repeated Apply is allowed.
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class OkApplyCancelPolicy : public ButtonPolicy {
-public:
-       ///
-       OkApplyCancelPolicy();
-       ///
-       //virtual ~OkApplyCancelPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       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 for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Ok, Apply and Cancel buttons for dialogs with no repeated Apply.
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class NoRepeatedApplyPolicy : public ButtonPolicy {
-public:
-       ///
-       NoRepeatedApplyPolicy();
-       ///
-       //virtual ~NoRepeatedApplyPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       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 for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Defines the policy used by the Preferences dialog.
-    Four buttons: Ok (Save), Apply, Cancel/Close, Restore.
-    Note: This scheme supports the relabelling of Cancel to Close
-    and vice versa.
-    This is based on the value of the bool state of the Button::CANCEL.
-    true == Cancel, false == Close
- */
-class PreferencesPolicy : public ButtonPolicy {
-public:
-       ///
-       PreferencesPolicy();
-       ///
-       //virtual ~PreferencesPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput);
-       /// Activation status of a button.
-       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 for a given state.
-       StateOutputs outputs_;
-       ///
-       StateMachine state_machine_;
-};
-
-
-/** Defines the policy used by dialogs that are forced to support a button
-    controller when they either don't have a use for one or are not ready to
-    use one.  This may be useful when testing a new button policy but wishing
-    to minimise problems to users by supplying an anything-goes policy via a
-    preprocessor directive.
- */
-class IgnorantPolicy : public ButtonPolicy {
-public:
-       //virtual ~IgnorantPolicy() {}
-       
-       /// Trigger a transition with this input.
-       virtual void input(SMInput) {}
-       /// Activation status of a button.
-       virtual bool buttonStatus(Button) const {
-               return true;
-       }
-       /// Are we in a read-only state?
-       virtual bool isReadOnly() const {
-               return false;
-       }
-};
-
-#endif
index 2044533b07eadc654acb2c71c45ec82e254d36d4..a76f3d3d008380fbe980bf5a594771003a79318b 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-20  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * ButtonPolicies.[Ch]: removed (thought I did this before?). The files
+       are now stored in the controllers dir.
+
 2001-03-16  Juergen Vigna  <jug@sad.it>
 
        * Dialogs.h (noncopyable): added minipage signals.
index b84d2a3dde574fa447ebb040e40cc47f1386563c..dfb923b5ba91414321473a9cbc468683cc879c4e 100644 (file)
@@ -1,3 +1,11 @@
+2001-03-20  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * ControlLog.[Ch]:
+       * ControlVCLog.[Ch]: new files; controllers for LaTeX and Version
+       Control log files, respectively.
+
+       * Makefile.am: added new files.
+
 2001-03-19  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * ControlBibtex.[Ch]: new files; controller for an InsetBibtex popup.
index 416983a992a13aaeeeba233860b2aab60c0439a8..3ca711a592e9f9df8b386aa4856943fee9e1082d 100644 (file)
@@ -4,11 +4,12 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2001 The LyX Team.
  *
  * ======================================================
  *
  * \file ControlBibitem.C
+ * \author John Levon, moz@compsoc.man.ac.uk
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
index 98b7bb53086cd6890ecd647d66f3e2f7b97f86d4..e6ead2ad8d0373930277416fcfebeed87ecc2608 100644 (file)
@@ -4,11 +4,12 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2001 The LyX Team.
  *
  * ======================================================
  *
  * \file ControlBibitem.h
+ * \author John Levon, moz@compsoc.man.ac.uk
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
index 8614b105bbb9f4e76fd8b154dacfedbef83a0fdd..0692d609829c89de5757243117ffcc1d510fca9a 100644 (file)
@@ -4,11 +4,12 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2001 The LyX Team.
  *
  * ======================================================
  *
  * \file ControlBibtex.C
+ * \author John Levon, moz@compsoc.man.ac.uk
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
index 46994272927132b9893c297670814688e45d114a..2771ed36d5b27ca8d51189eadc2161ee1d902265 100644 (file)
@@ -4,11 +4,12 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2001 The LyX Team.
  *
  * ======================================================
  *
  * \file ControlBibtex.h
+ * \author John Levon, moz@compsoc.man.ac.uk
  * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
index b19c7c72194c1867be42ebc3cadc3338dd7df378..bc2744db00c245e307e11372c84a2925812b6926 100644 (file)
@@ -4,7 +4,7 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2001 The LyX Team.
  *
  * ======================================================
  *
diff --git a/src/frontends/controllers/ControlLog.C b/src/frontends/controllers/ControlLog.C
new file mode 100644 (file)
index 0000000..ff00b6c
--- /dev/null
@@ -0,0 +1,66 @@
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlLog.h
+ * \author John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <config.h>
+#include "ButtonController.h"
+#include "ControlLog.h"
+#include "LyXView.h"
+#include "Dialogs.h"
+#include "lyxrc.h"
+#include "ViewBase.h"
+
+using std::make_pair;
+using SigC::slot;
+
+ControlLog::ControlLog(LyXView & lv, Dialogs & d)
+       : ControlConnectBD(lv, d)
+{
+       d_.showLogFile.connect(slot(this, &ControlLog::show));
+}
+
+
+void ControlLog::show()
+{
+       if (!lv_.view()->available())
+               return;
+
+       logfile_ = lv_.view()->buffer()->getLogName();
+
+       bc().readOnly(isReadonly());
+       view().show();
+}
+
+
+void ControlLog::update()
+{
+       if (!lv_.view()->available())
+               return;
+
+       logfile_ = lv_.view()->buffer()->getLogName();
+       
+       bc().readOnly(isReadonly());
+       view().update();
+}
+
+
+void ControlLog::hide()
+{
+       logfile_.second.erase();
+       disconnect();
+       view().hide();
+}
diff --git a/src/frontends/controllers/ControlLog.h b/src/frontends/controllers/ControlLog.h
new file mode 100644 (file)
index 0000000..63d66e6
--- /dev/null
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlLog.h
+ * \author John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifndef CONTROLLOG_H
+#define CONTROLLOG_H
+
+#include <utility>
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlConnections.h"
+#include "buffer.h" // Buffer::LogType
+
+/**
+ * A controller for a read-only text browser.
+ */
+class ControlLog : public ControlConnectBD {
+public:
+       ///
+       ControlLog(LyXView &, Dialogs &);
+       ///
+       std::pair<Buffer::LogType, string> const & logfile()
+               { return logfile_; }
+
+protected:
+       ///
+       virtual void apply() {}
+       /// Show the dialog.
+       virtual void show();
+       /// Update the dialog.
+       virtual void update();
+       /// Hide the dialog.
+       virtual void hide();
+
+private:
+       std::pair<Buffer::LogType, string> logfile_;
+};
+
+
+/** A class to instantiate and make available the GUI-specific
+    ButtonController and View.
+ */
+template <class GUIview, class GUIbc>
+class GUILog : public ControlLog {
+public:
+       ///
+       GUILog(LyXView &, Dialogs &);
+       ///
+       virtual ButtonControllerBase & bc() { return bc_; }
+       ///
+       virtual ViewBase & view() { return view_; }
+
+private:
+       ///
+       ButtonController<OkCancelPolicy, GUIbc> bc_;
+       ///
+       GUIview view_;
+};
+
+template <class GUIview, class GUIbc>
+GUILog<GUIview, GUIbc>::GUILog(LyXView & lv, Dialogs & d)
+       : ControlLog(lv, d),
+         view_(*this)
+{}
+
+#endif // CONTROLLOG_H
diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C
new file mode 100644 (file)
index 0000000..acba9d7
--- /dev/null
@@ -0,0 +1,68 @@
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlVCLog.h
+ * \author John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <config.h>
+#include "buffer.h"
+#include "ButtonController.h"
+#include "ControlVCLog.h"
+#include "LyXView.h"
+#include "Dialogs.h"
+#include "lyxrc.h"
+#include "ViewBase.h"
+
+using SigC::slot;
+
+ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
+       : ControlConnectBD(lv, d)
+{
+       d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
+}
+
+
+void ControlVCLog::show()
+{
+       if (!lv_.view()->available())
+               return;
+
+       logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
+
+       bc().readOnly(isReadonly());
+       view().show();
+}
+
+
+void ControlVCLog::update()
+{
+       if (!lv_.view()->available())
+               return;
+
+       logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
+       
+       bc().readOnly(isReadonly());
+       view().update();
+
+       lyx::unlink(logfile_); 
+}
+
+
+void ControlVCLog::hide()
+{
+       logfile_.erase();
+       disconnect();
+       view().hide();
+}
diff --git a/src/frontends/controllers/ControlVCLog.h b/src/frontends/controllers/ControlVCLog.h
new file mode 100644 (file)
index 0000000..6da6c7b
--- /dev/null
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ *
+ *           LyX, The Document Processor
+ *
+ *           Copyright 2001 The LyX Team.
+ *
+ * ======================================================
+ *
+ * \file ControlVCLog.h
+ * \author John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#ifndef CONTROLVCLOG_H
+#define CONTROLVCLOG_H
+
+#include <utility>
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlConnections.h"
+
+/**
+ * A controller for the Version Control log viewer.
+ */
+class ControlVCLog : public ControlConnectBD {
+public:
+       ///
+       ControlVCLog(LyXView &, Dialogs &);
+       ///
+       string const & logfile() { return logfile_; }
+
+protected:
+       ///
+       virtual void apply() {}
+       /// Show the dialog.
+       virtual void show();
+       /// Update the dialog.
+       virtual void update();
+       /// Hide the dialog.
+       virtual void hide();
+
+private:
+       string logfile_;
+};
+
+
+/** A class to instantiate and make available the GUI-specific
+    ButtonController and View.
+ */
+template <class GUIview, class GUIbc>
+class GUIVCLog : public ControlVCLog {
+public:
+       ///
+       GUIVCLog(LyXView &, Dialogs &);
+       ///
+       virtual ButtonControllerBase & bc() { return bc_; }
+       ///
+       virtual ViewBase & view() { return view_; }
+
+private:
+       ///
+       ButtonController<OkCancelPolicy, GUIbc> bc_;
+       ///
+       GUIview view_;
+};
+
+template <class GUIview, class GUIbc>
+GUIVCLog<GUIview, GUIbc>::GUIVCLog(LyXView & lv, Dialogs & d)
+       : ControlVCLog(lv, d),
+         view_(*this)
+{}
+
+#endif // CONTROLVCLOG_H
index 53bc704593519dd213f543739d7dfa4caa1ec651..65fcafb648eb2195813c6e7c3c6a9376a97147e5 100644 (file)
@@ -26,6 +26,10 @@ libcontrollers_la_SOURCES=\
        ControlCommand.h \
        ControlConnections.C \
        ControlConnections.h \
+       ControlLog.C \
+       ControlLog.h \
+       ControlVCLog.C \
+       ControlVCLog.h \
        ViewBase.h
 
 # just copied from old lyx repository
index 5b8dee4181bad1e04392b120310767116375edf9..b17729df061ca9cd68ae5474722104df1a2aa8a5 100644 (file)
@@ -1,3 +1,28 @@
+2001-03-20  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormBase.[Ch] (input): no longer pure virtual. Has defualt state of
+       SMI_NOOP.
+       (FormBase2): split into two template classes, FormDB (DialogBase) and
+       FormCB (ControllerBase) for greater flexibility.
+
+       * FormBibitem.[Ch]:
+       * FormBibtex.[Ch]:
+       * FormCitation.[Ch]: associated changes.
+
+       * FormBrowser.[Ch]:
+       * FormLog.[Ch]:
+       * FormVCLog.[Ch]:
+       * forms/form_browser.fd: implemented controller-view split.
+
+       * Dialogs.C: associated changes.
+
+2001-03-19  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * FormBibtex.[Ch]:
+       * forms/form_bibtex.fd: implemented controller-view split.
+
+       * Dialogs.C: associated changes.
+
 2001-03-19  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * FormBibtex.[Ch]:
index b1b6b9d520772c3f78c8406346e7e27b870ca57b..776df33c40d852b711c4a38bce145d3c2ba81f33 100644 (file)
 #include "ControlBibitem.h"
 #include "ControlBibtex.h"
 #include "ControlCitation.h"
+#include "ControlLog.h"
+#include "ControlVCLog.h"
 #include "xformsBC.h"
 
+#include "form_bibitem.h" // needed for clean destructtion of boost::scoped ptr
+#include "form_bibtex.h"
+#include "form_browser.h"
+#include "form_citation.h"
+
 #include "FormBibitem.h"
 #include "FormBibtex.h"
 #include "FormCitation.h"
+#include "FormLog.h"
+#include "FormVCLog.h"
+
 #include "FormCharacter.h"
 #include "FormCopyright.h"
 #include "FormCredits.h"
@@ -34,7 +44,6 @@
 #include "FormGraphics.h"
 #include "FormInclude.h"
 #include "FormIndex.h"
-#include "FormLog.h"
 #include "FormMathsPanel.h"
 #include "FormParagraph.h"
 #include "FormPreamble.h"
@@ -47,7 +56,6 @@
 #include "FormTabularCreate.h"
 #include "FormToc.h"
 #include "FormUrl.h"
-#include "FormVCLog.h"
 #include "FormMinipage.h"
 
 // Signal enabling all visible popups to be redrawn if so desired.
@@ -61,6 +69,8 @@ Dialogs::Dialogs(LyXView * lv)
        add(new GUICitation<FormCitation, xformsBC>(*lv, *this));
        add(new GUIBibitem<FormBibitem, xformsBC>(*lv, *this));
        add(new GUIBibtex<FormBibtex, xformsBC>(*lv, *this));
+       add(new GUILog<FormLog, xformsBC>(*lv, *this));
+       add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
 
        add(new FormCharacter(lv, this));
        add(new FormCopyright(lv, this));
@@ -71,7 +81,6 @@ Dialogs::Dialogs(LyXView * lv)
        add(new FormGraphics(lv, this));
        add(new FormInclude(lv, this));
        add(new FormIndex(lv, this));
-       add(new FormLog(lv, this));
        add(new FormMathsPanel(lv, this));
        add(new FormParagraph(lv, this));
        add(new FormPreamble(lv, this));
@@ -84,7 +93,6 @@ Dialogs::Dialogs(LyXView * lv)
        add(new FormTabularCreate(lv, this));
        add(new FormToc(lv, this));
        add(new FormUrl(lv, this));
-       add(new FormVCLog(lv, this));
        add(new FormMinipage(lv, this));
        
        // reduce the number of connections needed in
index d2547f63202e869bfa86321ab08c584059381678..30cfc33d0ce08fc6e2ca3defa28177e88bd820d4 100644 (file)
@@ -7,6 +7,8 @@
  *           Copyright 2000 The LyX Team.
  *
  * ======================================================
+ *
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #include <config.h>
@@ -87,6 +89,12 @@ void FormBase::InputCB(FL_OBJECT * ob, long data)
 }
 
 
+ButtonPolicy::SMInput FormBase::input(FL_OBJECT *, long)
+{
+       return ButtonPolicy::SMI_NOOP;
+}
+
+
 namespace {
 
 FormBase * GetForm(FL_OBJECT * ob)
index 8668e3722f92c5f7fa4ae54ba78b152ae0fb3942..fe7761e2fe79d1a7317ebbfe31fefb673703049e 100644 (file)
@@ -8,7 +8,7 @@
  *
  * ======================================================
  *
- * Author: Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #ifndef FORMBASE_H
@@ -53,7 +53,7 @@ private:
        virtual FL_FORM * form() const = 0;
        /** Filter the inputs on callback from xforms
            Return true if inputs are valid. */
-       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long) = 0;
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
        /** Redraw the form (on receipt of a Signal indicating, for example,
            that the xform colors have been re-mapped). */
@@ -71,14 +71,12 @@ private:
 };
 
 
-template <class Controller, class Dialog>
-class FormBase2: public FormBase
+template <class Dialog>
+class FormDB: public FormBase
 {
 protected:
        ///
-       FormBase2(ControlBase &, string const &);
-       /// The parent controller
-       Controller & controller() const;
+       FormDB(ControlBase &, string const &);
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const;
        /// Real GUI implementation.
@@ -86,25 +84,42 @@ protected:
 };
 
 
-template <class Controller, class Dialog>
-FormBase2<Controller, Dialog>::FormBase2(ControlBase & c, string const & t)
+template <class Dialog>
+FormDB<Dialog>::FormDB(ControlBase & c, string const & t)
        : FormBase(c, t)
 {}
 
 
-template <class Controller, class Dialog>
-Controller & FormBase2<Controller, Dialog>::controller() const
+template <class Dialog>
+FL_FORM * FormDB<Dialog>::form() const
 {
-       return static_cast<Controller &>(controller_);
-       //return dynamic_cast<Controller &>(controller_);
+       if (dialog_.get()) return dialog_->form;
+       return 0;
 }
 
 
-template <class Controller, class Dialog>
-FL_FORM * FormBase2<Controller, Dialog>::form() const
+template <class Controller, class Base>
+class FormCB: public Base
 {
-       if (dialog_.get()) return dialog_->form;
-       return 0;
+protected:
+       ///
+       FormCB(ControlBase &, string const &);
+       /// The parent controller
+       Controller & controller() const;
+};
+
+
+template <class Controller, class Base>
+FormCB<Controller, Base>::FormCB(ControlBase & c, string const & t)
+       : Base(c, t)
+{}
+
+
+template <class Controller, class Base>
+Controller & FormCB<Controller, Base>::controller() const
+{
+       return static_cast<Controller &>(controller_);
+       //return dynamic_cast<Controller &>(controller_);
 }
 
 
index d23831c7536c46197c375b8f58baf83da0f22611..69aeb1afa544d6c9e97ac9d4e82bfbb8fc475813 100644 (file)
 #include <config.h>
 #include "ControlBibitem.h"
 #include "FormBibitem.h"
+#include "form_bibitem.h"
 #include "gettext.h"
 #include "xformsBC.h"
 #include "support/lstrings.h" // compare
 
+typedef FormCB<ControlBibitem, FormDB<FD_form_bibitem> > base_class;
+
 FormBibitem::FormBibitem(ControlBibitem & c)
-       : FormBase2<ControlBibitem, FD_form_bibitem>(c, _("Bibliography Entry"))
+       : base_class(c, _("Bibliography Entry"))
 {}
 
 
index f103d12e27fc7e5eea4e44ab3ef0d882ca7dde7a..3016ab6aaf2ea7d597ae73f8c179ed46ee62579d 100644 (file)
@@ -4,8 +4,8 @@
  * Copyright 2001 the LyX Team
  * Read the file COPYING
  *
- * \author Angus Leeming
- * \author John Levon
+ * \author John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming, a.leeming@.ac.uk
  */
 
 #ifndef FORMBIBITEM_H
 
 #include "FormBase.h"
 
-#include "form_bibitem.h"
-
 class ControlBibitem;
+struct FD_form_bibitem;
 
 /**
  * For bibliography entry editing
  */
-class FormBibitem : public FormBase2<ControlBibitem, FD_form_bibitem> {
+class FormBibitem : public FormCB<ControlBibitem, FormDB<FD_form_bibitem> > {
 public:
        ///
        FormBibitem(ControlBibitem &);
index 2f32c2434bc37f27c36f03256d26818d5cef7a28..333a8f4cf7037225f2bb0279cdc88a2e400126f7 100644 (file)
 #include <config.h>
 #include "ControlBibtex.h"
 #include "FormBibtex.h"
+#include "form_bibtex.h"
 #include "gettext.h"
 #include "xformsBC.h"
 #include "debug.h"
 
+typedef FormCB<ControlBibtex, FormDB<FD_form_bibtex> > base_class;
+
 FormBibtex::FormBibtex(ControlBibtex & c)
-       : FormBase2<ControlBibtex, FD_form_bibtex>(c, _("BibTeX Database"))
+       : base_class(c, _("BibTeX Database"))
 {}
 
 
index ce9ca1d3787a5f5fd6f10bb293190f44171e9276..452cab7d594bcfb2eb6411641564fa1ffaa340a2 100644 (file)
 
 #include "FormBase.h"
 
-#include "form_bibtex.h"
-
 class ControlBibtex;
+struct FD_form_bibtex;
 
 /**
  * For bibtex database setting
  */
-class FormBibtex : public FormBase2<ControlBibtex, FD_form_bibtex> {
+class FormBibtex : public FormCB<ControlBibtex, FormDB<FD_form_bibtex> > {
 public:
        ///
        FormBibtex(ControlBibtex &);
index 7641dddec96e30b8f8c24d23bacf56604285f7a0..2b2aae8f81d84ffc9ab55ecd1a1c7ff10614206d 100644 (file)
@@ -3,26 +3,19 @@
  * John Levon, moz@compsoc.man.ac.uk
  */
 
-#include <config.h>
-
-#include FORMS_H_LOCATION
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "gettext.h"
+#include <config.h>
 #include "FormBrowser.h"
 #include "form_browser.h"
-#include "LyXView.h"
-#include "Dialogs.h"
-#include "lyxrc.h"
-#include "buffer.h"
+#include "xformsBC.h"
 
-FormBrowser::FormBrowser(LyXView * lv, Dialogs * d, const string & name)
-       : FormBaseBD(lv, d, name)
+FormBrowser::FormBrowser(ControlBase & c, string const & t)
+       : FormDB<FD_form_browser>(c, t)
 {}
-
+       
 
 void FormBrowser::build()
 {
@@ -32,21 +25,3 @@ void FormBrowser::build()
        bc().setCancel(dialog_->button_close);
        bc().refresh();
 }
-
-
-FL_FORM * FormBrowser::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
-
-void FormBrowser::update()
-{}
-
-
-bool FormBrowser::input(FL_OBJECT *, long)
-{
-       update();
-       return true;
-}
index 6de60da1d4a747caae5eff857d957f8448eb8de3..6e601ef2b80670cfc54fdf58e3926b19826b8e98 100644 (file)
@@ -1,58 +1,37 @@
 // -*- C++ -*-
 /*
- * FormBrowser.h
+ * \file FormBrowser.h
  *
  * (C) 2001 LyX Team
  * John Levon, moz@compsoc.man.ac.uk
+ * \author Angus Leeming, a.leeming@.ac.uk
  */
 
 #ifndef FORMBROWSER_H
 #define FORMBROWSER_H
 
-#include <boost/smart_ptr.hpp>
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include "FormBaseDeprecated.h"
-
-struct FD_form_browser;
+#include "FormBase.h"
 
 /**
  * This class provides an XForms implementation of a read only
  * text browser.
  */
-class FormBrowser : public FormBaseBD {
+struct FD_form_browser;
+
+class FormBrowser : public FormDB<FD_form_browser> {
 public:
        ///
-       FormBrowser(LyXView *, Dialogs *, const string &);
-protected:
-       /// Update the dialog.
-       virtual void update();
+       FormBrowser(ControlBase &, string const &);
 
-       /// Real GUI implementation.
-       boost::scoped_ptr<FD_form_browser> dialog_;
-       /// Pointer to the actual instantiation of the ButtonController.
-       virtual xformsBC & bc();
 private:
-       /// Pointer to the actual instantiation of the xforms form
-       virtual FL_FORM * form() const;
-       /// Filter the inputs on callback from xforms
-       virtual bool input(FL_OBJECT *, long);
-       /// Build the dialog
+       /// Build the dialog.
        virtual void build();
-
        /// generated build function
        FD_form_browser * build_browser();
-       /// The ButtonController
-       ButtonController<OkCancelPolicy, xformsBC> bc_;
 };
 
-
-inline
-xformsBC & FormBrowser::bc()
-{
-       return bc_;
-}
-#endif
+#endif // FORMBROWSER_H
index 0e65ed61776f9b610870834885db06f802df2487..eb63893974e0ab8444eac6e4642fd28d4b1df631 100644 (file)
@@ -7,6 +7,8 @@
  *           Copyright 2000 The LyX Team.
  *
  * ======================================================
+ *
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #include <algorithm>
@@ -31,8 +33,10 @@ using std::pair;
 using std::sort;
 using std::vector;
 
+typedef FormCB<ControlCitation, FormDB<FD_form_citation> > base_class;
+
 FormCitation::FormCitation(ControlCitation & c)
-       : FormBase2<ControlCitation, FD_form_citation>(c, _("Citation"))
+       : base_class(c, _("Citation"))
 {}
 
 
@@ -241,7 +245,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
                        ControlCitation::REGEX : ControlCitation::SIMPLE;
 
                vector<string>::const_iterator start = bibkeys.begin();
-               unsigned int const sel = fl_get_browser(dialog_->browser_bib);
+               int const sel = fl_get_browser(dialog_->browser_bib);
                if (sel >= 1 && sel <= bibkeys.size())
                        start += sel-1;
 
index 59d2e6918644b914879a2a22eb5d9906a1f6b13d..d35c256a15b75e4bdae3bf99e9147a41f808b306 100644 (file)
@@ -8,7 +8,7 @@
  *
  * ======================================================
  *
- * Author: Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #ifndef FORMCITATION_H
 
 /** This class provides an XForms implementation of the Citation Dialog.
  */
-#include "form_citation.h"
 class ControlCitation;
+struct FD_form_citation;
 
-class FormCitation : public FormBase2<ControlCitation, FD_form_citation> {
+class FormCitation : public FormCB<ControlCitation, FormDB<FD_form_citation> > {
 public:
        ///
        FormCitation(ControlCitation &);
index 4baadfc0cef3a8f61da93b41c69abe0ba8ee9c17..194fc2a96edefe2416603febf5dd79329e13bd55 100644 (file)
@@ -3,54 +3,38 @@
  * John Levon, moz@compsoc.man.ac.uk
  */
 
-#include <config.h>
-
-#include FORMS_H_LOCATION
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "gettext.h" 
+#include <config.h>
+#include "xformsBC.h"
+#include "ControlLog.h"
 #include "FormLog.h"
 #include "form_browser.h"
-#include "LyXView.h"
-#include "Dialogs.h"
-#include "lyxrc.h"
-#include "buffer.h"
+#include "gettext.h"
 
-using SigC::slot;
-
-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(ControlLog & c)
+       : FormCB<ControlLog, FormBrowser>(c, _("LaTeX Log"))
+{}
 
 
 void FormLog::update()
 {
-       if (!dialog_.get() || !lv_->view()->available())
-               return;
-       std::pair<Buffer::LogType, string> const logfile
-               = lv_->view()->buffer()->getLogName();
-
        fl_clear_browser(dialog_->browser);
 
-       if (logfile.first == Buffer::buildlog) {
+       if (controller().logfile().first == Buffer::buildlog) {
                fl_set_form_title(dialog_->form, _("Build log"));
-               if (!fl_load_browser(dialog_->browser, logfile.second.c_str()))
+               if (!fl_load_browser(dialog_->browser,
+                                    controller().logfile().second.c_str()))
                        fl_add_browser_line(dialog_->browser,
                                            _("No build log file found"));
                return;
        }
 
        fl_set_form_title(dialog_->form, _("LaTeX Log"));
-       if (!fl_load_browser(dialog_->browser, logfile.second.c_str()))
+       if (!fl_load_browser(dialog_->browser,
+                            controller().logfile().second.c_str()))
                fl_add_browser_line(dialog_->browser,
                                    _("No LaTeX log file found"));
 }
index ed82c8e06203a8728cc4e688ec1badef675538b4..220dd3d03ac9a1015cf6934e7d20ce350fdab660 100644 (file)
@@ -9,27 +9,29 @@
 #ifndef FORMLOG_H
 #define FORMLOG_H
 
-#include "FormBaseDeprecated.h"
-#include "FormBrowser.h"
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-class LyXView;
-class Dialogs;
+#include "FormBrowser.h"
+
+class ControlLog;
 
 /**
  * This class provides an XForms implementation of the LaTeX log dialog
  * for viewing the last LaTeX log file.
  */
-class FormLog : public FormBrowser {
+class FormLog : public FormCB<ControlLog, FormBrowser> {
 public:
        ///
-       FormLog(LyXView *, Dialogs *);
-private:
-       /// Update the dialog.
+       FormLog(ControlLog &);
+
+       // Functions accessible to the Controller.
+
+       /// Set the Params variable for the Controller.
+       virtual void apply() {}
+       /// Update dialog before/whilst showing it.
        virtual void update();
 };
 
-#endif
+#endif // FORMLOG_H
index 3e7abab8848267fe6c9d50dd3e2ca7cac1e83742..a1581e7f623af191bee8cf5649e0548369186f90 100644 (file)
 #include "MathsSymbols.h"
 #include "debug.h"
 
+#include "form_maths_deco.h"
+#include "form_maths_delim.h"
+#include "form_maths_matrix.h"
+#include "form_maths_space.h"
+
 #include "FormMathsBitmap.h"
 #include "FormMathsDeco.h"
-#include "form_maths_deco.h"
 #include "FormMathsDelim.h"
-#include "form_maths_delim.h"
 #include "FormMathsMatrix.h"
-#include "form_maths_matrix.h"
 #include "FormMathsSpace.h"
-#include "form_maths_space.h"
 
 #include "deco.xpm"
 #include "delim.xpm"
index 0fd056768cd1705f51e9a6a8ddc036ec43eca0e9..b58b93ac65db7ddc89aeb3599706b956669e01ea 100644 (file)
@@ -3,45 +3,28 @@
  * John Levon, moz@compsoc.man.ac.uk
  */
 
-#include <config.h>
-
-#include FORMS_H_LOCATION
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "gettext.h" 
+#include <config.h>
+#include "xformsBC.h"
+#include "ControlVCLog.h"
 #include "FormVCLog.h"
 #include "form_browser.h"
-#include "LyXView.h"
-#include "Dialogs.h"
-#include "lyxrc.h"
-#include "buffer.h"
+#include "gettext.h"
 
-using SigC::slot;
-
-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(ControlVCLog & c)
+       : FormCB<ControlVCLog, FormBrowser>(c, _("Version Control Log"))
+{}
 
 
 void FormVCLog::update()
 {
-       if (!dialog_.get() || !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); 
+       if (controller().logfile().empty() ||
+           !fl_load_browser(dialog_->browser, controller().logfile().c_str()))
+               fl_add_browser_line(dialog_->browser,
+                                   _("No version control log file available"));
 }
index 56df0b2ee5791f9d0b430cc09dc65963483b0766..cca629d009f60fad0376e68a6971f6b4dd14b6ae 100644 (file)
@@ -9,27 +9,29 @@
 #ifndef FORMVCLOG_H
 #define FORMVCLOG_H
 
-#include "FormBaseDeprecated.h"
-#include "FormBrowser.h"
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-class LyXView;
-class Dialogs;
+#include "FormBrowser.h"
+
+class ControlVCLog;
 
 /**
  * This class provides an XForms implementation of the Version Control
  * log viewer
  */
-class FormVCLog : public FormBrowser {
+class FormVCLog : public FormCB<ControlVCLog, FormBrowser> {
 public:
        ///
-       FormVCLog(LyXView *, Dialogs *);
-private:
-       /// Update the dialog.
+       FormVCLog(ControlVCLog &);
+
+       // Functions accessible to the Controller.
+
+       /// Set the Params variable for the Controller.
+       virtual void apply() {}
+       /// Update dialog before/whilst showing it.
        virtual void update();
 };
 
-#endif
+#endif // FORMVCLOG_H
index c623cea6b53d5737082372961d5371a011f459cb..326e955295c534325dda9b87a0c0d79763581698 100644 (file)
@@ -34,7 +34,7 @@ FD_form_browser * FormBrowser::build_browser()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0);
+    fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
   {
     char const * const dummy = N_("Update|#Uu");
     fdui->button_update = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 340, 90, 30, idex(_(dummy)));
@@ -42,7 +42,7 @@ FD_form_browser * FormBrowser::build_browser()
   }
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0);
+    fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
   fl_end_form();
 
   fdui->form->fdui = fdui;
index e2c80a3e19de7e306a945cc84c9a2911c7b001db..a4f3a3d13494ec03e099a7d777abd3177d368af6 100644 (file)
@@ -5,8 +5,8 @@
 #define FD_form_browser_h_
 
 /** Callbacks, globals and object handlers **/
-extern  "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long);
-extern  "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
+extern  "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
 
 
 /**** Forms and Objects ****/
index 9a565286a685d92f90e9239a58d978baa8dea5e3..30777451c01f4a77da678a42d536bb609b5b4602 100644 (file)
@@ -63,7 +63,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_close
-callback: C_FormBaseDeprecatedCancelCB
+callback: C_FormBaseCancelCB
 argument: 0
 
 --------------------
@@ -81,7 +81,7 @@ shortcut:
 resize: FL_RESIZE_NONE
 gravity: FL_SouthEast FL_SouthEast
 name: button_update
-callback: C_FormBaseDeprecatedInputCB
+callback: C_FormBaseRestoreCB
 argument: 0
 
 ==============================
index e64b36c777d0f0959fe162d7664a7208d433811c..2ea7ef90dbbf3f87bf13bc7523a8deb09b923be7 100644 (file)
@@ -1,3 +1,8 @@
+2001-03-20  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * figinset.C (fl_set_preemptive_callback): moved definition outside
+       of namespace anon.
+
 2001-03-20  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
        * insetminipage.C (Read): prepare for reading of minipage arguments.
index b55ff8f04e15b8c765e00a3d741fd40a899ed2de..125538ba429d7ff97688bef6360c76bc5e1f926a 100644 (file)
@@ -85,6 +85,10 @@ extern FL_OBJECT * figinset_canvas;
 
 extern char ** environ; // is this only redundtant on linux systems? Lgb.
 
+// xforms doesn't define this (but it should be in <forms.h>).
+extern "C"
+FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
+
 namespace {
 
 float const DEG2PI = 57.295779513;
@@ -374,12 +378,6 @@ void AllocGrays(int num)
        gs_color = true;
 }
 
-
-// xforms doesn't define this
-extern "C"
-FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
-
-
 void InitFigures()
 {
        // if bitmaps and figures are not empty we will leak mem