From c9c6982ca104d5903dff032f6feafc50c94ec6d8 Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Wed, 5 Sep 2001 15:13:19 +0000 Subject: [PATCH] further implementation of inverse search svn path=/trunk/kdegraphics/kdvi/; revision=113404 --- dviwin.cpp | 17 ++++++++++------- kdvi_multipage.cpp | 10 +++------- optiondialog.cpp | 22 ++++++++++++++++------ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/dviwin.cpp b/dviwin.cpp index 684913c9a..24ae3204a 100644 --- a/dviwin.cpp +++ b/dviwin.cpp @@ -288,9 +288,9 @@ void dviWindow::exportPDF(void) qApp->connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(dvips_output_receiver(KProcess *, char *, int))); qApp->connect(proc, SIGNAL(processExited(KProcess *)), this, SLOT(dvips_terminated(KProcess *))); - export_errorString = i18n("The external program 'dvipdf', which was used to export the file, reported an error. " + export_errorString = i18n("The external program 'dvipdf', which was used to export the file, reported an error. " "You might wish to look at the document info dialog which you will " - "find in the File-Menu for a precise error report.") ; + "find in the File-Menu for a precise error report.") ; if (info) @@ -952,7 +952,8 @@ void dviWindow::mousePressEvent ( QMouseEvent * e ) QString cp = sourceHyperLinkList[i].linkText; int max = cp.length(); - for(int i=0; iconnect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(dvips_output_receiver(KProcess *, char *, int))); qApp->connect(proc, SIGNAL(processExited(KProcess *)), this, SLOT(editorCommand_terminated(KProcess *))); // Merge the editor-specific editor message here. - export_errorString = i18n("The external program, which was used to call the editor for inverse search, reported an error. " - "You might wish to look at the document info dialog which you will " - "find in the File-Menu for a precise error report.") ; + export_errorString = i18n("The external program

%1

which was used to call the editor " + "for inverse search, reported an error. You might wish to look at the document info " + "dialog which you will find in the File-Menu for a precise error report. The " + "manual of KDVI contains a detailed explanation how to set up your editor for use with KDVI, " + "and a list of common problems.
").arg(command); if (info) - info->clear(i18n("Starting the editor... %1").arg(command)); + info->clear(i18n("Starting the editor...")); proc->clearArguments(); *proc << command; diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp index 9686b84dd..5db15c171 100644 --- a/kdvi_multipage.cpp +++ b/kdvi_multipage.cpp @@ -18,7 +18,6 @@ #include #include -// #include "../kviewshell/centeringScrollView.h" #include "fontpool.h" #include "kviewpart.h" #include "optiondialog.h" @@ -223,13 +222,10 @@ void KDVIMultiPage::doExportPDF(void) void KDVIMultiPage::doSettings() { - if (options) { - options->show(); - return; + if (!options) { + options = new OptionDialog(window); + connect(options, SIGNAL(preferencesChanged()), this, SLOT(preferencesChanged())); } - - options = new OptionDialog(window); - connect(options, SIGNAL(preferencesChanged()), this, SLOT(preferencesChanged())); options->show(); } diff --git a/optiondialog.cpp b/optiondialog.cpp index 008ede4bd..c718f2a3e 100644 --- a/optiondialog.cpp +++ b/optiondialog.cpp @@ -84,12 +84,20 @@ OptionDialog::OptionDialog( QWidget *parent, const char *name, bool modal ) mRender.showHyperLinksCheck->setChecked(config->readNumEntry("ShowHyperLinks", 1)); for(unsigned int i=0; iinsertItem(EditorNames[i]); - mRender.editorCallingCommand->setText(EditorCommands[0]); - // Missing: Read Entry from config file. - int item = 1; - slotComboBox(item); - // mFont.metafontMode->setCurrentItem( config->readNumEntry( "MetafontMode" , DefaultMFMode )); -} + // Set the proper editor on the "Rendering-Page", try to recognize + // the editor command from the config-file. If the editor command is + // not recognized, switch to "User defined editor". That way, kdvi + // stays compatible even if the EditorCommands[] change between + // different versions of kdvi. + QString currentEditorCommand = config->readEntry( "EditorCommand", "" ); + int i; + for(i = EditorCommands.count()-1; i>0; i--) + if (EditorCommands[i] == currentEditorCommand) + break; + if (i == 0) + usersEditorCommand = currentEditorCommand; + slotComboBox(i); +} void OptionDialog::show() @@ -214,6 +222,7 @@ void OptionDialog::makeRenderingPage() label = new QLabel( i18n("Editor description:"), page ); glay->addWidget( label, 3, 0 ); + // Find the longest description string available, to make sure that // the page is always large enough. Of course, we are making a // mistake here, since we use variable-width fonts. Let's hope that @@ -230,6 +239,7 @@ void OptionDialog::makeRenderingPage() } kdError() << longest << endl; mRender.editorDescription = new QLabel( longest, page ); + // Do something about minimum size here! QToolTip::add( mRender.editorDescription, i18n("Explains about the editor's capabilities in conjunction with inverse search.") ); QWhatsThis::add( mRender.editorDescription, i18n("Not all editors are well-suited for inverse search. For instance, many editors have no command like 'If the file is not yet loaded, load it. Otherwise, bring the window with the file to the front'. If you are using an editor like this, clicking into the DVI file will always open a new editor, even if the TeX-file is already open. Likewise, many editors have no command line argument that would allow KDVI to specify the exact line which you wish to edit.\nIf you feel that KDVI's support for a certain editor is not well-done, please write to kebekus@kde.org.") ); glay->addWidget( mRender.editorDescription, 3, 1 );