[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#868498: xpdf: adding search command usable through xpdf's remote feature



Package: xpdf
Version: 3.04-1ubuntu1
Severity: wishlist
Tags: patch

Hi,

I've added a new feature that can be used to execute a search in a document
through the remote interface that xpdf provides. This was useful to me and is
a feature I've always wanted to see in xpdf.

Best regards,
Stefan


-- System Information:
Debian Release: stretch/sid
  APT prefers xenial-updates
  APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 'xenial'), (100, 'xenial-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-72-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages xpdf depends on:
ii  libc6         2.23-0ubuntu7
ii  libgcc1       1:6.0.1-0ubuntu1
ii  libpoppler58  0.41.0-0ubuntu1.2
ii  libstdc++6    5.4.0-6ubuntu1~16.04.4
ii  libx11-6      2:1.6.3-1ubuntu2
ii  libxm4        2.3.4-10
ii  libxt6        1:1.1.5-0ubuntu1

Versions of packages xpdf recommends:
ii  cups-bsd       2.1.3-4
ii  gsfonts-x11    0.24
ii  poppler-data   0.4.7-7
ii  poppler-utils  0.41.0-0ubuntu1.1

xpdf suggests no packages.

-- no debconf information
Index: xpdf/xpdf/XPDFViewer.cc
===================================================================
--- xpdf.orig/xpdf/XPDFViewer.cc
+++ xpdf/xpdf/XPDFViewer.cc
@@ -239,6 +239,7 @@ XPDFViewerCmd XPDFViewer::cmdTab[] = {
   { "scrollToTopLeft",         0, gTrue,  gFalse, &XPDFViewer::cmdScrollToTopLeft },
   { "scrollUp",                1, gTrue,  gFalse, &XPDFViewer::cmdScrollUp },
   { "scrollUpPrevPage",        1, gTrue,  gFalse, &XPDFViewer::cmdScrollUpPrevPage },
+  { "search",                  1, gTrue,  gFalse, &XPDFViewer::cmdSearch },
   { "setSelection",            5, gTrue,  gFalse, &XPDFViewer::cmdSetSelection },
   { "singlePageMode",          0, gFalse, gFalse, &XPDFViewer::cmdSinglePageMode },
   { "startPan",                0, gTrue,  gTrue,  &XPDFViewer::cmdStartPan },
@@ -3844,3 +3845,13 @@ XmFontList XPDFViewer::createFontList(ch
 
   return fontList;
 }
+
+void XPDFViewer::cmdSearch(GString *args[], int nArgs, XEvent *event) {
+  char *searchText = args[0]->getCString();
+  core->find(searchText,
+    gFalse,
+    gFalse,
+    gFalse,
+    gFalse,
+    gFalse);
+}
Index: xpdf/xpdf/XPDFViewer.h
===================================================================
--- xpdf.orig/xpdf/XPDFViewer.h
+++ xpdf/xpdf/XPDFViewer.h
@@ -158,6 +158,7 @@ private:
   void cmdScrollToTopLeft(GString *args[], int nArgs, XEvent *event);
   void cmdScrollUp(GString *args[], int nArgs, XEvent *event);
   void cmdScrollUpPrevPage(GString *args[], int nArgs, XEvent *event);
+  void cmdSearch(GString *args[], int nArgs,XEvent *event);
   void cmdSetSelection(GString *args[], int nArgs, XEvent *event);
   void cmdSinglePageMode(GString *args[], int nArgs, XEvent *event);
   void cmdStartPan(GString *args[], int nArgs, XEvent *event);

Reply to: