Sunday, August 14, 2005

oKular beta1 'monoKle'

API work



While working on oKular I faced or was asked to consider a list of things the file format handling generator/backend might need. First problem was search, kpdf when branched did not have a page abstraction class, it did not handle searches between the lines too, it could only search for words on the same line.



Page abstraction



So the first thing I wrote was the page abstraction class, which holds a vector of text entities and implements the search functions. Text entities are a character or a set of them with a rectangle box describing a normalized ([0;1] coordinates) position on the screen. The text entity class has also information about whether new line follows this entity (used for getting the text for given coordinates) and the standard rotation and baseline data. The search algorithm is quite fast and includes a simplifying function when returning a result.



The result is a regular area, which is a finite set of normalized rectangles that describe positions of the found words. The great thing about it is being a template which can be used for virtually anyobject, or even for regular areas if we need regular areas of different shapes! Don't you just love object oriented coding ?



Information pushing



How should the file format backend inform the program about an error? Or maybe it would want to display a message or a warning. It is a simple as emitting a signal now! The user can configure whether he wants the messages displayed using kpdf's supreme popups in the page view or a standard KDE message/error/warning box (the latter not included in beta1).



Settings



Support for generator settings is easy when you think about allowing to set settings only when the generator is loaded with the document, but what about allowing to configure all backends at all time? The solution was simpler then I thought but at a cost. All the generators that have settings support are loaded if user chooses to configure them, later if the user opens a filetype and a generator for it is already loaded, its not loaded again - just reused. Who would have thought it would be that easy.



Adding pages to the configuration dialog is done by the generator in Generator::addPage(KConfigDialog *).



Intercepting the event of the page and adding components to the GUI



The need for a possibility to intercept the events, such as a right mouse click, in the page view was reported by Wilfred Huss of kviewshell. To be generous, I am allowing the generator to intercept nearly all events page view receives, just reimplement the bool Generator::handleEvent(QEvent *) function! Return true if the page view should parse the event itself after your function finishes.



Adding components to the GUI was another important aspect, the most important GUI items in kpdf are the QToolBox in the navigation pane and the menu. You can specify an XML menu layout that is to be merged with the standard menu by subclassing the newly added getXMLFile function, while the QToolBox and KActionCollection objects are available to the generator in setupGUI (QToolbox*,KActionCollection *).



The Ghostscript generator for Postscript



The next deliverable I pointed in the SoC proposition for Google was a backend using Ghostscript. I admit taiming Ghostscript library (libgs) was hell. A partially documented API along side with some typos (like sending void** instead of void*) and the library having a C object API made it really no fun. But with help of ghostscript developers (great thanks to ghostgum of #ghostscript, the author of the API) I managed to understand how it works and wrote a perfectly good wrapping class. The road was harsh though, as ghostgum lives in Australia and I live in Poland, so it usually ment to me no sleep at night if I needed to talk to him.



Asynchronous renderer



The asynchronous renderer based on ghostscript is the first fully synchronous generator in kpdf. libgs was not thread aware and did not allow more then one instance in the generator, reusing the synchronous renderer was too slow for me to accept so I wrote a helper application that uses the wrapper class to generate a pixmap and uses X11 functions so do an ultra fast transmission of the QPixmap. The asynchronous renderer is a masterpiece, the wrapper around it includes even asynchronous killing of the no longer used instances of helper apps. I'm proud of it.



Finally one night i managed to overcome the problems.




Replacing kghostview



oKular is now a full replacement of kghostview without support for PDF files, which is easy enough to implement later. The replacement in KDE4 will close 90% of kghostview bugs, which kpdf implemented earlier like review support or better navigation panel.



No text search support



Unfortunately there is no currently available solution for postscript searching, pstotext handles only some PostScript files and does not work with anything other then latin1. Also note there is no such thing as encoding in PostScript, it uses a set of glyphs and when more are needed the unneeded ones are removed and new ones are added, locally on page, so the encoding migh change several times inside a document. Currently there is no sane possibility to work this out.



Ghostscript library



To use the Ghostscript generator you need a Ghostscript compiled with shared library. To do it manually, take the sources and after configuring do:


make so

and to install
make soinstall

A list of RPMS with libgs can be found here. Debian does not currently provide any package with libgs.



Make sure you have it in your library path because using the --with-gs-library switch does not work yet (no idea how to add it to the list of directories checked by KDE_CHECK_LIB).



oKular Beta 1 "monoKle"


I am releasing oKular SVN revision as beta 1. It should work correctly with PostScript, Image and PDF files. For now my working version includes CHM support I did not put in this beta, due to some pagesize calculation problems. The CHM support is based on the chmlib wrapping code from kchmpart (three files actually), I did a few changes to make it usable in oKular, wrote the code that uses khtml to render the compressed html pages myself. Beta 2 is planned for mid October, when I have most of the kviewshell plugins ported to oKular. So get: the tarball for oKular beta1 'monoKle' Do not report this to slashdot. If the server gets slashdotted, there will be no betas and you'll have to wait until KDE4.

42 comments:

tweedledeetweedledum said...

This blog is awesome! If you get a chance you may want to visit this internet explorer download site, it's pretty awesome too!

jon said...

We are trying to find good best comedy movie to take the kids this weekend. Good best comedy movie reviews are hard to find

I just stumbled onto your blog while looking. Seems to happen to me a lot since I am a knowledge mooch LOL

Thanks

Rich said...

Generate massive Google AdSense income running your own Article Directory on the Internet. Check out this article submitter.

Websmartads.com said...

Dicecities.net
Large selection of Websites for sale, starting as low as $19.99 come by and check it out.

Linux Unix said...

Very informative blog. Please check out my damn linux small blog.

Linux Unix said...

Informative blog. Check out my 50xs955 kde blog.

Kim said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a submit article directory site which mostly consists of submit article directory related stuff.

Come and check it out if you get time :-)

Kingypoo said...

Very cool blog you got! I just added you to my bookmarks!

I have a great article resource you might want to check out.

Jaynne said...

Adult Add Information
is still in believe it or not. Just check out Adult Add Information
today and join our " team". I am myself have ADD and I love it. It makes me multi-tasking and that gives me an edge over everyone else that is "normal". Great bonus if you ask me.

usersanonimos said...

Great blog it really nice. To learn more about blogger visit
blog submitter The best blog submitter

usersanonimos said...

Great blog it really nice. To learn more about blogger visit
blog submitter The best blog submitter

Kim said...

Every once in a while I stumble upon very interesting blogs like yours.

My partner and I have a submit search engine optimization article site which is all about submit search engine optimization article.

usersanonimos said...

Great blog it really nice. To learn more about blogger visit
blog submitter The best blog submitter

Gordon said...

Hello, your blog is informative. I have a linux server related website, please visit and hope that it is helpful to you

musica said...

Great blog it really nice. To learn more about blogger visit
search engine position The best search engine position

Google Page Rank 6 said...

Want more clicks to your Adsense Ads on your Blog?

Then you have to check out my blog. I have found a FREE and Legitimate way that will increase your earnings.

Come Check us out. How to Boost Your AdSense Revenue

Johnny said...

Hello, just visited your blog, it's informative. I also have a website related togoogle adsense software. So make sure you visit and hope it's useful.

Brian said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a business payout safelist wealth site/blog. It pretty much covers business payout safelist wealth related stuff.

Come and check it out if you get time :-)

musica said...

Great blog it really nice. To learn more about blogger visit
search engine position The best search engine position

Linux Unix said...

Informative KDE blog.

Goodman441 said...

I am shocked at how many blogs there are on add adwords link new. My site is very simular to add adwords link new, please visit my site when you can at: www.ickaboo.com

musica said...

Great blog it really nice. To learn more about blogger visit
search engine position The best search engine position

Infactahost.com said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a affiliate marketing site/blog. It pretty much covers affiliate marketing related stuff.

Come and check it out if you get time :-)

Antonio Hicks said...

I was just browsing various blogs as I was doing a search on the word poster, and I just wanted to say that I really like what you've done with your blog, even though it wasn't particularly related to what I searched for. I appreciate your postings, and your blog is a good example of how a blog should be done. I've only just recently started a Posters website - feel free to visit it when you get a chance if you wish. Much success, antonio.

doer said...

Hello, just visited your blog, it's informative. I also have a website related togoogle adsense software. So make sure you visit and hope it's useful.

incbizz said...

Hi djurban, If you would like to send your ad to the best opportunity seekers please click here website promotion.
http://www.submitterbizz.com
website promotion

SubmitterBizz.com said...

Hi djurban, If you would like to send your ad to the best opportunity seekers please click here Safelist Submitter.
http://www.submitterbizz.com
Safelist Submitter

incbizz said...

Hi djurban, If you would like to send your ad to the best opportunity seekers please click here website promotion.
http://www.submitterbizz.com
website promotion

Kim said...

We were looking for an interesting source like yours.

We have a submit marketing article source site full of submit marketing article info.

Kim said...

I found your blog by mistake. Actually was looking for something else but I like yours.

My viral online marketing could help. It is a great viral online marketing tool.

Tomas said...

Good morning ##NAME##, I find it quite refreshing to occasionally find a post such as yours with a different topic completely. It somehow ads to ones little list of lifes experiences.

I seem to have a soft spot for blogs related to free articles and /or sites that have a central theme around free articles type items. I guess this comes from being a webmaster as well.

Once again ##NAME##, thank you, hope you don't mind if I visit again next month.

musica said...

We Offer The best methods to get top google position to learn more please
click the next link Premature Ejaculation
and visit our web site about Premature Ejaculation


search engine positioning or
search engine position or
internet marketing or
blog submitter or
blog or
blogger
top position fast
top msn position
top yahoo position
top google position



Also we Offer:

We offer help in search engine position

retrogade ejaculation or
Pre Ejaculation
or Male Ejaculation
or Stop Premature Ejaculation or

Premature Ejaculation cure or
Premature Ejaculation treatment or
Premature Ejaculation help or
prevent Premature Ejaculation
===================================================================================================

Also we Offer:

We offer help for acne cure you can find information in


acne cure or
natural acne cure or
natural cure acne treatment or
acne home cure or
nature cure acne

===================================================================================================

Also we Offer:

We offer help for dog obdience you can find information in

dog trainer or
dog training or
dog obedience

===================================================================================================

Also we Offer:

We offer entertaiment and you can get this visting

Download music or
free Download music or
free music Download or
mp3 Download music or
mp3 music download or

Download music or
free Download music or
free music Download or
mp3 Download music or
mp3 music download or

===================================================================================================

Also we Offer:

We offer help in penis enlargement visit

Penis enlargement or
Penis enlargement pills or
Penis growth

===================================================================================================

Also we Offer:

We offer help in search engine position visit

search engine positioning or
search engine position or
internet marketing or
blog submitter or
blog or
blogger
top position fast
top msn position
top yahoo position
top google position

===================================================================================================

Also we Offer:

We offer help in Travel bargain visit

travel bargains or
discount travel or
discount airfare or
airline tickets or
cheap hotels

===================================================================================================

Also we Offer:

We offer help in reduce mortgage visit

reduce mortgage

===================================================================================================

Also we Offer:

We offer help in quitting smoking visit

quicking smoking or
quick smoking or
quit smoking


===================================================================================================

Also we Offer:

We offer help in real state visit

real estates

joemiller4377 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog

musica said...

Your blog is perfect and nice, we are offering male ejaculation to learn more visit male ejaculation or oKular beta1 'monoKle' http://www.manifestingpower.com/premature-ejaculation.html
male ejaculation http://www.manifestingpower.com/premature-ejaculation.html

musica said...

Your blog is perfect and nice, we are offering ejaculation control to learn more visit ejaculation control or oKular beta1 'monoKle' http://www.manifestingpower.com/premature-ejaculation.html
ejaculation control http://www.manifestingpower.com/premature-ejaculation.html

musica said...

Your blog is perfect and nice, we are offering sex problem to learn more visit sex problem or oKular beta1 'monoKle' http://www.manifestingpower.com/premature-ejaculation.html
sex problem http://www.manifestingpower.com/premature-ejaculation.html

PP said...

Alot of interesting comments on this blog, I was searching for ##keyword## related info and some how came across this site. I found it pretty cool, so I bookmarked.
My site ##link## is in a bit different area, but just as useful. I have a ##keyword## site focusing on Natural Penis Enlargement topics.

Scott A. Edwards said...

Hello I am the traffic man, zip, zip, zip. make a new resolution to get a flood of traffic to your website this year. Let me show you how to get FREE traffic to your site. Yes I said FREE, FREE, FREE!!! Don't delay.

To find out more, visit my making money over the internet site. It successfully covers FREE information exposing FREE traffic and making money over the internet related stuff. Don't forget - FREE, FREE, FREE. You have nothing to lose!

Scott A. Edwards said...

Are you tired of getting nice compliments on your blog, when really you're not makeng the kind of money that you deserve? Now you can join a completely FREE program. No buying and No selling. FREE to join. All you do is refer customers. To get started fast, click here: money making opportunity online site. It pretty much covers money making opportunity online related stuff and it's FREE to join.

Britt Phillips ComputerMillions.com said...

Has anyone seen this... Google AdSense I picked my copy up and I'm beyond pumped! Finally somebody had the b*lls and smarts to tell it like ti really is to learn exactly step by step what to do ti make incredible daily cash using Google AdSense and Google AdWords. I'd appreciate feedback from others who also have this as well. http://www.1shoppingcart.com/app/?Clk=1482141

anne1978 said...

By the way, I have been looking up on the Internet and I have found some tools which are really cools to monitor the positioning of the competition, as well as seeing their tips and tricks. If you are interested, I advised to you have a look. It seems they are free: http://www.lineared.com/es/recuperar/en-datos-posiciones-google-msn-yahoo.htm

Diana said...

The Portable Document Format (PDF) is the file format created by Adobe Systems in 1993 for document exchange. PDF is used for representing two-dimensional documents in a device-independent and display resolution-independent fixed-layout document format. sportsbook, Each PDF file encapsulates a complete description of a 2-D document (and, with Acrobat 3-D, embedded 3-D documents) that includes the text, fonts, images, and 2-D vector graphics that compose the document. http://www.enterbet.com