Switch to unified view

a/src/qtgui/preview_w.h b/src/qtgui/preview_w.h
1
#ifndef _PREVIEW_W_H_INCLUDED_
1
#ifndef _PREVIEW_W_H_INCLUDED_
2
#define _PREVIEW_W_H_INCLUDED_
2
#define _PREVIEW_W_H_INCLUDED_
3
/* @(#$Id: preview_w.h,v 1.3 2006-09-21 12:56:57 dockes Exp $  (C) 2006 J.F.Dockes */
3
/* @(#$Id: preview_w.h,v 1.4 2006-11-17 10:09:07 dockes Exp $  (C) 2006 J.F.Dockes */
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
8
 *   (at your option) any later version.
8
 *   (at your option) any later version.
...
...
20
20
21
#include <qvariant.h>
21
#include <qvariant.h>
22
#include <qwidget.h>
22
#include <qwidget.h>
23
#include "rcldb.h"
23
#include "rcldb.h"
24
#include "preview.h"
24
#include "preview.h"
25
#include "refcntr.h"
26
#include "searchdata.h"
25
27
26
// We keep a list of data associated to each tab
28
// We keep a list of data associated to each tab
27
class TabData {
29
class TabData {
28
 public:
30
 public:
29
    string fn; // filename for this tab
31
    string fn; // filename for this tab
...
...
43
    Preview(QWidget* parent = 0, const char* name = 0, WFlags fl = 0) :
45
    Preview(QWidget* parent = 0, const char* name = 0, WFlags fl = 0) :
44
    PreviewBase(parent,name,fl) {init();}
46
    PreviewBase(parent,name,fl) {init();}
45
    
47
    
46
    ~Preview(){}
48
    ~Preview(){}
47
49
48
    virtual void setSId(int sid) {m_searchId = sid;}
50
    virtual void setSId(int sid, RefCntr<Rcl::SearchData> sdata) 
51
    {
52
  m_searchId = sid;
53
  m_searchData = sdata;
54
    }
49
    virtual void closeEvent( QCloseEvent *e );
55
    virtual void closeEvent( QCloseEvent *e );
50
    virtual bool eventFilter( QObject *target, QEvent *event );
56
    virtual bool eventFilter( QObject *target, QEvent *event );
51
    virtual bool makeDocCurrent( const string & fn, const Rcl::Doc & doc );
57
    virtual bool makeDocCurrent( const string & fn, const Rcl::Doc & doc );
52
    virtual QTextEdit *getCurrentEditor();
58
    virtual QTextEdit *getCurrentEditor();
53
    virtual QTextEdit *addEditorTab();
59
    virtual QTextEdit *addEditorTab();
54
    virtual bool loadFileInCurrentTab(string fn, size_t sz, 
60
    virtual bool loadFileInCurrentTab(string fn, size_t sz, 
55
                      const Rcl::Doc& idoc, int dnm);
61
                      const Rcl::Doc& idoc, int dnm);
56
62
57
public slots:
63
public slots:
58
    virtual void searchTextLine_textChanged( const QString & text );
64
    virtual void searchTextLine_textChanged( const QString & text );
59
    virtual void doSearch( const QString &str, bool next, bool reverse );
65
    virtual void doSearch(const QString &str, bool next, bool reverse,
66
             bool wo = false);
60
    virtual void nextPressed();
67
    virtual void nextPressed();
61
    virtual void prevPressed();
68
    virtual void prevPressed();
62
    virtual void currentChanged( QWidget * tw );
69
    virtual void currentChanged( QWidget * tw );
63
    virtual void closeCurrentTab();
70
    virtual void closeCurrentTab();
64
    virtual void setCurTabProps(const string & fn, const Rcl::Doc & doc, 
71
    virtual void setCurTabProps(const string & fn, const Rcl::Doc & doc, 
...
...
70
    void wordSelect(QString);
77
    void wordSelect(QString);
71
    void showNext(int sid, int docnum);
78
    void showNext(int sid, int docnum);
72
    void showPrev(int sid, int docnum);
79
    void showPrev(int sid, int docnum);
73
    void previewExposed(int sid, int docnum);
80
    void previewExposed(int sid, int docnum);
74
81
75
protected:
82
private:
76
    int m_searchId; // Identifier of search in main window. This is so that
83
    int m_searchId; // Identifier of search in main window. This is so that
77
                  // we make sense when requesting the next document when 
84
                  // we make sense when requesting the next document when 
78
                  // browsing successive search results in a tab.
85
                  // browsing successive search results in a tab.
79
    int matchIndex;
86
    int matchIndex;
80
    int matchPara;
87
    int matchPara;
81
    bool dynSearchActive;
88
    bool dynSearchActive;
82
    bool canBeep;
89
    bool canBeep;
83
    list<TabData> tabData;
90
    list<TabData> tabData;
84
    QWidget *currentW;
91
    QWidget *currentW;
85
92
    RefCntr<Rcl::SearchData> m_searchData;
86
private:
87
    void init();
93
    void init();
88
    virtual void destroy();
94
    virtual void destroy();
89
    TabData *tabDataForCurrent(); // Return auxiliary data pointer for cur tab
95
    TabData *tabDataForCurrent(); // Return auxiliary data pointer for cur tab
90
};
96
};
91
97