################ the last time working on ################ 

- hacking IUP::Canvas::Bitmap - still not finished
- POD hacking - IUP::Manual::*

##########################################################

######## IMPORTANT: IUP::Canvas::PNG
- or other bitmap format (via CD_IMAGERGB canvas)
- see http://www.tecgraf.puc-rio.br/im/en/samples.html
- or IUP::Canvas::File::Vector + IUP::Canvas::File::Bitmap
- or IUP::Canvas::FileVector + IUP::Canvas::FileBitmap
  IUP::Canvas::FileBitmap->new( type=>"PNG", file=>"filename.png", options=>"...." );

######## IMPORTANT: minor issues in element destruction
- Element.pm (look for XXX-FIXME)
- Canvas.pm / Canvas.xs (look for XXX-FIXME)

######## NICE-TO-HAVE: pre-built images
- imglib - Other: B<NOTE:> NOT included in the pre-compiled library
- we need imglib built with -DIUP_IMGLIB_LARGE (mention this in pod - note that Alien::IUP ask about that)

######## NICE-TO-HAVE: consider IDEA
- $element_reference = $radio->GetAttributeAsElement("VALUE");
- handy for: Radio, Toggle
- implementation:
  => $elem_name = $radio->GetAttribute("VALUE");
     $element = IUP->GetByName($elem_name);
    
######## MAYBE: access child=>[...] items like this
 $mybox = IUP::Hbox->new( child=>[ $bt1, $bt2, $bt3] );
 $mybox->[0]->FGCOLOR("255 0 0");   # changes bt1 foreground color
 $mybox->[1]->FGCOLOR("255 0 255"); # changes bt2 foreground color
- beware: somehow handle AddChild & co.
- from perl doc:
  $a = $array[5]; 	$obj->FETCH(5);
  $array[5] = "aa" 	$obj->STORE(5, "aa");

######## MAYBE: IUP::Matrix
- try to implement:
  my $m = IUP::Matrix->new(...);
  $m->[12][44] = 'value';
  $val = $m->[12][44];
- see implementation of SDLx::Surface + SDLx::Surface::TiedMatrix
  http://cpansearch.perl.org/src/KTHAKORE/SDL-2.533/lib/SDLx/Surface.pm
  http://cpansearch.perl.org/src/KTHAKORE/SDL-2.533/lib/SDLx/Surface/TiedMatrix.pm
  
######## POD: mention in POD/DOC
- mention PAR packing recommendation in DOC
- beware: (IUP_DEFAULT related) sub returns value even without explicit return

######## POD: finish doc - espec. IUP::Manual::*
- Cleanup first (in this order):
  - I::M::Elements.pod
  - I::M::Callbacks.pod
  - I::M::Attributes.pod
  - I::M::Introduction.pod
- Notes:
  - pplot: note in doc that DS_ has to be set after ->PPlotEnd()
  - tree: note in doc that tree->SetAttribude has to go after dialog->Show

######## IMPORTANT: IUP::Canvas (not finished yet)

1/ IUP::Canvas::Stipple - FINISHED!!!
$sti= IUP::Canvas::Stipple->new( [ [...], [...], [...] ] );     #1 param
$sti= IUP::Canvas::Stipple->new( $w, $h );                      #2 params
$value = $sti->Pixel($x, $y);
$sti->Pixel($x, $y, $value);
$canvas->cdStipple($sti);
$canvas->wdStipple($sti, $w_mm, $h_mm);
$cursti = $canvas->cdGetStipple();

IDEA: $sti->W + $sti->H + $sti->Pixels

2/ IUP::Canvas::Pattern - FINISHED!!!
$pat = IUP::Canvas::Pattern->new( [ [...], [...] ] );   #1 param
$pat = IUP::Canvas::Pattern->new( $w, $h );             #2 params
$value = $pat->Pixel($x, $y);
$pat->Pixel($x, $y, $value);
$canvas->cdPattern($pat);
$canvas->wdPattern($pat, $w_mm, $h_mm);
$curpat = $canvas->cdGetPattern();

IDEA: $pat->W + $pat->H + $pat->Pixels

3/ IUP::Canvas::Palette - FINISHED!!!
$pal = IUP::Canvas::Palette->new( [$col0, $col1, $col2, ...] );
$pal = IUP::Canvas::Palette->new( $n, $color );
$value = $pal->Color($n);
$pal->Color($n, $color);
$canvas->cdPalette($pal, $mode);

IDEA: $pal->N, $pal->Colors

4/ IUP::Canvas::InternalServerImage - FINISHED!!!
$img = $canvas->cdGetImage($x, $y, $w, $h);
$canvas->cdPutImage($img, $x, $y, $xmin, $xmax, $ymin, $ymax);
$canvas->wdPutImage($img, $x, $y, $xmin, $xmax, $ymin, $ymax);

5/ IUP::Canvas::Bitmap - XXX-NOT-IMPLEMENTED-YET-XXX
Hint - GOOD EXAMPLES:
http://www.lemoda.net/xs/xs-intro/set-bit.html
http://www.gossamer-threads.com/lists/perl/porters/7696

## bitmap methods
# cdBitmap* cdCreateBitmap(int w, int h, int type);
# cdBitmap* cdInitBitmap(int w, int h, int type, ...);
# void cdKillBitmap(cdBitmap* bitmap);
# unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
# void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
# void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);
## canvas methods
# void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
# void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, double x, double y, double w, double h);
# void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
#XXX-FIXME - MAYBE CHANGE TO: $bitmap = $canvas->cdGetBitmap($x, $y, $w, $h);
LUA:
cd.CreateBitmap(w, h, type: number) -> (bitmap: cdBitmap)
cd.KillBitmap(bitmap: cdBitmap)
canvas:PutBitmap(image: cdBitmap; x, y, w, h: number)
canvas:wPutBitmap(bitmap: cdBitmap; x, y, w, h: number)
canvas:GetBitmap(bitmap: cdBitmap; x, y: number)
image:cdCreateBitmap() -> bitmap: cdBitmap
image:cdInitBitmap() -> bitmap: cdBitmap   
+ MAYBE: bitmap.r[n] = color

Perl (idea):
$bmp = IUP::Canvas::Bitmap->new($filename);       #2 1x scalar value (string)
$bmp = IUP::Canvas::Bitmap->new($w, $h, $type);   #4 3x scalar value (numbers)
$bmp = IUP::Canvas::Bitmap->new($index, $colors); #3 2x arrayref
$bmp = IUP::Canvas::Bitmap->new($r, $g, $b);      #4 3x arrayref
$bmp = IUP::Canvas::Bitmap->new($r, $g, $b, $a);  #5 4x arrayref
$bmp = IUP::Canvas::Bitmap->new($type, $pixels);  #3 1x scalar + 1x arrayref
($r,$g,$b)    = $bmp->Pixel($x, $y);
($r,$g,$b,$a) = $bmp->Pixel($x, $y);
$n            = $bmp->Pixel($x, $y);
$bmp->PixelRGBA($x,$y,$r,$g,$b,$a);
$bmp->PixelRGB($x,$y,$r,$g,$b);
$bmp->PixelMAP($x,$y,$n);
$bmp->ColorMAP($n, XXX-???-XXX);

IDEA: $bmp->W + $bmp->H + $bmp->Type + $bmp->Pixels

$canvas->cdPutBitmap($bmp,$x,$y,$w,$h);
$canvas->wdPutBitmap($bmp,$x,$y,$w,$h);
$bmp = $canvas->cdGetBitmap($x,$y,$w,$h);

######## IMPORTANT: add more tests
- split tests: t\*.t + all GUI-related >>> t\gui\*.t
- maybe close after timeout (IUP::Timer -> return IUP_CLOSE)
- skip example:
  plan skip_all => "\$ENV{RELEASE_TESTING} required fot testing", unless $ENV{RELEASE_TESTING};
  eval "use Win32::Job ()";
  plan skip_all => "Can't interrupt hung processes without Win32::Job" if $@;  

### COSMETICS ################################################################################################

(cosmetics)######## IDEA: 
use IUP qw/:basic iup_NO_INIT/; #generally iup_ANY_OTHER_FLAG

(cosmetics)######## IUP::Canvas missing functions (not crutial for now)
- void wdCanvasHardcopy(cdCanvas* canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy));
- int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
- int cdUseContextPlus(int use);
- void cdInitContextPlus(void);

(cosmetics)######## GTK too noisy when no DISPLAY: asck scuri
- GTK + no DISPLAY set - error during gtk_init_check (= during 'use IUP'):
  (<unknown>:7541): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
  IUP->Open == -1
  [http://developer.gnome.org/doc/API/2.2/gtk/gtk-General.html]
  
bool XDisplayExists() {
  return (gdk_display_get_default() != NULL);
}
  
++        if (!gdk_display_get_default ()) {
++                if (!gtk_init_check (NULL, NULL)) {
++                        /* Oh well, no X for you! */
++                        g_printerr (_("Unable to connect to the X server"));
++                        g_printerr ("%s", message);
++                        exit (1);
++                }
++        }
++ 
  
- GTK/NOT-WORKING-DISPLAY 
  The application '<unknown>' lost its connection to the display localhost:10.0;
  most likely the X server was shut down or you killed/destroyed
  the application.

(cosmetics)######## IUP::Canvas
- XS autodetection cdCanvasLine vs. cdfCanvasLine

(cosmetics)######## global
- icon - see y:\IUP3.3\fltk\FLTK-0.532007\inc\MBX\FLTK.pm  (ACTION_code)

(cosmetics)######## Check this:
- consider return; vs. return undef;
  return IUP::Internal::LibraryIup::_voidfunc; == return;
  return IUP::Internal::LibraryIup::_nonvoidfunc; == return undef;
  SUGGESTION: always call: return IUP::Internal::LibraryIup::_func; (even for void functions)
- http://stackoverflow.com/questions/3435122/whats-the-difference-between-return-and-return-undef-in-perl
- "Perl Best Practices" (and Perl::Critic) suggest not using return undef

(cosmetics)######## global
- cleanup unused funcs from LibraryIup.XS - cross-check-xs-func.pl

(cosmetics)######## IUP (main module)
- ??? better detection of initialized gui than (IUP->Open == IUP_OPENED)?
- ??? detection of codepage used in GUI

(cosmetics)######## LibraryIUP.xs + Canvas.xs
- consider IUP::Internal::AllInOneLib.xs
- should save 2-3MB

(cosmetics)######## IUP::Submenu
- consider using $firstonly param of new()

(cosmetics)######## IUP::ProgressBar
- FGCOLOR seems to be ignored

(cosmetics)######## IUP::Split
- maybe support also new($child1, $child2) instead of new(child1=>$child1, child2=>$child2)

(cosmetics)######## IUP::Internal::Element
- change: _create_element should set $self->ihandle value

### NOT NOW, MAYBE LATER ################################################################################################

(not now, maybe later)!!Big Task!! ######## IUP::OLE (extra module)
- $o->IUNKNOWN ... pointer created by CoCreateInstance Function http://msdn.microsoft.com/en-us/library/ms686615%28v=vs.85%29.aspx
- perahps integrate with Win32::OLE like $o->ole->methodname(...)
- Win32::OLE needs something like new_from_iunknown
  IUnknown *punk = ... value from $olecontrol->IUNKNOWN;
  HRESULT hr;
  IDispatch *pDispatch = NULL;
  hr = punk->QueryInterface(IID_IDispatch, (void**)&pDispatch);
  punk->Release();
  ST(0) = CreatePerlObject(aTHX_ stash, pDispatch, destroy);
- see Wx+OLE/ActiveX integration http://search.cpan.org/~mdootson/Wx-ActiveX-0.15/lib/Wx/ActiveX.pm
- missing example: notepad.wlua? olecontrol_browser.wlua?
- missing -> add
- conditionally only on Win32
- we probably need IUP::ConfigData for listing available features (iupole, iupgl ...)

(not now, maybe later)######## implement threads demo
- threads+Wx - http://use.perl.org/~Alias/journal/40377

(not now, maybe later)######## memory issues
- moustly should be handled, some corner cases may occur
- see http://stackoverflow.com/questions/2223721/common-perl-memory-reference-leak-patterns
- somehow check memory leaks - http://use.perl.org/~jozef/journal/40411
- somehow check memory consumption - Devel::Size, Devel::Peak, PerlBench 
  - http://stackoverflow.com/questions/1359771/perl-memory-usage-profiling-and-leak-detection
  - http://www252.pair.com/comdog/mastering_perl/Chapters/06.benchmarking.html
- check memleaks by storing SetAttribute("ATTR", $ref)

(not now, maybe later)######## unicode in filenames (cpodepage magic)
http://www.i-programmer.info/programming/other-languages/1973-unicode-issues-in-perl.html

(not now, maybe later)######## missing examples
- no example for: Clipboard.pm ?
- no example for: User.pm ?
- no example for: ColorDlg.pm ?
- no example for: FontDlg.pm ?

(not now, maybe later)######## Ideas from lua bindings:
- global registers _IUPLUA_WIDGET_TABLE_REF

(not now, maybe later)######## Ideas from ruby bindings:
- iup.* namespace
- cd.* namespace (constants cd::BLUE, ...)
- just one iup.image (RGB, RGBA - ??? perhaps not supported)
- cdcanvas = Cd.ActiveCanvas()
- iupim just: IupLoadImage, IupSaveImage
- GLCanvasOpen, GL... (global function, not methods of glcanvas class)

(not now, maybe later)######## Linux - platform specific issues
- (<unknown>:4352): Pango-WARNING **: Error loading GSUB table 85
  before MainLoop
- GTK: 'Quit' in main menu requires double click

(not now, maybe later)######## Packaging (not a priority)
- RHEL 5 + FC 13,12,11
  - http://search.cpan.org/dist/cpan2rpm/
  - http://search.cpan.org/dist/Ovid/
- Db 4,5 (Ubuntu?)
  - http://search.cpan.org/dist/Debian-Apt-PM/
  - http://www.debian-administration.org/articles/78
    http://www.opensourcery.com/blog/hans-dieter-pearcey/packaging-cpan-modules-debian
- Linux distro info
  - http://distrowatch.com/table.php?distribution=ubuntu (10.04/LTS,9.10,8.04/LTS)
  - http://distrowatch.com/table.php?distribution=debian (5,4)
  - http://distrowatch.com/table.php?distribution=fedora (13,12,11)
  - http://distrowatch.com/table.php?distribution=redhat (5,4)
- vmware images: 
  - http://chrysaor.info/?page=images&filter=Ubuntu
  - http://www.thoughtpolice.co.uk/vmware/

### REJECTED FOR NOW ################################################################################################

#IUP - consider adding iupKeyCodeToName
#IUP - consider adding iupKeyNameToCode
#IUP - Idle? #xxxsomething causes progressbar3.pl to hangup/crash (after pressing accel/decel) - cannot reproduce
#IUP - is GetIhClassName() func name OK - yes for now
#IUP - IUP->GetIdle? or IUP->CheckIdle? #xxx how to check existing idle handler? - not for now

#IUP::Internal::Element - list2.pl: original examples uses inheritable IUP attribute _LABEL for storing pointers for iup elements (do we want to support this in perl?)
#IUP::Internal::Element - passing undef to child=> ... - maybe later
  Can't call method "ihandle" on an undefined value at
  Y:\@repos\perl-iup\blib\lib/IUP/Internal/Element.pm line 574. (better error message)
#IUP::Internal::Element - consider checking arg count SetAttributeId($$$) SetAttributeId2($$$$) - not now

#IUP::List - IUP::List->new() items 0-based or 1-based index? (item[0] >> attribute 1)

#IUP::Frame - missing accessor $frame->MARGIN("10x10"); - MARGIN not in official doc for IupFrame

#IUP::PPlot - maybe add AxsBounds() to IUP::PPlot # see examples\0-basic\pplot4.pl - not now
#IUP::PPlot - maybe add AxsBoundsAuto() - not now
