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

fixes #116 and jumps to page if provided via argument. #117

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

grexe
Copy link
Contributor

@grexe grexe commented Aug 13, 2024

first attempt, todo:

  • test with open documents and jump to page
  • check why alert does not work on page parsing error
  • translation of said alert

status_t result = msg->FindInt32(PAGE_NUM_MSG, &pageNum);
if (result != B_OK) {
if (result != B_NAME_NOT_FOUND) {
BAlert *error = new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("BePDF: Error getting page number!"), B_TRANSLATE("Close"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
Copy link
Member

Choose a reason for hiding this comment

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

Alerts normally don't start with the app's name, here "BePDF:".
The starndard button label to acknowledge an alert is "OK".

Copy link
Member

@humdingerb humdingerb left a comment

Choose a reason for hiding this comment

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

I tried what suggested at #116.

Neither the system BePDF, nor the one compiled with this patch react on the message hey BePDF '_RRC' with "bepdf:page_num"=11

I tried while displaying a PDF with <11 pages and >11 pages.

@grexe
Copy link
Contributor Author

grexe commented Aug 14, 2024

I just aligned with existing BePDF, should I fix this, too? Would need a change to translations, as the "BePDF:" prefix is used in the message.

@grexe
Copy link
Contributor Author

grexe commented Aug 14, 2024

I spent some quality time with hey and even compiled a debug build to find out what is going on, turns out that :

  • hey can actually send a refs_received message via LOAD command (same as using _RRC for the B_REFS_RECEIVED message what code, and
  • the file is specified via the file parameter and path value

this worked fine here, even jumping to different pages in the already opened document, just like I wanted :*)

hey application/x-vnd.mp-xpdf LOAD file\("/boot/home/Desktop/PDF use case/BeOS.scripting.pdf"\) with "bepdf:page_num"=int32\(2\)

I also added sanity checking for the page number and limit it to the document boundaries 1 < page_number < count_pages.

@humdingerb
Copy link
Member

OK, I may have misunderstood the hey BePDF '_RRC' with "bepdf:page_num"=11 mention in #116 . Thought if you had a PDF open, that line was supposed to go to page 11...

Anyway, it does work fine, also when using the command line options.

If the "BePDF:" prefix and "Close" is used in alerts throughout BePDF, we dont have to start changing it here...

Let's merge! Thanks for the PR!

@humdingerb humdingerb merged commit 3c9eae4 into HaikuArchives:master Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants