Discussion:
printkit source related reorganization
Julun
2008-07-21 14:03:43 UTC
Permalink
Hi,

as i wrote some time ago in an private mail, i would like to reorganize
the current printing related source files. What i came up with will look
like this:

headers/libs/print/libprint:
(moved from headers/private/print/libprint)
- AboutBox.h
- AddPrinterDlg.h
- DbgMsg.h
- DialogWindow.h
- Exports.h
- GraphicsDriver.h
- Halftone.h
- HalftoneView.h
- JobData.h
- JobSetupDlg.h
- JSDSlider.h
- PackBits.h
- PageSetupDlg.h
- PagesView.h
- Pattern.h
- Preview.h
- PrinterCap.h
- PrinterData.h
- PrinterDriver.h
- PrintProcess.h
- SpoolMetaData.h
- StatusWindow.h
- Transport.h
- UIDriver.h
- ValidRect.h

src/libs/print/libprint:
(moved from src/add-ons/print/drivers/shared/libprint)
- AboutBox.cpp
- AddPrinterDlg.cpp
- DbgMsg.cpp
- DialogWindow.cpp
- GraphicsDriver.cpp
- Halftone.cpp
- HalftoneView.cpp
- JobData.cpp
- JobSetupDlg.cpp
- JSDSlider.cpp
- PackBits.cpp
- PageSetupDlg.cpp
- PagesView.cpp
- Preview.cpp
- PrinterCap.cpp
- PrinterData.cpp
- PrinterDriver.cpp
- PrintProcess.cpp
- SpoolMetaData.cpp
- StatusWindow.cpp
- Transport.cpp
- UIDriver.cpp
- ValidRect.cpp
- tools
- make_pattern.cpp
- original_dither_pattern.h

Under src/libs/print/ and headers/libs/print/ we can add cups related
stuff? libprint would stay static.


headers/private/print:
(moved from headers/private/interface)
- pr_server
(moved from headers/private/print/utils)
- InterfaceUtils.h
- MarginView.h
- Utils.h
(the following was in place)
- BeUtils.h
- FolderWatcher.h
- Jobs.h
- PictureIterator.h
- PicturePrinter.h
- PrintJobReader.h
- PrintTransport.h
- PrintTransportAddOn.h
- Template.h

src/kits/print:
(moved from src/add-ons/print/drivers/shared/utils)
- InterfaceUtils.cpp
- MarginView.cpp
- Utils.cpp
(moved from src/add-ons/print/shared)
- PictureIterator.cpp
- PicturePrinter.cpp
- PrinterDriverAddOn.cpp
- PrintJobReader.cpp
- PrintTransport.cpp
- PrintTransportAddOn.cpp
- Template.cpp
(moved from src/servers/print/shared)
- BeUtils.cpp
- BeUtilsTranslation.cpp
- FolderWatcher.cpp
- Jobs.cpp

This would still result in a static libprintutils.a, but the place would
fit more for when we will have a real printkit. We may add here some
classes to properly access cups in the future.

What do you think?

Regards,
Karsten
Michael Pfeiffer
2008-07-21 18:17:33 UTC
Permalink
Hi Karsten!

Am 21.07.2008 um 16:03 schrieb Julun:

...snipped...
Post by Julun
What do you think?
Please do as you have proposed. Maybe you can also merge the various
*Utils* header and source files into a single header and source file;
or into UI and non-UI related files?

I had not time to check dependencies between the source files. When
you do the refactoring please try to break existing cyclic
dependencies and avoid new ones :-)
If it it makes sense you could also try to separate between
functionality that concerns printer drivers, printer transport add-
ons, print_server, the preferences application and common printing
related things.

Moving libprint into src/libs/print sounds good, as long as it does
not have any dependencies to internal API. This way printer driver
developers could use it and would not depend on the internal API that
could change in the future. Or maybe my assumption is wrong that src/
libs is a place for 3rd party libraries only.

@Jovan: Please let us know if you have code that needs to be committed
before the refactoring can take place.

Cheers,
Michael
julun
2008-07-21 19:25:38 UTC
Permalink
Hi Michael,
Post by Michael Pfeiffer
Hi Karsten!
...snipped...
Post by Julun
What do you think?
Please do as you have proposed. Maybe you can also merge the various
*Utils* header and source files into a single header and source file; or
into UI and non-UI related files?
I had not time to check dependencies between the source files. When you
do the refactoring please try to break existing cyclic dependencies and
avoid new ones :-)
If it it makes sense you could also try to separate between
functionality that concerns printer drivers, printer transport add-ons,
print_server, the preferences application and common printing related
things.
Moving libprint into src/libs/print sounds good, as long as it does not
have any dependencies to internal API. This way printer driver
developers could use it and would not depend on the internal API that
could change in the future. Or maybe my assumption is wrong that
src/libs is a place for 3rd party libraries only.
@Jovan: Please let us know if you have code that needs to be committed
before the refactoring can take place.
thank you for your fast response :) Currently I'm trying to get the files
into it's new place and adjust the build accordingly. I will look into
merging and dependency checking afterwards. When it comes to libprint, i
could not found anything obvious that depends on internal API.

I will wait with committing the changes until Jovan responds.

Regards,
Karsten
Michael Pfeiffer
2008-07-22 08:12:50 UTC
Permalink
Hi Jovan!
All my code is PPD parser related, so I you can reorganize the source
tree, and I'll keep up with the changes. I'm also quite happy that
there is more people working on printing stuff on Haiku. Great!
Is there anything where I could help? I will probably have some spare
time next week and the week after that week.

- Michael
PS: You didn't reply to the ML.
Jovan Ivankovic
2008-07-22 19:17:26 UTC
Permalink
I have one dilemma, how should user preferred configuration of each
installed printer be saved, I mean in which format. Should we use XML for
that? If it is so, is there some kind of library that already works on
beos/haiku, I should i write a simple parser for those files too? Also, I
could use some help with UI Design, I mean some kind of sketches or mockups.
I think I almost dealt with all the JCL keywords problems. I'm using your
TODO.txt list as reference of things that needs to be done for PPD.

Bye,
Jovan

On Tue, Jul 22, 2008 at 10:12 AM, Michael Pfeiffer <
Post by Michael Pfeiffer
Hi Jovan!
All my code is PPD parser related, so I you can reorganize the source
tree, and I'll keep up with the changes. I'm also quite happy that
there is more people working on printing stuff on Haiku. Great!
Is there anything where I could help? I will probably have some spare time
next week and the week after that week.
- Michael
PS: You didn't reply to the ML.
Michael Pfeiffer
2008-07-22 20:28:43 UTC
Permalink
Post by Jovan Ivankovic
I have one dilemma, how should user preferred configuration of each
installed printer be saved, I mean in which format.
Do you mean job and page settings? These are stored in a BMessage and
the print_server persists it already for each pair of installed
printer and printing application.

In printer driver hook functions (see http://www.haiku-os.org/documents/dev/how_to_write_a_printer_driver)
BMessage* config_page(BNode* spool_folder, BMessage* settings);
BMessage* config_job(BNode* spool_folder, BMessage* settings);
you receive a previous BMessage settings (can be empty at first) and
return the new settings.

You could add PPD related settings into a new BMessage ppdSettings and
add that to the provided settings, like (from memory):
BMessage ppdSettings;
ppdSettings.AddString("key", "value");
...
currentSettings.AddMessage("ppd", ppdSettings);
Post by Jovan Ivankovic
Should we use XML for that? If it is so, is there some kind of
library that already works on beos/haiku, I should i write a simple
parser for those files too?
If you mean other settings I would prefer to also use a BMessage and
de/serialize that from/to a file or into an attribute of the
spool_folder.
For XML there is a parser in src/libs/expat, you can find other
libraries too at www.bebits.com, don't know if there is more in the
Haiku tree.
Post by Jovan Ivankovic
Also, I could use some help with UI Design, I mean some kind of
sketches or mockups.
I think at first it suffices to add the current contents of the job
settings dialog into a new tab and add another tab for the PPD related
settings.
The UI of libprint has to be reworked later anyway, this should not be
your primary focus.
Post by Jovan Ivankovic
I think I almost dealt with all the JCL keywords problems. I'm using
your TODO.txt list as reference of things that needs to be done for
PPD.
Great. Maybe I can try to build CUPS on Haiku sometime in the next
three weeks.

- Michael
PS: Please avoid top-posting.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
Jovan Ivankovic
2008-07-22 20:38:31 UTC
Permalink
Great, I'll take your advice for settings, it seams easy and logical. Thanks
for the help!

On Tue, Jul 22, 2008 at 10:28 PM, Michael Pfeiffer <
Post by Jovan Ivankovic
I have one dilemma, how should user preferred configuration of each
Post by Jovan Ivankovic
installed printer be saved, I mean in which format.
Do you mean job and page settings? These are stored in a BMessage and the
print_server persists it already for each pair of installed printer and
printing application.
In printer driver hook functions (see
http://www.haiku-os.org/documents/dev/how_to_write_a_printer_driver)
BMessage* config_page(BNode* spool_folder, BMessage* settings);
BMessage* config_job(BNode* spool_folder, BMessage* settings);
you receive a previous BMessage settings (can be empty at first) and return
the new settings.
You could add PPD related settings into a new BMessage ppdSettings and add
BMessage ppdSettings;
ppdSettings.AddString("key", "value");
...
currentSettings.AddMessage("ppd", ppdSettings);
Should we use XML for that? If it is so, is there some kind of library
Post by Jovan Ivankovic
that already works on beos/haiku, I should i write a simple parser for those
files too?
If you mean other settings I would prefer to also use a BMessage and
de/serialize that from/to a file or into an attribute of the spool_folder.
For XML there is a parser in src/libs/expat, you can find other libraries
too at www.bebits.com, don't know if there is more in the Haiku tree.
Also, I could use some help with UI Design, I mean some kind of sketches
Post by Jovan Ivankovic
or mockups.
I think at first it suffices to add the current contents of the job
settings dialog into a new tab and add another tab for the PPD related
settings.
The UI of libprint has to be reworked later anyway, this should not be your
primary focus.
I think I almost dealt with all the JCL keywords problems. I'm using your
Post by Jovan Ivankovic
TODO.txt list as reference of things that needs to be done for PPD.
Great. Maybe I can try to build CUPS on Haiku sometime in the next three
weeks.
- Michael
PS: Please avoid top-posting.
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
p***@public.gmane.org
2008-07-22 21:34:44 UTC
Permalink
Hi Jovan,
Post by Jovan Ivankovic
I have one dilemma, how should user preferred configuration of each
installed printer be saved, I mean in which format.
The logic would be to follow the same design as other non-PPD printer driver does: they store their configuration as extra attribut(s) to the printer spooler folder in /boot/home/configs/settings/printers/<printer_folder>.

BTW, one would move these from HOME to /boot/COMMON/configs/... ;-)
Post by Jovan Ivankovic
Should we use XML for
that? If it is so, is there some kind of library that already works on
beos/haiku, I should i write a simple parser for those files too?
A quicker, smaller, easier and more beos-way will be to use a flattened BMessage, stored into a extra folder attribute.

Please, don't mix XML into Haiku until XML become the prefered system-wide structured format used by Haiku developers. AFAIK, no Haiky system component use it yet. But many used flattened BMessages.
Thanks to keep consistency.
Post by Jovan Ivankovic
Also, I
could use some help with UI Design, I mean some kind of sketches or mockups.
Maybe someone could share some screenshot of the BeOS R5 Postscript driver PPD configuration window?
This window show up when you *add* a new postscript printer, and allow the use to customize the PPD-defined settings for his printer.
I don't have access to a BeOS machine right now to take such shot, unfortunatly.

Bye,
Philippe.
Ithamar R. Adema
2008-07-22 21:49:27 UTC
Permalink
Hi,
Post by p***@public.gmane.org
Maybe someone could share some screenshot of the BeOS R5 Postscript driver
PPD configuration window?
This window show up when you *add* a new postscript printer, and allow the
use to customize the PPD-defined settings for his printer.
I don't have access to a BeOS machine right now to take such shot, unfortunatly.
And it might be helpful to take a look at a PPD config tab in ZETA as
well, as it used quite an acceptable method of making sure that there is
an easy (both from code and user point of view) way of editing the PPD
settings.

As these settings aren't (or at least were not) consistent over PPDs,
something along those lines might not be too bad a solution ;)

(and yes, I'm still lurking, though I haven't spend time on real Haiku
development for _months_ unfortunately).

HTH,

Ithamar.
julun
2008-07-23 00:15:25 UTC
Permalink
Hi,
Post by Ithamar R. Adema
Hi,
Post by p***@public.gmane.org
Maybe someone could share some screenshot of the BeOS R5 Postscript driver
PPD configuration window?
This window show up when you *add* a new postscript printer, and allow the
use to customize the PPD-defined settings for his printer.
I don't have access to a BeOS machine right now to take such shot, unfortunatly.
And it might be helpful to take a look at a PPD config tab in ZETA as
well, as it used quite an acceptable method of making sure that there is
an easy (both from code and user point of view) way of editing the PPD
settings.
As these settings aren't (or at least were not) consistent over PPDs,
something along those lines might not be too bad a solution ;)
(and yes, I'm still lurking, though I haven't spend time on real Haiku
development for _months_ unfortunately).
we should also look how others handle it, i really like whats done by the
gnome folks. Take a look at this (somewhere in the middle of the page):

http://www.xaraxtreme.org/developers/documentation/xaralx_printing_alternatives.html

Even though printer dialogs are the most inconsistent things on Linux.

Regards,
Karsten
Michael Pfeiffer
2008-07-23 05:27:46 UTC
Permalink
Hi,
Post by p***@public.gmane.org
Maybe someone could share some screenshot of the BeOS R5 Postscript driver
PPD configuration window?
This window show up when you *add* a new postscript printer, and allow the
use to customize the PPD-defined settings for his printer.
I don't have access to a BeOS machine right now to take such shot, unfortunatly.
add_printer_configuration.png - dialog after adding PS printer for
selection of printer model
Julun
2008-07-23 08:54:06 UTC
Permalink
Post by Michael Pfeiffer
Post by Ithamar R. Adema
Hi,
Post by p***@public.gmane.org
Maybe someone could share some screenshot of the BeOS R5 Postscript driver
PPD configuration window?
This window show up when you *add* a new postscript printer, and allow the
use to customize the PPD-defined settings for his printer.
I don't have access to a BeOS machine right now to take such shot, unfortunatly.
add_printer_configuration.png - dialog after adding PS printer for
selection of printer model
Post by Ithamar R. Adema
And it might be helpful to take a look at a PPD config tab in ZETA as
well, as it used quite an acceptable method of making sure that there is
an easy (both from code and user point of view) way of editing the PPD
settings.
Could someone post screenshots of that too?
I will, but I'm at work atm. So it might take some time.

Karsten
Michael Pfeiffer
2008-07-23 15:40:52 UTC
Permalink
Here is screenshot from my old PPDConfig prototype:
julun
2008-07-23 20:44:49 UTC
Permalink
Hi Michael,
Contrary to PS printer driver from R5 the Printer Settings (the most
right part only!) are not presented in a master - details view. I like
it as it is done here in the screenshot, are there any objections to
that, if it is done like that in our printer driver?
i don't know how extensive such Printer Settings might become, but i would
vote for a common subset and hide all advanced stuff from the user. If we
choose a good default, the average user will be happy and the advance will
be able to tweak the best out of it. So I'm quite in favor of how it was
done on R5. Still unsure if your question was meant like this :)

Regards,
Karsten
Michael Pfeiffer
2008-07-24 04:06:25 UTC
Permalink
Post by julun
Hi Michael,
Contrary to PS printer driver from R5 the Printer Settings (the most right
part only!) are not presented in a master - details view. I like it as it is
done here in the screenshot, are there any objections to that, if it is done
like that in our printer driver?
i don't know how extensive such Printer Settings might become, but i would
vote for a common subset and hide all advanced stuff from the user. If we
choose a good default, the average user will be happy and the advance will
be able to tweak the best out of it. So I'm quite in favor of how it was
done on R5. Still unsure if your question was meant like this :)
I was talking about the PPD settings only (in Zeta these seem to be under
"Advanced" tab) and whether these should be presented like in Be (or Zeta)
or like I did in the prototype.

julun
2008-07-23 00:08:35 UTC
Permalink
Post by Jovan Ivankovic
I have one dilemma, how should user preferred configuration of each
installed printer be saved, I mean in which format. Should we use XML for
that? If it is so, is there some kind of library that already works on
beos/haiku, I should i write a simple parser for those files too? Also, I
could use some help with UI Design, I mean some kind of sketches or mockups.
I think I almost dealt with all the JCL keywords problems. I'm using your
TODO.txt list as reference of things that needs to be done for PPD.
Bye,
Jovan
On Tue, Jul 22, 2008 at 10:12 AM, Michael Pfeiffer <
Post by Michael Pfeiffer
Hi Jovan!
All my code is PPD parser related, so I you can reorganize the source
tree, and I'll keep up with the changes. I'm also quite happy that
there is more people working on printing stuff on Haiku. Great!
Is there anything where I could help? I will probably have some spare time
next week and the week after that week.
- Michael
PS: You didn't reply to the ML.
julun
2008-07-23 00:16:20 UTC
Permalink
Post by Jovan Ivankovic
I have one dilemma, how should user preferred configuration of each
installed printer be saved, I mean in which format. Should we use XML for
that? If it is so, is there some kind of library that already works on
beos/haiku, I should i write a simple parser for those files too? Also, I
could use some help with UI Design, I mean some kind of sketches or mockups.
I think I almost dealt with all the JCL keywords problems. I'm using your
TODO.txt list as reference of things that needs to be done for PPD.
Bye,
Jovan
On Tue, Jul 22, 2008 at 10:12 AM, Michael Pfeiffer <
Post by Michael Pfeiffer
Hi Jovan!
All my code is PPD parser related, so I you can reorganize the source
tree, and I'll keep up with the changes. I'm also quite happy that
there is more people working on printing stuff on Haiku. Great!
Is there anything where I could help? I will probably have some spare time
next week and the week after that week.
- Michael
PS: You didn't reply to the ML.
Ups, i hit the send button to fast :)
julun
2008-07-22 20:45:18 UTC
Permalink
Hi all,
Post by Michael Pfeiffer
Hi Karsten!
...snipped...
Post by Julun
What do you think?
Please do as you have proposed. Maybe you can also merge the various
*Utils* header and source files into a single header and source file; or
into UI and non-UI related files?
I had not time to check dependencies between the source files. When you
do the refactoring please try to break existing cyclic dependencies and
avoid new ones :-)
If it it makes sense you could also try to separate between
functionality that concerns printer drivers, printer transport add-ons,
print_server, the preferences application and common printing related
things.
Moving libprint into src/libs/print sounds good, as long as it does not
have any dependencies to internal API. This way printer driver
developers could use it and would not depend on the internal API that
could change in the future. Or maybe my assumption is wrong that
src/libs is a place for 3rd party libraries only.
@Jovan: Please let us know if you have code that needs to be committed
before the refactoring can take place.
I've integrated my changes as of r25561. I double checked that everything
builds so far, please let me know if i missed something to move etc...

Next will be to merge the various utils and remove some deps from libprint
on private stuff, like MarginView, HWindow and so on. I plan to move that
into libprint as well.

Regards,
Karsten
julun
2008-07-23 20:34:13 UTC
Permalink
Hi,

this is how it looks like on ZETA.

Regards,
Karsten
Loading...