File: c2bCiter.h

package info (click to toggle)
cb2bib 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,368 kB
  • sloc: cpp: 24,179; sh: 481; makefile: 16
file content (161 lines) | stat: -rw-r--r-- 5,314 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/***************************************************************************
 *   Copyright (C) 2004-2015 by Pere Constans
 *   constans@molspaces.com
 *   cb2Bib version 1.9.2. Licensed under the GNU GPL version 3.
 *   See the LICENSE file that comes with this distribution.
 ***************************************************************************/
#ifndef C2BCITER_H
#define C2BCITER_H

#include <QString>


/** \page c2bciter The cb2Bib Citer

    The cb2Bib Citer is a keyboard based module for inserting citation IDs into
    a working document. Conveniently, the command <tt>c2bciter</tt>, or its
    expansion <tt>'cb2bib --citer'</tt>, can be assigned to a global, desktop
    wide shortcut key. This will provide an easy access to the citer from
    within any text editor. Pressing the shortcut turns on and off the citer
    panel. Once appropriate references are selected, pressing key C sets the
    citations either to the clipboard or to a LyX pipe, closes the citer panel,
    and returns keyboard focus to the editor.

    By default, <tt>c2bciter</tt> loads all references from the current
    directory, specified in the cb2Bib main panel. On the desktop tray, the
    cb2Bib icon indicates that the citer is running. Its context menu offers
    the possibility to load other files or directories, or to toggle full
    screen mode.

    Search, filtering, navigation, and citation are keyword based. Pressing
    keys A, I, J, T, and Y sorts the references by author, included date,
    journal, title, and year, respectively. Key F initiates filtering, and Esc
    leaves filtering mode. References are selected when pressing enter. Key S
    toggles the current selection display, and Del clears the selection. The
    combination Shift + letter navigates through the rows starting by the
    letter.

    Advanced filtering capabilities are available if documents are indexed.
    Document indexing, or term or key sentence extraction, is performed by
    clicking the tray icon menu action Index Documents. Once indexing is done,
    after pressing Refresh, pressing K displays the document extracted
    keywords, and pressing G, the collection glossary of terms. On a keyword,
    pressing R display all documents indexed by the keyword. On a document,
    pressing R display related documents. Relatedness is set from keyword based
    similarity measures.

    Key sequence Alt+C toggles clipboard connection on and off. When connection
    is on, the clipboard contents is set, each time it changes, as the filter
    string. This provides a fast way to retrieve a given reference while
    browsing elsewhere.


    <p>&nbsp;</p>

\verbatim
   Usage:      cb2bib --citer [dirname1 [dirname2 ... ]]
               cb2bib --citer [filename1.bib [filename2.bib ... ]]

\endverbatim

\verbatim
   Display Keys
      A        author - journal - year - title
      I        included date - title
      J        journal - year - author
      T        title
      Y        year - author - journal - title

\endverbatim

\verbatim
   Filter Keys
      D        Delete last filter
      F        Enter pattern filter mode
      G        Toggle glossary of terms view
      K        Toggle document keywords view
      R        Display related documents

      Left     Move to previous filtered view
      Right    Move to next filtered view

\endverbatim

\verbatim
   Action Keys
      C        Cite selected citations and close citer window
      Del      Unselect all citations
      E        Edit current citation's source
      Enter    Select current citation
      Esc      Exit filter mode or close citer window
      O        Open current citation's file
      S        Display the set of selected citations
      V        Display document excerpts in keywords view
      Shift+   Keyboard search naviagation
      U        Open current citation's URL

\endverbatim

\verbatim
   Tray Icon Actions
      F1       Citer help
      Ctrl+O   Open BibTeX directory
      Alt+O    Open BibTeX files
      F5       Refresh
      Ctrl+F   Search in files
      Alt+L    Set Lyx pipe
      F2       Toggle cb2Bib
      Alt+C    Toggle clipboard
      Alt+F    Toggle full screen
               Index documents

\endverbatim

    <p>&nbsp;</p>

    See also \ref relnotes130, \ref relnotes140, \ref relnotes147, \ref commandline and
    \htmlonly
    <a href="cb2bib/annote.tex.html" target="_blank">The cb2Bib Annote</a>.
    \endhtmlonly

*/


namespace c2bCiter
{

enum Format {AJYT, IT, JYA, T, YAJT, R, K};
enum Filter {None, Document, Keyword, Pattern, Related, Selected};

struct State
{
    inline State() : format(AJYT), filter(None), viewer_index(0) {}
    inline State(const Format fo, const Filter fi, const int vi, const QString fs) :
        format(fo),
        filter(fi),
        viewer_index(vi),
        filter_string(fs) {}

    inline bool operator==(const State& s) const
    {
        return format == s.format && filter == s.filter && viewer_index == s.viewer_index && filter_string == s.filter_string;
    }

    Format format;
    Filter filter;
    int viewer_index;
    QString filter_string;
    QString index_data;
};

struct KeywordData
{
    bool valid;
    QString bibtexfn;
    QString documentfn;
    QString keyword;
};

} // namespace c2bCiter

#endif