]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbib.h
Hopefully fixed the redo problems with insets!
[lyx.git] / src / insets / insetbib.h
index 90bd3dfbcd2e04c9e9cf51a52fd3ecc76a4ed9a1..e51b236deaf9dfa610932c7067697f6cad72947f 100644 (file)
@@ -5,7 +5,7 @@
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  * 
  * ====================================================== */
 
 #pragma interface
 #endif
 
+#include <vector>
 #include "insetcommand.h"
 
 class Buffer;
 
-/** Used to insert citations  
- */
-class InsetCitation: public InsetCommand {
-public:
-       ///
-       InsetCitation() : InsetCommand("cite") {}
-       ///
-       InsetCitation(string const & key, string const & note = string());
-        ///
-       ~InsetCitation();
-        ///
-        Inset * Clone() const {
-               return new InsetCitation(contents, options);
-       }
-       ///
-       string getScreenLabel()const;
-        ///
-       void Edit(BufferView *, int x, int y, unsigned int button);
-        ///
-       EDITABLE Editable() const {
-               return IS_EDITABLE;
-       }
-       ///
-       struct Holder {
-               InsetCitation * inset;
-               BufferView * view;
-       };
-
-private:
-       ///
-       Holder holder;
-};
-
-
 /** Used to insert bibitem's information (key and label)
   
   Must be automatically inserted as the first object in a
   bibliography paragraph. 
   */
-class InsetBibKey: public InsetCommand {
+class InsetBibKey : public InsetCommand {
 public:
        ///
-       InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
+       InsetBibKey(InsetCommandParams const &);
        ///
-       InsetBibKey(string const & key, string const & label = string());
+       ~InsetBibKey();
        ///
-       InsetBibKey(InsetBibKey const *);
+       Inset * clone(Buffer const &, bool same_id = false) const;
+       /** Currently \bibitem is used as a LyX2.x command,
+           so we need this method.
+       */
+       void write(Buffer const *, std::ostream &) const;
        ///
-       ~InsetBibKey();
+       void read(Buffer const *, LyXLex & lex);
        ///
-        Inset * Clone() const { return new InsetBibKey(this); }
-       /// Currently \bibitem is used as a LyX2.x command, so we need this method.
-        void Write(ostream &) const;
+       virtual string const getScreenLabel(Buffer const *) const;
        ///
-       virtual string getScreenLabel() const;
-        ///
-       void Edit(BufferView *, int x, int y, unsigned int button);
+       void edit(BufferView *, int x, int y, unsigned int button);
        ///
-       EDITABLE Editable() const {
-               return IS_EDITABLE;
-       }
+       void edit(BufferView * bv, bool front = true);
+       ///
+       EDITABLE editable() const { return IS_EDITABLE; } 
        /// A user can't neither insert nor delete this inset
-       bool Deletable() const {
+       bool deletable() const {
                return false;
        }
-        ///
-        void setCounter(int);
-        ///
-        int  getCounter() const { return counter; }
+       ///
+       void setCounter(int);
+       ///
+       int  getCounter() const { return counter; }
+       ///
+       string const getBibLabel() const;
        ///
        struct Holder {
                InsetBibKey * inset;
                BufferView * view;
        };
-
- private:
+private:
        ///
-        int counter;
-
+       int counter;
        ///
        Holder holder;
+       ///
+       static int key_counter;
 };
 
 
 /** Used to insert BibTeX's information 
   */
-class InsetBibtex: public InsetCommand {
+class InsetBibtex : public InsetCommand {
 public:
-       /// 
-       InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
        ///
-       InsetBibtex(string const & dbase, string const & style,
-                   Buffer *);
+       InsetBibtex(InsetCommandParams const &, bool same_id = false);
        ///
        ~InsetBibtex();
-
-        ///
-       Inset * Clone() const {
-               return new InsetBibtex(contents, options, 0);
-       }
-       ///  
-       Inset::Code LyxCode() const
-       {
-               return Inset::BIBTEX_CODE;
+       ///
+       Inset * clone(Buffer const &, bool same_id = false) const {
+               return new InsetBibtex(params(), same_id);
        }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel(Buffer const *) const;
        ///
-       void Edit(BufferView *, int x, int y, unsigned int button);
+       EDITABLE editable() const { return IS_EDITABLE; }
+       ///
+       Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
+       ///
+       void edit(BufferView *, int x, int y, unsigned int button);
+       ///
+       void edit(BufferView * bv, bool front = true);
        /// 
-       int Latex(ostream &, signed char, bool) const;
+       int latex(Buffer const *, std::ostream &,
+                 bool fragile, bool freespace) const;
        ///
-       string getKeys(char delim);
+       std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
        ///
-       EDITABLE Editable() const {
-               return IS_EDITABLE;
-       }
-        ///
-        bool addDatabase(string const &);
-        ///
-        bool delDatabase(string const &);
+       std::vector<string> const getFiles(Buffer const &) const;
+       ///
+       bool addDatabase(string const &);
+       ///
+       bool delDatabase(string const &);
        ///
        bool display() const { return true; } 
-
+       ///
        struct Holder {
                InsetBibtex * inset;
                BufferView * view;
        };
 
 private:
-       ///
-       mutable Buffer * owner;
-
        ///
        Holder holder;
 };