]> git.lyx.org Git - features.git/commitdiff
Angus's insetref-patch and a small fix.
authorJürgen Vigna <jug@sad.it>
Tue, 8 Aug 2000 13:55:26 +0000 (13:55 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 8 Aug 2000 13:55:26 +0000 (13:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@960 a592a061-630c-0410-9148-cb99ea01b6c8

30 files changed:
ChangeLog
forms/lyx.fd
src/BufferView_pimpl.C
src/LyXAction.C
src/buffer.C
src/commandtags.h
src/frontends/Dialogs.h
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormCommand.C
src/frontends/xforms/FormCommand.h
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormIndex.h
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormUrl.h
src/frontends/xforms/Makefile.am
src/frontends/xforms/forms/makefile
src/graphics/GraphicsCache.h
src/graphics/GraphicsCacheItem.C
src/graphics/XPM_Renderer.C
src/insets/insetcommand.C
src/insets/insetref.C
src/insets/insetref.h
src/lyx.C
src/lyx.h
src/lyx_cb.C
src/lyx_gui.C
src/lyx_gui_misc.C
src/lyxfunc.C
src/lyxrc.C
src/menus.C

index c28baaf11ef88bcb49a948ecf1a4aec63de28b55..5be067f48e47fc777da5c70057273472029aadcd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,63 @@
 2000-08-08  Juergen Vigna  <jug@sad.it>
 
+       * src/frontends/xforms/FormRef.h: puting FD_form_ref declaration
+       before Goto toggle declaration, because of compiler warning.
+
+       * src/frontends/xforms/FormRef.C: forgot include of <algorithm>
+
+       * src/lyxfunc.C (MenuNew): small fix.
+
+       * src/lyxrc.C (output): added RC_NEW_ASK_FILENAME tag.
+
        * src/bufferlist.C (newFile):
        * src/lyxfunc.C (MenuNew): use the new_ask_filename tag from lyxrc.
 
        * src/lyxrc.C: added new_ask_filename tag
 
+2000-08-07  Angus Leeming  <a.leeming@ic.ac.uk>
+
+       * src/lyx.fd: removed code pertaining to form_ref
+       * src/lyx.[Ch]: ditto
+       * src/lyx_cb.C: ditto
+       * src/lyx_gui.C: ditto
+       * src/lyx_gui_misc.C: ditto
+
+       * src/BufferView_pimpl.C (restorePosition): update buffer only
+       if file has changed
+
+       * src/commandtags.h (LFUN_REFTOGGLE): removed
+       (LFUN_INSERT_REF): renamed LFUN_REF_INSERT
+       (LFUN_REFGOTO): renamed LFUN_REF_GOTO
+       (LFUN_REFBACK): renamed LFUN_REF_BACK
+
+       * src/LyXAction.C: removed code pertaining to LFUN_REFTOGGLE
+       * src/menus.C: ditto
+       * src/lyxfunc.C (Dispatch): ditto.
+       InsertRef dialog is now GUI-independent.
+
+       * src/texrow.C: added using std::endl;
+
+       * src/insets/insetref.[Ch]: strip out large amounts of code.
+       The inset is now a container and this functionality is now
+       managed by a new FormRef dialog
+       
+       * src/frontends/Dialogs.h (showRef, createRef): new signals
+
+       * src/frontends/xforms/FormIndex.[Ch],
+       src/frontends/xforms/FormUrl.[Ch]: workaround an xforms bug
+       when setting dialog's min/max size
+       * src/frontends/xforms/FormIndex.[Ch]: ditto
+
+       * src/frontends/xforms/FormRef.[Ch],
+       src/frontends/xforms/forms/form_ref.fd: new xforms
+       implementation of an InsetRef dialog
+
+       * src/graphics/GraphicsCache.[Ch]: small changes to compile with
+       DEC cxx
+
+       * src/graphics/XPM_Renderer.C (isImageFormatOK):
+       ios::nocreate is not part of the standard. Removed.
+
 2000-08-07  Baruch Even  <baruch.even@writeme.com>
 
        * src/graphics/Renderer.h:
index 8c4eb923c7cc6ff8ded9a49c612b7262d891e012..0c144c2807af11231bc86dce4d76fe1df330d6bd 100644 (file)
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 5
+Number of forms: 4
 Unit of measure: FL_COORD_PIXEL
 
 =============== FORM ===============
@@ -402,247 +402,6 @@ name:
 callback: ScreenCancelCB
 argument: 0
 
-=============== FORM ===============
-Name: form_ref
-Width: 590
-Height: 400
-Number of Objects: 13
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 590 400
-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: HOLD_BROWSER
-box: 10 10 280 380
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_BOTTOM
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_SouthEast
-name: browser_ref
-callback: 
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 480 60 100 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|#U
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: 
-callback: RefUpdateCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 480 100 100 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|#C^[
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: 
-callback: RefHideCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 60 160 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: Insert reference|#I^M
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: ref
-callback: RefSelectCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 100 160 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: Insert page number|#P
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: pageref
-callback: RefSelectCB
-argument: 1
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 280 160 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: Go to reference|#G
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: gotoref
-callback: RefSelectCB
-argument: 5
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 380 20 200 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: Name|#N
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_NorthEast FL_NorthEast
-name: ref_name
-callback: 
-argument: 
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 310 360 110 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Sort keys|#S
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_SouthEast FL_SouthEast
-name: sort
-callback: RefUpdateCB
-argument: 0
-       value: 1
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 140 160 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: Insert text reference|#V
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: vref
-callback: RefSelectCB
-argument: 2
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 180 160 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: Insert text page number|#N
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: vpageref
-callback: RefSelectCB
-argument: 3
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 220 160 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: Insert pretty reference|#T
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: prettyref
-callback: RefSelectCB
-argument: 4
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 310 320 160 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: Go back|#B
-shortcut: 
-resize: FL_RESIZE_NONE
-gravity: FL_NorthEast FL_NorthEast
-name: back
-callback: RefSelectCB
-argument: 6
-
 =============== FORM ===============
 Name: form_external
 Width: 560
index 7dc44c6def37812c32981a6276817f81409d7f79..fc0f96954de1b1e42856c2f2514c269c9798c654 100644 (file)
@@ -1241,15 +1241,19 @@ void BufferView::Pimpl::restorePosition()
        
        int  x, y;
        string fname = backstack.pop(&x, &y);
-       
+
        beforeChange();
-       Buffer * b = bufferlist.exists(fname) ?
-               bufferlist.getBuffer(fname) :
-               bufferlist.loadLyXFile(fname); // don't ask, just load it
-       buffer(b);
+
+       if( fname != buffer_->fileName() ) {
+               Buffer * b = bufferlist.exists(fname) ?
+                       bufferlist.getBuffer(fname) :
+                       bufferlist.loadLyXFile(fname); // don't ask, just load it
+               if( b != 0 ) buffer(b);
+       }
+
        bv_->text->SetCursorFromCoordinates(bv_, x, y);
        update(BufferView::SELECT|BufferView::FITCUR);
-} 
+}
 
 
 bool BufferView::Pimpl::NoSavedPositions()
index fae2dc2a4bd2b363921b1671c9d720d7bd988cc1..935261b823d69e0334ffe31c7b27d47b8a2863ea 100644 (file)
@@ -355,11 +355,10 @@ void LyXAction::init()
                { LFUN_RECONFIGURE, "reconfigure",
                  N_("Reconfigure"), NoBuffer },
                { LFUN_REDO, "redo", N_("Redo"), Noop },
-               { LFUN_REFBACK, "reference-back", "", ReadOnly },
-               { LFUN_REFGOTO, "reference-goto", "", ReadOnly },
-               { LFUN_INSERT_REF, "reference-insert",
+               { LFUN_REF_BACK, "reference-back", "", ReadOnly },
+               { LFUN_REF_GOTO, "reference-goto", "", ReadOnly },
+               { LFUN_REF_CREATE, "reference-insert",
                  N_("Insert cross reference"), ReadOnly },
-               { LFUN_REFTOGGLE, "reference-toggle", "", Noop },
                { LFUN_NEXT, "screen-down", "", ReadOnly },
                { LFUN_NEXTSEL, "screen-down-select", "", ReadOnly },
                { LFUN_CENTER, "screen-recenter", "", ReadOnly },
index 7e5395cabc66013c2a5a150d4b2cdef5c53fb3b3..6c804cbb9c4f21e16d999ff60253241f296baa48 100644 (file)
@@ -1068,7 +1068,7 @@ void Buffer::readInset(LyXLex & lex, LyXParagraph *& par,
                           || inscmd.getCmdName() == "prettyref") {
                        if (!inscmd.getOptions().empty()
                            || !inscmd.getContents().empty()) {
-                               inset = new InsetRef(inscmd, this);
+                               inset = new InsetRef(inscmd);
                        }
                } else if (inscmd.getCmdName() == "tableofcontents"
                           || inscmd.getCmdName() == "listofalgorithms"
index 93725f29d8d348fbe109a80aa1f8723e35ee99e9..e5a91ced7f2d0d057a7ff04d61a111cee3d51ed5 100644 (file)
@@ -170,7 +170,7 @@ enum kb_action {
        LFUN_LOWCASE_WORD,
        LFUN_CAPITALIZE_WORD,
        LFUN_INSERT_LABEL,  // 150
-       LFUN_INSERT_REF,
+       LFUN_REF_INSERT,
        LFUN_PUSH_TOOLBAR,
        LFUN_ADD_TO_TOOLBAR,
        LFUN_DEPTH_MIN,                // RVDK_PATCH_5
@@ -223,11 +223,10 @@ enum kb_action {
        LFUN_VC_REVERT,                 // Lgb 97-07-01
        LFUN_VC_UNDO,                   // Lgb 97-07-01
        LFUN_VC_HISTORY,                // Lgb 97-07-01
-       LFUN_REFTOGGLE,                 // Ale 970723
        LFUN_EXPORT,                    // Lgb 97-07-29
        LFUN_INSERTFOOTNOTE,            // Bernhard 97-08-07
-       LFUN_REFGOTO,                   // Ale 970806
-       LFUN_REFBACK,                   // Ale 970806
+       LFUN_REF_GOTO,                  // Ale 970806
+       LFUN_REF_BACK,                  // Ale 970806
        LFUN_PARENTINSERT,              // Ale 970813
        LFUN_REMOVEERRORS, // 210       // Asger 970906
        LFUN_LDOTS,                     // Asger 970929
@@ -275,6 +274,7 @@ enum kb_action {
        LFUN_LAYOUT_TABULAR,            // Jug 20000731
        LFUN_SCROLL_INSET,              // Jug 20000801
        LFUN_INDEX_INSERT,              // Angus 20000803
+       LFUN_REF_CREATE,                // Angus 20000807
        LFUN_LASTACTION  /* this marks the end of the table */
 };
 
index 6d3ac5c90652cad761fa103bacb3ce4cf6976719..fb58890b864cb467485ed9f1ad580607b027c789 100644 (file)
@@ -118,6 +118,10 @@ public:
        ///
        Signal1<void, string const &> createCitation;
        ///
+       Signal1<void, InsetCommand *> showRef;
+       ///
+       Signal1<void, string const &> createRef;
+       ///
        Signal1<void, InsetCommand *> showTOC;
        ///
        Signal1<void, string const &> createTOC;
index e193eecc06a5968ae36e89cafc0a10c17d4a6afd..1d8891dad70d87032515878d1a2a3377b37ededb 100644 (file)
@@ -8,6 +8,7 @@
 #include "FormIndex.h"
 #include "FormPreferences.h"
 #include "FormPrint.h"
+#include "FormRef.h"
 #include "FormTabular.h"
 #include "FormToc.h"
 #include "FormUrl.h"
@@ -25,6 +26,7 @@ Dialogs::Dialogs(LyXView * lv)
        dialogs_.push_back(new FormIndex(lv, this));
        dialogs_.push_back(new FormPreferences(lv, this));
        dialogs_.push_back(new FormPrint(lv, this));
+       dialogs_.push_back(new FormRef(lv, this));
        dialogs_.push_back(new FormTabular(lv, this));
        dialogs_.push_back(new FormToc(lv, this));
        dialogs_.push_back(new FormUrl(lv, this));
index a9d975fa6662d18da3c800510ea9d5376033769b..f1dffc600ebe3b742a72275fe3adbc51750fc025 100644 (file)
@@ -148,5 +148,3 @@ void FormCommand::OKCB(FL_OBJECT * ob, long)
        pre->apply();
        pre->hide();
 }
-
-
index d7c02e76632bbe65c00858f7e9dd083a5c8a4b11..dff523bd5673a201e43861d8de29c265cba90706 100644 (file)
@@ -35,13 +35,14 @@ public:
        ///
        static  int WMHideCB(FL_FORM *, void *);
        ///
-       static void OKCB(FL_OBJECT *, long);
-       ///
        static void ApplyCB(FL_OBJECT *, long);
        ///
        static void CancelCB(FL_OBJECT *, long);
        ///
        static void InputCB(FL_OBJECT *, long);
+       ///
+       static void OKCB(FL_OBJECT *, long);
+
 protected:
        /// Slot launching dialog to (possibly) create a new inset
        void createInset( string const & );
index 8a38f7eeb646e1869fc8055ff422e8bfa8ad06f4..2d64ae01a4cc1fdbe41c7b10d3d489c8834f2081 100644 (file)
@@ -27,7 +27,7 @@
 #include "lyxfunc.h"
 
 FormIndex::FormIndex(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Index")), dialog_(0)
+       : FormCommand(lv, d, _("Index")), dialog_(0), minh(0), minw(0)
 {
        // let the dialog be shown
        // These are permanent connections so we won't bother
@@ -48,11 +48,9 @@ void FormIndex::build()
 {
        dialog_ = build_index();
 
-       int w = form()->w;
-       int h = form()->h;
-
-       fl_set_form_minsize(form(), w,   h);
-       fl_set_form_maxsize(form(), 2*w, h);
+       // XFORMS bug workaround
+       // Define the min/max dimensions. Actually applied in update()
+       minw = form()->w; minh = form()->h;
 }
 
 
@@ -67,6 +65,9 @@ FL_FORM * const FormIndex::form() const
 
 void FormIndex::update()
 {
+       fl_set_form_minsize(form(), minw, minh);
+       fl_set_form_maxsize(form(), 2*minw, minh);
+
        fl_set_input(dialog_->key, params.getContents().c_str());
 
        if( lv_->buffer()->isReadonly() ) {
index 4b7fa42b51af4699a4d1e7a9cc8628f8c008b453..e2ac09500c5a96d6267e81e418fec71cd2717489 100644 (file)
@@ -44,8 +44,10 @@ private:
        virtual FL_FORM * const form() const;
        ///
        FD_form_index * build_index();
-       //@}
 
+
+       /// 
+       int minh, minw;
        /// Real GUI implementation.
        FD_form_index * dialog_;
 };
index f0495b546b489000584a59c80c6172b50636aab8..83c5ed8cec5cfee7fa849cd757749c084abb216b 100644 (file)
@@ -27,7 +27,7 @@
 #include "lyxfunc.h"
 
 FormUrl::FormUrl(LyXView * lv, Dialogs * d)
-       : FormCommand(lv, d, _("Url")), dialog_(0)
+       : FormCommand(lv, d, _("Url")), dialog_(0), minh(0), minw(0)
 {
        dialog_ = 0;
        // let the dialog be shown
@@ -49,11 +49,9 @@ void FormUrl::build()
 {
        dialog_ = build_url();
 
-       int w = form()->w;
-       int h = form()->h;
-
-       fl_set_form_minsize(form(), w,   h);
-       fl_set_form_maxsize(form(), 2*w, h);
+       // XFORMS bug workaround
+       // Define the min/max dimensions. Actually applied in update()
+       minw = form()->w; minh = form()->h;
 }
 
 
@@ -68,6 +66,9 @@ FL_FORM * const FormUrl::form() const
 
 void FormUrl::update()
 {
+       fl_set_form_minsize(form(), minw, minh);
+       fl_set_form_maxsize(form(), 2*minw, minh);
+
        fl_set_input(dialog_->url,  params.getContents().c_str());
        fl_set_input(dialog_->name, params.getOptions().c_str());
 
index 0635409c85265419a244f5f64521274172e8ada1..d02dd0f40c987f75f89229446a81ad09356dbb3d 100644 (file)
@@ -44,8 +44,9 @@ private:
        virtual FL_FORM * const form() const;
        ///
        FD_form_url * build_url();
-       //@}
 
+       /// 
+       int minh, minw;
        /// Real GUI implementation.
        FD_form_url * dialog_;
 };
index abcfc97fdf4061f8dbd404a6a8663f8a00c6228c..69cc9ea199a4f58b02149633027e4249f018befa 100644 (file)
@@ -38,6 +38,10 @@ libxforms_la_SOURCES = \
        FormPrint.h \
        form_print.C \
        form_print.h \
+       FormRef.C \
+       FormRef.h \
+       form_ref.C \
+       form_ref.h \
        FormTabular.C \
        FormTabular.h \
        form_tabular.C \
index 754e90f0caa0bf7ff8f22bc9ef9de1ca4f022e53..95b122e00e4c5a71ad35f474724a2a76a474c153 100644 (file)
@@ -21,10 +21,11 @@ FDESIGN = fdesign
 
 SRCS := form_citation.fd \
        form_copyright.fd \
+       form_graphics.fd \
        form_index.fd \
        form_preferences.fd \
        form_print.fd \
-       form_graphics.fd \
+       form_ref.fd \
        form_tabular.fd \
        form_toc.fd \
        form_url.fd
index 5c887fbccba4a7b6ff4ee569758828e90abca8a8..ebb0f7bcaf3dbae8b4d911af3e56eb68f5597368 100644 (file)
@@ -56,6 +56,6 @@ private:
        // We need this so that an Item can tell the cache that it should be
        // deleted. (to call removeFile).
        // It also helps removing a warning gcc emits.
-       friend GraphicsCacheItem;
+       friend class GraphicsCacheItem;
 };
 #endif
index 3efca95af8fd0b0b3c2831ed5cb0a25226742104..3b1dce490451526f8d44699e1eb298e64467bd1f 100644 (file)
@@ -28,6 +28,7 @@
 #include FORMS_H_LOCATION
 
 using std::endl;
+using std::map;
 
 GraphicsCacheItem::GraphicsCacheItem()
        : height_(-1), width_(-1), imageStatus_(Loading),
index 1f3f9729a81473dbcfec369c000b47b693411864..c51bdca672227a62f79730be100afc94a9da50cd 100644 (file)
@@ -24,6 +24,9 @@
 #include "support/LAssert.h"
 #include "debug.h"
 
+using std::endl;
+using std::ios;
+
 XPM_Renderer::XPM_Renderer()
        : Renderer()
 {}
@@ -69,7 +72,7 @@ bool XPM_Renderer::renderImage()
 
 bool XPM_Renderer::isImageFormatOK(string const & filename) const
 {
-       std::ifstream is(filename.c_str(), ios::in | ios::nocreate);
+       std::ifstream is(filename.c_str(), ios::in);
 
        // The signature of the file without the spaces.
        static const char str[] = "/*XPM*/";
index 6260da9615442c334bced468d273a1c8794940b0..5c1e972ed639f918bf3ae73b66a883a49d4e3c74 100644 (file)
@@ -44,7 +44,12 @@ string InsetCommandParams::getAsString() const
 void InsetCommandParams::setFromString( string const & b )
 {
        string::size_type idx = b.find("|++|");
-       if( idx == string::npos ) return;
+       if( idx == string::npos ) {
+               cmdname = "";
+               options  = "";
+               contents = "";
+               return;
+       }
 
        cmdname = b.substr(0, idx);
        string tmp = b.substr(idx+4);
index 72be4d27f0c069cdd8b83ee9667b267a9e5703a2..0f50539eff3171e227fe67e0226fe4dddb6c1803 100644 (file)
@@ -1,79 +1,55 @@
 #include <config.h>
 
-#include <cstdlib>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include FORMS_H_LOCATION 
 #include "insetref.h"
 #include "buffer.h"
-#include "debug.h"
-#include "lyx_gui_misc.h" // CancelCloseBoxCB
-#include "LyXView.h"
-#include "lyxfunc.h"
 #include "commandtags.h"
+#include "debug.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
+#include "lyxfunc.h"
+#include "LyXView.h"
+#include "frontends/Dialogs.h"
 
 using std::ostream;
-using std::endl;
 
 extern BufferView * current_view;
 
 
-InsetRef::InsetRef(InsetCommandParams const & p, Buffer * bf)
-       : InsetCommand(p), master(bf)
+InsetRef::InsetRef(InsetCommandParams const & p)
+       : InsetCommand(p)
+{}
+
+void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
 {
-       GenerateFlag();
+       // Eventually trigger dialog with button 3 not 1
+       if( button == 3 )
+               bv->owner()->getLyXFunc()->
+                       Dispatch(LFUN_REF_GOTO, getContents().c_str());
+       else if( button == 1 )
+               bv->owner()->getDialogs()->showRef( this );
 }
 
-void InsetRef::GenerateFlag()
+
+string InsetRef::getScreenLabel() const
 {
+       string temp;
        if (getCmdName() == "ref")
-               flag = REF;
+               temp = _( "Ref: " );
        else if (getCmdName() == "pageref")
-               flag = PAGE_REF;
+               temp = _( "Page: " );
        else if (getCmdName() == "vref")
-               flag = VREF;
+               temp = _( "TextRef: " );
        else if (getCmdName() == "vpageref")
-               flag = VPAGE_REF;
-       else if (getCmdName() == "prettyref")
-               flag = PRETTY_REF;
-       else {
-               lyxerr << "ERROR (InsetRef::GenerateFlag): Unknown command name "
-                      << getCmdName() << endl;
-               flag = REF;
-       }
-}
-
-
-void InsetRef::Toggle() {
-       static string const cmd_names[REF_LAST+1] 
-               = {"ref", "pageref", "vref", "vpageref", "prettyref"};
-       
-       if (flag == REF_LAST)
-               flag = REF_FIRST;
+               temp = _( "TextPage: " );
        else
-               flag = static_cast<Ref_Flags>(flag + 1);
-       setCmdName(cmd_names[flag]);
-}
+               temp = _( "PrettyRef: " );
 
+       temp += getContents();
 
-void InsetRef::Edit(BufferView * bv, int, int, unsigned int)
-{
-        bv->owner()->getLyXFunc()->
-               Dispatch(LFUN_REFGOTO, getContents().c_str());
-}
-
-
-string InsetRef::getScreenLabel() const
-{
-       static char const * labels[REF_LAST+1]
-               = { N_("Ref: "), N_("Page: "), N_("TextRef: "), N_("TextPage: "),
-                   N_("PrettyRef: ")};
-       string temp = _(labels[flag]) + getContents();
        if(!current_view->buffer()->isLatex()
           && !getOptions().empty()) {
                temp += "||";
@@ -141,24 +117,8 @@ string InsetRef::escape(string const & lab) const
 
 void InsetRef::Validate(LaTeXFeatures & features) const
 {
-       switch (flag) {
-       case VREF:
-       case VPAGE_REF: 
+       if (getCmdName() == "vref" || getCmdName() == "vpageref")
                features.varioref = true;
-               break;
-       case PRETTY_REF:
+       else if(getCmdName() == "prettyref")
                features.prettyref = true;
-               break;
-       case REF:
-       case PAGE_REF:
-               break;
-       }
-}
-
-
-void InsetRef::gotoLabel()
-{
-    if (master) {
-       master->getUser()->gotoLabel(getContents());
-    }
 }
index 994d3ad914786a9f3fd023ab33561529ff2cd0ce..3b889dda851c6cc644011d6c3f9168c50fa65ad5 100644 (file)
 
 #include "insetcommand.h"
 
-class Buffer;
 struct LaTeXFeatures;
 
 /** The reference inset  
  */
 class InsetRef : public InsetCommand {
 public:
-        ///
-        enum Ref_Flags {
-               ///
-               REF = 0,
-               ///
-               PAGE_REF,
-               ///
-               VREF,
-               ///
-               VPAGE_REF,
-               ///
-               PRETTY_REF,
-               ///
-               REF_LAST = PRETTY_REF,
-               ///
-               REF_FIRST = REF
-       };
-       
        ///
-       InsetRef(InsetCommandParams const &, Buffer *);
+       InsetRef(InsetCommandParams const &);
        ///
-       Inset * Clone() const { return new InsetRef(params(), master); }
+       Inset * Clone() const { return new InsetRef(params()); }
        ///
        string getScreenLabel() const;
        ///
@@ -57,10 +38,6 @@ public:
         ///
        bool display() const { return false; }
        ///
-       void Toggle();
-        ///
-        void gotoLabel();
-       ///
        int Latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
        ///
@@ -72,13 +49,7 @@ public:
        ///
        void Validate(LaTeXFeatures & features) const;
 private:
-       ///
-       void GenerateFlag();
        /// This function escapes 8-bit characters
        string escape(string const &) const;
-       ///
-        Ref_Flags flag;
-        ///
-       Buffer * master;
 };
 #endif
index acad35fe100b77cd10f652c4b1f3376c500dd2c2..68a3bf3543f7fbf81a046adb1a89e605b1cbe395 100644 (file)
--- a/src/lyx.C
+++ b/src/lyx.C
@@ -112,67 +112,6 @@ FD_form_screen *create_form_form_screen(void)
 }
 /*---------------------------------------*/
 
-FD_form_ref *create_form_form_ref(void)
-{
-  FL_OBJECT *obj;
-  FD_form_ref *fdui = (FD_form_ref *) fl_calloc(1, sizeof(FD_form_ref));
-
-  fdui->form_ref = fl_bgn_form(FL_NO_BOX, 590, 400);
-  obj = fl_add_box(FL_UP_BOX, 0, 0, 590, 400, "");
-  fdui->browser_ref = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 280, 380, "");
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-  obj = fl_add_button(FL_NORMAL_BUTTON, 480, 60, 100, 30, idex(_("Update|#U")));fl_set_button_shortcut(obj, scex(_("Update|#U")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefUpdateCB, 0);
-  obj = fl_add_button(FL_NORMAL_BUTTON, 480, 100, 100, 30, idex(_("Close|#C^[")));fl_set_button_shortcut(obj, scex(_("Close|#C^[")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefHideCB, 0);
-  fdui->ref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 60, 160, 30, idex(_("Insert reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert reference|#I^M")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 0);
-  fdui->pageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 100, 160, 30, idex(_("Insert page number|#P")));fl_set_button_shortcut(obj, scex(_("Insert page number|#P")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 1);
-  fdui->gotoref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 280, 160, 30, idex(_("Go to reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to reference|#G")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 5);
-  fdui->ref_name = obj = fl_add_input(FL_NORMAL_INPUT, 380, 20, 200, 30, idex(_("Name|#N")));fl_set_button_shortcut(obj, scex(_("Name|#N")), 1);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-  fdui->sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 310, 360, 110, 30, idex(_("Sort keys|#S")));fl_set_button_shortcut(obj, scex(_("Sort keys|#S")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
-    fl_set_object_callback(obj, RefUpdateCB, 0);
-    fl_set_button(obj, 1);
-  fdui->vref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 140, 160, 30, idex(_("Insert text reference|#V")));fl_set_button_shortcut(obj, scex(_("Insert text reference|#V")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 2);
-  fdui->vpageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 180, 160, 30, idex(_("Insert text page number|#N")));fl_set_button_shortcut(obj, scex(_("Insert text page number|#N")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 3);
-  fdui->prettyref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 220, 160, 30, idex(_("Insert pretty reference|#T")));fl_set_button_shortcut(obj, scex(_("Insert pretty reference|#T")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 4);
-  fdui->back = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 320, 160, 30, idex(_("Go back|#B")));fl_set_button_shortcut(obj, scex(_("Go back|#B")), 1);
-    fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-    fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
-    fl_set_object_callback(obj, RefSelectCB, 6);
-  fl_end_form();
-
-  //fdui->form_ref->fdui = fdui;
-
-  return fdui;
-}
-/*---------------------------------------*/
-
 FD_form_external *create_form_form_external(void)
 {
   FL_OBJECT *obj;
index 2d0f56c86d78c5b8b7b2896fcc2e54629e8aa3fc..7d21e7e0010cd619e4fea5861c211f324dce0596 100644 (file)
--- a/src/lyx.h
+++ b/src/lyx.h
@@ -14,10 +14,6 @@ extern "C" void ScreenOKCB(FL_OBJECT *, long);
 extern "C" void ScreenApplyCB(FL_OBJECT *, long);
 extern "C" void ScreenCancelCB(FL_OBJECT *, long);
 
-extern "C" void RefUpdateCB(FL_OBJECT *, long);
-extern "C" void RefHideCB(FL_OBJECT *, long);
-extern "C" void RefSelectCB(FL_OBJECT *, long);
-
 extern "C" void ExternalTemplateCB(FL_OBJECT *, long);
 extern "C" void ExternalBrowseCB(FL_OBJECT *, long);
 extern "C" void ExternalEditCB(FL_OBJECT *, long);
@@ -61,24 +57,6 @@ typedef struct {
 } FD_form_screen;
 
 extern FD_form_screen * create_form_form_screen(void);
-typedef struct {
-       FL_FORM *form_ref;
-       void *vdata;
-       char *cdata;
-       long  ldata;
-       FL_OBJECT *browser_ref;
-       FL_OBJECT *ref;
-       FL_OBJECT *pageref;
-       FL_OBJECT *gotoref;
-       FL_OBJECT *ref_name;
-       FL_OBJECT *sort;
-       FL_OBJECT *vref;
-       FL_OBJECT *vpageref;
-       FL_OBJECT *prettyref;
-       FL_OBJECT *back;
-} FD_form_ref;
-
-extern FD_form_ref * create_form_form_ref(void);
 typedef struct {
        FL_FORM *form_external;
        void *vdata;
index 45d9c08fa8d8cfbe4094a5d63168c4c16ff41e19..dc55aed188a65d794e5c4e21e7b7ad895046f9d8 100644 (file)
@@ -71,7 +71,6 @@ extern FD_form_preamble * fd_form_preamble;
 extern FD_form_table * fd_form_table;
 extern FD_form_figure * fd_form_figure;
 extern FD_form_screen * fd_form_screen;
-extern FD_form_ref * fd_form_ref;
 extern FD_form_bullet * fd_form_bullet;
 
 extern BufferView * current_view; // called too many times in this file...
@@ -1153,26 +1152,6 @@ void MenuInsertLabel(char const * arg)
 }
 
 
-void MenuInsertRef()
-{
-       static int ow = -1, oh;
-
-       RefUpdateCB(0, 0);
-       if (fd_form_ref->form_ref->visible) {
-               fl_raise_form(fd_form_ref->form_ref);
-       } else {
-               fl_show_form(fd_form_ref->form_ref,
-                            FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
-                            _("Insert Reference"));
-               if (ow < 0) {
-                       ow = fd_form_ref->form_ref->w;
-                       oh = fd_form_ref->form_ref->h;
-               }
-               fl_set_form_minsize(fd_form_ref->form_ref, ow, oh);
-       }
-}
-
-
 // candidate for move to LyXView
 // This is only used in toolbar.C
 void LayoutsCB(int sel, void *)
@@ -2896,151 +2875,3 @@ void Reconfigure(BufferView * bv)
                   _("You need to restart LyX to make use of any"),
                   _("updated document class specifications."));
 }
-
-
-/* callbacks for form form_ref */
-extern "C" void RefSelectCB(FL_OBJECT *, long data)
-{
-       if (!current_view->available())
-               return;
-
-       string s = 
-               fl_get_browser_line(fd_form_ref->browser_ref,
-                                   fl_get_browser(fd_form_ref->browser_ref));
-       string u = frontStrip(strip(fl_get_input(fd_form_ref->ref_name)));
-
-       if (s.empty())
-               return;
-
-        if (data == 5) {
-                current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFGOTO, s.c_str());
-               if (!current_view->NoSavedPositions()) {
-                       fl_activate_object(fd_form_ref->back);
-                       fl_set_object_lcol(fd_form_ref->back, FL_BLACK);
-               }
-               return;
-       } else if (data >= 6) {
-               current_view->owner()->getLyXFunc()->Dispatch(LFUN_REFBACK);
-               if (current_view->NoSavedPositions()) {
-                       fl_deactivate_object(fd_form_ref->back);
-                       fl_set_object_lcol(fd_form_ref->back, FL_INACTIVE);
-               }
-               return;
-       }       
-
-       static string const cmdname[5]
-               = { "ref", "pageref", "vref", "vpageref", "prettyref"};
-       InsetCommandParams p( cmdname[data] );
-       p.setContents( s );
-       
-       if (current_view->buffer()->isSGML())
-               p.setOptions( u );
-
-       Inset * inset = new InsetRef( p, current_view->buffer() );
-       current_view->insertInset( inset );
-}
-
-
-extern "C" void RefUpdateCB(FL_OBJECT *, long)
-{
-       if (!current_view->available()) {
-               fl_clear_browser(fd_form_ref->browser_ref);
-               return;
-       }
-
-       FL_OBJECT * brow = fd_form_ref->browser_ref;
-
-       // Get the current line, in order to restore it later
-       char const * const btmp = fl_get_browser_line(brow,
-                                                     fl_get_browser(brow));
-       string currentstr = btmp ? btmp : "";
-
-       fl_clear_browser(brow);
-       fl_hide_object(brow);
-
-       vector<string> refs = current_view->buffer()->getLabelList();
-       if (fl_get_button(fd_form_ref->sort))
-               sort(refs.begin(),refs.end());
-       for (vector<string>::const_iterator it = refs.begin();
-            it != refs.end(); ++it)
-               fl_add_browser_line(brow, (*it).c_str());
-
-       int topline = 1;
-       int total_lines = fl_get_browser_maxline(brow);
-       for (int i = 1; i <= total_lines ; ++i) {
-               if (fl_get_browser_line(brow, i) == currentstr) {
-                       topline = i;
-                       break;
-               }
-       }
-       fl_set_browser_topline(brow, topline);
-
-       bool empty = refs.empty();
-       bool sgml = current_view->buffer()->isSGML();
-       bool readonly = current_view->buffer()->isReadonly();
-
-       if (current_view->NoSavedPositions()) {
-               fl_deactivate_object(fd_form_ref->back);
-               fl_set_object_lcol(fd_form_ref->back, FL_INACTIVE);
-       } else {
-               fl_activate_object(fd_form_ref->back);
-               fl_set_object_lcol(fd_form_ref->back, FL_BLACK);
-       }
-
-       if (empty) {
-               fl_add_browser_line(brow, 
-                                   _("*** No labels found in document ***"));
-               fl_deactivate_object(brow);
-               fl_deactivate_object(fd_form_ref->gotoref);
-               fl_set_object_lcol(fd_form_ref->gotoref, FL_INACTIVE);
-       } else {
-               fl_select_browser_line(brow, topline);
-               fl_activate_object(brow);
-               fl_activate_object(fd_form_ref->gotoref);
-               fl_set_object_lcol(fd_form_ref->gotoref, FL_BLACK);
-       }
-
-       if (empty || readonly) {
-               fl_deactivate_object(fd_form_ref->ref);
-               fl_set_object_lcol(fd_form_ref->ref, FL_INACTIVE);
-               fl_deactivate_object(fd_form_ref->pageref);
-               fl_set_object_lcol(fd_form_ref->pageref, FL_INACTIVE);
-       } else {
-               fl_activate_object(fd_form_ref->ref);
-               fl_set_object_lcol(fd_form_ref->ref, FL_BLACK);
-               fl_activate_object(fd_form_ref->pageref);
-               fl_set_object_lcol(fd_form_ref->pageref, FL_BLACK);
-       }
-       
-       if (empty || readonly || sgml) {
-               fl_deactivate_object(fd_form_ref->vref);
-               fl_set_object_lcol(fd_form_ref->vref, FL_INACTIVE);
-               fl_deactivate_object(fd_form_ref->vpageref);
-               fl_set_object_lcol(fd_form_ref->vpageref, FL_INACTIVE);
-               fl_deactivate_object(fd_form_ref->prettyref);
-               fl_set_object_lcol(fd_form_ref->prettyref, FL_INACTIVE);
-       } else {
-               fl_activate_object(fd_form_ref->vref);
-               fl_set_object_lcol(fd_form_ref->vref, FL_BLACK);
-               fl_activate_object(fd_form_ref->vpageref);
-               fl_set_object_lcol(fd_form_ref->vpageref, FL_BLACK);
-               fl_activate_object(fd_form_ref->prettyref);
-               fl_set_object_lcol(fd_form_ref->prettyref, FL_BLACK);
-       }
-
-       if (sgml) {
-               fl_activate_object(fd_form_ref->ref_name);
-               fl_set_object_lcol(fd_form_ref->ref_name, FL_BLACK);
-       } else {
-               fl_deactivate_object(fd_form_ref->ref_name);
-               fl_set_object_lcol(fd_form_ref->ref_name, FL_INACTIVE);
-       }
-
-       fl_show_object(brow);
-}
-
-
-extern "C" void RefHideCB(FL_OBJECT *, long)
-{
-       fl_hide_form(fd_form_ref->form_ref);
-}
index da1dbdd3b5dbc63a29ad8a9194f69b9de3eac9bb..1a731b82c87d5cbaebaa632264439d3f3d529d5a 100644 (file)
@@ -64,7 +64,6 @@ FD_form_table * fd_form_table;
 FD_form_sendto * fd_form_sendto;
 FD_form_figure * fd_form_figure;
 FD_form_screen * fd_form_screen;
-FD_form_ref * fd_form_ref;
 FD_LaTeXLog * fd_latex_log; // from log_form.h
 Combox * combo_language;
 Combox * combo_language2;
@@ -531,12 +530,6 @@ void LyXGUI::create_forms()
        fl_set_form_atclose(fd_form_screen->form_screen,
                            CancelCloseBoxCB, 0);
 
-       // the ref form
-       fd_form_ref = create_form_form_ref();
-       fl_set_form_atclose(fd_form_ref->form_ref, CancelCloseBoxCB, 0);
-       fl_set_form_minsize(fd_form_ref->form_ref, fd_form_ref->form_ref->w,
-                           fd_form_ref->form_ref->h);
-
        // the latex log form
        fd_latex_log = create_form_LaTeXLog();
        fl_set_form_atclose(fd_latex_log->LaTeXLog,
index 5f38392c1947a3102fb31db9dd7b3929a0e7f218..4e1ca11ebc0af9678417df38e656ae488257a2a3 100644 (file)
@@ -53,7 +53,6 @@ extern FD_form_preamble * fd_form_preamble;
 extern FD_form_table * fd_form_table;
 extern FD_form_sendto * fd_form_sendto;
 extern FD_form_figure * fd_form_figure;
-extern FD_form_ref * fd_form_ref;
 extern FD_form_paragraph_extra * fd_form_paragraph_extra;
 extern FD_LaTeXLog * fd_latex_log;
 extern FD_form_spell_check * fd_form_spell_check;
@@ -116,9 +115,6 @@ void CloseAllBufferRelatedDialogs()
        if (fd_form_figure->form_figure->visible) {
                fl_hide_form(fd_form_figure->form_figure);
        }
-       if (fd_form_ref->form_ref->visible) {
-               fl_hide_form(fd_form_ref->form_ref);
-       }
        if (fd_form_paper->form_paper->visible) {
                fl_hide_form(fd_form_paper->form_paper);
        }
@@ -212,19 +208,6 @@ void updateAllVisibleBufferRelatedDialogs()
        if (fd_latex_log->LaTeXLog->visible) {
                LatexLogUpdate(0,0);
        }
-#ifdef ALWAYS_UPDATE_REF
-       // Ideally, the RefUpdateCB should be modified so that if the
-       // current document is a subdocument the reference list should come
-       // from master document (or even be a merger of references from all
-       // its sibling documents).  For now this has effectively been
-       // commented out to ensure that users of multipart documents can
-       // access the reference list of a different document.  This is
-       // of course a compromise and an annoyance for users switching
-       // between separate documents.  ARRae 241198
-       if (fd_form_ref->form_ref->visible) {
-               RefUpdateCB(0, 0);
-       }
-#endif
        if (current_view->buffer()->isReadonly()) {
                // a little crude perhaps but it works. ARRae
                if (fd_form_character->form_character->visible) {
@@ -234,14 +217,6 @@ void updateAllVisibleBufferRelatedDialogs()
                        fl_hide_form(fd_form_table->form_table);
                }
 
-#ifndef ALWAYS_UPDATE_REF
-               // We must update the popup in order to make the
-               // insert ref buttons insactive
-               if (fd_form_ref->form_ref->visible) {
-                       RefUpdateCB(0, 0);
-               }
-#endif
-
 #ifndef ALWAYS_CLOSE_MATH_PANELS
                // The math popups should be closed only if we switch
                // to a readonly buffer
index fe0b186c8cd605041eb6e3b4d2eaece1a92d88ad..64a4aed6aa5e72f29790e946700649de3602290b 100644 (file)
@@ -129,7 +129,6 @@ extern void AutoSave(BufferView *);
 extern bool PreviewDVI(Buffer *);
 extern bool PreviewPostscript(Buffer *);
 extern void MenuInsertLabel(char const *);
-extern void MenuInsertRef();
 extern void MenuLayoutCharacter();
 extern void MenuLayoutParagraph();
 extern void MenuLayoutDocument();
@@ -1421,30 +1420,33 @@ string LyXFunc::Dispatch(int ac,
                MenuInsertLabel(argument.c_str());
                break;
                
-       case LFUN_INSERT_REF:
-               MenuInsertRef();
-               break;
+       case LFUN_REF_CREATE:
+       {
+               InsetCommandParams p( "ref" );
+               owner->getDialogs()->createRef( p.getAsString() );
+       }
+       break;
                
-       case LFUN_REFTOGGLE:
+       case LFUN_REF_INSERT:
        {
-               InsetRef * inset = 
-                       static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
-               if (inset) {
-                       inset->Toggle();
-                       owner->view()->updateInset(inset, true);
-               } else {
-                       setErrorMessage(N_("No cross-reference to toggle"));
-               }
+               InsetCommandParams p;
+               p.setFromString( argument );
+
+               InsetRef * inset = new InsetRef( p );
+               if (!owner->view()->insertInset(inset))
+                       delete inset;
+               else
+                       owner->view()->updateInset( inset, true );
        }
        break;
-       
-       case LFUN_REFBACK:
+                   
+       case LFUN_REF_BACK:
        {
                owner->view()->restorePosition();
        }
        break;
 
-       case LFUN_REFGOTO:
+       case LFUN_REF_GOTO:
        {
                string label(argument);
                if (label.empty()) {
@@ -2963,7 +2965,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
        }
 
        static int newfile_number = 0;
-       string s = "newfile"+tostr(++newfile_number);
+       string s;
 
        if (lyxrc.new_ask_filename) {
                ProhibitInput(owner->view());
@@ -2981,7 +2983,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
        
                // get absolute path of file and make sure the filename ends
                // with .lyx
-               string s = MakeAbsPath(fname);
+               s = MakeAbsPath(fname);
                if (!IsLyXFilename(s))
                        s += ".lyx";
 
@@ -3025,10 +3027,12 @@ void LyXFunc::MenuNew(bool fromTemplate)
                        }
                }
        } else {
+               s = lyxrc.document_path + "newfile" + tostr(++newfile_number);
                FileInfo fi(s);
                while (bufferlist.exists(s) || fi.readable()) {
                        ++newfile_number;
-                       s = "newfile"+tostr(newfile_number);
+                       s = lyxrc.document_path + "newfile" +
+                               tostr(newfile_number);
                        fi.newFile(s);
                }
        }
index 1cdf1a51f2e94bb03a32799511ad9b7597f51ead..13b5820e33e8e69e5dc8e5148ddb9c592432b430 100644 (file)
@@ -1535,6 +1535,8 @@ void LyXRC::output(ostream & os) const
                os << "\\auto_number " << tostr(auto_number) << "\n";
        case RC_USE_GUI:
                os << "\\use_gui " << tostr(use_gui) << "\n";
+       case RC_NEW_ASK_FILENAME:
+               os << "\\new_ask_filename " << tostr(new_ask_filename) << "\n";
        }
        os.flush();
 }
index 2816cd216a4b78d323092b96c58e36e5be399fc6..296671b14a01d8f944e64de79e7d982a511a0f0a 100644 (file)
@@ -1555,19 +1555,19 @@ void Menus::ShowRefsMenu(FL_OBJECT * ob, long)
        fl_redraw_object(ob);
 
        if (choice == 7)
-               men->_view->getLyXFunc()->Dispatch(LFUN_REFBACK);
+               men->_view->getLyXFunc()->Dispatch(LFUN_REF_BACK);
        else if (choice >= BIG_NUM) {
                int type = (choice / BIG_NUM) - 1;
                int num = choice % BIG_NUM;
                if (type >= 5)
-                       men->_view->getLyXFunc()->Dispatch(LFUN_REFGOTO,
+                       men->_view->getLyXFunc()->Dispatch(LFUN_REF_GOTO,
                                                           label_list[num].c_str());
                else {
                        static string const cmdname[5]
                                = { "ref", "pageref", "vref", "vpageref", "prettyref"};
                        InsetCommandParams p( cmdname[type] );
                        p.setContents( label_list[num] );
-                       men->currentView()->insertInset(new InsetRef(p, buffer));
+                       men->currentView()->insertInset(new InsetRef(p));
                }
        }
 
@@ -1898,7 +1898,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
 
                case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
                case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
-               case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
+               case 14: tmpfunc->Dispatch(LFUN_REF_CREATE); break;
                case 15: tmpfunc->Dispatch(LFUN_CITATION_CREATE); break;
                case 16: tmpfunc->Dispatch(LFUN_INDEX_CREATE); break;
                case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;