Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use same cmd for build and preview #3978

Merged
merged 11 commits into from
Feb 10, 2025

Conversation

octaeder
Copy link
Contributor

@octaeder octaeder commented Feb 5, 2025

A new selection available in the Command combobox (s. Config/Preview and images below) tells the build system that the compiler used for previews should be the one used for builds. This includes the Default Compiler setup in Config/Build or given in a magic comment in the document. For this the build system tries to figure out which dvi2pngMode (i.e. one of the other selections available in the combobox) should be used internally. If this is not possible then a default selection from the combobox list is used (Preview with dvipng).

previewCmdComboboxAnimation

This PR closes #3851.

Note: Comment updated

src/configdialog.ui Outdated Show resolved Hide resolved
src/configdialog.ui Outdated Show resolved Hide resolved
Copy link
Contributor

@muzimuzhi muzimuzhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor spelling and wording improvements.

src/buildmanager.cpp Outdated Show resolved Hide resolved
@@ -181,7 +181,12 @@ public slots:
QStringList deprecatedUserToolCommands, deprecatedUserToolNames;
QStringList userToolOrder, userToolDisplayNames;
enum Dvi2PngMode { DPM_DVIPNG, DPM_DVIPNG_FOLLOW, DPM_DVIPS_GHOSTSCRIPT, DPM_EMBEDDED_PDF, DPM_LUA_EMBEDDED_PDF, DPM_XE_EMBEDDED_PDF};
// following Dvi2PngModes add tight page modifications for to the document preamble preview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// following Dvi2PngModes add tight page modifications for to the document preamble preview
// following Dvi2PngModes add tight page modifications for the document preamble preview

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@muzimuzhi I think I ment 'add ... to the document preamble for preview''. Ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It's "for to" that confused me. So you meant

Suggested change
// following Dvi2PngModes add tight page modifications for to the document preamble preview
// following Dvi2PngModes add tight page modifications to the document preamble preview

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest following Dvi2PngModes add tight page modifications to the document preamble used for preview

<string notr="true">Prefer Preview with Build Compiler</string>
</property>
<property name="toolTip">
<string>The option applies when the build compiler is pdflatex, lualatex, xelatex, or latex.</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would "is one of ..." be better? I'm not native speaker.

Suggested change
<string>The option applies when the build compiler is pdflatex, lualatex, xelatex, or latex.</string>
<string>The option applies when the build compiler is one of pdflatex, lualatex, xelatex, or latex.</string>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait for suggestions from sunderme

@octaeder octaeder force-pushed the sameBuildAndPreviewCmd branch from 0c95a22 to 6d3b93c Compare February 6, 2025 17:31
@sunderme
Copy link
Member

sunderme commented Feb 7, 2025

I would suggest to simplify the design. Just add a "Autoselect preview command" (or similar) in the combobox and set it as default.
Then you can decide what to do if the logic can't find an adequate command (fail with error or try something blindly)
From user perspective, there is no advantage in having extra choices which are typically not needed.

@octaeder
Copy link
Contributor Author

octaeder commented Feb 7, 2025

This was my first try. I added it at top of the list, but this is not sensible because it shifts current user setting to the previous item. Another advantage of the checkbox would have been that we can force this option as default for anyone (not jsut for new installations). I'm going to change it to your solution.

@octaeder
Copy link
Contributor Author

octaeder commented Feb 8, 2025

grafik

grafik

I wouldn't say that there is some auto selection.
Adding a new Preview item in the future will not look very nice since it needs to be added at the end of the list.

Edit: For latest images s. description of this PR.

@octaeder octaeder force-pushed the sameBuildAndPreviewCmd branch from d0f2317 to 11331b9 Compare February 8, 2025 17:03
#ifdef NO_POPPLER_PREVIEW
int l = confDlg->ui.comboBoxDvi2PngMode->count();
for (int index=l-1; index>=0; index--) {
if (buildManager->modifyHeader.contains(buildManager->dvi2PngMode(index)))
if (buildManager->dvi2PngMode(index)>=BuildManager::DPM_EMBEDDED_PDF)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will also remove the new option dpm_build_compiler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is not much choice if no pdf can be processed.

@sunderme sunderme merged commit cf1ea3a into texstudio-org:master Feb 10, 2025
7 checks passed
@octaeder octaeder deleted the sameBuildAndPreviewCmd branch February 10, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using preview tool corresponding to compiler
4 participants