Обсуждение: s/xpm/png/g

Поиск
Список
Период
Сортировка

s/xpm/png/g

От
Dave Page
Дата:
Hi,

The (large) patch at
http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
replaces all the XPM images in pgAdmin with PNG ones. This offers us
two major advantages:

1) XPM images aren't supported by many graphics tools, and almost
always require manual editing to fix the internal naming anyway.

2) XPM images don't support alpha transparency.

The patch is a little complex, as it's not straightforward to embed
PNG images at build time. Here's what it does:

- Adds a new project, png2c, on which the pgAdmin project is dependent.
- Adds a new build rule for .png files, which will cause them to be
pre-processed with png2c, to create .pngc files which are C source
code, containing the PNG data and some accessor functions and macros.
- #include's the .pngc files in place of the XPMs.
- Updates the rest of the code to use the new accessor macros created
in the .pngc files:

    filename_png_img - represents a wxImage*
    filename_png_bmp - represents a wxBitmap*
    filename_png_ico - represents a wxIcon*

Each of the accessors uses static data, so in theory, this also gives
us a performance optimisation as any given image only need be
converted to a different format (by using the appropriate accessor)
once, upon first access.

I've tested on Linux, Mac and Windows, and everything looks good.
Comments/objections before I commit?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: s/xpm/png/g

От
Magnus Hagander
Дата:
On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
> Hi,
>
> The (large) patch at
> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
> replaces all the XPM images in pgAdmin with PNG ones. This offers us
> two major advantages:
>
> 1) XPM images aren't supported by many graphics tools, and almost
> always require manual editing to fix the internal naming anyway.
>
> 2) XPM images don't support alpha transparency.
>
> The patch is a little complex, as it's not straightforward to embed
> PNG images at build time. Here's what it does:
>
> - Adds a new project, png2c, on which the pgAdmin project is dependent.
> - Adds a new build rule for .png files, which will cause them to be
> pre-processed with png2c, to create .pngc files which are C source
> code, containing the PNG data and some accessor functions and macros.

Didn't we get rid of the beerware license in postgresql, to make
corporate lawyers happy? Are you sure it's a good idea to introduce it
to pgadmin here?


> - #include's the .pngc files in place of the XPMs.
> - Updates the rest of the code to use the new accessor macros created
> in the .pngc files:
>
>    filename_png_img - represents a wxImage*
>    filename_png_bmp - represents a wxBitmap*
>    filename_png_ico - represents a wxIcon*

Just to make it easier to browse and search, I'd use a prefix for that
stuf.. E.g. img_filename_... So you can do a prefix search and find
all references. Or maybe embed_filename_png_xyz.


> Each of the accessors uses static data, so in theory, this also gives
> us a performance optimisation as any given image only need be
> converted to a different format (by using the appropriate accessor)
> once, upon first access.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: s/xpm/png/g

От
Dave Page
Дата:
On Mon, Mar 7, 2011 at 2:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
>> Hi,
>>
>> The (large) patch at
>> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
>> replaces all the XPM images in pgAdmin with PNG ones. This offers us
>> two major advantages:
>>
>> 1) XPM images aren't supported by many graphics tools, and almost
>> always require manual editing to fix the internal naming anyway.
>>
>> 2) XPM images don't support alpha transparency.
>>
>> The patch is a little complex, as it's not straightforward to embed
>> PNG images at build time. Here's what it does:
>>
>> - Adds a new project, png2c, on which the pgAdmin project is dependent.
>> - Adds a new build rule for .png files, which will cause them to be
>> pre-processed with png2c, to create .pngc files which are C source
>> code, containing the PNG data and some accessor functions and macros.
>
> Didn't we get rid of the beerware license in postgresql, to make
> corporate lawyers happy? Are you sure it's a good idea to introduce it
> to pgadmin here?

I don't see why not. It doesn't *require* us to do anything. It just
says *if we think* it's worth it, we *can* buy him a beer.

>> - #include's the .pngc files in place of the XPMs.
>> - Updates the rest of the code to use the new accessor macros created
>> in the .pngc files:
>>
>>    filename_png_img - represents a wxImage*
>>    filename_png_bmp - represents a wxBitmap*
>>    filename_png_ico - represents a wxIcon*
>
> Just to make it easier to browse and search, I'd use a prefix for that
> stuf.. E.g. img_filename_... So you can do a prefix search and find
> all references. Or maybe embed_filename_png_xyz.

Maybe. I can't get that excited about it, as we've lived with _xpm for
the last 9 years.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: s/xpm/png/g

От
Magnus Hagander
Дата:
On Mon, Mar 7, 2011 at 18:18, Dave Page <dpage@pgadmin.org> wrote:
> On Mon, Mar 7, 2011 at 2:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
>> On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
>>> Hi,
>>>
>>> The (large) patch at
>>> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
>>> replaces all the XPM images in pgAdmin with PNG ones. This offers us
>>> two major advantages:
>>>
>>> 1) XPM images aren't supported by many graphics tools, and almost
>>> always require manual editing to fix the internal naming anyway.
>>>
>>> 2) XPM images don't support alpha transparency.
>>>
>>> The patch is a little complex, as it's not straightforward to embed
>>> PNG images at build time. Here's what it does:
>>>
>>> - Adds a new project, png2c, on which the pgAdmin project is dependent.
>>> - Adds a new build rule for .png files, which will cause them to be
>>> pre-processed with png2c, to create .pngc files which are C source
>>> code, containing the PNG data and some accessor functions and macros.
>>
>> Didn't we get rid of the beerware license in postgresql, to make
>> corporate lawyers happy? Are you sure it's a good idea to introduce it
>> to pgadmin here?
>
> I don't see why not. It doesn't *require* us to do anything. It just
> says *if we think* it's worth it, we *can* buy him a beer.

Yes.

It was removed from postgresql because of potential concerns from
*lawyers*. Don't expect them to be *logical*.

Given that it seems fairly simple code, it might be worth doing a
clean-room implementation.


>>> - #include's the .pngc files in place of the XPMs.
>>> - Updates the rest of the code to use the new accessor macros created
>>> in the .pngc files:
>>>
>>>    filename_png_img - represents a wxImage*
>>>    filename_png_bmp - represents a wxBitmap*
>>>    filename_png_ico - represents a wxIcon*
>>
>> Just to make it easier to browse and search, I'd use a prefix for that
>> stuf.. E.g. img_filename_... So you can do a prefix search and find
>> all references. Or maybe embed_filename_png_xyz.
>
> Maybe. I can't get that excited about it, as we've lived with _xpm for
> the last 9 years.

Fair enough. Though now is the time to change it, if ever.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: s/xpm/png/g

От
Dave Page
Дата:
On Mon, Mar 7, 2011 at 6:36 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Mon, Mar 7, 2011 at 18:18, Dave Page <dpage@pgadmin.org> wrote:
>> On Mon, Mar 7, 2011 at 2:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
>>> On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
>>>> Hi,
>>>>
>>>> The (large) patch at
>>>> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
>>>> replaces all the XPM images in pgAdmin with PNG ones. This offers us
>>>> two major advantages:
>>>>
>>>> 1) XPM images aren't supported by many graphics tools, and almost
>>>> always require manual editing to fix the internal naming anyway.
>>>>
>>>> 2) XPM images don't support alpha transparency.
>>>>
>>>> The patch is a little complex, as it's not straightforward to embed
>>>> PNG images at build time. Here's what it does:
>>>>
>>>> - Adds a new project, png2c, on which the pgAdmin project is dependent.
>>>> - Adds a new build rule for .png files, which will cause them to be
>>>> pre-processed with png2c, to create .pngc files which are C source
>>>> code, containing the PNG data and some accessor functions and macros.
>>>
>>> Didn't we get rid of the beerware license in postgresql, to make
>>> corporate lawyers happy? Are you sure it's a good idea to introduce it
>>> to pgadmin here?
>>
>> I don't see why not. It doesn't *require* us to do anything. It just
>> says *if we think* it's worth it, we *can* buy him a beer.
>
> Yes.
>
> It was removed from postgresql because of potential concerns from
> *lawyers*. Don't expect them to be *logical*.

Whose lawyers? Ones from companies that insist their staff include
confidentiality clauses on emails to public mailing lists by any
chance? Certainly not postgresql.org lawyers.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: s/xpm/png/g

От
Magnus Hagander
Дата:
On Mon, Mar 7, 2011 at 19:43, Dave Page <dpage@pgadmin.org> wrote:
> On Mon, Mar 7, 2011 at 6:36 PM, Magnus Hagander <magnus@hagander.net> wrote:
>> On Mon, Mar 7, 2011 at 18:18, Dave Page <dpage@pgadmin.org> wrote:
>>> On Mon, Mar 7, 2011 at 2:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
>>>> On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
>>>>> Hi,
>>>>>
>>>>> The (large) patch at
>>>>> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
>>>>> replaces all the XPM images in pgAdmin with PNG ones. This offers us
>>>>> two major advantages:
>>>>>
>>>>> 1) XPM images aren't supported by many graphics tools, and almost
>>>>> always require manual editing to fix the internal naming anyway.
>>>>>
>>>>> 2) XPM images don't support alpha transparency.
>>>>>
>>>>> The patch is a little complex, as it's not straightforward to embed
>>>>> PNG images at build time. Here's what it does:
>>>>>
>>>>> - Adds a new project, png2c, on which the pgAdmin project is dependent.
>>>>> - Adds a new build rule for .png files, which will cause them to be
>>>>> pre-processed with png2c, to create .pngc files which are C source
>>>>> code, containing the PNG data and some accessor functions and macros.
>>>>
>>>> Didn't we get rid of the beerware license in postgresql, to make
>>>> corporate lawyers happy? Are you sure it's a good idea to introduce it
>>>> to pgadmin here?
>>>
>>> I don't see why not. It doesn't *require* us to do anything. It just
>>> says *if we think* it's worth it, we *can* buy him a beer.
>>
>> Yes.
>>
>> It was removed from postgresql because of potential concerns from
>> *lawyers*. Don't expect them to be *logical*.
>
> Whose lawyers? Ones from companies that insist their staff include
> confidentiality clauses on emails to public mailing lists by any
> chance? Certainly not postgresql.org lawyers.

Yes, I believe so.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: s/xpm/png/g

От
Dave Page
Дата:
On Mon, Mar 7, 2011 at 6:45 PM, Magnus Hagander <magnus@hagander.net> wrote:
> On Mon, Mar 7, 2011 at 19:43, Dave Page <dpage@pgadmin.org> wrote:
>> On Mon, Mar 7, 2011 at 6:36 PM, Magnus Hagander <magnus@hagander.net> wrote:
>>> On Mon, Mar 7, 2011 at 18:18, Dave Page <dpage@pgadmin.org> wrote:
>>>> On Mon, Mar 7, 2011 at 2:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
>>>>> On Mon, Mar 7, 2011 at 14:55, Dave Page <dpage@pgadmin.org> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> The (large) patch at
>>>>>> http://developer.pgadmin.org/~dpage/embedded_images_infra-v8.diff
>>>>>> replaces all the XPM images in pgAdmin with PNG ones. This offers us
>>>>>> two major advantages:
>>>>>>
>>>>>> 1) XPM images aren't supported by many graphics tools, and almost
>>>>>> always require manual editing to fix the internal naming anyway.
>>>>>>
>>>>>> 2) XPM images don't support alpha transparency.
>>>>>>
>>>>>> The patch is a little complex, as it's not straightforward to embed
>>>>>> PNG images at build time. Here's what it does:
>>>>>>
>>>>>> - Adds a new project, png2c, on which the pgAdmin project is dependent.
>>>>>> - Adds a new build rule for .png files, which will cause them to be
>>>>>> pre-processed with png2c, to create .pngc files which are C source
>>>>>> code, containing the PNG data and some accessor functions and macros.
>>>>>
>>>>> Didn't we get rid of the beerware license in postgresql, to make
>>>>> corporate lawyers happy? Are you sure it's a good idea to introduce it
>>>>> to pgadmin here?
>>>>
>>>> I don't see why not. It doesn't *require* us to do anything. It just
>>>> says *if we think* it's worth it, we *can* buy him a beer.
>>>
>>> Yes.
>>>
>>> It was removed from postgresql because of potential concerns from
>>> *lawyers*. Don't expect them to be *logical*.
>>
>> Whose lawyers? Ones from companies that insist their staff include
>> confidentiality clauses on emails to public mailing lists by any
>> chance? Certainly not postgresql.org lawyers.
>
> Yes, I believe so.

Which?


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company