Hi!

here are more patches for icons. These patches are based in the icon creation 
stuff.

Fist, I splitted the function wDefaultGetImage(), in two functions. I did it 
because this function found the icon file name, then loaded the icon file image 
and return it. Sometimes, usually with WIcons, we store the file name and the 
RImage, so, is better call the functions only one time (this is the patch 
0004). The functions are:

1. get_default_icon_filename(): This function returns the full
   path of an icon. The function search the icon in the database
   using instance and class.
2. get_default_icon_rimage(): This function returns the RImage for
   a given image path (full path). This function validate the icon
   size, so the icon is fully usable.

Using these functions, I updated the icon creating in wIconCreate and 
wIconCreateWithIconFile. After the update, the functions were so similar, the 
main diference was that the first receives all the information, but the second 
only the icon file path. Then, I moved the code to find the icon path inside 
the wIconCreateWithIconFile. Then both functions were similar. I joined them 
(see patch 0009).

The functions wAppIconCreate and wAppIconCreateForDock were similar too. I move 
the code to make them equal and then removed wAppiconCreateForDock. See 0012.

The main work was make the interfaces of these functions (in appicon.[ch] and 
icon.[ch]) similar, and some patches show this, like for example 0006+0007 and 
0010+0011.

The rest of the patches do different work.

1,2 and 3 clean code, to use the function get_default_icon_filename() in 
dialog.c, removing the duplicated code. See patch 5.

The last patch, 13, removes the duplicated code too, but removes the cache 
variable, because is never used.

I spent some days/weeks with these patches, I think the icon code is now more 
clear.

Saludos,
kix
-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to [email protected].

Reply via email to