wxPDFView compile problem.

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

wxPDFView compile problem.

Post by dkaip »

Helo. I am trying to make wxPDFView from all sources. At wxPDFView-0.8/src/PDFViewDocumentFrame.cpp at line 441 compiler says...

Code: Select all

		double zoom = reinterpret_cast<int>(m_zoomComboBox->GetClientData(m_zoomComboBox->GetSelection())) / (double) 100;
.../wxPDFView-0.8/src/PDFViewDocumentFrame.cpp|441|error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive]|
What i must do?
I am using Linux Mint, CodeBlocks add c++11 or 14.
Thank's
Jim
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

GetClientData returns a pointer to the data and you want the data itselves. So, maybe you can try to add a * in front of the expression to say "what is pointed by" (not tested, not sure if added parenthesis are necessary or not here ; let try without):

Code: Select all

 double zoom = reinterpret_cast<int>(*m_zoomComboBox->GetClientData(m_zoomComboBox->GetSelection())) / (double) 100;
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxPDFView compile problem.

Post by xaviou »

Hi.
eranon wrote:GetClientData returns a pointer to the data and you want the data itselves.
I'm not sure this is right : GetClientData returns a value associated to a wxComboBox item as a pointer.
But generary, one just want this value "as is" (and converted to a (unsigned) int/long).

@dkaip: you can use wx(U)IntPtr() to convert the value obtained with GetClientData to an (unsigned) int :

Code: Select all

double zoom = 0.01*(wxUIntPtr(m_zoomComboBox->GetClientData(m_zoomComboBox->GetSelection())));
or

Code: Select all

double zoom = 0.01*(wxIntPtr(m_zoomComboBox->GetClientData(m_zoomComboBox->GetSelection())));
Regards.
Xav'
My wxWidgets stuff web page : X@v's wxStuff
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

Yep, not sure too, Xaviou. I just reasoned from the help about wxItemContainer::GetClientData:

Code: Select all

void* wxItemContainer::GetClientData  ( unsigned int  n ) const 
Returns a pointer to the client data associated with the given item (if any). 
So, it needs testing...
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxPDFView compile problem.

Post by xaviou »

Well, it depends what has been given to SetClientData.

I regularly use this to itentify the wxComboBox/wxChoice entry related to an array item.
So I generaly put a single index as ClientData (casted with wxUIntPtr) so I can quickly retreive the corresponding item in the array.

I just assumed (wrongly, I must admit :? ) that he was doing the same thing.

Regards
Xav'
My wxWidgets stuff web page : X@v's wxStuff
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

And on my part, I must admit I don't know in practice, my answer was just a theorical one from reading... So, we just have to hope the op will be back to tell us the reality of his current specific case ;)
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxPDFView compile problem.

Post by dkaip »

Hello. I just see all messages. Trying to compile all source codes, i realize that there is not only one project. So i am download all projects, all codes...
https://github.com/PDFium/PDFium.git

git clone https://pdfium.googlesource.com/pdfium

git clone https://chromium.googlesource.com/chrom ... _tools.git
export PATH=$PATH:/path/to/depot_tools
gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git
gclient sync
git clone git://github.com/ninja-build/ninja.git && cd ninja
git checkout release
./configure.py --bootstrap
gn args out/debug
gedit out/debug/args.gn
we add what we want ...
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
pdf_is_standalone = true # Set for a non-embedded build.
is_component_build = false # Disable component build (must be false)
clang_use_chrome_plugins = false # Currently must be false.
gn gen out/debug
sudo ./ninja -C out/debug pdfium_all
out/debug/pdfium_test --png /home/a/mozilla.pdf
all are ok ...
Then i mix all codes and trying compile wxPDFView i have not this problem.

But when i am using only the simple.h and simple.cpp project files, compiler says "it seems that this project has not been built yet. Do you want to build it now?" and in yes stops.

So we need from developer exactly the information step by step to make wxPDFView lib, or how to use with sources, or an upload a new branch with all pdfium sources.
You can see that this is very profecional and costs... see at
but there is not open source code.
If i find a solution with only source code i will upload.
Thank's
Jim
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

OK, but you don't tell us about your original error... Did you try to cast (wxUIntPtr) or dereference ("*" at left side)?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxPDFView compile problem.

Post by dkaip »

I don't know how to do this. Now i can't compile anything. I just study ...
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

So, let's go, but it was because we were also interested in knowing the end of it. In a forum, sometime we ask and sometime we help... In both cases, we progress.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxPDFView compile problem.

Post by dkaip »

Hello. I will again take all codes from begining, and step by step i will add external dependensies.
But first i must study, the ninja build system for pdfium, the i must try the pdfium_test that runs ok and the must see wxPDFView and cmake build system.
BTW i have download evince source code and as i see maybe is one way.
What i have i will upload for all.
Thank's
Jim.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
dkaip
Super wx Problem Solver
Super wx Problem Solver
Posts: 333
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxPDFView compile problem.

Post by dkaip »

Thanks, but is only jar file, java exe.
I am try to have only c++ files.
Jim.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxPDFView compile problem.

Post by eranon »

You talk about the build tools. The pdfium sources remains C++ (from what I understood, never checked out) and the generated binaries will be a compiled ones (from what I read, Gradle can build native app using various toolchains, including C/C++ ones: https://gradle.org/features/#native-applications).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxPDFView compile problem.

Post by evstevemd »

Hi,
dkaip wrote: So we need from developer exactly the information step by step to make wxPDFView lib, or how to use with sources, or an upload a new branch with all pdfium sources.
You can see that this is very profecional and costs... see at
but there is not open source code.
If i find a solution with only source code i will upload.
Thank's
Jim
PDFium is google library. Find it here
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply