-
Notifications
You must be signed in to change notification settings - Fork 351
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
make grid options and two others available to the embedded pdf-viewer #3942
Conversation
I have two points
|
context menu would be ok. So we would have a sequence of seperator, Grid, Show, right? |
correct |
Grid to context menu only for embedded mode? |
I would prefere always having Grid in both modes. On large monitors, this can reduce mouse pointer movements. |
and for continuous I suggest the same. So you don't need to think about which action where to find in different modes. |
I don't see a benefit of having non-continuous or single step in the embedded viewer. But if it must be, maybe part of the grid sub menu
|
well that structure is already as you describe it. Non-continous allows faster and precise scrolling with the wheel. The question is should continous also be there in the windowed case. As said, I would prefere it. |
that is fine |
and that's why I suggested to move continuous from View to View/Grid in last PR. Would you change your mind now? |
The previous suggestion was about the pdf main menu , yet here we are talking about context menu , right ? |
I think nothing more to do from my side |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be a cleaner concept about embedded/windowed handling of the grid setting.
And don't leave obsolete/dead code in pull-requests
src/pdfviewer/PDFDocument.cpp
Outdated
@@ -2919,7 +2959,7 @@ PDFDocument::~PDFDocument() | |||
/*! | |||
* \brief setup ToolBar | |||
*/ | |||
void PDFDocument::setupToolBar(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused, please remove change (here it shows the original side of code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing argument embedded
of method done
src/pdfviewer/PDFDocument.cpp
Outdated
@@ -3072,6 +3112,9 @@ void PDFDocument::setupMenus(bool embedded) | |||
actionGroupGrid->addAction(actionCustom); | |||
menuGrid->addSeparator(); | |||
actionSinglePageStep=configManager->newManagedAction(menuroot,menuGrid, "singlePageStep", tr("Single Page Step"), pdfWidget, SLOT(setSinglePageStep(bool)), QList<QKeySequence>()); | |||
// if (embedded) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused code, please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/pdfviewer/PDFDocument.cpp
Outdated
setupMenus(embedded); | ||
|
||
setupToolBar(); | ||
setupToolBar(embedded); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done
src/pdfviewer/PDFDocument.h
Outdated
@@ -232,6 +232,14 @@ class PDFWidget : public QLabel | |||
Q_INVOKABLE void zoom(qreal scale); | |||
|
|||
virtual void wheelEvent(QWheelEvent *event); | |||
int getGridxEmbedded() {return gridxEmbedded;}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this concepts does not comply with the general idea of object oriented programming.
You should not have special functions to set normal parameters when the object is just in a different state (i.e. embedded)
This way the state needs to be tracked in the caller & the receiver and you can make mistake on both ends.
So the issue is that you want to overwrite the global config for the grid.
The simplest way, is to keep it as it is:
- grid 1/1 does not overwrite global config
- other grid settings set the global config and thus stay when you switch from embedded to windowed.
- This seems like a useful behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of setting grid to 1x1 without changes to the original config turns out to be problematic. When continuous mode is switched off, the grid size is restored from the config, resulting in unexpected grid changes for the user. This is independent of whether the imbedded and windowed viewer use the same or different configurations.
Both embedded and windowed viewer initialize the config to grid 1x1 when startet first time ever. Regarding your concerns about changes to the grid, I would say that this is not such a problem. An unexperienced user might do grid changes and others with the main menu in the windowed viewer. This would have no effect on the embedded viewer (assuming two configs). Only when he discovers the context menu can he make changes in this case. I think this is acceptable. Restoring the settings of the embedded viewer will certainly please many users.
This is now the current PR.
src/pdfviewer/PDFDocument.h
Outdated
@@ -675,8 +682,10 @@ private slots: | |||
|
|||
QStatusBar *statusbar; | |||
QToolBar *toolBar; | |||
QToolBar *tbPdfView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused, please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, and change to definition of setupToolBar must also be removed. This is done.
src/pdfviewer/PDFDocument.h
Outdated
|
||
int gridx, gridy, pageOffset; | ||
int gridxEmbedded, gridyEmbedded, pageOffsetEmbedded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for extra variables to keep a state (grid setting)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a missunderstanding. The Embedded
ones are used similar to the ones from the config. Why this? Well, option continuous changes temporarily gridy (and similar single page step changes offset temporarily). So, turning of this option makes it necessary to retrieve the original values (I do so for gridx also, even so it is not needed). Until now this has been gridy=1. But now we need the user supplied value. This could be the config. Maybe I didn't get right, what you said here #3554 (comment). Anyway, I still think that the user may want to have two non-shared settings, because one preferes other settings in the smaler area of the embedded viewer. If a future decision is to save the embedded settings, too, then this could be done easier.
src/pdfviewer/PDFDocument.cpp
Outdated
if (pdfDoc) { | ||
if (pdfDoc->menuGrid || pdfDoc->menuShow) { | ||
menu.addSeparator(); | ||
if (pdfDoc->menuGrid) { | ||
menu.addMenu(pdfDoc->menuGrid); | ||
} | ||
if (pdfDoc->menuShow) { | ||
menu.addMenu(pdfDoc->menuShow); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overly complicated code
apart from the fact the the pointers are not zeroed in the first place, there is no case when only one of the two appears.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified and assinged nullptr in headerfile
} | ||
if (!setAsDefault) | ||
globalConfig->pageOffset = pageOffset; | ||
if (!setAsDefault) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the setAsDefault was the way of distinguishing embedded/windowed
Having now an additional "embedded" makes a mess of the concept.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. as explained above there are cases where pageOffset
needs to be changed temporarily, i.e. without updating the profile. That's what setAsDefault
is used.
@@ -2199,7 +2220,15 @@ int PDFWidget::pageStep() | |||
*/ | |||
int PDFWidget::gridCols(bool fromConfig) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like above
the concept from/to config and embedded/windowed needs to cleaned up
e25f20e
to
59a4ca1
Compare
5ee7cba
to
b971f45
Compare
Thanks |
Happy new year!
This PR resolves #222 (enhancement request). The changes add a
Grid
menu to the context menu of both the windowed and the embedded pdf-viewer. TheGrid
menu offers known options from the main menuView
of the windowed pdf-viewer. The menu then looks like this:This may often allow working without the windowed pdf-viewer. For example, you could choose grid
2x1
and optionFit to Window
. If you want to take a closer look at the pdf, you can expand the viewer to the left (and later on shrink it to the right) with the button Enlarge Viewer to the right of the tool bar. On large screens it may suffice to enlarge the texstudio window.Following assertions hold:
Previous PR is #3554.
Note: Changed PR description after discussion.