]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcite.h
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insetcite.h
index ee1581323b91d44ec2826afc22691ac48de2fa7c..a38e133f62677d576394d4e759041a7f4cb55732 100644 (file)
@@ -1,82 +1,83 @@
 // -*- C++ -*-
-/* This file is part of*
- * ====================================================== 
+/**
+ * \file insetcite.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
- *      
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
- * 
- * ====================================================== */
+ * \author Angus Leeming
+ * \author Herbert Voss
+ *
+ * Full author contact details are available in file CREDITS.
+ */
 
 #ifndef INSET_CITE_H
 #define INSET_CITE_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
 
 #include "insetcommand.h"
-#include "bibforms.h"
-#include <vector>
 
-class Buffer;
-
-/** Used to insert citations  
+/** Used to insert citations
  */
-class InsetCitation: public InsetCommand {
+class InsetCitation : public InsetCommand {
 public:
        ///
-       enum State {
-               CANCEL,
-               OK,
-               DOWN,
-               UP,
-               DELETE,
-               ADD,
-               BIBBRSR,
-               CITEBRSR,
-               ON,
-               OFF
-       };
-       ///
-       InsetCitation() : InsetCommand("cite") {}
+       InsetCitation(InsetCommandParams const &);
        ///
-       explicit
-       InsetCitation(string const & key, string const & note = string());
-        ///
        ~InsetCitation();
-        ///
-        Inset * Clone() const {
-               return new InsetCitation(getContents(), getOptions());
-       }
-       ///
-       string getScreenLabel()const;
-        ///
-       void Edit(BufferView *, int x, int y, unsigned int button);
        ///
-       void callback( FD_citation_form *, State );
-        ///
-       EDITABLE Editable() const {
-               return IS_EDITABLE;
+       std::auto_ptr<InsetBase> clone() const {
+               return std::auto_ptr<InsetBase>(new InsetCitation(params()));
        }
        ///
-       struct Holder {
-               InsetCitation * inset;
-               BufferView * view;
+       string const getScreenLabel(Buffer const &) const;
+       ///
+       EDITABLE editable() const { return IS_EDITABLE; }
+       ///
+       InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
+       ///
+       int ascii(Buffer const &, std::ostream &, int linelen) const;
+       ///
+       int latex(Buffer const &, std::ostream &,
+                 LatexRunParams const &) const;
+       ///
+       dispatch_result localDispatch(FuncRequest const & cmd);
+       ///
+       void validate(LaTeXFeatures &) const;
+       /** Invoked by BufferView::Pimpl::dispatch when a new citation key
+           is inserted. Tells us that the buffer is no longer being loaded
+           and that the cache of BibTeX keys should be reloaded in the future.
+       */
+       void setLoadingBuffer(Buffer const & buffer, bool state) const;
+private:
+       struct Cache {
+               ///
+               enum Style {
+                       ///
+                       BASIC,
+                       ///
+                       NATBIB_AY,
+                       ///
+                       NATBIB_NUM
+               };
+               ///
+               Cache() : style(BASIC) {}
+               ///
+               Style style;
+               ///
+               InsetCommandParams params;
+               ///
+               string generated_label;
+               ///
+               string screen_label;
        };
 
-private:
-        ///
-       void setSize( FD_citation_form *, int, bool ) const;
+       /// This function does the donkey work of creating the pretty label
+       string const generateLabel(Buffer const &) const;
        ///
-       void setBibButtons( FD_citation_form *, State ) const;
-       ///
-       void setCiteButtons( FD_citation_form *, State ) const;
+       Cache::Style getStyle(Buffer const & buffer) const;
+
        ///
-       void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
-        ///    
-       Holder holder;
+       mutable Cache cache;
 };
 
 #endif // INSET_CITE_H