Switch to unified view

a/src/qtgui/preview_w.h b/src/qtgui/preview_w.h
...
...
46
class Q3PopupMenu;
46
class Q3PopupMenu;
47
#define RCLPOPUP Q3PopupMenu
47
#define RCLPOPUP Q3PopupMenu
48
#define QTEXTEDIT Q3TextEdit
48
#define QTEXTEDIT Q3TextEdit
49
#endif
49
#endif
50
50
51
// We keep a list of data associated to each tab
52
class TabData {
53
public:
54
    string fn; // filename for this tab
55
    string ipath; // Internal doc path inside file
56
    int docnum;  // Index of doc in db search results.
57
    // doc out of internfile (previous fields come from the index) with
58
    // main text erased (for space).
59
    Rcl::Doc fdoc; 
60
    // Saved rich text: the textedit seems to sometimes (but not
61
    // always) return its text stripped of tags, so this is needed
62
    // (for printing for example)
63
    QString  richtxt; 
64
    TabData() 
65
  : docnum(-1) 
66
    {}
67
};
68
51
class PreviewTextEdit : public QTEXTEDIT {
69
class PreviewTextEdit : public QTEXTEDIT {
52
    Q_OBJECT
70
    Q_OBJECT
53
public:
71
public:
54
    PreviewTextEdit(QWidget* parent, const char* name, Preview *pv) 
72
    PreviewTextEdit(QWidget* parent, const char* name, Preview *pv) 
55
    : QTEXTEDIT(parent, name), m_preview(pv)
73
    : QTEXTEDIT(parent, name), m_preview(pv), m_dspflds(false)
56
    {}
74
    {}
57
    void moveToAnchor(const QString& name);
75
    void moveToAnchor(const QString& name);
58
public slots:
76
public slots:
59
    virtual void toggleFields();
77
    virtual void toggleFields();
60
    virtual void print();
78
    virtual void print();
79
    friend class Preview;
61
private:
80
private:
62
    virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
81
    virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
63
    Preview *m_preview;
82
    Preview *m_preview;
64
    QString  m_savedText;
83
    TabData  m_data;
84
    bool     m_dspflds;
65
};
85
};
66
86
67
68
// We keep a list of data associated to each tab
69
class TabData {
70
 public:
71
    string fn; // filename for this tab
72
    string ipath; // Internal doc path inside file
73
    QWidget *w; // widget for setCurrent
74
    int docnum;  // Index of doc in db search results.
75
    // doc out of internfile (previous fields come from the index) with
76
    // main text erased (for space).
77
    Rcl::Doc fdoc; 
78
    QString  richtxt;
79
    TabData(QWidget *wi) 
80
  : w(wi), docnum(-1) 
81
    {}
82
};
83
87
84
// Subclass plainToRich to add <termtag>s and anchors to the preview text
88
// Subclass plainToRich to add <termtag>s and anchors to the preview text
85
class PlainToRichQtPreview : public PlainToRich {
89
class PlainToRichQtPreview : public PlainToRich {
86
public:
90
public:
87
    int lastanchor;
91
    int lastanchor;
...
...
159
    int           m_searchId; 
163
    int           m_searchId; 
160
164
161
    bool          m_dynSearchActive;
165
    bool          m_dynSearchActive;
162
    bool          m_canBeep;
166
    bool          m_canBeep;
163
    bool          m_loading;
167
    bool          m_loading;
164
    list<TabData> m_tabData;
165
    QWidget      *m_currentW;
168
    QWidget      *m_currentW;
166
    HiliteData    m_hData;
169
    HiliteData    m_hData;
167
    bool          m_justCreated; // First tab create is different
170
    bool          m_justCreated; // First tab create is different
168
    PlainToRichQtPreview m_plaintorich;
171
    PlainToRichQtPreview m_plaintorich;
169
    bool          m_haveAnchors; // Search terms are marked in text
172
    bool          m_haveAnchors; // Search terms are marked in text
...
...
179
    QCheckBox* matchCheck;
182
    QCheckBox* matchCheck;
180
183
181
    void init();
184
    void init();
182
    virtual void setCurTabProps(const string& fn, const Rcl::Doc& doc, 
185
    virtual void setCurTabProps(const string& fn, const Rcl::Doc& doc, 
183
                int docnum);
186
                int docnum);
184
    virtual PreviewTextEdit *getCurrentEditor();
187
    virtual PreviewTextEdit *currentEditor();
185
    virtual PreviewTextEdit *addEditorTab();
188
    virtual PreviewTextEdit *addEditorTab();
186
    virtual bool loadFileInCurrentTab(string fn, size_t sz, 
189
    virtual bool loadFileInCurrentTab(string fn, size_t sz, 
187
                      const Rcl::Doc& idoc, int dnm);
190
                      const Rcl::Doc& idoc, int dnm);
188
    // Return auxiliary data pointer for cur tab
189
    TabData *tabDataForCurrent(); 
190
};
191
};
191
192
192
#endif /* _PREVIEW_W_H_INCLUDED_ */
193
#endif /* _PREVIEW_W_H_INCLUDED_ */