synchronize preview tab and colored paragraph in result list
This commit is contained in:
parent
34341eae24
commit
739fc085b3
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.2 2006-09-12 10:11:36 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.3 2006-09-21 12:56:57 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -79,6 +79,7 @@ void Preview::destroy()
|
|||||||
|
|
||||||
void Preview::closeEvent(QCloseEvent *e)
|
void Preview::closeEvent(QCloseEvent *e)
|
||||||
{
|
{
|
||||||
|
emit previewExposed(m_searchId, -1);
|
||||||
emit previewClosed((QWidget *)this);
|
emit previewClosed((QWidget *)this);
|
||||||
QWidget::closeEvent(e);
|
QWidget::closeEvent(e);
|
||||||
}
|
}
|
||||||
@ -251,6 +252,9 @@ void Preview::currentChanged(QWidget * tw)
|
|||||||
edit->setFocus();
|
edit->setFocus();
|
||||||
connect(edit, SIGNAL(doubleClicked(int, int)),
|
connect(edit, SIGNAL(doubleClicked(int, int)),
|
||||||
this, SLOT(textDoubleClicked(int, int)));
|
this, SLOT(textDoubleClicked(int, int)));
|
||||||
|
TabData *d = tabDataForCurrent();
|
||||||
|
if (d)
|
||||||
|
emit(previewExposed(m_searchId, d->docnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,6 +623,7 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
|
|||||||
matchCheck->setChecked(wasC);
|
matchCheck->setChecked(wasC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit(previewExposed(m_searchId, docnum));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _PREVIEW_W_H_INCLUDED_
|
#ifndef _PREVIEW_W_H_INCLUDED_
|
||||||
#define _PREVIEW_W_H_INCLUDED_
|
#define _PREVIEW_W_H_INCLUDED_
|
||||||
/* @(#$Id: preview_w.h,v 1.2 2006-09-12 10:11:36 dockes Exp $ (C) 2006 J.F.Dockes */
|
/* @(#$Id: preview_w.h,v 1.3 2006-09-21 12:56:57 dockes Exp $ (C) 2006 J.F.Dockes */
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -70,6 +70,7 @@ signals:
|
|||||||
void wordSelect(QString);
|
void wordSelect(QString);
|
||||||
void showNext(int sid, int docnum);
|
void showNext(int sid, int docnum);
|
||||||
void showPrev(int sid, int docnum);
|
void showPrev(int sid, int docnum);
|
||||||
|
void previewExposed(int sid, int docnum);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_searchId; // Identifier of search in main window. This is so that
|
int m_searchId; // Identifier of search in main window. This is so that
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.33 2006-09-21 09:37:28 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.34 2006-09-21 12:56:57 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -452,6 +452,8 @@ void RclMain::startPreview(int docnum)
|
|||||||
this, SLOT(previewNextInTab(int, int)));
|
this, SLOT(previewNextInTab(int, int)));
|
||||||
connect(curPreview, SIGNAL(showPrev(int, int)),
|
connect(curPreview, SIGNAL(showPrev(int, int)),
|
||||||
this, SLOT(previewPrevInTab(int, int)));
|
this, SLOT(previewPrevInTab(int, int)));
|
||||||
|
connect(curPreview, SIGNAL(previewExposed(int, int)),
|
||||||
|
this, SLOT(previewExposed(int, int)));
|
||||||
curPreview->show();
|
curPreview->show();
|
||||||
} else {
|
} else {
|
||||||
if (curPreview->makeDocCurrent(fn, doc)) {
|
if (curPreview->makeDocCurrent(fn, doc)) {
|
||||||
@ -541,6 +543,18 @@ void RclMain::previewPrevInTab(int sid, int docnum)
|
|||||||
curPreview->closeCurrentTab();
|
curPreview->closeCurrentTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Preview tab exposed: possibly tell reslist (to color the paragraph)
|
||||||
|
void RclMain::previewExposed(int sid, int docnum)
|
||||||
|
{
|
||||||
|
LOGDEB2(("RclMain::previewExposed: sid %d docnum %d, m_sid %d\n",
|
||||||
|
sid, docnum, m_searchId));
|
||||||
|
|
||||||
|
if (sid != m_searchId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
resList->previewExposed(docnum);
|
||||||
|
}
|
||||||
|
|
||||||
// Add term to simple search. Term comes out of double-click in
|
// Add term to simple search. Term comes out of double-click in
|
||||||
// reslist or preview. The cleanup code is really horrible. Selection
|
// reslist or preview. The cleanup code is really horrible. Selection
|
||||||
// out of the reslist will typically look like
|
// out of the reslist will typically look like
|
||||||
|
|||||||
@ -66,6 +66,7 @@ public slots:
|
|||||||
virtual void startNativeViewer(int docnum);
|
virtual void startNativeViewer(int docnum);
|
||||||
virtual void previewNextInTab(int sid, int docnum);
|
virtual void previewNextInTab(int sid, int docnum);
|
||||||
virtual void previewPrevInTab(int sid, int docnum);
|
virtual void previewPrevInTab(int sid, int docnum);
|
||||||
|
virtual void previewExposed(int sid, int docnum);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Preview *curPreview;
|
Preview *curPreview;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.19 2006-09-13 14:57:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.20 2006-09-21 12:56:57 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -52,6 +52,7 @@ RclResList::RclResList(QWidget* parent, const char* name)
|
|||||||
this, SLOT(doubleClicked(int, int)));
|
this, SLOT(doubleClicked(int, int)));
|
||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
m_docsource = 0;
|
m_docsource = 0;
|
||||||
|
m_curPvDoc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -454,24 +455,36 @@ void RclResList::resultPageNext()
|
|||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
hasNext = false;
|
hasNext = false;
|
||||||
}
|
}
|
||||||
|
// Possibly color paragraph of current preview if any
|
||||||
|
previewExposed(m_curPvDoc);
|
||||||
emit nextPageAvailable(hasNext);
|
emit nextPageAvailable(hasNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single click in result list: color active paragraph
|
// Single click in result list:
|
||||||
void RclResList::clicked(int par, int car)
|
void RclResList::clicked(int, int)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclResList::clicked:wfirst %d par %d char %d\n",
|
}
|
||||||
m_winfirst, par, car));
|
|
||||||
// Erase everything back to white
|
// Color paragraph (if any) of currently visible preview
|
||||||
{
|
void RclResList::previewExposed(int docnum)
|
||||||
|
{
|
||||||
|
LOGDEB(("RclResList::previewExposed: doc %d\n", docnum));
|
||||||
|
|
||||||
|
// Possibly erase old one to white
|
||||||
|
int par;
|
||||||
|
if (m_curPvDoc != -1 && (par = parnumfromdocnum(m_curPvDoc)) != -1) {
|
||||||
QColor color("white");
|
QColor color("white");
|
||||||
for (int i = 0; i < paragraphs(); i++)
|
setParagraphBackgroundColor(par, color);
|
||||||
setParagraphBackgroundColor(i, color);
|
m_curPvDoc = -1;
|
||||||
}
|
}
|
||||||
|
m_curPvDoc = docnum;
|
||||||
|
par = parnumfromdocnum(docnum);
|
||||||
|
// Maybe docnum is -1 or not in this window,
|
||||||
|
if (par < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
// Color the new active paragraph
|
// Color the new active paragraph
|
||||||
QColor color("lightblue");
|
QColor color("LightBlue");
|
||||||
setParagraphBackgroundColor(par, color);
|
setParagraphBackgroundColor(par, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _RCLRESLIST_H_INCLUDED_
|
#ifndef _RCLRESLIST_H_INCLUDED_
|
||||||
#define _RCLRESLIST_H_INCLUDED_
|
#define _RCLRESLIST_H_INCLUDED_
|
||||||
/* @(#$Id: rclreslist.h,v 1.9 2006-09-12 10:11:36 dockes Exp $ (C) 2005 J.F.Dockes */
|
/* @(#$Id: rclreslist.h,v 1.10 2006-09-21 12:56:57 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||||
|
|
||||||
#include <qtextbrowser.h>
|
#include <qtextbrowser.h>
|
||||||
#include <qpopupmenu.h>
|
#include <qpopupmenu.h>
|
||||||
@ -41,6 +41,7 @@ class RclResList : public QTextBrowser
|
|||||||
virtual void menuCopyFN();
|
virtual void menuCopyFN();
|
||||||
virtual void menuCopyURL();
|
virtual void menuCopyURL();
|
||||||
virtual void menuExpand();
|
virtual void menuExpand();
|
||||||
|
virtual void previewExposed(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void nextPageAvailable(bool);
|
void nextPageAvailable(bool);
|
||||||
@ -66,9 +67,12 @@ class RclResList : public QTextBrowser
|
|||||||
std::vector<Rcl::Doc> m_curDocs;
|
std::vector<Rcl::Doc> m_curDocs;
|
||||||
int m_winfirst;
|
int m_winfirst;
|
||||||
int m_docnum; // Docnum matching the currently active para
|
int m_docnum; // Docnum matching the currently active para
|
||||||
|
int m_curPvDoc;// Docnum for current preview
|
||||||
|
|
||||||
virtual int docnumfromparnum(int);
|
virtual int docnumfromparnum(int);
|
||||||
virtual int parnumfromdocnum(int);
|
virtual int parnumfromdocnum(int);
|
||||||
|
|
||||||
|
// Don't know why this is necessary but it is
|
||||||
void emitLinkClicked(const QString &s) {
|
void emitLinkClicked(const QString &s) {
|
||||||
emit linkClicked(s);
|
emit linkClicked(s);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user