"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2bCiter.h" (12 Feb 2021, 5276 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "c2bCiter.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.0.0_vs_2.0.1.

    1 /***************************************************************************
    2  *   Copyright (C) 2004-2021 by Pere Constans
    3  *   constans@molspaces.com
    4  *   cb2Bib version 2.0.1. Licensed under the GNU GPL version 3.
    5  *   See the LICENSE file that comes with this distribution.
    6  ***************************************************************************/
    7 #ifndef C2BCITER_H
    8 #define C2BCITER_H
    9 
   10 #include <QString>
   11 
   12 
   13 /** \page c2bciter cb2Bib Citer
   14 
   15     The cb2Bib Citer is a keyboard based module for inserting citation IDs into
   16     a working document. Conveniently, the command <tt>c2bciter</tt>, or its
   17     expansion <tt>cb2bib --citer</tt>, can be assigned to a global, desktop
   18     wide shortcut key. This will provide an easy access to the citer from
   19     within any text editor. Pressing the shortcut turns on and off the citer
   20     panel. Once appropriate references are selected, pressing key C sets the
   21     citations either to the clipboard or to a LyX pipe, closes the citer panel,
   22     and returns keyboard focus to the editor.
   23 
   24     By default, <tt>c2bciter</tt> loads all references from the current
   25     directory, specified in the cb2Bib main panel. On the desktop tray, the
   26     cb2Bib icon indicates that the citer is running. Its context menu offers
   27     the possibility to load other files or directories, or to toggle full
   28     screen mode.
   29 
   30     Search, filtering, navigation, and citation are keyword based. Pressing
   31     keys A, I, J, T, and Y sorts the references by author, included date,
   32     journal, title, and year, respectively. Key F initiates filtering, and Esc
   33     leaves filtering mode. References are selected when pressing enter. Key S
   34     toggles the current selection display, and Del clears the selection. The
   35     combination Shift + letter navigates through the rows starting by the
   36     letter.
   37 
   38     Advanced filtering capabilities are available after indexing the documents.
   39     Document indexing, or term or key sentence extraction, is performed by
   40     clicking the tray icon menu action Index Documents. Once indexing is done
   41     and after clicking Refresh, pressing K displays the document extracted
   42     keywords, and pressing G, the collection glossary of terms. On a keyword,
   43     pressing R display all documents indexed by the keyword. On a document,
   44     pressing R display related documents. Relatedness is set from keyword based
   45     similarity measures.
   46 
   47     Key sequence Alt+C toggles clipboard connection on and off. When connection
   48     is on, the clipboard contents is set, each time it changes, as the filter
   49     string. This provides a fast way to retrieve a given reference while
   50     browsing elsewhere.
   51 
   52 
   53 
   54 \verbatim
   55    Usage:      cb2bib --citer [dirname1 [dirname2 ... ]]
   56                cb2bib --citer [filename1.bib [filename2.bib ... ]]
   57 
   58 \endverbatim
   59 
   60 \verbatim
   61    Display Keys
   62       A        author - journal - year - title
   63       I        included date - title
   64       J        journal - year - author
   65       T        title
   66       Y        year - author - journal - title
   67 
   68 \endverbatim
   69 
   70 \verbatim
   71    Filter Keys
   72       D        Delete last filter
   73       F        Enter pattern filter mode
   74       G        Toggle glossary of terms view
   75       K        Toggle document keywords view
   76       R        Display related documents
   77 
   78       Left     Move to previous filtered view
   79       Right    Move to next filtered view
   80 
   81 \endverbatim
   82 
   83 \verbatim
   84    Action Keys
   85       C        Cite selected citations and close citer window
   86       Del      Unselect all citations
   87       E        Edit current citation's source
   88       Enter    Select current citation
   89       Esc      Exit filter mode or close citer window
   90       O        Open current citation's file
   91       S        Display the set of selected citations
   92       V        Display document excerpts in keywords view
   93       Shift+   Keyboard search naviagation
   94       U        Open current citation's URL
   95       W        Write notes using Annote
   96 
   97 \endverbatim
   98 
   99 \verbatim
  100    Tray Icon Actions
  101       F1       Citer help
  102       Ctrl+O   Open BibTeX directory
  103       Alt+O    Open BibTeX files
  104       F5       Refresh
  105       Ctrl+F   Search in files
  106       Alt+L    Set Lyx pipe
  107       F2       Toggle cb2Bib
  108       Alt+C    Toggle clipboard
  109       Alt+F    Toggle full screen
  110                Index documents
  111 
  112 \endverbatim
  113 
  114 
  115 
  116   See also \ref relnotes130, \ref relnotes140, \ref relnotes147, \ref
  117   commandline and \ref c2bannote.
  118 
  119 */
  120 
  121 
  122 namespace c2bCiter
  123 {
  124 
  125 enum Format
  126 {
  127     AJYT,
  128     IT,
  129     JYA,
  130     T,
  131     YAJT,
  132     R,
  133     K
  134 };
  135 enum Filter
  136 {
  137     None,
  138     Document,
  139     Keyword,
  140     Pattern,
  141     Related,
  142     Selected
  143 };
  144 
  145 struct State
  146 {
  147     inline State() : format(AJYT), filter(None), viewer_index(0) {}
  148     inline State(const Format fo, const Filter fi, const int vi, const QString fs)
  149         : format(fo), filter(fi), viewer_index(vi), filter_string(fs) {}
  150 
  151     inline bool operator==(const State& s) const
  152     {
  153         return format == s.format && filter == s.filter && viewer_index == s.viewer_index &&
  154                filter_string == s.filter_string;
  155     }
  156 
  157     Format format;
  158     Filter filter;
  159     int viewer_index;
  160     QString filter_string;
  161     QString index_data;
  162 };
  163 
  164 struct KeywordData
  165 {
  166     bool valid;
  167     QString bibtexfn;
  168     QString documentfn;
  169     QString keyword;
  170 };
  171 
  172 } // namespace c2bCiter
  173 
  174 #endif