Răsfoiți Sursa

Remove rGuiLayout tool

Moved to own repo: https://github.com/raysan5/rguilayout
Ray 7 ani în urmă
părinte
comite
70bc8d47b3
44 a modificat fișierele cu 0 adăugiri și 10988 ștergeri
  1. 0 45
      tools/rGuiLayout/README.md
  2. 0 23
      tools/rGuiLayout/design/codegen_naming.txt
  3. BIN
      tools/rGuiLayout/design/lines_quads.png
  4. BIN
      tools/rGuiLayout/design/lines_tris.png
  5. BIN
      tools/rGuiLayout/design/tracemap_menus.png
  6. BIN
      tools/rGuiLayout/design/tracemap_rfxgen.png
  7. 0 35
      tools/rGuiLayout/layouts/generate_code_options.rgl
  8. 0 36
      tools/rGuiLayout/layouts/generate_code_options_rev2.rgl
  9. 0 31
      tools/rGuiLayout/layouts/image_edit_tools.rgl
  10. 0 23
      tools/rGuiLayout/layouts/image_exporter.rgl
  11. 0 32
      tools/rGuiLayout/layouts/image_info.rgl
  12. 0 39
      tools/rGuiLayout/layouts/image_raw_importer.rgl
  13. 0 34
      tools/rGuiLayout/layouts/image_resize.rgl
  14. 0 19
      tools/rGuiLayout/layouts/messagebox.rgl
  15. 0 37
      tools/rGuiLayout/layouts/raygui_controls_palette.rgl
  16. 0 78
      tools/rGuiLayout/layouts/rfxgen.rgl
  17. 0 47
      tools/rGuiLayout/layouts/rguistyler.rgl
  18. 0 47
      tools/rGuiLayout/layouts/rguistyler_rev2.rgl
  19. 0 59
      tools/rGuiLayout/layouts/rpbr_left_panel.rgl
  20. 0 30
      tools/rGuiLayout/layouts/rpbr_right_panel.rgl
  21. 0 47
      tools/rGuiLayout/layouts/rtexpacker_right_panel.rgl
  22. BIN
      tools/rGuiLayout/logo/rguilayout.pdn
  23. BIN
      tools/rGuiLayout/logo/rguilayout_128x128.png
  24. BIN
      tools/rGuiLayout/logo/rguilayout_16x16.png
  25. BIN
      tools/rGuiLayout/logo/rguilayout_24x24.png
  26. BIN
      tools/rGuiLayout/logo/rguilayout_256x256.png
  27. BIN
      tools/rGuiLayout/logo/rguilayout_32x32.png
  28. BIN
      tools/rGuiLayout/logo/rguilayout_48x48.png
  29. BIN
      tools/rGuiLayout/logo/rguilayout_64x64.png
  30. BIN
      tools/rGuiLayout/logo/rguilayout_96x96.png
  31. BIN
      tools/rGuiLayout/release/win32/rguilayout.exe
  32. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot000.png
  33. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot001.png
  34. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot002.png
  35. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot003.png
  36. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot004.png
  37. BIN
      tools/rGuiLayout/screenshots/rguilayout_shot005.png
  38. 0 253
      tools/rGuiLayout/src/external/easings.h
  39. 0 7370
      tools/rGuiLayout/src/external/tinyfiledialogs.c
  40. 0 325
      tools/rGuiLayout/src/external/tinyfiledialogs.h
  41. 0 2351
      tools/rGuiLayout/src/rguilayout.c
  42. BIN
      tools/rGuiLayout/src/rguilayout.ico
  43. 0 27
      tools/rGuiLayout/src/rguilayout.rc
  44. BIN
      tools/rGuiLayout/src/rguilayout_icon

+ 0 - 45
tools/rGuiLayout/README.md

@@ -1,45 +0,0 @@
-<img align="left" src="logo/rguilayout_256x256.png" width=256>
-
-# rGuiLayout
-A simple and easy-to-use tool to create raygui-based layouts. Useful for fast tools development. The perfect companion for [rGuiStyler](https://github.com/raysan5/raygui/tree/master/tools/rGuiStyler) tool.
-
-<br>
-<br>
-<br>
-<br>
-
-## Features
-
- - **+25 controls available to define your imgui layout**
- - Place controls visually and move/scale them freely
- - Snap to grid mode for maximum precission
- - Save/Load your layout as **.rgl (text or binary mode)**
- - Import **.rgs** files ([rGuiStyler](https://github.com/raysan5/raygui/tree/master/tools/rGuiStyler)) to customize visual style (drag&drop)
- - **Export layout directly as plain C code, ready to edit and compile!**
- - Multiple code generation options to customize exported code
- - Supports image loading to be used as tracemap
- - Autovisible right controls panel for quick selection
- - Anchors mode support to link your controls
- - Controls text edition and name edition (for exported variables)
- - **+10 predefined layout available for reference**
- - **Completely portable (single file)**
- - Free and open source
- 
-## Usage
-The tool is pretty intuitive to use, it mostly works with mouse and several key shortcuts that can be seen just pressing TAB key once program is open. Use mouse wheel to select desired control or RightMouseButton to open controls panel.
-
-You can drag&drop .rgl files for layout loading and also .rgs files (rGuiStyler) for layout style loading. To export created layout as C code, just pres LCTRL+ENTER, you can configure multiple export options to generate the code.
-
-To compile the code, you need raygui library (single-file header-only) and raylib v2.0 library, not yet released on itch.io but already available for early adopters on raylib GitHub, ready to be compiled.
- 
-## Screenshots
-
-![rGuiLayout](screenshots/screenshot000.png)
-
-## License
-
-rGuiLayout is free and open source software. rGuiLayout source code is licensed under an unmodified zlib/libpng license. Check [LICENSE](LICENSE) for further details.
-
-Despite being completely free, consider a small donation for the development efforts or contributing to raylib patreon to help the author keep working on free software for games development.
-
-*Copyright (c) 2017-2018 raylib technologies ([@raysan5](https://twitter.com/raysan5))*

+ 0 - 23
tools/rGuiLayout/design/codegen_naming.txt

@@ -1,23 +0,0 @@
-Control     |   DefaultName     | #GenVars  |      Generated variables (sufixes)
------------------------------------------------------------------------
-WINDOWBOX       WindowBox001        1           bool {name}Active
-GROUPBOX        GroupBox001         0           -
-LINE            Line001             0           -
-PANEL           Panel001            0           -
-LABEL           Label001            0           [!] const char *{name}Text  -->  Only if defined to be exported
-BUTTON          Button001           0           [!] void {name}() func
-TOGGLE          Toggle001           1           bool {name}Active
-TOGGLEGROUP     ToggleGroup001      3           const char *{name}TextList[], const int {name}Count, int {name}Active
-CHECKBOX        CheckBox001         1           bool {name}Checked
-COMBOBOX        ComboBox001         3           const char *{name}TextList[], const int {name}Count, int {name}Active
-DROPDOWNBOX     DropdownBox001      3           const char *{name}TextList[], const int {name}Count, int {name}Active
-SPINNER         Spinner001          1           int {name}Value
-VALUEBOX        ValueBox001         1           int {name}Value
-TEXTBOX         TextBox001          2           char *{name}Text, int {name}TextSize
-SLIDER          Slider001           1           float {name}Value, const float {name}MinValue, const float {name}MaxValue 
-SLIDERBAR       SliderBar001        1           float {name}Value, const float {name}MinValue, const float {name}MaxValue 
-PROGRESSBAR     ProgressBar001      1           float {name}Value
-STATUSBAR       StatusBar           1           char *{name}Text
-LISTVIEW        ListView001         3           const char *{name}TextList[], const int {name}Count, int {name}Active
-COLORPICKER     ColorPicker001      1           Color {name}Value
-DUMMYREC        DummyRec001         0           -

BIN
tools/rGuiLayout/design/lines_quads.png


BIN
tools/rGuiLayout/design/lines_tris.png


BIN
tools/rGuiLayout/design/tracemap_menus.png


BIN
tools/rGuiLayout/design/tracemap_rfxgen.png


+ 0 - 35
tools/rGuiLayout/layouts/generate_code_options.rgl

@@ -1,35 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     20
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 generateWindow 0 0 400 225 1 Generate Code Options - layout
-c 001 4 lblName 10 35 65 25 1 Name:
-c 002 13 toolName 75 35 135 25 1 tool_name
-c 003 4 lblVersion 225 35 50 25 1 Version:
-c 004 13 toolVersion 275 35 115 25 1 1.2.0-dev
-c 005 4 lblWindowSize 10 65 65 25 1 Window size:
-c 006 12 width 75 65 60 25 1 File name:
-c 007 4 lblx 140 65 10 25 1 x
-c 008 12 height 150 65 60 25 1 Untitled
-c 009 4 lblCompany 225 65 50 25 1 Company:
-c 010 13 company 275 65 115 25 1 raysan5
-c 011 4 lblDescription 10 95 65 25 1 Description:
-c 012 13 toolDescription 75 95 315 55 1 tool_description
-c 013 8 defineRecs 10 160 15 15 1 Define Rectangles
-c 014 8 defineTexts 10 180 15 15 1 Define text const
-c 015 8 exportAnchors 140 160 15 15 1 Export anchors
-c 016 8 exportAnchor0 140 180 15 15 1 Export anchor 0
-c 017 8 fullComments 140 200 15 15 1 Full comments
-c 018 5 GenerateCode 275 185 115 30 1 Generate Code
-c 019 8 cropWindow 10 200 15 15 1 Crop to Window

+ 0 - 36
tools/rGuiLayout/layouts/generate_code_options_rev2.rgl

@@ -1,36 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     21
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 generateWindow 0 0 400 225 1 Generate Code Options - layout
-c 001 4 lblName 10 35 65 25 1 Name:
-c 002 13 toolName 75 35 135 25 1 tool_name
-c 003 4 lblVersion 225 35 50 25 1 Version:
-c 004 13 toolVersion 275 35 115 25 1 1.2.0-dev
-c 005 4 lblWindowSize 10 65 65 25 1 Window size:
-c 006 12 width 75 65 60 25 1 File name:
-c 007 4 lblx 140 65 10 25 1 x
-c 008 12 height 150 65 60 25 1 Untitled
-c 009 4 lblCompany 225 65 50 25 1 Company:
-c 010 13 company 275 65 115 25 1 raysan5
-c 011 4 lblDescription 10 95 65 25 1 Description:
-c 012 13 toolDescription 75 95 315 55 1 tool_description
-c 013 8 defineRecs 10 160 15 15 1 Define Rectangles
-c 014 8 defineTexts 10 180 15 15 1 Define text const
-c 015 8 fullVariables 10 200 15 15 1 Full variables
-c 016 8 exportAnchors 140 160 15 15 1 Export anchors
-c 017 8 exportAnchor0 140 180 15 15 1 Export anchor 0
-c 018 8 fullComments 140 200 15 15 1 Full comments
-c 019 8 cropWindow 275 160 15 15 1 Crop to Window
-c 020 5 GenerateCode 275 185 115 30 1 Generate Code

+ 0 - 31
tools/rGuiLayout/layouts/image_edit_tools.rgl

@@ -1,31 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     16
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 editWindow 0 0 170 445 1 Image Edit Tools
-c 001 6 flipH 10 35 70 25 1 Flip H
-c 002 6 flipV 90 35 70 25 1 Flip V
-c 003 5 RotateCCW 10 70 70 25 1 Rotate CCW
-c 004 5 RotateCW 90 70 70 25 1 Rotate CW
-c 005 5 ImagePOT 10 105 150 25 1 Make Power Of Two
-c 006 5 ImageAlphaClear 10 140 150 25 1 Clear Transparent Pixels
-c 007 5 ImageCrop 10 175 150 25 1 Crop Transparent Border
-c 008 5 ImageAlphaMultiply 10 210 150 25 1 Pre-Multiply Alpha
-c 009 5 ImageMipmaps 10 245 150 25 1 Generate Mipmaps
-c 010 5 ImageNormalmap 10 280 150 25 1 Generate Normalmap
-c 011 5 ImagetDithering 10 315 150 25 1 Compute Dithering
-c 012 2 line01 10 340 150 20 1 
-c 013 5 ImageResize 10 360 150 25 1 Resize Image
-c 014 2 line02 10 385 150 20 1 
-c 015 5 ExportImage 10 405 150 25 1 Export Image

+ 0 - 23
tools/rGuiLayout/layouts/image_exporter.rgl

@@ -1,23 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     8
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 exportWindow 0 0 220 190 1 Image Export Options
-c 001 4 lblFileFormat 10 35 60 25 1 File format:
-c 002 9 fileFormat 80 35 130 25 1 Laser/Shoot
-c 003 4 lblPixelFormat 10 70 63 25 1 Pixel format:
-c 004 9 pixelFormat 80 70 130 25 1 SAMPLE TEXT
-c 005 4 lblFileName 10 105 50 25 1 File name:
-c 006 13 fileName 80 105 130 25 1 Untitled
-c 007 5 ExportImage 10 145 200 30 1 Export Image

+ 0 - 32
tools/rGuiLayout/layouts/image_info.rgl

@@ -1,32 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     17
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 0 0 0
-a 002 50 50 1
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 infoWindow 0 0 170 245 2 Image Info
-c 001 4 lblSize 10 30 80 20 2 Size:
-c 002 4 size 95 30 65 20 2 256 x 256
-c 003 4 lblPixelFormat 10 50 80 20 2 Pixel format:
-c 004 4 pixelFormat 95 50 65 20 2 R8G8B8A8
-c 005 4 lblDataSize 10 70 80 20 2 Data size:
-c 006 4 dataSize 95 70 70 20 2 262144 bytes
-c 007 4 lblMipmaps 10 90 80 20 2 Mipmap levels:
-c 008 4 mipmaps 95 90 70 20 2 01
-c 009 4 lblScaleFilter 10 110 80 20 2 Scale filter:
-c 010 4 scaleFilter 95 110 70 20 2 BILINEAR
-c 011 1 groupSelectedPixel 10 145 150 85 2 Selected Pixel
-c 012 20 pixelBox 20 155 65 65 2 <pixel>
-c 013 4 compR 100 155 50 20 2 R: 205
-c 014 4 compG 100 170 50 20 2 G: 150
-c 015 4 compB 100 185 50 20 2 B: 80
-c 016 4 compA 100 200 50 20 2 A: 255

+ 0 - 39
tools/rGuiLayout/layouts/image_raw_importer.rgl

@@ -1,39 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     24
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 importWindow 0 0 200 465 1 Image RAW Import Options
-c 001 4 lblImportFile 10 30 65 20 1 Import file:
-c 002 4 fileName 85 30 75 20 1 Untitled.raw
-c 003 4 lblFileSize 10 50 65 20 1 File size:
-c 004 4 fileSize 85 50 75 20 1 2132421 bytes
-c 005 1 resolutionBox 10 85 180 80 1 Resolution
-c 006 4 lblWidth 20 100 33 25 1 Width:
-c 007 12 width 60 100 80 25 1 SAMPLE TEXT
-c 008 4 lblPixels 145 100 30 25 1 pixels
-c 009 4 lblHeight 20 130 33 25 1 Height:
-c 010 12 height 60 130 80 25 1 SAMPLE TEXT
-c 011 4 lblPixels 145 130 30 25 1 pixels
-c 012 1 pixelFormatBox 10 180 180 160 1 Pixel Format
-c 013 9 pixelFormat 20 195 160 25 1 SAMPLE TEXT
-c 014 2 line 20 220 160 20 1 
-c 015 4 lblChannels 20 235 50 20 1 Channels:
-c 016 7 channels 20 255 159 25 1 Bit Depth:
-c 017 4 lblBitDepth 20 285 50 20 1 Bit Depth:
-c 018 7 bitDepth 20 305 159 25 1 Bit Depth:
-c 019 1 headerBox 10 355 180 50 1 Header
-c 020 4 lblSize 25 370 27 25 1 Size:
-c 021 12 headerSize 55 370 85 25 1 SAMPLE TEXT
-c 022 4 lblBytes 145 370 30 25 1 bytes
-c 023 5 ImportRAW 10 420 180 30 1 Import RAW

+ 0 - 34
tools/rGuiLayout/layouts/image_resize.rgl

@@ -1,34 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     19
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 205 160 1
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 resizeWindow 0 0 220 210 1 Image Resize Options
-c 001 4 lblResize 10 35 60 25 1 Resize:
-c 002 12 width 75 35 60 25 1 
-c 003 4 lblx 140 35 15 25 1 x
-c 004 12 height 150 35 60 25 1 
-c 005 4 lblAlgorythm 10 70 65 25 1 Algorythm:
-c 006 9 algorythm 75 70 135 25 1 
-c 007 8 lockAspect 20 110 15 15 1 Lock Aspect Ratio
-c 008 8 canvasResize 20 135 15 15 1 Canvas Resize
-c 009 8 checkTopLeft 0 0 15 15 2 
-c 010 8 checkTop 14 0 15 15 2 
-c 011 8 checkTopRight 28 0 15 15 2 
-c 012 8 checkLeft 0 14 15 15 2 
-c 013 8 checkCenter 14 14 15 15 2 
-c 014 8 checkRight 28 14 15 15 2 
-c 015 8 checkBottomLeft 0 28 15 15 2 
-c 016 8 checkBottom 14 28 15 15 2 
-c 017 8 checkBottomRight 28 28 15 15 2 
-c 018 5 ResizeImage 10 165 200 30 1 Resize Image

+ 0 - 19
tools/rGuiLayout/layouts/messagebox.rgl

@@ -1,19 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     4
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 225 175 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 messageWindow 0 0 325 125 1 rGuiLayout - GuiMessageBox
-c 001 4 lblMsg01 35 40 255 25 1 Are you ready to create the most amazing tools?
-c 002 5 SureButton 25 75 120 30 1 Sure!
-c 003 5 ContinueButton 180 75 120 30 1 Continue!

+ 0 - 37
tools/rGuiLayout/layouts/raygui_controls_palette.rgl

@@ -1,37 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     22
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 100 50 1
-a 002 0 0 0
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 3 controlsPanel -10 -10 150 865 1 
-c 001 0 WindowBox 0 0 130 50 1 WindowBox
-c 002 1 GroupBox 0 60 130 30 1 GroupBox
-c 003 2 Line 0 95 130 20 1 
-c 004 3 Panel 0 120 130 35 1 
-c 005 4 Label 0 160 131 25 1 Label (SAMPLE TEXT)
-c 006 5 Button 0 190 130 30 1 Button
-c 007 6 Toggle 0 230 90 25 1 Toggle
-c 008 8 CheckBox 105 235 15 15 1 
-c 009 7 ToggleGroup 0 265 130 25 1 
-c 010 9 ComboBox 0 300 130 25 1 
-c 011 10 DropdownBox 0 335 130 25 1 
-c 012 11 Spinner 0 370 130 25 1 
-c 013 12 ValueBox 0 405 130 25 1 
-c 014 13 TextBox 0 440 130 25 1 TextBox
-c 015 14 Slider 0 475 130 15 1 
-c 016 15 SliderBar 0 500 130 15 1 
-c 017 16 ProgressBar 0 525 130 15 1 
-c 018 17 StatusBar 0 550 130 25 1 StatusBar
-c 019 18 ListView 0 585 130 75 1 
-c 020 19 ColorPicker 0 670 100 100 1 
-c 021 20 DummyRec 0 810 130 30 1 DummyRec

+ 0 - 78
tools/rGuiLayout/layouts/rfxgen.rgl

@@ -1,78 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     63
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 165 90 1
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 20 version 25 15 80 20 1 Version
-c 001 5 PickupCoin 10 45 95 20 1 Pickup/Coin
-c 002 5 LaserShoot 10 70 95 20 1 Laser/Shoot
-c 003 5 Explosion 10 95 95 20 1 Explosion
-c 004 5 Powerup 10 120 95 20 1 Powerup
-c 005 5 HitHurt 10 145 95 20 1 Hit/Hurt
-c 006 5 Jump 10 170 95 20 1 Jump
-c 007 5 BlipSelect 10 195 95 20 1 Blip/Select
-c 008 4 lblInfo01 15 235 90 20 1 based on sfxr by
-c 009 4 lblInfo02 10 248 98 20 1 Tomas Pettersson
-c 010 4 lblInfo03 20 280 85 20 1 www.github.com/
-c 011 4 lblInfo04 20 295 85 20 1 raysan5/raygui
-c 012 4 lblInfo05 20 320 85 20 1 www.github.com/
-c 013 4 lblInfo06 20 335 85 20 1 raysan5/raylib
-c 014 5 Mutate 10 365 95 20 1 Mutate
-c 015 5 Randomize 10 390 95 20 1 Randomize
-c 016 7 waveType 115 15 265 20 1 
-c 017 6 screenSize 440 65 95 20 0 Screen Size x2
-c 018 4 lblVolume 390 45 95 20 1 VOLUME:    60%
-c 019 15 volume 390 65 95 10 1 
-c 020 5 PlaySound 390 81 95 20 1 Play Sound
-c 021 8 playOnChange 390 115 10 10 1 Play on change
-c 022 4 lblPoweredBy 390 135 80 20 1 powered by
-c 023 20 logo 390 153 95 95 1 LOGO
-c 024 4 lblRaylibDotCom 405 250 70 20 1 www.raylib.com
-c 025 5 LoadSound 390 280 95 20 1 Load Sound
-c 026 5 SaveSound 390 305 95 20 1 Save Sound
-c 027 9 sampleRate 390 340 95 20 1 
-c 028 9 sampleSize 390 364 95 20 1 
-c 029 5 ExportWav 390 389 95 20 1 Export Wav
-c 030 1 GroupBox098 0 0 265 71 2 
-c 031 1 GroupBox099 0 70 265 96 2 
-c 032 1 GroupBox100 0 165 265 36 2 
-c 033 1 GroupBox102 0 200 265 36 2 
-c 034 1 GroupBox101 0 235 265 21 2 
-c 035 1 GroupBox104 0 255 265 36 2 
-c 036 1 GroupBox103 0 290 265 85 2 
-c 037 15 attackTime 125 10 100 10 2 ATTACK TIME
-c 038 15 sustainTime 125 25 100 10 2 SUSTAIN TIME
-c 039 15 sustainPunch 125 40 100 10 2 SUSTAIN PUNCH
-c 040 15 decayTime 125 55 100 10 2 DECAY TIME
-c 041 15 startFrequency 125 75 100 10 2 START FREQUENCY
-c 042 15 minFrequency 125 90 100 10 2 MIN FREQUENCY
-c 043 15 slide 125 105 100 10 2 SLIDE
-c 044 15 deltaSlide 125 120 100 10 2 DELTA SLIDE
-c 045 15 vibratoDepth 125 135 100 10 2 VIBRATO DEPTH
-c 046 15 vibratoSpeed 125 150 100 10 2 VIBRATO SPEED
-c 047 15 changeAmount 125 170 100 10 2 CHANGE AMOUNT
-c 048 15 changeSpeed 125 185 100 10 2 CHANGE SPEED
-c 049 15 squareDuty 125 205 100 10 2 SQUARE DUTY
-c 050 15 dutySweep 125 220 100 10 2 DUTY SWEEP
-c 051 15 repeatSpeed 125 240 100 10 2 REPEAT SPEED
-c 052 15 phaserOffset 125 260 100 10 2 PHASER OFFSET
-c 053 15 phaserSweep 125 275 100 10 2 PHASER SWEEP
-c 054 15 lpfCutoff 125 295 100 10 2 LPF CUTOFF
-c 055 15 lpfCutoffSweep 125 310 100 10 2 LPF CUTOFF SWEEP
-c 056 15 lpfResonance 125 325 100 10 2 LPF RESONANCE
-c 057 15 hpfCutoff 125 340 100 10 2 HPF CUTOFF
-c 058 15 hpfCutoffSweep 125 355 100 10 2 HPF CUTOFF SWEEP
-c 059 20 Wave 10 420 475 50 1 WAVE
-c 060 17 soundInfo 0 480 201 20 1 SOUND INFO: Num samples:
-c 061 17 duration 200 480 126 20 1 Duration
-c 062 17 waveSize 325 480 175 20 1 Wave size

+ 0 - 47
tools/rGuiLayout/layouts/rguistyler.rgl

@@ -1,47 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     32
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 395 90 1
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 17 StatusBar002 0 0 720 24 1 CHOSE CONTROL            >
-c 001 18 ListView000 10 40 140 560 1 
-c 002 18 ListView001 155 40 180 560 1 
-c 003 0 WindowBox004 0 0 365 560 2 Sample raygui controls
-c 004 4 Label007 10 35 65 25 2 rGuiStyler
-c 005 4 Label008 90 35 145 25 2 github.com/raysan5/raygui
-c 006 5 Button006 240 35 115 25 2 Load Style
-c 007 6 Toggle009 10 70 65 30 2 toggle
-c 008 7 ToggleGroup010 90 70 265 30 2 
-c 009 14 Slider011 10 110 345 20 2 
-c 010 15 SliderBar012 10 140 345 20 2 
-c 011 16 ProgressBar013 10 170 320 20 2 
-c 012 8 CheckBox014 335 170 20 20 2 
-c 013 11 Spinner015 10 200 150 30 2 
-c 014 13 TextBox016 175 200 180 30 2 custom_style.rgs
-c 015 9 ComboBox017 10 240 150 30 2 
-c 016 5 Button005 175 240 180 30 2 Save Style
-c 017 19 ColorPicker018 10 280 240 240 2 
-c 018 1 GroupBox019 290 285 65 75 2 RGBA
-c 019 4 Label023 300 290 20 20 2 R:
-c 020 4 Label024 300 305 20 20 2 G:
-c 021 4 Label025 300 320 20 20 2 B:
-c 022 4 Label026 300 335 20 20 2 A:
-c 023 1 GroupBox020 290 370 65 60 2 HSV
-c 024 4 Label027 300 375 8 20 2 H:
-c 025 17 StatusBar003 0 616 150 24 1 BASE STYLE: LIGHT
-c 026 20 DummyRec021 290 440 65 80 2 Panel
-c 027 13 TextBox022 290 530 65 20 2 AABBCCDD
-c 028 4 Label028 300 405 19 20 2 V:
-c 029 4 Label029 300 390 18 20 2 S:
-c 030 17 StatusBar030 149 616 186 24 1 CHANGED PROPERTIES: 77
-c 031 17 StatusBar031 334 616 386 24 1 EDITION TIME: 02:45:30

+ 0 - 47
tools/rGuiLayout/layouts/rguistyler_rev2.rgl

@@ -1,47 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     32
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 395 90 1
-a 003 0 0 0
-a 004 0 0 0
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 17 StatusBar002 0 0 720 24 1 CHOSE CONTROL            >
-c 001 18 ListView000 10 40 140 560 1 
-c 002 18 ListView001 155 40 180 560 1 
-c 003 0 WindowBox004 0 0 365 560 2 Sample raygui controls
-c 004 4 Label007 10 35 65 25 2 rGuiStyler
-c 005 4 Label008 85 35 145 25 2 github.com/raysan5/raygui
-c 006 8 CheckBox014 270 38 20 20 2 DISABLED
-c 007 6 Toggle009 10 70 65 30 2 toggle
-c 008 7 ToggleGroup010 85 70 270 30 2 
-c 009 14 Slider011 75 115 250 15 2 SLIDER
-c 010 15 SliderBar012 75 140 250 15 2 SLIDERBAR
-c 011 16 ProgressBar013 10 165 315 15 2 
-c 012 9 ComboBox017 10 195 110 30 2 
-c 013 10 DropdownBox032 125 195 110 30 2 
-c 014 11 Spinner015 240 195 115 30 2 
-c 015 13 TextBox016 10 240 180 30 2 custom_style.rgs
-c 016 5 Button005 195 240 160 30 2 Save Style
-c 017 2 Line031 10 275 345 20 2 
-c 018 19 ColorPicker018 10 300 240 240 2 
-c 019 1 GroupBox019 290 300 65 55 2 RGBA
-c 020 4 Label023 300 305 20 20 2 R:
-c 021 4 Label024 300 320 20 20 2 G:
-c 022 4 Label025 300 335 20 20 2 B:
-c 023 1 GroupBox020 290 365 65 55 2 HSV
-c 024 4 Label027 300 370 20 20 2 H:
-c 025 4 Label029 300 385 20 20 2 S:
-c 026 4 Label028 300 400 20 20 2 V:
-c 027 20 DummyRec021 290 430 65 80 2 Panel
-c 028 13 TextBox022 290 520 65 20 2 AABBCCDD
-c 029 17 StatusBar003 0 616 150 24 1 BASE STYLE: LIGHT
-c 030 17 StatusBar030 149 616 186 24 1 CHANGED PROPERTIES: 77
-c 031 17 StatusBar031 334 616 386 24 1 EDITION TIME: 02:45:30

+ 0 - 59
tools/rGuiLayout/layouts/rpbr_left_panel.rgl

@@ -1,59 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     44
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 25 1
-a 002 60 215 1
-a 003 60 400 1
-a 004 60 480 1
-a 005 60 575 1
-a 006 0 0 0
-a 007 0 0 0
-c 000 17 StatusBar000 0 0 210 25 1 SCENE SETTINGS
-c 001 3 Panel063 50 50 210 775 0 
-c 002 1 GroupBox010 10 40 190 135 1 Render Settings
-c 003 4 Label002 20 50 80 25 1 Render Mode:
-c 004 9 ComboBox001 95 50 95 25 1 
-c 005 14 Slider003 90 85 80 10 1 World scale:
-c 006 8 CheckBox007 20 105 10 10 1 
-c 007 15 SliderBar004 90 105 80 10 1 Wireframe
-c 008 4 Label008 20 120 86 20 1 Render elements:
-c 009 7 ToggleGroup009 20 138 170 25 1 
-c 010 1 GroupBox016 0 0 190 170 2 Environment
-c 011 20 DummyRec011 10 10 170 110 2 
-c 012 14 Slider013 60 130 90 10 2 Parallax:
-c 013 15 SliderBar014 60 150 90 10 2 Blurry:
-c 014 1 GroupBox020 0 0 190 65 3 Camera
-c 015 7 ToggleGroup017 10 13 170 25 3 
-c 016 15 SliderBar019 45 45 105 10 3 FOV:
-c 017 1 GroupBox033 0 0 190 80 4 Lights
-c 018 8 CheckBox024 10 15 10 10 4 Key
-c 019 15 SliderBar027 55 15 90 10 4 
-c 020 20 DummyRec030 150 10 30 20 4 -
-c 021 8 CheckBox025 10 35 10 10 4 Fill
-c 022 15 SliderBar028 55 35 90 10 4 
-c 023 20 DummyRec031 150 30 30 20 4 -
-c 024 8 CheckBox026 10 55 10 10 4 Back
-c 025 15 SliderBar029 55 55 90 10 4 
-c 026 20 DummyRec032 150 50 30 20 4 -
-c 027 1 GroupBox062 0 0 190 240 5 Postpro FX
-c 028 8 CheckBox034 10 15 10 10 5 Antialiasing (FXAAv3)
-c 029 8 CheckBox035 10 35 10 10 5 Bloom:
-c 030 8 CheckBox036 10 55 10 10 5 Vignette:
-c 031 8 CheckBox037 10 75 10 10 5 DOF:
-c 032 8 CheckBox038 10 95 10 10 5 Grain:
-c 033 8 CheckBox039 10 115 10 10 5 Color correction:
-c 034 15 SliderBar046 75 35 80 10 5 
-c 035 15 SliderBar047 75 55 80 10 5 
-c 036 15 SliderBar048 75 95 80 10 5 
-c 037 14 Slider049 75 75 80 10 5 
-c 038 14 Slider054 55 145 100 10 5 Sat:
-c 039 14 Slider055 55 160 100 10 5 Lum:
-c 040 15 SliderBar056 60 180 95 10 5 Bright:
-c 041 15 SliderBar057 60 200 95 10 5 Contrast:
-c 042 15 SliderBar058 60 220 95 10 5 Gamma:
-c 043 14 Slider048 55 130 100 10 5 Hue:

+ 0 - 30
tools/rGuiLayout/layouts/rpbr_right_panel.rgl

@@ -1,30 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     15
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 50 50 1
-a 002 60 460 1
-a 003 60 645 1
-a 004 60 275 1
-a 005 0 0 0
-a 006 0 0 0
-a 007 0 0 0
-c 000 17 StatusBar008 0 0 170 30 1 MATERIAL MAPS
-c 001 3 Panel014 50 80 170 745 0 
-c 002 1 GroupBox013 10 40 150 170 1 Albedo
-c 003 20 DummyRec000 20 50 130 130 1 <ALBEDO MAP>
-c 004 4 Label004 40 185 55 20 1 Color Tint:
-c 005 20 DummyRec012 100 185 50 20 1 col
-c 006 1 GroupBox009 0 0 150 170 4 Normals
-c 007 20 DummyRec001 10 10 130 130 4 <NORMAL MAP>
-c 008 15 sldrNormal 10 150 100 10 4 
-c 009 1 GroupBox010 0 0 150 170 2 Metalness
-c 010 20 DummyRec002 10 10 130 130 2 <METALNESS MAP>
-c 011 15 sldrMetalness 10 150 100 10 2 
-c 012 1 GroupBox011 0 0 150 170 3 Roughness
-c 013 20 DummyRec003 10 10 130 130 3 <ROUGHNESS MAP>
-c 014 15 sldrRoughness 10 150 100 10 3 

+ 0 - 47
tools/rGuiLayout/layouts/rtexpacker_right_panel.rgl

@@ -1,47 +0,0 @@
-#
-# rgl text file (v1.0) - raygui layout text file generated using rGuiLayout
-#
-# Total number of controls:     32
-# Anchor info:   a <id> <posx> <posy> <enabled>
-# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>
-#
-a 000 0 0 1
-a 001 0 0 0
-a 002 60 90 1
-a 003 60 280 1
-a 004 60 440 1
-a 005 50 50 1
-a 006 0 0 0
-a 007 0 0 0
-c 000 0 WindowBox033 0 0 230 575 5 ATLAS SETTINGS
-c 001 1 GroupPacking 0 0 210 175 2 Packing
-c 002 4 lblAlgorythm 10 15 60 25 2 Algorythm:
-c 003 9 algorythm 70 15 130 25 2 
-c 004 4 lblHeuristics 10 50 60 25 2 Heuristics:
-c 005 9 heuristics 70 50 130 25 2 
-c 006 4 lblPadding 10 85 60 25 2 Padding:
-c 007 11 padding 70 85 130 25 2 
-c 008 8 trimSprites 10 125 15 15 2 Trim sprites
-c 009 8 allowRotation 110 125 15 15 2 Allow rotation
-c 010 8 removeDups 10 150 15 15 2 Detect Duplicates and use Alias
-c 011 1 GroupTexture 0 0 210 145 3 Texture
-c 012 4 lblSize 10 15 30 25 3 Size:
-c 013 12 width 55 15 65 25 3 
-c 014 4 lblx 125 15 10 25 3 x
-c 015 12 height 135 15 65 25 3 
-c 016 8 forcePOT 10 50 15 15 3 Force POT
-c 017 8 clearAlpha 10 75 15 15 3 Alpha Clear
-c 018 8 forceSquared 105 50 15 15 3 Force Square
-c 019 5 ExportImage 10 105 190 30 3 Export Image
-c 020 1 GroupFont 0 0 210 170 4 Font
-c 021 4 lblCharHeight 10 10 100 25 4 Char size (Height):
-c 022 4 lblPixels 170 10 31 25 4 pixels
-c 023 4 lblCharRange 10 35 100 25 4 Characters Range:
-c 024 11 minChar 10 60 85 25 4 
-c 025 4 lblto 100 60 15 25 4 to
-c 026 11 maxChar 115 60 85 25 4 
-c 027 5 ImportCharset 10 95 190 25 4 Import Charset
-c 028 8 generateSDF 10 140 15 15 4 Generate SDF
-c 029 12 charHeight 115 10 50 25 4 
-c 030 8 CheckBox032 105 75 15 15 3 Alpha Premult.
-c 031 11 Spinner033 115 135 85 25 4 

BIN
tools/rGuiLayout/logo/rguilayout.pdn


BIN
tools/rGuiLayout/logo/rguilayout_128x128.png


BIN
tools/rGuiLayout/logo/rguilayout_16x16.png


BIN
tools/rGuiLayout/logo/rguilayout_24x24.png


BIN
tools/rGuiLayout/logo/rguilayout_256x256.png


BIN
tools/rGuiLayout/logo/rguilayout_32x32.png


BIN
tools/rGuiLayout/logo/rguilayout_48x48.png


BIN
tools/rGuiLayout/logo/rguilayout_64x64.png


BIN
tools/rGuiLayout/logo/rguilayout_96x96.png


BIN
tools/rGuiLayout/release/win32/rguilayout.exe


BIN
tools/rGuiLayout/screenshots/rguilayout_shot000.png


BIN
tools/rGuiLayout/screenshots/rguilayout_shot001.png


BIN
tools/rGuiLayout/screenshots/rguilayout_shot002.png


BIN
tools/rGuiLayout/screenshots/rguilayout_shot003.png


BIN
tools/rGuiLayout/screenshots/rguilayout_shot004.png


BIN
tools/rGuiLayout/screenshots/rguilayout_shot005.png


+ 0 - 253
tools/rGuiLayout/src/external/easings.h

@@ -1,253 +0,0 @@
-/*******************************************************************************************
-*
-*   raylib easings (header only file)
-*   
-*   Useful easing functions for values animation
-*
-*   This header uses:
-*       #define EASINGS_STATIC_INLINE       // Inlines all functions code, so it runs faster.
-*                                           // This requires lots of memory on system.
-*   How to use:
-*   The four inputs t,b,c,d are defined as follows:
-*   t = current time (in any unit measure, but same unit as duration)
-*   b = starting value to interpolate
-*   c = the total change in value of b that needs to occur
-*   d = total time it should take to complete (duration)
-*
-*   Example:
-*
-*   int currentTime = 0;
-*   int duration = 100;
-*   float startPositionX = 0.0f;
-*   float finalPositionX = 30.0f;
-*   float currentPositionX = startPositionX;
-*
-*   while (currentPositionX < finalPositionX)
-*   {
-*       currentPositionX = EaseSineIn(currentTime, startPositionX, finalPositionX - startPositionX, duration);
-*       currentTime++;
-*   }
-*
-*   A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/)
-*
-*   Robert Penner License
-*   ---------------------------------------------------------------------------------
-*   Open source under the BSD License. 
-*
-*   Copyright (c) 2001 Robert Penner. All rights reserved.
-*
-*   Redistribution and use in source and binary forms, with or without modification, 
-*   are permitted provided that the following conditions are met:
-*
-*       - Redistributions of source code must retain the above copyright notice, 
-*         this list of conditions and the following disclaimer.
-*       - Redistributions in binary form must reproduce the above copyright notice, 
-*         this list of conditions and the following disclaimer in the documentation 
-*         and/or other materials provided with the distribution.
-*       - Neither the name of the author nor the names of contributors may be used 
-*         to endorse or promote products derived from this software without specific 
-*         prior written permission.
-*
-*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
-*   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
-*   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-*   IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-*   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-*   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
-*   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
-*   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
-*   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
-*   OF THE POSSIBILITY OF SUCH DAMAGE.
-*   ---------------------------------------------------------------------------------
-*
-*   Copyright (c) 2015 Ramon Santamaria
-*
-*   This software is provided "as-is", without any express or implied warranty. In no event
-*   will the authors be held liable for any damages arising from the use of this software.
-*
-*   Permission is granted to anyone to use this software for any purpose, including commercial
-*   applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-*     1. The origin of this software must not be misrepresented; you must not claim that you
-*     wrote the original software. If you use this software in a product, an acknowledgment
-*     in the product documentation would be appreciated but is not required.
-*
-*     2. Altered source versions must be plainly marked as such, and must not be misrepresented
-*     as being the original software.
-*
-*     3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#ifndef EASINGS_H
-#define EASINGS_H
-
-#define EASINGS_STATIC_INLINE     // NOTE: By default, compile functions as static inline
-
-#if defined(EASINGS_STATIC_INLINE)
-    #define EASEDEF static inline
-#else
-    #define EASEDEF extern
-#endif
-
-#include <math.h>       // Required for: sin(), cos(), sqrt(), pow()
-
-#ifdef __cplusplus
-extern "C" {            // Prevents name mangling of functions
-#endif
-
-// Linear Easing functions
-EASEDEF float EaseLinearNone(float t, float b, float c, float d) { return (c*t/d + b); }
-EASEDEF float EaseLinearIn(float t, float b, float c, float d) { return (c*t/d + b); }
-EASEDEF float EaseLinearOut(float t, float b, float c, float d) { return (c*t/d + b); }
-EASEDEF float EaseLinearInOut(float t,float b, float c, float d) { return (c*t/d + b); }
-
-// Sine Easing functions
-EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cos(t/d*(PI/2)) + c + b); }
-EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sin(t/d*(PI/2)) + b); }
-EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2*(cos(PI*t/d) - 1) + b); }
-
-// Circular Easing functions
-EASEDEF float EaseCircIn(float t, float b, float c, float d) { return (-c*(sqrt(1 - (t/=d)*t) - 1) + b); }
-EASEDEF float EaseCircOut(float t, float b, float c, float d) { return (c*sqrt(1 - (t=t/d-1)*t) + b); }
-EASEDEF float EaseCircInOut(float t, float b, float c, float d) 
-{
-    if ((t/=d/2) < 1) return (-c/2*(sqrt(1 - t*t) - 1) + b);
-    return (c/2*(sqrt(1 - t*(t-=2)) + 1) + b);
-}
-
-// Cubic Easing functions
-EASEDEF float EaseCubicIn(float t, float b, float c, float d) { return (c*(t/=d)*t*t + b); }
-EASEDEF float EaseCubicOut(float t, float b, float c, float d) { return (c*((t=t/d-1)*t*t + 1) + b); }
-EASEDEF float EaseCubicInOut(float t, float b, float c, float d) 
-{ 
-    if ((t/=d/2) < 1) return (c/2*t*t*t + b);
-    return (c/2*((t-=2)*t*t + 2) + b);
-}
-
-// Quadratic Easing functions
-EASEDEF float EaseQuadIn(float t, float b, float c, float d) { return (c*(t/=d)*t + b); }
-EASEDEF float EaseQuadOut(float t, float b, float c, float d) { return (-c*(t/=d)*(t-2) + b); }
-EASEDEF float EaseQuadInOut(float t, float b, float c, float d) 
-{
-    if ((t/=d/2) < 1) return (((c/2)*(t*t)) + b);
-    return (-c/2*(((t-2)*(--t)) - 1) + b);
-}
-
-// Exponential Easing functions
-EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0) ? b : (c*pow(2, 10*(t/d - 1)) + b); }
-EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c*(-pow(2, -10*t/d) + 1) + b);    }
-EASEDEF float EaseExpoInOut(float t, float b, float c, float d) 
-{
-    if (t == 0) return b;
-    if (t == d) return (b + c);
-    if ((t/=d/2) < 1) return (c/2*pow(2, 10*(t - 1)) + b);
-    
-    return (c/2*(-pow(2, -10*--t) + 2) + b);
-}
-
-// Back Easing functions
-EASEDEF float EaseBackIn(float t, float b, float c, float d) 
-{
-    float s = 1.70158f;
-    float postFix = t/=d;
-    return (c*(postFix)*t*((s + 1)*t - s) + b);
-}
-
-EASEDEF float EaseBackOut(float t, float b, float c, float d)
-{    
-    float s = 1.70158f;
-    return (c*((t=t/d-1)*t*((s + 1)*t + s) + 1) + b);
-}
-
-EASEDEF float EaseBackInOut(float t, float b, float c, float d)
-{
-    float s = 1.70158f;
-    if ((t/=d/2) < 1) return (c/2*(t*t*(((s*=(1.525f)) + 1)*t - s)) + b);
-    
-    float postFix = t-=2;
-    return (c/2*((postFix)*t*(((s*=(1.525f)) + 1)*t + s) + 2) + b);
-}
-
-// Bounce Easing functions
-EASEDEF float EaseBounceOut(float t, float b, float c, float d) 
-{
-    if ((t/=d) < (1/2.75f)) 
-    {
-        return (c*(7.5625f*t*t) + b);
-    } 
-    else if (t < (2/2.75f)) 
-    {
-        float postFix = t-=(1.5f/2.75f);
-        return (c*(7.5625f*(postFix)*t + 0.75f) + b);
-    } 
-    else if (t < (2.5/2.75)) 
-    {
-        float postFix = t-=(2.25f/2.75f);
-        return (c*(7.5625f*(postFix)*t + 0.9375f) + b);
-    } 
-    else 
-    {
-        float postFix = t-=(2.625f/2.75f);
-        return (c*(7.5625f*(postFix)*t + 0.984375f) + b);
-    }
-}
-
-EASEDEF float EaseBounceIn(float t, float b, float c, float d) { return (c - EaseBounceOut(d-t, 0, c, d) + b); }
-EASEDEF float EaseBounceInOut(float t, float b, float c, float d) 
-{
-    if (t < d/2) return (EaseBounceIn(t*2, 0, c, d)*0.5f + b);
-    else return (EaseBounceOut(t*2-d, 0, c, d)*0.5f + c*0.5f + b);
-}
-
-// Elastic Easing functions
-EASEDEF float EaseElasticIn(float t, float b, float c, float d) 
-{
-    if (t == 0) return b;
-    if ((t/=d) == 1) return (b + c);
-    
-    float p = d*0.3f;
-    float a = c; 
-    float s = p/4;
-    float postFix = a*pow(2, 10*(t-=1));
-    
-    return (-(postFix*sin((t*d-s)*(2*PI)/p )) + b);
-}
-
-EASEDEF float EaseElasticOut(float t, float b, float c, float d)
-{
-    if (t == 0) return b;
-    if ((t/=d) == 1) return (b + c);
-    
-    float p = d*0.3f;
-    float a = c; 
-    float s = p/4;
-    
-    return (a*pow(2,-10*t)*sin((t*d-s)*(2*PI)/p) + c + b);    
-}
-
-EASEDEF float EaseElasticInOut(float t, float b, float c, float d)
-{
-    if (t == 0) return b;
-    if ((t/=d/2) == 2) return (b + c);
-    
-    float p = d*(0.3f*1.5f);
-    float a = c;
-    float s = p/4;
-
-    if (t < 1) 
-    {
-        float postFix = a*pow(2, 10*(t-=1));
-        return -0.5f*(postFix*sin((t*d-s)*(2*PI)/p)) + b;
-    }
-    
-    float postFix = a*pow(2, -10*(t-=1));
-    
-    return (postFix*sin((t*d-s)*(2*PI)/p)*0.5f + c + b);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // EASINGS_H

+ 0 - 7370
tools/rGuiLayout/src/external/tinyfiledialogs.c

@@ -1,7370 +0,0 @@
-/*_________
- /         \ tinyfiledialogs.c v3.3.1 [Feb 16, 2018] zlib licence
- |tiny file| Unique code file created [November 9, 2014]
- | dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
- \____  ___/ http://tinyfiledialogs.sourceforge.net
-      \|     git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
-                 ____________________________________________
-                |                                            |
-                |   email: tinyfiledialogs at ysengrin.com   |
-                |____________________________________________|
-     ___________________________________________________________________
-    |                                                                   |
-    | the windows only wchar_t UTF-16 prototypes are in the header file |
-    |___________________________________________________________________|
-
-Please 1) let me know If you are using it on exotic hardware / OS / compiler
-       2) leave a 1-word review on Sourceforge.
-       3) upvote my stackoverflow answer/advert https://stackoverflow.com/a/47651444
-
-tiny file dialogs (cross-platform C C++)
-InputBox PasswordBox MessageBox ColorPicker
-OpenFileDialog SaveFileDialog SelectFolderDialog
-Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
-SSH supported via automatic switch to console mode or X11 forwarding
-
-a C file + a header (add them to your C or C++ project) with 8 functions:
-- beep
-- notify popup
-- message & question
-- input & password
-- save file
-- open file(s)
-- select folder
-- color picker
-
-Complements OpenGL GLFW GLUT GLUI VTK SFML TGUI SDL Ogre Unity3d ION OpenCV
-CEGUI MathGL GLM CPW GLOW IMGUI MyGUI GLT NGL STB & GUI less programs
-
-NO INIT
-NO MAIN LOOP
-NO LINKING
-NO INCLUDE
-
-The dialogs can be forced into console mode
-
-Windows (XP to 10) ASCII MBCS UTF-8 UTF-16
-- native code & vbs create the graphic dialogs
-- enhanced console mode can use dialog.exe from
-http://andrear.altervista.org/home/cdialog.php
-- basic console input
-
-Unix (command line calls) ASCII UTF-8
-- applescript, kdialog, zenity
-- python (2 or 3) + tkinter + python-dbus (optional)
-- dialog (opens a console if needed)
-- basic console input
-The same executable can run across desktops & distributions
-
-C89 & C++98 compliant: tested with C & C++ compilers
-VisualStudio MinGW-gcc GCC Clang TinyCC OpenWatcom-v2 BorlandC SunCC
-on Windows Mac Linux Bsd Solaris Minix Raspbian
-using Gnome Kde Enlightenment Mate Cinnamon Unity Lxde Lxqt Xfce
-WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
-
-Bindings for LUA and C# dll, Haskell
-Included in LWJGL(java), Rust, Allegrobasic
-
-Thanks for contributions, bug corrections & thorough testing to:
-- Don Heyse http://ldglite.sf.net for bug corrections & thorough testing!
-- Paul Rouget
-
-- License -
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software.  If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#define _POSIX_C_SOURCE 2 /* to accept POSIX 2 in old ANSI C standards */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#include "tinyfiledialogs.h"
-/* #define TINYFD_NOLIB */ 
-
-#ifdef _WIN32
- #ifdef __BORLANDC__
-  #define _getch getch
- #endif
- #ifndef _WIN32_WINNT
-  #define _WIN32_WINNT 0x0500
- #endif
- #ifndef TINYFD_NOLIB
-  #include <Windows.h>
-  /*#define TINYFD_NOSELECTFOLDERWIN*/
-  #ifndef TINYFD_NOSELECTFOLDERWIN
-   #include <Shlobj.h>
-  #endif /*TINYFD_NOSELECTFOLDERWIN*/
- #endif
- #include <conio.h>
- #include <commdlg.h>
- #define TINYFD_NOCCSUNICODE
- #define SLASH "\\"
- int tinyfd_winUtf8 = 0 ; /* on windows string char can be 0:MBCS or 1:UTF-8 */
-#else
- #include <limits.h>
- #include <unistd.h>
- #include <dirent.h> /* on old systems try <sys/dir.h> instead */
- #include <termios.h>
- #include <sys/utsname.h>
- #include <signal.h> /* on old systems try <sys/signal.h> instead */
- #define SLASH "/"
-#endif /* _WIN32 */
-
-#define MAX_PATH_OR_CMD 1024 /* _MAX_PATH or MAX_PATH */
-#define MAX_MULTIPLE_FILES 32
-
-char tinyfd_version [8] = "3.3.1";
-
-int tinyfd_verbose = 0 ; /* on unix: prints the command line calls */
-
-#if defined(TINYFD_NOLIB) && defined(_WIN32)
-int tinyfd_forceConsole = 1 ;
-#else
-int tinyfd_forceConsole = 0 ; /* 0 (default) or 1 */
-#endif
-/* for unix & windows: 0 (graphic mode) or 1 (console mode).
-0: try to use a graphic solution, if it fails then it uses console mode.
-1: forces all dialogs into console mode even when the X server is present,
-  if the package dialog (and a console is present) or dialog.exe is installed.
-  on windows it only make sense for console applications */
-
-char tinyfd_response[1024];
-/* if you pass "tinyfd_query" as aTitle,
-the functions will not display the dialogs
-but and return 0 for console mode, 1 for graphic mode.
-tinyfd_response is then filled with the retain solution.
-possible values for tinyfd_response are (all lowercase)
-for graphic mode:
-  windows_wchar windows
-  applescript kdialog zenity zenity3 matedialog qarma
-  python2-tkinter python3-tkinter python-dbus perl-dbus
-  gxmessage gmessage xmessage xdialog gdialog
-for console mode:
-  dialog whiptail basicinput */
-
-#if defined(TINYFD_NOLIB) && defined(_WIN32)
-static int gWarningDisplayed = 1 ;
-#else
-static int gWarningDisplayed = 0 ;
-#endif
-
-static char gTitle[]="missing software! (we will try basic console input)";
-
-#ifdef _WIN32
-char tinyfd_needs[] = "\
- ___________\n\
-/           \\ \n\
-| tiny file |\n\
-|  dialogs  |\n\
-\\_____  ____/\n\
-      \\|\
-\ntiny file dialogs on Windows needs:\
-\n   a graphic display\
-\nor dialog.exe (enhanced console mode)\
-\nor a console for basic input";
-#else
-char tinyfd_needs[] = "\
- ___________\n\
-/           \\ \n\
-| tiny file |\n\
-|  dialogs  |\n\
-\\_____  ____/\n\
-      \\|\
-\ntiny file dialogs on UNIX needs:\
-\n   applescript\
-\nor kdialog\
-\nor zenity (or matedialog or qarma)\
-\nor python (2 or 3)\
-\n + tkinter + python-dbus (optional)\
-\nor dialog (opens console if needed)\
-\nor xterm + bash\
-\n   (opens console for basic input)\
-\nor existing console for basic input";
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable:4996) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
-#pragma warning(disable:4100) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
-#pragma warning(disable:4706) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
-#endif
-
-static char * getPathWithoutFinalSlash(
-        char * const aoDestination, /* make sure it is allocated, use _MAX_PATH */
-        char const * const aSource) /* aoDestination and aSource can be the same */
-{
-        char const * lTmp ;
-        if ( aSource )
-        {
-                lTmp = strrchr(aSource, '/');
-                if (!lTmp)
-                {
-                        lTmp = strrchr(aSource, '\\');
-                }
-                if (lTmp)
-                {
-                        strncpy(aoDestination, aSource, lTmp - aSource );
-                        aoDestination[lTmp - aSource] = '\0';
-                }
-                else
-                {
-                        * aoDestination = '\0';
-                }
-        }
-        else
-        {
-                * aoDestination = '\0';
-        }
-        return aoDestination;
-}
-
-
-static char * getLastName(
-        char * const aoDestination, /* make sure it is allocated */
-        char const * const aSource)
-{
-        /* copy the last name after '/' or '\' */
-        char const * lTmp ;
-        if ( aSource )
-        {
-                lTmp = strrchr(aSource, '/');
-                if (!lTmp)
-                {
-                        lTmp = strrchr(aSource, '\\');
-                }
-                if (lTmp)
-                {
-                        strcpy(aoDestination, lTmp + 1);
-                }
-                else
-                {
-                        strcpy(aoDestination, aSource);
-                }
-        }
-        else
-        {
-                * aoDestination = '\0';
-        }
-        return aoDestination;
-}
-
-
-static void ensureFinalSlash( char * const aioString )
-{
-        if ( aioString && strlen( aioString ) )
-        {
-                char * lastcar = aioString + strlen( aioString ) - 1 ;
-                if ( strncmp( lastcar , SLASH , 1 ) )
-                {
-                        strcat( lastcar , SLASH ) ;
-                }
-        }
-}
-
-
-static void Hex2RGB( char const aHexRGB [8] ,
-                                         unsigned char aoResultRGB [3] )
-{
-        char lColorChannel [8] ;
-        if ( aoResultRGB )
-        {
-                if ( aHexRGB )
-                {
-                        strcpy(lColorChannel, aHexRGB ) ;
-                        aoResultRGB[2] = (unsigned char)strtoul(lColorChannel+5,NULL,16);
-                        lColorChannel[5] = '\0';
-                        aoResultRGB[1] = (unsigned char)strtoul(lColorChannel+3,NULL,16);
-                        lColorChannel[3] = '\0';
-                        aoResultRGB[0] = (unsigned char)strtoul(lColorChannel+1,NULL,16);
-/* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); */
-                }
-                else
-                {
-                        aoResultRGB[0]=0;
-                        aoResultRGB[1]=0;
-                        aoResultRGB[2]=0;
-                }
-        }
-}
-
-static void RGB2Hex( unsigned char const aRGB [3] ,
-                                         char aoResultHexRGB [8] )
-{
-        if ( aoResultHexRGB )
-        {
-                if ( aRGB )
-                {
-#if defined(__GNUC__) && defined(_WIN32)
-                        sprintf(aoResultHexRGB, "#%02hx%02hx%02hx",
-#else
-                        sprintf(aoResultHexRGB, "#%02hhx%02hhx%02hhx",
-#endif
-                                aRGB[0], aRGB[1], aRGB[2]);
-                        /* printf("aoResultHexRGB %s\n", aoResultHexRGB); */
-                }
-                else
-                {
-                        aoResultHexRGB[0]=0;
-                        aoResultHexRGB[1]=0;
-                        aoResultHexRGB[2]=0;
-                }
-        }
-}
-
-
-static void replaceSubStr( char const * const aSource ,
-                                                   char const * const aOldSubStr ,
-                                                   char const * const aNewSubStr ,
-                                                   char * const aoDestination )
-{
-        char const * pOccurence ;
-        char const * p ;
-        char const * lNewSubStr = "" ;
-        size_t lOldSubLen = strlen( aOldSubStr ) ;
-        
-        if ( ! aSource )
-        {
-                * aoDestination = '\0' ;
-                return ;
-        }
-        if ( ! aOldSubStr )
-        {
-                strcpy( aoDestination , aSource ) ;
-                return ;
-        }
-        if ( aNewSubStr )
-        {
-                lNewSubStr = aNewSubStr ;
-        }
-        p = aSource ;
-        * aoDestination = '\0' ;
-        while ( ( pOccurence = strstr( p , aOldSubStr ) ) != NULL )
-        {
-                strncat( aoDestination , p , pOccurence - p ) ;
-                strcat( aoDestination , lNewSubStr ) ;
-                p = pOccurence + lOldSubLen ;
-        }
-        strcat( aoDestination , p ) ;
-}
-
-
-static int filenameValid( char const * const aFileNameWithoutPath )
-{
-        if ( ! aFileNameWithoutPath
-          || ! strlen(aFileNameWithoutPath)
-          || strpbrk(aFileNameWithoutPath , "\\/:*?\"<>|") )
-        {
-                return 0 ;
-        }
-        return 1 ;
-}
-
-#ifndef _WIN32
-
-static int fileExists( char const * const aFilePathAndName )
-{
-        FILE * lIn ;
-        if ( ! aFilePathAndName || ! strlen(aFilePathAndName) )
-        {
-                return 0 ;
-        }
-        lIn = fopen( aFilePathAndName , "r" ) ;
-        if ( ! lIn )
-        {
-                return 0 ;
-        }
-        fclose( lIn ) ;
-        return 1 ;
-}
-
-#elif defined(TINYFD_NOLIB)
-
-static int fileExists( char const * const aFilePathAndName )
-{
-        FILE * lIn ;
-        if ( ! aFilePathAndName || ! strlen(aFilePathAndName) )
-        {
-                return 0 ;
-        }
-
-        if ( tinyfd_winUtf8 )
-                return 1; /* we cannot test */
-
-        lIn = fopen( aFilePathAndName , "r" ) ;
-        if ( ! lIn )
-        {
-                return 0 ;
-        }
-        fclose( lIn ) ;
-        return 1 ;
-}
-
-#endif
-
-
-static void wipefile(char const * const aFilename)
-{
-        int i;
-        struct stat st;
-        FILE * lIn;
-
-        if (stat(aFilename, &st) == 0)
-        {
-                if ((lIn = fopen(aFilename, "w")))
-                {
-                        for (i = 0; i < st.st_size; i++)
-                        {
-                                fputc('A', lIn);
-                        }
-                }
-                fclose(lIn);
-        }
-}
-
-
-#ifdef _WIN32
-
-static int replaceChr( char * const aString ,
-                                           char const aOldChr ,
-                                           char const aNewChr )
-{
-        char * p ;
-        int lRes = 0 ;
-
-        if ( ! aString )
-        {
-                return 0 ;
-        }
-
-        if ( aOldChr == aNewChr )
-        {
-                return 0 ;
-        }
-
-        p = aString ;
-        while ( (p = strchr( p , aOldChr )) )
-        {
-                * p = aNewChr ;
-                p ++ ;
-                lRes = 1 ;
-        }
-        return lRes ;
-}
-
-#ifdef TINYFD_NOLIB
-
-static int dirExists(char const * const aDirPath)
-{
-        struct stat lInfo;
-
-        if (!aDirPath || !strlen(aDirPath))
-                return 0;       
-        if (stat(aDirPath, &lInfo) != 0)
-                return 0;
-        else if ( tinyfd_winUtf8 )
-                return 1; /* we cannot test */
-        else if (lInfo.st_mode & S_IFDIR)
-                return 1;
-        else
-                return 0;
-}
-
-
-void tinyfd_beep()
-{
-        printf("\a");
-}
-
-#else /* ndef TINYFD_NOLIB */
-
-void tinyfd_beep()
-{
-        Beep(440,300);
-}
-
-
-static void wipefileW(wchar_t const * const aFilename)
-{
-        int i;
-        struct _stat st;
-        FILE * lIn;
-
-        if (_wstat(aFilename, &st) == 0)
-        {
-                if ((lIn = _wfopen(aFilename, L"w")))
-                {
-                        for (i = 0; i < st.st_size; i++)
-                        {
-                                fputc('A', lIn);
-                        }
-                }
-                fclose(lIn);
-        }
-}
-
-
-static wchar_t * getPathWithoutFinalSlashW(
-        wchar_t * const aoDestination, /* make sure it is allocated, use _MAX_PATH */
-        wchar_t const * const aSource) /* aoDestination and aSource can be the same */
-{
-        wchar_t const * lTmp;
-        if (aSource)
-        {
-                lTmp = wcsrchr(aSource, L'/');
-                if (!lTmp)
-                {
-                        lTmp = wcsrchr(aSource, L'\\');
-                }
-                if (lTmp)
-                {
-                        wcsncpy(aoDestination, aSource, lTmp - aSource);
-                        aoDestination[lTmp - aSource] = L'\0';
-                }
-                else
-                {
-                        *aoDestination = L'\0';
-                }
-        }
-        else
-        {
-                *aoDestination = L'\0';
-        }
-        return aoDestination;
-}
-
-
-static wchar_t * getLastNameW(
-        wchar_t * const aoDestination, /* make sure it is allocated */
-        wchar_t const * const aSource)
-{
-        /* copy the last name after '/' or '\' */
-        wchar_t const * lTmp;
-        if (aSource)
-        {
-                lTmp = wcsrchr(aSource, L'/');
-                if (!lTmp)
-                {
-                        lTmp = wcsrchr(aSource, L'\\');
-                }
-                if (lTmp)
-                {
-                        wcscpy(aoDestination, lTmp + 1);
-                }
-                else
-                {
-                        wcscpy(aoDestination, aSource);
-                }
-        }
-        else
-        {
-                *aoDestination = L'\0';
-        }
-        return aoDestination;
-}
-
-
-static void Hex2RGBW(wchar_t const aHexRGB[8],
-        unsigned char aoResultRGB[3])
-{
-        wchar_t lColorChannel[8];
-        if (aoResultRGB)
-        {
-                if (aHexRGB)
-                {
-                        wcscpy(lColorChannel, aHexRGB);
-                        aoResultRGB[2] = (unsigned char)wcstoul(lColorChannel + 5, NULL, 16);
-                        lColorChannel[5] = '\0';
-                        aoResultRGB[1] = (unsigned char)wcstoul(lColorChannel + 3, NULL, 16);
-                        lColorChannel[3] = '\0';
-                        aoResultRGB[0] = (unsigned char)wcstoul(lColorChannel + 1, NULL, 16);
-                        /* printf("%d %d %d\n", aoResultRGB[0], aoResultRGB[1], aoResultRGB[2]); */
-                }
-                else
-                {
-                        aoResultRGB[0] = 0;
-                        aoResultRGB[1] = 0;
-                        aoResultRGB[2] = 0;
-                }
-        }
-}
-
-
-static void RGB2HexW(
-        unsigned char const aRGB[3],
-        wchar_t aoResultHexRGB[8])
-{
-        if (aoResultHexRGB)
-        {
-                if (aRGB)
-                {
-                        /* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); */
-                        swprintf(aoResultHexRGB,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                                8,
-#endif
-                        L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]);
-                }
-                else
-                {
-                        aoResultHexRGB[0] = 0;
-                        aoResultHexRGB[1] = 0;
-                        aoResultHexRGB[2] = 0;
-                }
-        }
-}
-
-
-#if !defined(WC_ERR_INVALID_CHARS)
-/* undefined prior to Vista, so not yet in MINGW header file */
-#define WC_ERR_INVALID_CHARS 0x00000080
-#endif
-
-
-static int sizeUtf16(char const * const aUtf8string)
-{
-        return MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
-                                        aUtf8string, -1, NULL, 0);
-}
-
-
-static int sizeUtf8(wchar_t const * const aUtf16string)
-{
-        return WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS,
-                aUtf16string, -1, NULL, 0, NULL, NULL);
-}
-
-
-static int sizeMbcs(wchar_t const * const aMbcsString)
-{
-        int lRes = WideCharToMultiByte(CP_ACP, 0,
-                aMbcsString, -1, NULL, 0, NULL, NULL);
-        /* DWORD licic = GetLastError(); */
-        return lRes;
-}
-
-
-static wchar_t * utf8to16(char const * const aUtf8string)
-{
-        wchar_t * lUtf16string ;
-        int lSize = sizeUtf16(aUtf8string);     
-        lUtf16string = (wchar_t *) malloc( lSize * sizeof(wchar_t) );
-        lSize = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
-                                        aUtf8string, -1, lUtf16string, lSize);
-        if (lSize == 0)
-        {
-                free(lUtf16string);
-                return NULL;
-        }
-        return lUtf16string;
-}
-
-
-static wchar_t * mbcsTo16(char const * const aMbcsString)
-{
-        wchar_t * lMbcsString;
-        int lSize = sizeUtf16(aMbcsString);
-        lMbcsString = (wchar_t *)malloc(lSize * sizeof(wchar_t));
-        lSize = MultiByteToWideChar(CP_ACP, 0,
-                aMbcsString, -1, lMbcsString, lSize);
-        if (lSize == 0)
-        {
-                free(lMbcsString);
-                return NULL;
-        }
-        return lMbcsString;
-}
-
-
-static char * utf16to8(wchar_t const * const aUtf16string)
-{
-        char * lUtf8string ;
-        int lSize = sizeUtf8(aUtf16string);
-        lUtf8string = (char *) malloc( lSize );
-        lSize = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS,
-                aUtf16string, -1, lUtf8string, lSize, NULL, NULL);
-        if (lSize == 0)
-        {
-                free(lUtf8string);
-                return NULL;
-        }
-        return lUtf8string;
-}
-
-
-static char * utf16toMbcs(wchar_t const * const aUtf16string)
-{
-        char * lMbcsString;
-        int lSize = sizeMbcs(aUtf16string);
-        lMbcsString = (char *)malloc(lSize);
-        lSize = WideCharToMultiByte(CP_ACP, 0,
-                aUtf16string, -1, lMbcsString, lSize, NULL, NULL);
-        if (lSize == 0)
-        {
-                free(lMbcsString);
-                return NULL;
-        }
-        return lMbcsString;
-}
-
-
-static int dirExists(char const * const aDirPath)
-{
-        struct _stat lInfo;
-        wchar_t * lTmpWChar;
-        int lStatRet;
-
-        if (!aDirPath || !strlen(aDirPath))
-                return 0;
-
-        if (tinyfd_winUtf8)
-        {
-                lTmpWChar = utf8to16(aDirPath);
-                lStatRet = _wstat(lTmpWChar, &lInfo);
-                free(lTmpWChar);
-                if (lStatRet != 0)
-                        return 0;
-                else if (lInfo.st_mode & S_IFDIR)
-                        return 1;
-                else
-                        return 0;
-        }
-        else if (_stat(aDirPath, &lInfo) != 0)
-                return 0;
-        else if (lInfo.st_mode & S_IFDIR)
-                return 1;
-        else
-                return 0;
-}
-
-
-static int fileExists(char const * const aFilePathAndName)
-{
-        struct _stat lInfo;
-        wchar_t * lTmpWChar;
-        int lStatRet;
-        FILE * lIn;
-
-        if (!aFilePathAndName || !strlen(aFilePathAndName))
-        {
-                return 0;
-        }
-
-        if (tinyfd_winUtf8)
-        {
-                lTmpWChar = utf8to16(aFilePathAndName);
-                lStatRet = _wstat(lTmpWChar, &lInfo);
-                free(lTmpWChar);
-                if (lStatRet != 0)
-                        return 0;
-                else if (lInfo.st_mode & _S_IFREG)
-                        return 1;
-                else
-                        return 0;
-        }
-        else
-        {
-                lIn = fopen(aFilePathAndName, "r");
-                if (!lIn)
-                {
-                        return 0;
-                }
-                fclose(lIn);
-                return 1;
-        }
-}
-
-#endif /* TINYFD_NOLIB */
-#endif /* _WIN32 */
-
-/* source and destination can be the same or ovelap*/
-static char const * ensureFilesExist(char * const aDestination,
-        char const * const aSourcePathsAndNames)
-{
-        char * lDestination = aDestination;
-        char const * p;
-        char const * p2;
-        size_t lLen;
-
-        if (!aSourcePathsAndNames)
-        {
-                return NULL;
-        }
-        lLen = strlen(aSourcePathsAndNames);
-        if (!lLen)
-        {
-                return NULL;
-        }
-
-        p = aSourcePathsAndNames;
-        while ((p2 = strchr(p, '|')) != NULL)
-        {
-                lLen = p2 - p;
-                memmove(lDestination, p, lLen);
-                lDestination[lLen] = '\0';
-                if (fileExists(lDestination))
-                {
-                        lDestination += lLen;
-                        *lDestination = '|';
-                        lDestination++;
-                }
-                p = p2 + 1;
-        }
-        if (fileExists(p))
-        {
-                lLen = strlen(p);
-                memmove(lDestination, p, lLen);
-                lDestination[lLen] = '\0';
-        }
-        else
-        {
-                *(lDestination - 1) = '\0';
-        }
-        return aDestination;
-}
-
-#ifdef _WIN32
-#ifndef TINYFD_NOLIB
-
-static int __stdcall EnumThreadWndProc(HWND hwnd, LPARAM lParam)
-{ 
-        wchar_t lTitleName[MAX_PATH];
-        GetWindowTextW(hwnd, lTitleName, MAX_PATH);
-        /* wprintf(L"lTitleName %ls \n", lTitleName);  */
-        if (wcscmp(L"tinyfiledialogsTopWindow", lTitleName) == 0)
-        {
-                SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-                return 0;
-        }
-        return 1;
-}
-
-
-static void hiddenConsoleW(wchar_t const * const aString, wchar_t const * const aDialogTitle, int const aInFront)
-{
-        STARTUPINFOW StartupInfo;
-        PROCESS_INFORMATION ProcessInfo;
-
-        if (!aString || !wcslen(aString) ) return;
-
-        memset(&StartupInfo, 0, sizeof(StartupInfo));
-        StartupInfo.cb = sizeof(STARTUPINFOW);
-        StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
-        StartupInfo.wShowWindow = SW_HIDE;
-
-        if (!CreateProcessW(NULL, (LPWSTR)aString, NULL, NULL, FALSE,
-                                CREATE_NEW_CONSOLE, NULL, NULL,
-                                &StartupInfo, &ProcessInfo))
-        {
-                return; /* GetLastError(); */
-        }
-
-        WaitForInputIdle(ProcessInfo.hProcess, INFINITE);
-        if (aInFront)
-        {
-                while (EnumWindows(EnumThreadWndProc, (LPARAM)NULL)) {}
-                SetWindowTextW(GetForegroundWindow(), aDialogTitle);
-        }
-        WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
-        CloseHandle(ProcessInfo.hThread);
-        CloseHandle(ProcessInfo.hProcess);
-}
-
-
-int tinyfd_messageBoxW(
-        wchar_t const * const aTitle, /* NULL or "" */
-        wchar_t const * const aMessage, /* NULL or ""  may contain \n and \t */
-        wchar_t const * const aDialogType, /* "ok" "okcancel" "yesno" "yesnocancel" */
-        wchar_t const * const aIconType, /* "info" "warning" "error" "question" */
-        int const aDefaultButton) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        int lBoxReturnValue;
-        UINT aCode;
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return 1; }
-
-        if (aIconType && !wcscmp(L"warning", aIconType))
-        {
-                aCode = MB_ICONWARNING;
-        }
-        else if (aIconType && !wcscmp(L"error", aIconType))
-        {
-                aCode = MB_ICONERROR;
-        }
-        else if (aIconType && !wcscmp(L"question", aIconType))
-        {
-                aCode = MB_ICONQUESTION;
-        }
-        else
-        {
-                aCode = MB_ICONINFORMATION;
-        }
-
-        if (aDialogType && !wcscmp(L"okcancel", aDialogType))
-        {
-                aCode += MB_OKCANCEL;
-                if (!aDefaultButton)
-                {
-                        aCode += MB_DEFBUTTON2;
-                }
-        }
-        else if (aDialogType && !wcscmp(L"yesno", aDialogType))
-        {
-                aCode += MB_YESNO;
-                if (!aDefaultButton)
-                {
-                        aCode += MB_DEFBUTTON2;
-                }
-        }
-        else
-        {
-                aCode += MB_OK;
-        }
-
-        aCode += MB_TOPMOST;
-
-        lBoxReturnValue = MessageBoxW(GetForegroundWindow(), aMessage, aTitle, aCode);
-        if (((aDialogType
-                && wcscmp(L"okcancel", aDialogType)
-                && wcscmp(L"yesno", aDialogType)))
-                || (lBoxReturnValue == IDOK)
-                || (lBoxReturnValue == IDYES))
-        {
-                return 1;
-        }
-        else
-        {
-                return 0;
-        }
-}
-
-
-static int messageBoxWinGui8(
-        char const * const aTitle, /* NULL or "" */
-        char const * const aMessage, /* NULL or ""  may contain \n and \t */
-        char const * const aDialogType, /* "ok" "okcancel" "yesno" "yesnocancel" */
-        char const * const aIconType, /* "info" "warning" "error" "question" */
-        int const aDefaultButton) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        int lIntRetVal;
-        wchar_t * lTitle;
-        wchar_t * lMessage;
-        wchar_t * lDialogType;
-        wchar_t * lIconType;
-
-        lTitle = utf8to16(aTitle);
-        lMessage = utf8to16(aMessage);
-        lDialogType = utf8to16(aDialogType);
-        lIconType = utf8to16(aIconType);
-
-        lIntRetVal = tinyfd_messageBoxW(lTitle, lMessage,
-                                                                lDialogType, lIconType, aDefaultButton );
-
-        free(lTitle);
-        free(lMessage);
-        free(lDialogType);
-        free(lIconType);
-
-        return lIntRetVal ;
-}
-
-
-/* return has only meaning for tinyfd_query */
-int tinyfd_notifyPopupW(
-        wchar_t const * const aTitle, /* NULL or L"" */
-        wchar_t const * const aMessage, /* NULL or L"" may contain \n \t */
-        wchar_t const * const aIconType) /* L"info" L"warning" L"error" */
-{
-        wchar_t * lDialogString;
-        size_t lTitleLen;
-        size_t lMessageLen;
-        size_t lDialogStringLen;
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return 1; }
-
-        lTitleLen = aTitle ? wcslen(aTitle) : 0;
-        lMessageLen = aMessage ? wcslen(aMessage) : 0;
-        lDialogStringLen = 3 * MAX_PATH_OR_CMD + lTitleLen + lMessageLen;
-        lDialogString = (wchar_t *)malloc(2 * lDialogStringLen);
-
-        wcscpy(lDialogString, L"powershell.exe -command \"\
-function Show-BalloonTip {\
-[cmdletbinding()] \
-param( \
-[string]$Title = ' ', \
-[string]$Message = ' ', \
-[ValidateSet('info', 'warning', 'error')] \
-[string]$IconType = 'info');\
-[system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null ; \
-$balloon = New-Object System.Windows.Forms.NotifyIcon ; \
-$path = Get-Process -id $pid | Select-Object -ExpandProperty Path ; \
-$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path) ;");
-
-        wcscat(lDialogString, L"\
-$balloon.Icon = $icon ; \
-$balloon.BalloonTipIcon = $IconType ; \
-$balloon.BalloonTipText = $Message ; \
-$balloon.BalloonTipTitle = $Title ; \
-$balloon.Text = 'lalala' ; \
-$balloon.Visible = $true ; \
-$balloon.ShowBalloonTip(5000)};\
-Show-BalloonTip");
-
-        if (aTitle && wcslen(aTitle))
-        {
-                wcscat(lDialogString, L" -Title '");
-                wcscat(lDialogString, aTitle);
-                wcscat(lDialogString, L"'");
-        }
-        if (aMessage && wcslen(aMessage))
-        {
-                wcscat(lDialogString, L" -Message '");
-                wcscat(lDialogString, aMessage);
-                wcscat(lDialogString, L"'");
-        }
-        if (aMessage && wcslen(aIconType))
-        {
-                wcscat(lDialogString, L" -IconType '");
-                wcscat(lDialogString, aIconType);
-                wcscat(lDialogString, L"'");
-        }
-        wcscat(lDialogString, L"\"");
-
-        /* wprintf ( L"lDialogString: %ls\n" , lDialogString ) ; */
-
-        hiddenConsoleW(lDialogString, aTitle, 0);
-        free(lDialogString);
-        return 1;
-}
-
-
-static int notifyWinGui(
-        char const * const aTitle, /* NULL or "" */
-        char const * const aMessage, /* NULL or "" may NOT contain \n nor \t */
-        char const * const aIconType) 
-{
-        wchar_t * lTitle;
-        wchar_t * lMessage;
-        wchar_t * lIconType;
-
-        if (tinyfd_winUtf8)
-        {
-                lTitle = utf8to16(aTitle);
-                lMessage = utf8to16(aMessage);
-                lIconType = utf8to16(aIconType);
-        }
-        else
-        {
-                lTitle = mbcsTo16(aTitle);
-                lMessage = mbcsTo16(aMessage);
-                lIconType = mbcsTo16(aIconType);
-        }
-
-        tinyfd_notifyPopupW( lTitle,    lMessage, lIconType);
-
-        free(lTitle);
-        free(lMessage);
-        free(lIconType);
-        return 1;
-}
-
-
-wchar_t const * tinyfd_inputBoxW(
-        wchar_t const * const aTitle, /* NULL or L"" */
-        wchar_t const * const aMessage, /* NULL or L"" may NOT contain \n nor \t */
-        wchar_t const * const aDefaultInput) /* L"" , if NULL it's a passwordBox */
-{
-        static wchar_t lBuff[MAX_PATH_OR_CMD];
-        wchar_t * lDialogString;
-        FILE * lIn;
-        FILE * lFile;
-        int lResult;
-        size_t lTitleLen;
-        size_t lMessageLen;
-        size_t lDialogStringLen;
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
-
-        lTitleLen =  aTitle ? wcslen(aTitle) : 0 ;
-        lMessageLen =  aMessage ? wcslen(aMessage) : 0 ;
-        lDialogStringLen = 3 * MAX_PATH_OR_CMD + lTitleLen + lMessageLen;
-        lDialogString = (wchar_t *)malloc(2 * lDialogStringLen);
-
-        if (aDefaultInput)
-        {
-			swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                lDialogStringLen,
-#endif
-                L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs", _wgetenv(L"USERPROFILE"));
-        }
-        else
-        {
-                swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                        lDialogStringLen,
-#endif
-                        L"%ls\\AppData\\Local\\Temp\\tinyfd.hta", _wgetenv(L"USERPROFILE"));
-        }
-        lIn = _wfopen(lDialogString, L"w");
-        if (!lIn)
-        {
-                free(lDialogString);
-                return NULL;
-        }
-
-        if ( aDefaultInput )
-        {
-                wcscpy(lDialogString, L"Dim result:result=InputBox(\"");
-                if (aMessage && wcslen(aMessage))
-                {
-                        wcscat(lDialogString, aMessage);
-                }
-                wcscat(lDialogString, L"\",\"tinyfiledialogsTopWindow\",\"");
-                if (aDefaultInput && wcslen(aDefaultInput))
-                {
-                        wcscat(lDialogString, aDefaultInput);
-                }
-                wcscat(lDialogString, L"\"):If IsEmpty(result) then:WScript.Echo 0");
-                wcscat(lDialogString, L":Else: WScript.Echo \"1\" & result : End If");
-        }
-        else
-        {
-                wcscpy(lDialogString, L"\n\
-<html>\n\
-<head>\n\
-<title>");
-
-                wcscat(lDialogString, L"tinyfiledialogsTopWindow");
-                wcscat(lDialogString, L"</title>\n\
-<HTA:APPLICATION\n\
-ID = 'tinyfdHTA'\n\
-APPLICATIONNAME = 'tinyfd_inputBox'\n\
-MINIMIZEBUTTON = 'no'\n\
-MAXIMIZEBUTTON = 'no'\n\
-BORDER = 'dialog'\n\
-SCROLL = 'no'\n\
-SINGLEINSTANCE = 'yes'\n\
-WINDOWSTATE = 'hidden'>\n\
-\n\
-<script language = 'VBScript'>\n\
-\n\
-intWidth = Screen.Width/4\n\
-intHeight = Screen.Height/6\n\
-ResizeTo intWidth, intHeight\n\
-MoveTo((Screen.Width/2)-(intWidth/2)),((Screen.Height/2)-(intHeight/2))\n\
-result = 0\n\
-\n\
-Sub Window_onLoad\n\
-txt_input.Focus\n\
-End Sub\n\
-\n");
-
-                wcscat(lDialogString, L"\
-Sub Window_onUnload\n\
-Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\n\
-Set oShell = CreateObject(\"WScript.Shell\")\n\
-strHomeFolder = oShell.ExpandEnvironmentStrings(\"%USERPROFILE%\")\n\
-Set objFile = objFSO.CreateTextFile(strHomeFolder & \"\\AppData\\Local\\Temp\\tinyfd.txt\",True,True)\n\
-If result = 1 Then\n\
-objFile.Write 1 & txt_input.Value\n\
-Else\n\
-objFile.Write 0\n\
-End If\n\
-objFile.Close\n\
-End Sub\n\
-\n\
-Sub Run_ProgramOK\n\
-result = 1\n\
-window.Close\n\
-End Sub\n\
-\n\
-Sub Run_ProgramCancel\n\
-window.Close\n\
-End Sub\n\
-\n");
-
-                wcscat(lDialogString, L"Sub Default_Buttons\n\
-If Window.Event.KeyCode = 13 Then\n\
-btn_OK.Click\n\
-ElseIf Window.Event.KeyCode = 27 Then\n\
-btn_Cancel.Click\n\
-End If\n\
-End Sub\n\
-\n\
-</script>\n\
-</head>\n\
-<body style = 'background-color:#EEEEEE' onkeypress = 'vbs:Default_Buttons' align = 'top'>\n\
-<table width = '100%' height = '80%' align = 'center' border = '0'>\n\
-<tr border = '0'>\n\
-<td align = 'left' valign = 'middle' style='Font-Family:Arial'>\n");
-
-                wcscat(lDialogString, aMessage ? aMessage : L"");
-
-                wcscat(lDialogString, L"\n\
-</td>\n\
-<td align = 'right' valign = 'middle' style = 'margin-top: 0em'>\n\
-<table  align = 'right' style = 'margin-right: 0em;'>\n\
-<tr align = 'right' style = 'margin-top: 5em;'>\n\
-<input type = 'button' value = 'OK' name = 'btn_OK' onClick = 'vbs:Run_ProgramOK' style = 'width: 5em; margin-top: 2em;'><br>\n\
-<input type = 'button' value = 'Cancel' name = 'btn_Cancel' onClick = 'vbs:Run_ProgramCancel' style = 'width: 5em;'><br><br>\n\
-</tr>\n\
-</table>\n\
-</td>\n\
-</tr>\n\
-</table>\n");
-
-                wcscat(lDialogString, L"<table width = '100%' height = '100%' align = 'center' border = '0'>\n\
-<tr>\n\
-<td align = 'left' valign = 'top'>\n\
-<input type = 'password' id = 'txt_input'\n\
-name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
-</td>\n\
-</tr>\n\
-</table>\n\
-</body>\n\
-</html>\n\
-"               ) ;
-        }
-        fputws(lDialogString, lIn);
-        fclose(lIn);
-
-        if (aDefaultInput)
-        {
-                swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                        lDialogStringLen,
-#endif
-                        L"%ls\\AppData\\Local\\Temp\\tinyfd.txt",_wgetenv(L"USERPROFILE"));
-
-#ifdef TINYFD_NOCCSUNICODE
-				lFile = _wfopen(lDialogString, L"w");
-				fputc(0xFF, lFile);
-				fputc(0xFE, lFile);
-#else
-				lFile = _wfopen(lDialogString, L"wt, ccs=UNICODE"); /*or ccs=UTF-16LE*/
-#endif
-				fclose(lFile);
-
-                wcscpy(lDialogString, L"cmd.exe /c cscript.exe //U //Nologo ");
-                wcscat(lDialogString, L"%USERPROFILE%\\AppData\\Local\\Temp\\tinyfd.vbs ");
-                wcscat(lDialogString, L">> %USERPROFILE%\\AppData\\Local\\Temp\\tinyfd.txt");
-        }
-        else
-        {
-                wcscpy(lDialogString,
-                        L"cmd.exe /c mshta.exe %USERPROFILE%\\AppData\\Local\\Temp\\tinyfd.hta");
-        }
-
-        /* wprintf ( "lDialogString: %ls\n" , lDialogString ) ; */
-
-        hiddenConsoleW(lDialogString, aTitle, 1);
-
-        swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                lDialogStringLen,
-#endif
-				L"%ls\\AppData\\Local\\Temp\\tinyfd.txt", _wgetenv(L"USERPROFILE"));
-		/* wprintf(L"lDialogString: %ls\n", lDialogString); */
-#ifdef TINYFD_NOCCSUNICODE
-		if (!(lIn = _wfopen(lDialogString, L"r")))
-#else
-		if (!(lIn = _wfopen(lDialogString, L"rt, ccs=UNICODE"))) /*or ccs=UTF-16LE*/
-#endif
-		{
-                _wremove(lDialogString);
-                free(lDialogString);
-                return NULL;
-        }
-#ifdef TINYFD_NOCCSUNICODE
-		fgets((char *)lBuff, 2*MAX_PATH_OR_CMD, lIn);
-#else
-		fgetws(lBuff, MAX_PATH_OR_CMD, lIn);
-#endif
-		fclose(lIn);
-		wipefileW(lDialogString);
-		_wremove(lDialogString);
-
-		if (aDefaultInput)
-		{
-			swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                        lDialogStringLen,
-#endif
-                        L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs",
-                        _wgetenv(L"USERPROFILE"));
-        }
-        else
-        {
-                swprintf(lDialogString,
-#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
-                        lDialogStringLen,
-#endif
-                        L"%ls\\AppData\\Local\\Temp\\tinyfd.hta",
-                        _wgetenv(L"USERPROFILE"));
-        }
-        _wremove(lDialogString);
-        free(lDialogString);
-        /* wprintf( L"lBuff: %ls\n" , lBuff ) ; */
-#ifdef TINYFD_NOCCSUNICODE
-		lResult = !wcsncmp(lBuff+1, L"1", 1);
-#else
-		lResult = !wcsncmp(lBuff, L"1", 1);
-#endif
-        
-        /* printf( "lResult: %d \n" , lResult ) ; */
-        if (!lResult)
-        {
-            return NULL ;
-        }
-
-        /* wprintf( "lBuff+1: %ls\n" , lBuff+1 ) ; */
-#ifdef TINYFD_NOCCSUNICODE
-		return lBuff + 2;
-#else
-		return lBuff + 1;
-#endif
-}
-
-
-static char const * inputBoxWinGui(
-        char * const aoBuff,
-        char const * const aTitle, /* NULL or "" */
-        char const * const aMessage, /* NULL or "" may NOT contain \n nor \t */
-        char const * const aDefaultInput) /* "" , if NULL it's a passwordBox */
-{
-        wchar_t * lTitle;
-        wchar_t * lMessage;
-        wchar_t * lDefaultInput;
-        wchar_t const * lTmpWChar;
-        char * lTmpChar;
-
-        if (tinyfd_winUtf8)
-        {
-                lTitle = utf8to16(aTitle);
-                lMessage = utf8to16(aMessage);
-                lDefaultInput = utf8to16(aDefaultInput);
-        }
-        else
-        {
-                lTitle = mbcsTo16(aTitle);
-                lMessage = mbcsTo16(aMessage);
-                lDefaultInput = mbcsTo16(aDefaultInput);
-        }
-
-        lTmpWChar = tinyfd_inputBoxW( lTitle, lMessage, lDefaultInput);
-
-        free(lTitle);
-        free(lMessage);
-        free(lDefaultInput);
-
-        if (!lTmpWChar)
-        {
-                return NULL;
-        }
-
-        if (tinyfd_winUtf8)
-        {
-                lTmpChar = utf16to8(lTmpWChar);
-        }
-        else
-        {
-                lTmpChar = utf16toMbcs(lTmpWChar);
-        }
-        strcpy(aoBuff, lTmpChar);
-        free(lTmpChar);
-
-        return aoBuff;
-}
-
-
-wchar_t const * tinyfd_saveFileDialogW(
-        wchar_t const * const aTitle, /* NULL or "" */
-        wchar_t const * const aDefaultPathAndFile, /* NULL or "" */
-        int const aNumOfFilterPatterns, /* 0 */
-        wchar_t const * const * const aFilterPatterns, /* NULL or {"*.jpg","*.png"} */
-        wchar_t const * const aSingleFilterDescription) /* NULL or "image files" */
-{
-        static wchar_t lBuff[MAX_PATH_OR_CMD];
-        wchar_t lDirname[MAX_PATH_OR_CMD];
-        wchar_t lDialogString[MAX_PATH_OR_CMD];
-        wchar_t lFilterPatterns[MAX_PATH_OR_CMD] = L"";
-        wchar_t * p;
-        wchar_t * lRetval;
-        int i;
-        HRESULT lHResult;
-        OPENFILENAMEW ofn = {0};
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
-
-        lHResult = CoInitializeEx(NULL, 0);
-
-        getPathWithoutFinalSlashW(lDirname, aDefaultPathAndFile);
-        getLastNameW(lBuff, aDefaultPathAndFile);
-
-        if (aNumOfFilterPatterns > 0)
-        {
-                if (aSingleFilterDescription && wcslen(aSingleFilterDescription))
-                {
-                        wcscpy(lFilterPatterns, aSingleFilterDescription);
-                        wcscat(lFilterPatterns, L"\n");
-                }
-                wcscat(lFilterPatterns, aFilterPatterns[0]);
-                for (i = 1; i < aNumOfFilterPatterns; i++)
-                {
-                        wcscat(lFilterPatterns, L";");
-                        wcscat(lFilterPatterns, aFilterPatterns[i]);
-                }
-                wcscat(lFilterPatterns, L"\n");
-                if (!(aSingleFilterDescription && wcslen(aSingleFilterDescription)))
-                {
-                        wcscpy(lDialogString, lFilterPatterns);
-                        wcscat(lFilterPatterns, lDialogString);
-                }
-                wcscat(lFilterPatterns, L"All Files\n*.*\n");
-                p = lFilterPatterns;
-                while ((p = wcschr(p, L'\n')) != NULL)
-                {
-                        *p = L'\0';
-                        p++;
-                }
-        }
-
-        ofn.lStructSize = sizeof(OPENFILENAMEW);
-        ofn.hwndOwner = GetForegroundWindow();
-        ofn.hInstance = 0;
-        ofn.lpstrFilter = lFilterPatterns && wcslen(lFilterPatterns) ? lFilterPatterns : NULL;
-        ofn.lpstrCustomFilter = NULL;
-        ofn.nMaxCustFilter = 0;
-        ofn.nFilterIndex = 1;
-        ofn.lpstrFile = lBuff;
-
-        ofn.nMaxFile = MAX_PATH_OR_CMD;
-        ofn.lpstrFileTitle = NULL;
-        ofn.nMaxFileTitle = MAX_PATH_OR_CMD/2;
-        ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
-        ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
-        ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST ;
-        ofn.nFileOffset = 0;
-        ofn.nFileExtension = 0;
-        ofn.lpstrDefExt = NULL;
-        ofn.lCustData = 0L;
-        ofn.lpfnHook = NULL;
-        ofn.lpTemplateName = NULL;
-
-        if (GetSaveFileNameW(&ofn) == 0)
-        {
-                lRetval = NULL;
-        }
-        else
-        {
-                lRetval = lBuff;
-        }
-
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                CoUninitialize();
-        }
-        return lRetval;
-}
-
-
-static char const * saveFileDialogWinGui8(
-        char * const aoBuff,
-        char const * const aTitle, /* NULL or "" */
-        char const * const aDefaultPathAndFile, /* NULL or "" */
-        int const aNumOfFilterPatterns, /* 0 */
-        char const * const * const aFilterPatterns, /* NULL or {"*.jpg","*.png"} */
-        char const * const aSingleFilterDescription) /* NULL or "image files" */
-{
-        wchar_t * lTitle;
-        wchar_t * lDefaultPathAndFile;
-        wchar_t * lSingleFilterDescription;
-        wchar_t * * lFilterPatterns;
-        wchar_t const * lTmpWChar;
-        char * lTmpChar;
-        int i ;
-
-        lFilterPatterns = (wchar_t **) malloc(aNumOfFilterPatterns*sizeof(wchar_t *));
-        for (i = 0; i < aNumOfFilterPatterns; i++)
-        {
-                lFilterPatterns[i]  = utf8to16(aFilterPatterns[i]);
-        }
-
-        lTitle = utf8to16(aTitle);
-        lDefaultPathAndFile = utf8to16(aDefaultPathAndFile);
-        lSingleFilterDescription = utf8to16(aSingleFilterDescription);
-
-        lTmpWChar = tinyfd_saveFileDialogW(
-                                        lTitle,
-                                        lDefaultPathAndFile,
-                                        aNumOfFilterPatterns,
-                                        (wchar_t const** ) /*stupid cast for gcc*/
-                                        lFilterPatterns,
-                                        lSingleFilterDescription);
-
-        free(lTitle);
-        free(lDefaultPathAndFile);
-        free(lSingleFilterDescription);
-        for (i = 0; i < aNumOfFilterPatterns; i++)
-        {
-                free(lFilterPatterns[i]);
-        }
-        free(lFilterPatterns);
-
-        if (!lTmpWChar)
-        {
-                return NULL;
-        }
-
-        lTmpChar = utf16to8(lTmpWChar);
-        strcpy(aoBuff, lTmpChar);
-        free(lTmpChar);
-
-        return aoBuff;
-}
-
-
-wchar_t const * tinyfd_openFileDialogW(
-        wchar_t const * const aTitle, /* NULL or "" */
-        wchar_t const * const aDefaultPathAndFile, /* NULL or "" */
-        int const aNumOfFilterPatterns, /* 0 */
-        wchar_t const * const * const aFilterPatterns, /* NULL or {"*.jpg","*.png"} */
-        wchar_t const * const aSingleFilterDescription, /* NULL or "image files" */
-        int const aAllowMultipleSelects) /* 0 or 1 */
-{
-        static wchar_t lBuff[MAX_MULTIPLE_FILES*MAX_PATH_OR_CMD];
-                
-        size_t lLengths[MAX_MULTIPLE_FILES];
-        wchar_t lDirname[MAX_PATH_OR_CMD];
-        wchar_t lFilterPatterns[MAX_PATH_OR_CMD] = L"";
-        wchar_t lDialogString[MAX_PATH_OR_CMD];
-        wchar_t * lPointers[MAX_MULTIPLE_FILES];
-        wchar_t * lRetval, * p;
-        int i, j;
-        size_t lBuffLen;
-        HRESULT lHResult;
-        OPENFILENAMEW ofn = { 0 };
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
-
-        lHResult = CoInitializeEx(NULL, 0);
-
-        getPathWithoutFinalSlashW(lDirname, aDefaultPathAndFile);
-        getLastNameW(lBuff, aDefaultPathAndFile);
-
-        if (aNumOfFilterPatterns > 0)
-        {
-                if (aSingleFilterDescription && wcslen(aSingleFilterDescription))
-                {
-                        wcscpy(lFilterPatterns, aSingleFilterDescription);
-                        wcscat(lFilterPatterns, L"\n");
-                }
-                wcscat(lFilterPatterns, aFilterPatterns[0]);
-                for (i = 1; i < aNumOfFilterPatterns; i++)
-                {
-                        wcscat(lFilterPatterns, L";");
-                        wcscat(lFilterPatterns, aFilterPatterns[i]);
-                }
-                wcscat(lFilterPatterns, L"\n");
-                if (!(aSingleFilterDescription && wcslen(aSingleFilterDescription)))
-                {
-                        wcscpy(lDialogString, lFilterPatterns);
-                        wcscat(lFilterPatterns, lDialogString);
-                }
-                wcscat(lFilterPatterns, L"All Files\n*.*\n");
-                p = lFilterPatterns;
-                while ((p = wcschr(p, L'\n')) != NULL)
-                {
-                        *p = L'\0';
-                        p++;
-                }
-        }
-
-        ofn.lStructSize = sizeof(OPENFILENAME);
-        ofn.hwndOwner = GetForegroundWindow();
-        ofn.hInstance = 0;
-        ofn.lpstrFilter = lFilterPatterns && wcslen(lFilterPatterns) ? lFilterPatterns : NULL;
-        ofn.lpstrCustomFilter = NULL;
-        ofn.nMaxCustFilter = 0;
-        ofn.nFilterIndex = 1;
-        ofn.lpstrFile = lBuff;
-        ofn.nMaxFile = MAX_PATH_OR_CMD;
-        ofn.lpstrFileTitle = NULL;
-        ofn.nMaxFileTitle = MAX_PATH_OR_CMD / 2;
-        ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
-        ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
-        ofn.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
-        ofn.nFileOffset = 0;
-        ofn.nFileExtension = 0;
-        ofn.lpstrDefExt = NULL;
-        ofn.lCustData = 0L;
-        ofn.lpfnHook = NULL;
-        ofn.lpTemplateName = NULL;
-
-        if (aAllowMultipleSelects)
-        {
-                ofn.Flags |= OFN_ALLOWMULTISELECT;
-        }
-
-        if (GetOpenFileNameW(&ofn) == 0)
-        {
-                lRetval = NULL;
-        }
-        else
-        {
-                lBuffLen = wcslen(lBuff);
-                lPointers[0] = lBuff + lBuffLen + 1;
-                if (!aAllowMultipleSelects || (lPointers[0][0] == L'\0'))
-                {
-                        lRetval = lBuff;
-                }
-                else
-                {
-                        i = 0;
-                        do
-                        {
-                                lLengths[i] = wcslen(lPointers[i]);
-                                lPointers[i + 1] = lPointers[i] + lLengths[i] + 1;
-                                i++;
-                        } while (lPointers[i][0] != L'\0');
-                        i--;
-                        p = lBuff + MAX_MULTIPLE_FILES*MAX_PATH_OR_CMD - 1;
-                        *p = L'\0';
-                        for (j = i; j >= 0; j--)
-                        {
-                                p -= lLengths[j];
-                                memmove(p, lPointers[j], lLengths[j]*sizeof(wchar_t));
-                                p--;
-                                *p = L'\\';
-                                p -= lBuffLen;
-                                memmove(p, lBuff, lBuffLen*sizeof(wchar_t));
-                                p--;
-                                *p = L'|';
-                        }
-                        p++;
-                        lRetval = p;
-                }
-        }
-
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                CoUninitialize();
-        }
-        return lRetval;
-}
-
-
-static char const * openFileDialogWinGui8(
-        char * const aoBuff,
-        char const * const aTitle, /*  NULL or "" */
-        char const * const aDefaultPathAndFile, /*  NULL or "" */
-        int const aNumOfFilterPatterns, /* 0 */
-        char const * const * const aFilterPatterns, /* NULL or {"*.jpg","*.png"} */
-        char const * const aSingleFilterDescription, /* NULL or "image files" */
-        int const aAllowMultipleSelects) /* 0 or 1 */
-{
-        wchar_t * lTitle;
-        wchar_t * lDefaultPathAndFile;
-        wchar_t * lSingleFilterDescription;
-        wchar_t * * lFilterPatterns;
-        wchar_t const * lTmpWChar;
-        char * lTmpChar;
-        int i;
-
-        lFilterPatterns = (wchar_t * *) malloc(aNumOfFilterPatterns*sizeof(wchar_t *));
-        for (i = 0; i < aNumOfFilterPatterns; i++)
-        {
-                lFilterPatterns[i] = utf8to16(aFilterPatterns[i]);
-        }
-
-        lTitle = utf8to16(aTitle);
-        lDefaultPathAndFile = utf8to16(aDefaultPathAndFile);
-        lSingleFilterDescription = utf8to16(aSingleFilterDescription);
-
-        lTmpWChar = tinyfd_openFileDialogW(
-                lTitle,
-                lDefaultPathAndFile,
-                aNumOfFilterPatterns,
-                (wchar_t const**) /*stupid cast for gcc*/
-                lFilterPatterns,
-                lSingleFilterDescription,
-                aAllowMultipleSelects);
-
-        free(lTitle);
-        free(lDefaultPathAndFile);
-        free(lSingleFilterDescription);
-        for (i = 0; i < aNumOfFilterPatterns; i++)
-        {
-                free(lFilterPatterns[i]);
-        }
-        free(lFilterPatterns);
-
-        if (!lTmpWChar)
-        {
-                return NULL;
-        }
-
-        lTmpChar = utf16to8(lTmpWChar);
-        strcpy(aoBuff, lTmpChar);
-        free(lTmpChar);
-
-        return aoBuff;
-}
-
-#ifndef TINYFD_NOSELECTFOLDERWIN
-static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
-{
-        if (uMsg == BFFM_INITIALIZED)
-        {
-                SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
-        }
-        return 0;
-}
-
-static int __stdcall BrowseCallbackProcW(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
-{
-        if (uMsg == BFFM_INITIALIZED)
-        {
-                SendMessage(hwnd, BFFM_SETSELECTIONW, TRUE, (LPARAM)pData);
-        }
-        return 0;
-}
-
-wchar_t const * tinyfd_selectFolderDialogW(
-        wchar_t const * const aTitle, /* NULL or "" */
-        wchar_t const * const aDefaultPath) /* NULL or "" */
-{
-        static wchar_t lBuff[MAX_PATH_OR_CMD];
-                
-        BROWSEINFOW bInfo;
-        LPITEMIDLIST lpItem;
-        HRESULT lHResult;
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
-
-        lHResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-
-        bInfo.hwndOwner = GetForegroundWindow();
-        bInfo.pidlRoot = NULL;
-        bInfo.pszDisplayName = lBuff;
-        bInfo.lpszTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                bInfo.ulFlags = BIF_USENEWUI;
-        }
-        bInfo.lpfn = BrowseCallbackProcW;
-        bInfo.lParam = (LPARAM)aDefaultPath;
-        bInfo.iImage = -1;
-
-        lpItem = SHBrowseForFolderW(&bInfo);
-        if (lpItem)
-        {
-                SHGetPathFromIDListW(lpItem, lBuff);
-        }
-
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                CoUninitialize();
-        }
-        return lBuff;
-}
-
-
-static char const * selectFolderDialogWinGui8(
-        char * const aoBuff ,
-        char const * const aTitle , /*  NULL or "" */
-        char const * const aDefaultPath ) /* NULL or "" */
-{
-        wchar_t * lTitle;
-        wchar_t * lDefaultPath;
-        wchar_t const * lTmpWChar;
-        char * lTmpChar;
-
-        lTitle = utf8to16(aTitle);
-        lDefaultPath = utf8to16(aDefaultPath);
-
-        lTmpWChar = tinyfd_selectFolderDialogW(
-                lTitle,
-                lDefaultPath);
-
-        free(lTitle);
-        free(lDefaultPath);
-        if (!lTmpWChar)
-        {
-                return NULL;
-        }
-
-        lTmpChar = utf16to8(lTmpWChar);
-        strcpy(aoBuff, lTmpChar);
-        free(lTmpChar);
-
-        return aoBuff;
-}
-#endif /*TINYFD_NOSELECTFOLDERWIN*/
-
-
-wchar_t const * tinyfd_colorChooserW(
-        wchar_t const * const aTitle, /* NULL or "" */
-        wchar_t const * const aDefaultHexRGB, /* NULL or "#FF0000"*/
-        unsigned char const aDefaultRGB[3], /* { 0 , 255 , 255 } */
-        unsigned char aoResultRGB[3]) /* { 0 , 0 , 0 } */
-{
-        static wchar_t lResultHexRGB[8];
-        CHOOSECOLORW cc;
-        COLORREF crCustColors[16];
-        unsigned char lDefaultRGB[3];
-        int lRet;
-
-        HRESULT lHResult;
-
-        if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
-
-        lHResult = CoInitializeEx(NULL, 0);
-
-        if (aDefaultHexRGB)
-        {
-                Hex2RGBW(aDefaultHexRGB, lDefaultRGB);
-        }
-        else
-        {
-                lDefaultRGB[0] = aDefaultRGB[0];
-                lDefaultRGB[1] = aDefaultRGB[1];
-                lDefaultRGB[2] = aDefaultRGB[2];
-        }
-
-        /* we can't use aTitle */
-        cc.lStructSize = sizeof(CHOOSECOLOR);
-        cc.hwndOwner = GetForegroundWindow();
-        cc.hInstance = NULL;
-        cc.rgbResult = RGB(lDefaultRGB[0], lDefaultRGB[1], lDefaultRGB[2]);
-        cc.lpCustColors = crCustColors;
-        cc.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ANYCOLOR ;
-        cc.lCustData = 0;
-        cc.lpfnHook = NULL;
-        cc.lpTemplateName = NULL;
-
-        lRet = ChooseColorW(&cc);
-
-        if (!lRet)
-        {
-                return NULL;
-        }
-
-        aoResultRGB[0] = GetRValue(cc.rgbResult);
-        aoResultRGB[1] = GetGValue(cc.rgbResult);
-        aoResultRGB[2] = GetBValue(cc.rgbResult);
-
-        RGB2HexW(aoResultRGB, lResultHexRGB);
-
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                CoUninitialize();
-        }
-
-        return lResultHexRGB;
-}
-
-
-static char const * colorChooserWinGui8(
-        char const * const aTitle, /* NULL or "" */
-        char const * const aDefaultHexRGB, /* NULL or "#FF0000"*/
-        unsigned char const aDefaultRGB[3], /* { 0 , 255 , 255 } */
-        unsigned char aoResultRGB[3]) /* { 0 , 0 , 0 } */
-{
-        static char lResultHexRGB[8];
-
-        wchar_t * lTitle;
-        wchar_t * lDefaultHexRGB;
-        wchar_t const * lTmpWChar;
-        char * lTmpChar;
-
-        lTitle = utf8to16(aTitle);
-        lDefaultHexRGB = utf8to16(aDefaultHexRGB);
-
-        lTmpWChar = tinyfd_colorChooserW(
-                lTitle,
-                lDefaultHexRGB,
-                aDefaultRGB,
-                aoResultRGB );
-
-        free(lTitle);
-        free(lDefaultHexRGB);
-        if (!lTmpWChar)
-        {
-                return NULL;
-        }
-
-        lTmpChar = utf16to8(lTmpWChar);
-        strcpy(lResultHexRGB, lTmpChar);
-        free(lTmpChar);
-
-        return lResultHexRGB;
-}
-
-
-static int messageBoxWinGuiA(
-    char const * const aTitle , /* NULL or "" */
-    char const * const aMessage , /* NULL or ""  may contain \n and \t */
-    char const * const aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
-    char const * const aIconType , /* "info" "warning" "error" "question" */
-    int const aDefaultButton ) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        int lBoxReturnValue;
-    UINT aCode ;
-        
-        if ( aIconType && ! strcmp( "warning" , aIconType ) )
-        {
-                aCode = MB_ICONWARNING ;
-        }
-        else if ( aIconType && ! strcmp("error", aIconType))
-        {
-                aCode = MB_ICONERROR ;
-        }
-        else if ( aIconType && ! strcmp("question", aIconType))
-        {
-                aCode = MB_ICONQUESTION ;
-        }
-        else
-        {
-                aCode = MB_ICONINFORMATION ;
-        }
-
-        if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-        {
-                aCode += MB_OKCANCEL ;
-                if ( ! aDefaultButton )
-                {
-                        aCode += MB_DEFBUTTON2 ;
-                }
-        }
-        else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-        {
-                aCode += MB_YESNO ;
-                if ( ! aDefaultButton )
-                {
-                        aCode += MB_DEFBUTTON2 ;
-                }
-        }
-        else if (aDialogType && !strcmp("yesnocancel", aDialogType))
-        {
-                aCode += MB_YESNOCANCEL;
-                if (!aDefaultButton)
-                {
-                        aCode += MB_DEFBUTTON3;
-                }
-                else if (aDefaultButton == 2)
-                {
-                        aCode += MB_DEFBUTTON2;
-                }
-        }
-        else
-        {
-                aCode += MB_OK ;
-        }
-
-        aCode += MB_TOPMOST;
-
-        lBoxReturnValue = MessageBoxA(GetForegroundWindow(), aMessage, aTitle, aCode);
-
-        if (((aDialogType && !strcmp("yesnocancel", aDialogType))
-                && (lBoxReturnValue == IDNO)))
-        {
-                return 2;
-        }
-
-        if ( ( ( aDialogType
-                && strcmp("yesnocancel", aDialogType)
-                && strcmp("okcancel", aDialogType)
-                && strcmp("yesno", aDialogType)))
-                || (lBoxReturnValue == IDOK)
-                || (lBoxReturnValue == IDYES) )
-        {
-                return 1 ;
-        }
-        else
-        {
-                return 0 ;
-        }
-}
-
-
-static char const * saveFileDialogWinGuiA(
-        char * const aoBuff ,
-    char const * const aTitle , /* NULL or "" */
-    char const * const aDefaultPathAndFile , /* NULL or "" */
-    int const aNumOfFilterPatterns , /* 0 */
-    char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-    char const * const aSingleFilterDescription ) /* NULL or "image files" */
-{
-        char lDirname [MAX_PATH_OR_CMD] ;
-        char lDialogString[MAX_PATH_OR_CMD];
-        char lFilterPatterns[MAX_PATH_OR_CMD] = "";
-        int i ;
-        char * p;
-        char * lRetval;
-        HRESULT lHResult;
-        OPENFILENAMEA ofn = { 0 };
-
-        lHResult = CoInitializeEx(NULL,0);
-
-        getPathWithoutFinalSlash(lDirname, aDefaultPathAndFile);
-        getLastName(aoBuff, aDefaultPathAndFile);
-    
-        if (aNumOfFilterPatterns > 0)
-        {
-                if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                {
-                        strcpy(lFilterPatterns, aSingleFilterDescription);
-                        strcat(lFilterPatterns, "\n");
-                }
-                strcat(lFilterPatterns, aFilterPatterns[0]);
-                for (i = 1; i < aNumOfFilterPatterns; i++)
-                {
-                        strcat(lFilterPatterns, ";");
-                        strcat(lFilterPatterns, aFilterPatterns[i]);
-                }
-                strcat(lFilterPatterns, "\n");
-                if ( ! (aSingleFilterDescription && strlen(aSingleFilterDescription) ) )
-                {
-                        strcpy(lDialogString, lFilterPatterns);
-                        strcat(lFilterPatterns, lDialogString);
-                }
-                strcat(lFilterPatterns, "All Files\n*.*\n");
-                p = lFilterPatterns;
-                while ((p = strchr(p, '\n')) != NULL)
-                {
-                        *p = '\0';
-                        p ++ ;
-                }
-        }
-    
-        ofn.lStructSize     = sizeof(OPENFILENAME) ;
-        ofn.hwndOwner           = GetForegroundWindow();
-        ofn.hInstance       = 0 ;
-        ofn.lpstrFilter         = lFilterPatterns && strlen(lFilterPatterns) ? lFilterPatterns : NULL;
-        ofn.lpstrCustomFilter = NULL ;
-        ofn.nMaxCustFilter  = 0 ;
-        ofn.nFilterIndex    = 1 ;
-        ofn.lpstrFile           = aoBuff;
-
-        ofn.nMaxFile        = MAX_PATH_OR_CMD ;
-        ofn.lpstrFileTitle  = NULL ;
-        ofn.nMaxFileTitle       = MAX_PATH_OR_CMD / 2;
-        ofn.lpstrInitialDir = lDirname && strlen(lDirname) ? lDirname : NULL;
-        ofn.lpstrTitle          = aTitle && strlen(aTitle) ? aTitle : NULL;
-        ofn.Flags           = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR ;
-        ofn.nFileOffset     = 0 ;
-        ofn.nFileExtension  = 0 ;
-        ofn.lpstrDefExt     = NULL ;
-        ofn.lCustData       = 0L ;
-        ofn.lpfnHook        = NULL ;
-        ofn.lpTemplateName  = NULL ;
-
-        if ( GetSaveFileNameA ( & ofn ) == 0 )
-        {
-                lRetval = NULL ;
-        }
-        else 
-        { 
-                lRetval = aoBuff ;
-        }
-
-        if (lHResult==S_OK || lHResult==S_FALSE) 
-        {
-                CoUninitialize();
-        }
-        return lRetval ;
-}
-
-
-static char const * openFileDialogWinGuiA(
-        char * const aoBuff ,
-    char const * const aTitle , /*  NULL or "" */
-    char const * const aDefaultPathAndFile , /*  NULL or "" */
-    int const aNumOfFilterPatterns , /* 0 */
-    char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-    char const * const aSingleFilterDescription , /* NULL or "image files" */
-    int const aAllowMultipleSelects ) /* 0 or 1 */
-{
-        char lDirname [MAX_PATH_OR_CMD] ;
-        char lFilterPatterns[MAX_PATH_OR_CMD] = "";
-        char lDialogString[MAX_PATH_OR_CMD] ;
-        char * lPointers[MAX_MULTIPLE_FILES];
-        size_t lLengths[MAX_MULTIPLE_FILES];
-        int i , j ;
-        char * p;
-        size_t lBuffLen ;
-        char * lRetval;
-        HRESULT lHResult;
-        OPENFILENAMEA ofn = {0};
-
-        lHResult = CoInitializeEx(NULL,0);
-
-        getPathWithoutFinalSlash(lDirname, aDefaultPathAndFile);
-        getLastName(aoBuff, aDefaultPathAndFile);
-
-        if (aNumOfFilterPatterns > 0)
-        {
-                if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                {
-                        strcpy(lFilterPatterns, aSingleFilterDescription);
-                        strcat(lFilterPatterns, "\n");
-                }
-                strcat(lFilterPatterns, aFilterPatterns[0]);
-                for (i = 1; i < aNumOfFilterPatterns; i++)
-                {
-                        strcat(lFilterPatterns, ";");
-                        strcat(lFilterPatterns, aFilterPatterns[i]);
-                }
-                strcat(lFilterPatterns, "\n");
-                if ( ! (aSingleFilterDescription && strlen(aSingleFilterDescription) ) )
-                {
-                        strcpy(lDialogString, lFilterPatterns);
-                        strcat(lFilterPatterns, lDialogString);
-                }
-                strcat(lFilterPatterns, "All Files\n*.*\n");
-                p = lFilterPatterns;
-                while ((p = strchr(p, '\n')) != NULL)
-                {
-                        *p = '\0';
-                        p ++ ;
-                }
-        }
-
-        ofn.lStructSize     = sizeof( OPENFILENAME ) ;
-        ofn.hwndOwner           = GetForegroundWindow();
-        ofn.hInstance       = 0 ;
-        ofn.lpstrFilter         = lFilterPatterns && strlen(lFilterPatterns) ? lFilterPatterns : NULL;
-        ofn.lpstrCustomFilter = NULL ;
-        ofn.nMaxCustFilter  = 0 ;
-        ofn.nFilterIndex    = 1 ;
-        ofn.lpstrFile           = aoBuff ;
-        ofn.nMaxFile        = MAX_PATH_OR_CMD ;
-        ofn.lpstrFileTitle  = NULL ;
-        ofn.nMaxFileTitle       = MAX_PATH_OR_CMD / 2;
-        ofn.lpstrInitialDir = lDirname && strlen(lDirname) ? lDirname : NULL;
-        ofn.lpstrTitle          = aTitle && strlen(aTitle) ? aTitle : NULL;
-        ofn.Flags                       = OFN_EXPLORER  | OFN_NOCHANGEDIR ;
-        ofn.nFileOffset     = 0 ;
-        ofn.nFileExtension  = 0 ;
-        ofn.lpstrDefExt     = NULL ;
-        ofn.lCustData       = 0L ;
-        ofn.lpfnHook        = NULL ;
-        ofn.lpTemplateName  = NULL ;
-
-        if ( aAllowMultipleSelects )
-        {
-                ofn.Flags |= OFN_ALLOWMULTISELECT;
-        }
-
-        if ( GetOpenFileNameA( & ofn ) == 0 )
-        {
-                lRetval = NULL ;
-        }
-        else 
-        {
-                lBuffLen = strlen(aoBuff) ;
-                lPointers[0] = aoBuff + lBuffLen + 1 ;
-                if ( !aAllowMultipleSelects || (lPointers[0][0] == '\0')  )
-                {
-                        lRetval = aoBuff ;
-                }
-                else 
-                {
-                        i = 0 ;
-                        do
-                        {
-                                lLengths[i] = strlen(lPointers[i]);
-                                lPointers[i+1] = lPointers[i] + lLengths[i] + 1 ;
-                                i ++ ;
-                        }
-                        while ( lPointers[i][0] != '\0' );
-                        i--;
-                        p = aoBuff + MAX_MULTIPLE_FILES*MAX_PATH_OR_CMD - 1 ;
-                        * p = '\0';
-                        for ( j = i ; j >=0 ; j-- )
-                        {
-                                p -= lLengths[j];
-                                memmove(p, lPointers[j], lLengths[j]);
-                                p--;
-                                *p = '\\';
-                                p -= lBuffLen ;
-                                memmove(p, aoBuff, lBuffLen);
-                                p--;
-                                *p = '|';
-                        }
-                        p++;
-                        lRetval = p ;
-                }
-        }
-
-        if (lHResult==S_OK || lHResult==S_FALSE) 
-        {
-                CoUninitialize();
-        }
-        return lRetval;
-}
-
-#ifndef TINYFD_NOSELECTFOLDERWIN
-static char const * selectFolderDialogWinGuiA(
-        char * const aoBuff ,
-        char const * const aTitle , /*  NULL or "" */
-        char const * const aDefaultPath ) /* NULL or "" */
-{
-        BROWSEINFOA bInfo ;
-        LPITEMIDLIST lpItem ;
-        HRESULT lHResult;
-
-        lHResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-
-        /* we can't use aDefaultPath */
-        bInfo.hwndOwner = GetForegroundWindow();
-        bInfo.pidlRoot = NULL ;
-        bInfo.pszDisplayName = aoBuff ;
-        bInfo.lpszTitle = aTitle && strlen(aTitle) ? aTitle : NULL;
-        if (lHResult == S_OK || lHResult == S_FALSE)
-        {
-                bInfo.ulFlags = BIF_USENEWUI;
-        }
-        bInfo.lpfn = BrowseCallbackProc;
-        bInfo.lParam = (LPARAM)aDefaultPath;
-        bInfo.iImage = -1 ;
-
-        lpItem = SHBrowseForFolderA( & bInfo ) ;
-        if ( lpItem )
-        {
-                SHGetPathFromIDListA( lpItem , aoBuff ) ;
-        }
-
-        if (lHResult==S_OK || lHResult==S_FALSE) 
-        {
-                CoUninitialize();
-        }
-        return aoBuff ;
-}
-#endif /*TINYFD_NOSELECTFOLDERWIN*/
-
-
-static char const * colorChooserWinGuiA(
-        char const * const aTitle, /* NULL or "" */
-        char const * const aDefaultHexRGB, /* NULL or "#FF0000"*/
-        unsigned char const aDefaultRGB[3], /* { 0 , 255 , 255 } */
-        unsigned char aoResultRGB[3]) /* { 0 , 0 , 0 } */
-{
-        static char lResultHexRGB[8];
-
-        CHOOSECOLORA cc;
-        COLORREF crCustColors[16];
-        unsigned char lDefaultRGB[3];
-        int lRet;
-
-        if ( aDefaultHexRGB )
-        {
-                Hex2RGB(aDefaultHexRGB, lDefaultRGB);
-        }
-        else
-        {
-                lDefaultRGB[0]=aDefaultRGB[0];
-                lDefaultRGB[1]=aDefaultRGB[1];
-                lDefaultRGB[2]=aDefaultRGB[2];
-        }
-
-        /* we can't use aTitle */
-        cc.lStructSize = sizeof( CHOOSECOLOR ) ;
-        cc.hwndOwner = GetForegroundWindow();
-        cc.hInstance = NULL ;
-        cc.rgbResult = RGB(lDefaultRGB[0], lDefaultRGB[1], lDefaultRGB[2]);
-        cc.lpCustColors = crCustColors;
-        cc.Flags = CC_RGBINIT | CC_FULLOPEN;
-        cc.lCustData = 0;
-        cc.lpfnHook = NULL;
-        cc.lpTemplateName = NULL;
-
-        lRet = ChooseColorA(&cc);
-
-        if ( ! lRet )
-        {
-                return NULL;
-        }
-
-        aoResultRGB[0] = GetRValue(cc.rgbResult);
-        aoResultRGB[1] = GetGValue(cc.rgbResult);
-        aoResultRGB[2] = GetBValue(cc.rgbResult);
-
-        RGB2Hex(aoResultRGB, lResultHexRGB);
-
-        return lResultHexRGB;
-}
-
-#endif /* TINYFD_NOLIB */
-
-static int dialogPresent( )
-{
-        static int lDialogPresent = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        char const * lString = "dialog.exe";
-        if ( lDialogPresent < 0 )
-        {
-                if (!(lIn = _popen("where dialog.exe","r")))
-                {
-                        lDialogPresent = 0 ;
-                        return 0 ;
-                }
-                while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                {}
-                _pclose( lIn ) ;
-                if ( lBuff[strlen( lBuff ) -1] == '\n' )
-                {
-                        lBuff[strlen( lBuff ) -1] = '\0' ;
-                }
-                if ( strcmp(lBuff+strlen(lBuff)-strlen(lString),lString) )
-                {
-                        lDialogPresent = 0 ;
-                }
-                else
-                {
-                        lDialogPresent = 1 ;
-                }
-        }
-        return lDialogPresent;
-}
-
-
-static int messageBoxWinConsole(
-    char const * const aTitle , /* NULL or "" */
-    char const * const aMessage , /* NULL or ""  may contain \n and \t */
-    char const * const aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
-    char const * const aIconType , /* "info" "warning" "error" "question" */
-    int const aDefaultButton ) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        char lDialogString[MAX_PATH_OR_CMD];
-        char lDialogFile[MAX_PATH_OR_CMD];
-        FILE * lIn;
-        char lBuff [MAX_PATH_OR_CMD] = "";
-        
-        strcpy( lDialogString , "dialog " ) ;
-        if ( aTitle && strlen(aTitle) )
-        {
-                strcat(lDialogString, "--title \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        if ( aDialogType && ( !strcmp( "okcancel" , aDialogType )
-                || !strcmp("yesno", aDialogType) || !strcmp("yesnocancel", aDialogType) ) )
-        {
-                strcat(lDialogString, "--backtitle \"") ;
-                strcat(lDialogString, "tab: move focus") ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-        {
-                if ( ! aDefaultButton )
-                {
-                        strcat( lDialogString , "--defaultno " ) ;
-                }
-                strcat( lDialogString ,
-                                "--yes-label \"Ok\" --no-label \"Cancel\" --yesno " ) ;
-        }
-        else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-        {
-                if ( ! aDefaultButton )
-                {
-                        strcat( lDialogString , "--defaultno " ) ;
-                }
-                strcat( lDialogString , "--yesno " ) ;
-        }
-        else if (aDialogType && !strcmp("yesnocancel", aDialogType))
-        {
-                if (!aDefaultButton)
-                {
-                        strcat(lDialogString, "--defaultno ");
-                }
-                strcat(lDialogString, "--menu ");
-        }
-        else
-        {
-                strcat( lDialogString , "--msgbox " ) ;
-        }
-
-        strcat( lDialogString , "\"" ) ;
-        if ( aMessage && strlen(aMessage) )
-        {
-                replaceSubStr( aMessage , "\n" , "\\n" , lBuff ) ;
-                strcat(lDialogString, lBuff) ;
-                lBuff[0]='\0';
-        }
-        strcat(lDialogString, "\" ");
-
-        if (aDialogType && !strcmp("yesnocancel", aDialogType))
-        {
-                strcat(lDialogString, "0 60 0 Yes \"\" No \"\"");
-                strcat(lDialogString, "2>>");
-        }
-        else
-        {
-                strcat(lDialogString, "10 60");
-                strcat(lDialogString, " && echo 1 > ");
-        }
-
-        strcpy(lDialogFile, getenv("USERPROFILE"));
-        strcat(lDialogFile, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcat(lDialogString, lDialogFile);
-
-        /*if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;*/
-        system( lDialogString ) ;
-                
-        if (!(lIn = fopen(lDialogFile, "r")))
-        {
-                remove(lDialogFile);
-                return 0 ;
-        }
-        while (fgets(lBuff, sizeof(lBuff), lIn) != NULL)
-        {}
-        fclose(lIn);
-        remove(lDialogFile);
-    if ( lBuff[strlen( lBuff ) -1] == '\n' )
-    {
-        lBuff[strlen( lBuff ) -1] = '\0' ;
-    }
-
-        /* if (tinyfd_verbose) printf("lBuff: %s\n", lBuff); */
-        if ( ! strlen(lBuff) )
-        {
-                return 0;
-        }
-
-        if (aDialogType && !strcmp("yesnocancel", aDialogType))
-        {
-                if (lBuff[0] == 'Y') return 1;
-                else return 2;
-        }
-
-        return 1;
-}
-
-
-static char const * inputBoxWinConsole(
-        char * const aoBuff ,
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or "" may NOT contain \n nor \t */
-        char const * const aDefaultInput ) /* "" , if NULL it's a passwordBox */
-{
-        char lDialogString[MAX_PATH_OR_CMD];
-        char lDialogFile[MAX_PATH_OR_CMD];
-        FILE * lIn;
-        int lResult;
-
-        strcpy(lDialogFile, getenv("USERPROFILE"));
-        strcat(lDialogFile, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcpy(lDialogString , "echo|set /p=1 >" ) ;
-        strcat(lDialogString, lDialogFile);
-        strcat( lDialogString , " & " ) ;
-
-        strcat( lDialogString , "dialog " ) ;
-        if ( aTitle && strlen(aTitle) )
-        {
-                strcat(lDialogString, "--title \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        strcat(lDialogString, "--backtitle \"") ;
-        strcat(lDialogString, "tab: move focus") ;
-        if ( ! aDefaultInput )
-        {
-                strcat(lDialogString, " (sometimes nothing, no blink nor star, is shown in text field)") ;
-        }
-
-        strcat(lDialogString, "\" ") ;
-
-        if ( ! aDefaultInput )
-        {
-                strcat( lDialogString , "--insecure --passwordbox" ) ;
-        }
-        else
-        {
-                strcat( lDialogString , "--inputbox" ) ;
-        }
-        strcat( lDialogString , " \"" ) ;
-        if ( aMessage && strlen(aMessage) )
-        {
-                strcat(lDialogString, aMessage) ;
-        }
-        strcat(lDialogString,"\" 10 60 ") ;
-        if ( aDefaultInput && strlen(aDefaultInput) )
-        {
-                strcat(lDialogString, "\"") ;
-                strcat(lDialogString, aDefaultInput) ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        strcat(lDialogString, "2>>");
-        strcpy(lDialogFile, getenv("USERPROFILE"));
-        strcat(lDialogFile, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcat(lDialogString, lDialogFile);
-        strcat(lDialogString, " || echo 0 > ");
-        strcat(lDialogString, lDialogFile);
-
-        /* printf( "lDialogString: %s\n" , lDialogString ) ; */
-        system( lDialogString ) ;
-
-        if (!(lIn = fopen(lDialogFile, "r")))
-        {
-                remove(lDialogFile);
-                return 0 ;
-        }
-        while (fgets(aoBuff, MAX_PATH_OR_CMD, lIn) != NULL)
-        {}
-        fclose(lIn);
-
-        wipefile(lDialogFile);
-        remove(lDialogFile);
-    if ( aoBuff[strlen( aoBuff ) -1] == '\n' )
-    {
-        aoBuff[strlen( aoBuff ) -1] = '\0' ;
-    }
-        /* printf( "aoBuff: %s\n" , aoBuff ) ; */
-
-        /* printf( "aoBuff: %s len: %lu \n" , aoBuff , strlen(aoBuff) ) ; */
-    lResult =  strncmp( aoBuff , "1" , 1) ? 0 : 1 ;
-        /* printf( "lResult: %d \n" , lResult ) ; */
-    if ( ! lResult )
-    {
-                return NULL ;
-        }
-        /* printf( "aoBuff+1: %s\n" , aoBuff+1 ) ; */
-        return aoBuff+3 ;
-}
-
-
-static char const * saveFileDialogWinConsole(
-        char * const aoBuff ,
-        char const * const aTitle , /* NULL or "" */
-        char const * const aDefaultPathAndFile ) /* NULL or "" */
-{
-        char lDialogString[MAX_PATH_OR_CMD];
-        char lPathAndFile[MAX_PATH_OR_CMD] = "";
-        FILE * lIn;
-
-        strcpy( lDialogString , "dialog " ) ;
-        if ( aTitle && strlen(aTitle) )
-        {
-                strcat(lDialogString, "--title \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-        }
-        
-        strcat(lDialogString, "--backtitle \"") ;
-        strcat(lDialogString,
-                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-        strcat(lDialogString, "\" ") ;
-
-        strcat( lDialogString , "--fselect \"" ) ;
-        if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-        {
-                /* dialog.exe uses unix separators even on windows */
-                strcpy(lPathAndFile, aDefaultPathAndFile);
-                replaceChr( lPathAndFile , '\\' , '/' ) ;
-        }
-                
-        /* dialog.exe needs at least one separator */
-        if ( ! strchr(lPathAndFile, '/') )
-        {
-                strcat(lDialogString, "./") ;
-        }
-        strcat(lDialogString, lPathAndFile) ;
-        strcat(lDialogString, "\" 0 60 2>");
-        strcpy(lPathAndFile, getenv("USERPROFILE"));
-        strcat(lPathAndFile, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcat(lDialogString, lPathAndFile);
-
-        /* printf( "lDialogString: %s\n" , lDialogString ) ; */
-        system( lDialogString ) ;
-
-        if (!(lIn = fopen(lPathAndFile, "r")))
-        {
-                remove(lPathAndFile);
-                return NULL;
-        }
-        while (fgets(aoBuff, MAX_PATH_OR_CMD, lIn) != NULL)
-        {}
-        fclose(lIn);
-        remove(lPathAndFile);
-        replaceChr( aoBuff , '/' , '\\' ) ;
-        /* printf( "aoBuff: %s\n" , aoBuff ) ; */
-        getLastName(lDialogString,aoBuff);
-        if ( ! strlen(lDialogString) )
-        {
-                return NULL;
-        }
-        return aoBuff;
-}
-
-
-static char const * openFileDialogWinConsole(
-        char * const aoBuff ,
-        char const * const aTitle , /*  NULL or "" */
-        char const * const aDefaultPathAndFile , /*  NULL or "" */
-        int const aAllowMultipleSelects ) /* 0 or 1 */
-{
-        char lFilterPatterns[MAX_PATH_OR_CMD] = "";
-        char lDialogString[MAX_PATH_OR_CMD] ;
-        FILE * lIn;
-
-        strcpy( lDialogString , "dialog " ) ;
-        if ( aTitle && strlen(aTitle) )
-        {
-                strcat(lDialogString, "--title \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        strcat(lDialogString, "--backtitle \"") ;
-        strcat(lDialogString,
-                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-        strcat(lDialogString, "\" ") ;
-
-        strcat( lDialogString , "--fselect \"" ) ;
-        if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-        {
-                /* dialog.exe uses unix separators even on windows */
-                strcpy(lFilterPatterns, aDefaultPathAndFile);
-                replaceChr( lFilterPatterns , '\\' , '/' ) ;
-        }
-                
-        /* dialog.exe needs at least one separator */
-        if ( ! strchr(lFilterPatterns, '/') )
-        {
-                strcat(lDialogString, "./") ;
-        }
-        strcat(lDialogString, lFilterPatterns) ;
-        strcat(lDialogString, "\" 0 60 2>");
-        strcpy(lFilterPatterns, getenv("USERPROFILE"));
-        strcat(lFilterPatterns, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcat(lDialogString, lFilterPatterns);
-
-        /* printf( "lDialogString: %s\n" , lDialogString ) ; */
-        system( lDialogString ) ;
-
-        if (!(lIn = fopen(lFilterPatterns, "r")))
-        {
-                remove(lFilterPatterns);
-                return NULL;
-        }
-        while (fgets(aoBuff, MAX_PATH_OR_CMD, lIn) != NULL)
-        {}
-        fclose(lIn);
-        remove(lFilterPatterns);
-        replaceChr( aoBuff , '/' , '\\' ) ;
-        /* printf( "aoBuff: %s\n" , aoBuff ) ; */
-        return aoBuff;
-}
-
-
-static char const * selectFolderDialogWinConsole(
-        char * const aoBuff ,
-        char const * const aTitle , /*  NULL or "" */
-        char const * const aDefaultPath ) /* NULL or "" */
-{
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        char lString [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        
-        strcpy( lDialogString , "dialog " ) ;
-        if ( aTitle && strlen(aTitle) )
-        {
-                strcat(lDialogString, "--title \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-        }
-
-        strcat(lDialogString, "--backtitle \"") ;
-        strcat(lDialogString,
-                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-        strcat(lDialogString, "\" ") ;
-
-        strcat( lDialogString , "--dselect \"" ) ;
-        if ( aDefaultPath && strlen(aDefaultPath) )
-        {
-                /* dialog.exe uses unix separators even on windows */
-                strcpy(lString, aDefaultPath) ;
-                ensureFinalSlash(lString);
-                replaceChr( lString , '\\' , '/' ) ;
-                strcat(lDialogString, lString) ;
-        }
-        else
-        {
-                /* dialog.exe needs at least one separator */
-                strcat(lDialogString, "./") ;
-        }
-        strcat(lDialogString, "\" 0 60 2>");
-        strcpy(lString, getenv("USERPROFILE"));
-        strcat(lString, "\\AppData\\Local\\Temp\\tinyfd.txt");
-        strcat(lDialogString, lString);
-
-        /* printf( "lDialogString: %s\n" , lDialogString ) ; */
-        system( lDialogString ) ;
-
-        if (!(lIn = fopen(lString, "r")))
-        {
-                remove(lString);
-                return NULL;
-        }
-        while (fgets(aoBuff, MAX_PATH_OR_CMD, lIn) != NULL)
-        {}
-        fclose(lIn);
-        remove(lString);
-        replaceChr( aoBuff , '/' , '\\' ) ;
-        /* printf( "aoBuff: %s\n" , aoBuff ) ; */
-        return aoBuff;
-}
-
-
-int tinyfd_messageBox(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or ""  may contain \n and \t */
-        char const * const aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
-        char const * const aIconType , /* "info" "warning" "error" "question" */
-        int const aDefaultButton ) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        char lChar ;
-
-#ifndef TINYFD_NOLIB
-        if ((!tinyfd_forceConsole || !(GetConsoleWindow() || dialogPresent()))
-                && (!getenv("SSH_CLIENT") || getenv("DISPLAY")))
-        {
-                if (aTitle&&!strcmp(aTitle, "tinyfd_query")){ strcpy(tinyfd_response, "windows"); return 1; }
-                if (tinyfd_winUtf8)
-                {
-                        return messageBoxWinGui8(
-                                aTitle, aMessage, aDialogType, aIconType, aDefaultButton);
-                }
-                else
-                {
-                        return messageBoxWinGuiA(
-                                aTitle, aMessage, aDialogType, aIconType, aDefaultButton);
-                }
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( dialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return 0;}
-                return messageBoxWinConsole(
-                                        aTitle,aMessage,aDialogType,aIconType,aDefaultButton);
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return 0;}
-                if (!gWarningDisplayed && !tinyfd_forceConsole )
-                {
-                        gWarningDisplayed = 1; 
-                        printf("\n\n%s\n", gTitle);
-                        printf("%s\n\n", tinyfd_needs);
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        printf("\n%s\n\n", aTitle);
-                }
-                if ( aDialogType && !strcmp("yesno",aDialogType) )
-                {
-                        do
-                        {
-                                if ( aMessage && strlen(aMessage) )
-                                {
-                                        printf("%s\n",aMessage);
-                                }
-                                printf("y/n: ");
-                                lChar = (char) tolower( _getch() ) ;
-                                printf("\n\n");
-                        }
-                        while ( lChar != 'y' && lChar != 'n' ) ;
-                        return lChar == 'y' ? 1 : 0 ;
-                }
-                else if ( aDialogType && !strcmp("okcancel",aDialogType) )
-                {
-                        do
-                        {
-                                if ( aMessage && strlen(aMessage) )
-                                {
-                                        printf("%s\n",aMessage);
-                                }
-                                printf("[O]kay/[C]ancel: ");
-                                lChar = (char) tolower( _getch() ) ;
-                                printf("\n\n");
-                        }
-                        while ( lChar != 'o' && lChar != 'c' ) ;
-                        return lChar == 'o' ? 1 : 0 ;
-                }
-                else if (aDialogType && !strcmp("yesnocancel", aDialogType))
-                {
-                        do
-                        {
-                                if (aMessage && strlen(aMessage))
-                                {
-                                        printf("%s\n", aMessage);
-                                }
-                                printf("[Y]es/[N]o/[C]ancel: ");
-                                lChar = (char)tolower(_getch());
-                                printf("\n\n");
-                        } while (lChar != 'y' && lChar != 'n' && lChar != 'c');
-                        return (lChar == 'y') ? 1 : (lChar == 'n') ? 2 : 0 ;
-                }
-                else
-                {
-                        if ( aMessage && strlen(aMessage) )
-                        {
-                                printf("%s\n\n",aMessage);
-                        }
-                        printf("press enter to continue ");
-                        lChar = (char) _getch() ;
-                        printf("\n\n");
-                        return 1 ;
-                }
-        }
-}
-
-
-/* return has only meaning for tinyfd_query */
-int tinyfd_notifyPopup(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or "" may contain \n \t */
-        char const * const aIconType ) /* "info" "warning" "error" */
-{
-#ifndef TINYFD_NOLIB
-        if ((!tinyfd_forceConsole || !( 
-                GetConsoleWindow() || 
-                dialogPresent()))
-                && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return 1;}
-                return notifyWinGui(aTitle, aMessage, aIconType);
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        {
-                return tinyfd_messageBox(aTitle, aMessage, "ok" , aIconType, 0);
-        }
-}
-
-
-/* returns NULL on cancel */
-char const * tinyfd_inputBox(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or "" may NOT contain \n nor \t */
-        char const * const aDefaultInput ) /* "" , if NULL it's a passwordBox */
-{
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char * lEOF;
-
-#ifndef TINYFD_NOLIB
-        DWORD mode = 0;
-        HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
-
-        if ((!tinyfd_forceConsole || !( 
-                GetConsoleWindow() || 
-                dialogPresent()))
-                && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return (char const *)1;}
-                lBuff[0]='\0';
-                return inputBoxWinGui(lBuff, aTitle, aMessage, aDefaultInput);
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( dialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                lBuff[0]='\0';
-                return inputBoxWinConsole(lBuff,aTitle,aMessage,aDefaultInput);
-        }
-        else 
-        {
-      if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-      lBuff[0]='\0';
-      if (!gWarningDisplayed && !tinyfd_forceConsole)
-      {
-          gWarningDisplayed = 1 ;
-          printf("\n\n%s\n", gTitle);
-          printf("%s\n\n", tinyfd_needs);
-      }
-      if ( aTitle && strlen(aTitle) )
-      {
-          printf("\n%s\n\n", aTitle);
-      }
-      if ( aMessage && strlen(aMessage) )
-      {
-          printf("%s\n",aMessage);
-      }
-      printf("(ctrl-Z + enter to cancel): ");
-#ifndef TINYFD_NOLIB
-      if ( ! aDefaultInput )
-      {
-          GetConsoleMode(hStdin,&mode);
-          SetConsoleMode(hStdin,mode & (~ENABLE_ECHO_INPUT) );
-      }
-#endif /* TINYFD_NOLIB */
-      lEOF = fgets(lBuff, MAX_PATH_OR_CMD, stdin);
-      if ( ! lEOF )
-      {
-          return NULL;
-      }
-#ifndef TINYFD_NOLIB
-      if ( ! aDefaultInput )
-      {
-          SetConsoleMode(hStdin,mode);
-          printf("\n");
-      }
-#endif /* TINYFD_NOLIB */
-      printf("\n");
-      if ( strchr(lBuff,27) )
-      {
-          return NULL ;
-      }
-      if ( lBuff[strlen( lBuff ) -1] == '\n' )
-      {
-          lBuff[strlen( lBuff ) -1] = '\0' ;
-      }
-      return lBuff ;
-  }
-}
-
-
-char const * tinyfd_saveFileDialog(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aDefaultPathAndFile , /* NULL or "" */
-        int const aNumOfFilterPatterns , /* 0 */
-        char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-        char const * const aSingleFilterDescription ) /* NULL or "image files" */
-{
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char lString[MAX_PATH_OR_CMD] ;
-        char const * p ;
-        lBuff[0]='\0';
-#ifndef TINYFD_NOLIB
-        if ( ( !tinyfd_forceConsole || !( GetConsoleWindow() || dialogPresent() ) )
-          && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return (char const *)1;}
-                if (tinyfd_winUtf8)
-                {
-                        p = saveFileDialogWinGui8(lBuff,
-                                aTitle, aDefaultPathAndFile, aNumOfFilterPatterns, aFilterPatterns, aSingleFilterDescription);
-                }
-                else
-                {
-                        p = saveFileDialogWinGuiA(lBuff,
-                                aTitle, aDefaultPathAndFile, aNumOfFilterPatterns, aFilterPatterns, aSingleFilterDescription);
-                }
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( dialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                p = saveFileDialogWinConsole(lBuff,aTitle,aDefaultPathAndFile);
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-                p = tinyfd_inputBox(aTitle, "Save file","");
-        }
-
-        if ( ! p || ! strlen( p )  )
-        {
-                return NULL;
-        }
-        getPathWithoutFinalSlash( lString , p ) ;
-        if ( strlen( lString ) && ! dirExists( lString ) )
-        {
-                return NULL ;
-        }
-        getLastName(lString,p);
-        if ( ! filenameValid(lString) )
-        {
-                return NULL;
-        }
-        return p ;
-}
-
-
-/* in case of multiple files, the separator is | */
-char const * tinyfd_openFileDialog(
-    char const * const aTitle , /* NULL or "" */
-    char const * const aDefaultPathAndFile , /* NULL or "" */
-    int const aNumOfFilterPatterns , /* 0 */
-    char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-    char const * const aSingleFilterDescription , /* NULL or "image files" */
-    int const aAllowMultipleSelects ) /* 0 or 1 */
-{
-        static char lBuff[MAX_MULTIPLE_FILES*MAX_PATH_OR_CMD];
-        char const * p ;
-#ifndef TINYFD_NOLIB
-        if ( ( !tinyfd_forceConsole || !( GetConsoleWindow() || dialogPresent() ) )
-          && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return (char const *)1;}
-                if (tinyfd_winUtf8)
-                {
-                        p = openFileDialogWinGui8(lBuff,
-                                aTitle, aDefaultPathAndFile, aNumOfFilterPatterns,
-                                aFilterPatterns, aSingleFilterDescription, aAllowMultipleSelects);
-                }
-                else
-                {
-                        p = openFileDialogWinGuiA(lBuff,
-                                aTitle, aDefaultPathAndFile, aNumOfFilterPatterns,
-                                aFilterPatterns, aSingleFilterDescription, aAllowMultipleSelects);
-                }
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( dialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                p = openFileDialogWinConsole(lBuff,
-                                aTitle,aDefaultPathAndFile,aAllowMultipleSelects);
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-                p = tinyfd_inputBox(aTitle, "Open file","");
-        }
-
-        if ( ! p || ! strlen( p )  )
-        {
-                return NULL;
-        }
-        if ( aAllowMultipleSelects && strchr(p, '|') )
-        {
-                p = ensureFilesExist( lBuff , p ) ;
-        }
-        else if ( ! fileExists(p) )
-        {
-                return NULL ;
-        }
-        /* printf( "lBuff3: %s\n" , p ) ; */
-        return p ;
-}
-
-
-char const * tinyfd_selectFolderDialog(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aDefaultPath ) /* NULL or "" */
-{
-    static char lBuff [MAX_PATH_OR_CMD] ;
-        char const * p ;
-#ifndef TINYFD_NOLIB
-        if ( ( !tinyfd_forceConsole || !( GetConsoleWindow() || dialogPresent() ) )
-          && ( !getenv("SSH_CLIENT") || getenv("DISPLAY") ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return (char const *)1;}
-                if (tinyfd_winUtf8)
-                {
-#ifndef TINYFD_NOSELECTFOLDERWIN
-                        p = selectFolderDialogWinGui8(lBuff, aTitle, aDefaultPath);
-                }
-                else
-                {
-                        p = selectFolderDialogWinGuiA(lBuff, aTitle, aDefaultPath);
-#endif /*TINYFD_NOSELECTFOLDERWIN*/
-                }
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( dialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                p = selectFolderDialogWinConsole(lBuff,aTitle,aDefaultPath);
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-                p = tinyfd_inputBox(aTitle, "Select folder","");
-        }
-        
-        if ( ! p || ! strlen( p ) || ! dirExists( p ) )
-        {
-                return NULL ;
-        }
-        return p ;
-}
-
-
-/* returns the hexcolor as a string "#FF0000" */
-/* aoResultRGB also contains the result */
-/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
-/* aDefaultRGB and aoResultRGB can be the same array */
-char const * tinyfd_colorChooser(
-        char const * const aTitle, /* NULL or "" */
-        char const * const aDefaultHexRGB, /* NULL or "#FF0000"*/
-        unsigned char const aDefaultRGB[3], /* { 0 , 255 , 255 } */
-        unsigned char aoResultRGB[3]) /* { 0 , 0 , 0 } */
-{
-        char lDefaultHexRGB[8];
-        char * lpDefaultHexRGB;
-        int i;
-        char const * p ;
-
-#ifndef TINYFD_NOLIB
-        if ( (!tinyfd_forceConsole || !( GetConsoleWindow() || dialogPresent()) )
-          && (!getenv("SSH_CLIENT") || getenv("DISPLAY")) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"windows");return (char const *)1;}
-                if (tinyfd_winUtf8)
-                {
-                        return colorChooserWinGui8(
-                                aTitle, aDefaultHexRGB, aDefaultRGB, aoResultRGB);
-                }
-                else
-                {
-                        return colorChooserWinGuiA(
-                                aTitle, aDefaultHexRGB, aDefaultRGB, aoResultRGB);
-                }
-        }
-        else
-#endif /* TINYFD_NOLIB */
-        if ( aDefaultHexRGB )
-        {
-                lpDefaultHexRGB = (char *) aDefaultHexRGB ;
-        }
-        else
-        {
-                RGB2Hex( aDefaultRGB , lDefaultHexRGB ) ;
-                lpDefaultHexRGB = (char *) lDefaultHexRGB ;
-        }
-        p = tinyfd_inputBox(aTitle,
-                        "Enter hex rgb color (i.e. #f5ca20)",lpDefaultHexRGB);
-        if (aTitle&&!strcmp(aTitle,"tinyfd_query")) return p;
-
-        if ( !p || (strlen(p) != 7) || (p[0] != '#') )
-        {
-                return NULL ;
-        }
-        for ( i = 1 ; i < 7 ; i ++ )
-        {
-                if ( ! isxdigit( p[i] ) )
-                {
-                        return NULL ;
-                }
-        }
-        Hex2RGB(p,aoResultRGB);
-        return p ;
-}
-
-
-#else /* unix */
-
-static char gPython2Name[16];
-static char gPython3Name[16];
-static char gPythonName[16];
-
-static int isDarwin( )
-{
-        static int lsIsDarwin = -1 ;
-        struct utsname lUtsname ;
-        if ( lsIsDarwin < 0 )
-        {
-                lsIsDarwin = !uname(&lUtsname) && !strcmp(lUtsname.sysname,"Darwin") ;
-        }
-        return lsIsDarwin ;
-}
-
-
-static int dirExists( char const * const aDirPath )
-{
-        DIR * lDir ;
-        if ( ! aDirPath || ! strlen( aDirPath ) )
-                return 0 ;
-        lDir = opendir( aDirPath ) ;
-        if ( ! lDir )
-        {
-                return 0 ;
-        }
-        closedir( lDir ) ;
-        return 1 ;
-}
-
-                                                                        
-static int detectPresence( char const * const aExecutable )
-{
-        char lBuff [MAX_PATH_OR_CMD] ;
-        char lTestedString [MAX_PATH_OR_CMD] = "which " ;
-        FILE * lIn ;
-
-    strcat( lTestedString , aExecutable ) ;
-        strcat( lTestedString, " 2>/dev/null ");
-    lIn = popen( lTestedString , "r" ) ;
-    if ( ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                && ( ! strchr( lBuff , ':' ) )
-                && ( strncmp(lBuff, "no ", 3) ) )
-    {   /* present */
-        pclose( lIn ) ;
-        if (tinyfd_verbose) printf("detectPresence %s %d\n", aExecutable, 1);
-        return 1 ;
-    }
-    else
-    {
-        pclose( lIn ) ;
-        if (tinyfd_verbose) printf("detectPresence %s %d\n", aExecutable, 0);
-        return 0 ;
-    }
-}
-
-
-static char const * getVersion( char const * const aExecutable ) /*version # must follow :*/
-{
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char lTestedString [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        char * lTmp ;
-
-    strcpy( lTestedString , aExecutable ) ;
-    strcat( lTestedString , " --version" ) ;
-
-    lIn = popen( lTestedString , "r" ) ;
-        lTmp = fgets( lBuff , sizeof( lBuff ) , lIn ) ;
-        pclose( lIn ) ;
-    if ( ! lTmp || !(lTmp = strchr( lBuff , ':' )) ) return 0 ;
-        lTmp ++ ;
-        /* printf("lTmp %s\n", lTmp); */
-        return lTmp ;
-}
-
-
-static int tryCommand( char const * const aCommand )
-{
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-
-        lIn = popen( aCommand , "r" ) ;
-        if ( fgets( lBuff , sizeof( lBuff ) , lIn ) == NULL )
-        {       /* present */
-                pclose( lIn ) ;
-                return 1 ;
-        }
-        else
-        {
-                pclose( lIn ) ;
-                return 0 ;
-        }
-
-}
-
-
-static int isTerminalRunning()
-{
-        return isatty(1);
-}
-
-
-static char const * dialogNameOnly( )
-{
-        static char lDialogName[128] = "*" ;
-        if ( lDialogName[0] == '*' )
-        {
-                if ( isDarwin() && strcpy(lDialogName , "/opt/local/bin/dialog" )
-                        && detectPresence( lDialogName ) )
-                {}
-                else if ( strcpy(lDialogName , "dialog" )
-                        && detectPresence( lDialogName ) )
-                {}
-                else
-                {
-                        strcpy(lDialogName , "" ) ;
-                }
-        }
-    return lDialogName ;
-}
-
-
-int isDialogVersionBetter09b( )
-{
-        char const * lDialogName ;
-        char * lVersion ;
-        int lMajor ;
-        int lMinor ;
-        int lDate ;
-        int lResult ;
-        char * lMinorP ;
-        char * lLetter ;
-        char lBuff[128] ;
-
-        /*char lTest[128] = " 0.9b-20031126" ;*/
-
-        lDialogName = dialogNameOnly() ;
-        if ( ! strlen(lDialogName) || !(lVersion = (char *) getVersion(lDialogName)) ) return 0 ;
-        /*lVersion = lTest ;*/
-        /*printf("lVersion %s\n", lVersion);*/
-        strcpy(lBuff,lVersion);
-        lMajor = atoi( strtok(lVersion," ,.-") ) ;
-        /*printf("lMajor %d\n", lMajor);*/
-        lMinorP = strtok(0," ,.-abcdefghijklmnopqrstuvxyz");
-        lMinor = atoi( lMinorP ) ;
-        /*printf("lMinor %d\n", lMinor );*/
-        lDate = atoi( strtok(0," ,.-") ) ;
-        if (lDate<0) lDate = - lDate;
-        /*printf("lDate %d\n", lDate);*/
-        lLetter = lMinorP + strlen(lMinorP) ;
-        strcpy(lVersion,lBuff);
-        strtok(lLetter," ,.-");
-        /*printf("lLetter %s\n", lLetter);*/
-        lResult = (lMajor > 0) || ( ( lMinor == 9 ) && (*lLetter == 'b') && (lDate >= 20031126) );
-        /*printf("lResult %d\n", lResult);*/
-        return lResult;
-}
-
-
-static int whiptailPresentOnly( )
-{
-        static int lWhiptailPresent = -1 ;
-        if ( lWhiptailPresent < 0 )
-        {
-                lWhiptailPresent = detectPresence( "whiptail" ) ;
-        }
-        return lWhiptailPresent ;
-}
-
-
-static char const * terminalName( )
-{
-        static char lTerminalName[128] = "*" ;
-        char lShellName[64] = "*" ;
-
-        if ( lTerminalName[0] == '*' )
-        {
-                if ( detectPresence( "bash" ) )
-                {
-                        strcpy(lShellName , "bash -c " ) ; /*good for basic input*/
-                }
-        else if ( strlen(dialogNameOnly()) || whiptailPresentOnly() )
-        {
-                strcpy(lShellName , "sh -c " ) ; /*good enough for dialog & whiptail*/
-        }
-        else
-        {
-            return NULL ;
-        }
-
-                if ( isDarwin() )
-                {
-                        if ( strcpy(lTerminalName , "/opt/X11/bin/xterm" )
-                      && detectPresence( lTerminalName ) )
-                        {
-                                strcat(lTerminalName , " -fa 'DejaVu Sans Mono' -fs 10 -title tinyfiledialogs -e " ) ;
-                                strcat(lTerminalName , lShellName ) ;
-                        }
-                        else
-                        {
-                                strcpy(lTerminalName , "" ) ;
-                        }
-                }
-                else if ( strcpy(lTerminalName,"xterm") /*good (small without parameters)*/
-                        && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -fa 'DejaVu Sans Mono' -fs 10 -title tinyfiledialogs -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"terminator") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -x " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"lxterminal") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"konsole") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"kterm") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"xfce4-terminal") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -x " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"mate-terminal") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -x " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"Eterm") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"evilvte") /*good*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"pterm") /*good (only letters)*/
-                          && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " -e " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else if ( strcpy(lTerminalName,"gnome-terminal") /*bad (good if version < 3)*/
-                && detectPresence(lTerminalName) )
-                {
-                        strcat(lTerminalName , " --disable-factory -x " ) ;
-                        strcat(lTerminalName , lShellName ) ;
-                }
-                else
-                {
-                        strcpy(lTerminalName , "" ) ;
-                }
-                /* bad: koi rxterm guake tilda vala-terminal qterminal
-                aterm Terminal terminology sakura lilyterm weston-terminal
-                roxterm termit xvt rxvt mrxvt urxvt */
-        }
-        if ( strlen(lTerminalName) )
-        {
-                return lTerminalName ;
-        }
-        else
-        {
-                return NULL ;
-        }
-}
-
-
-static char const * dialogName( )
-{
-    char const * lDialogName ;
-    lDialogName = dialogNameOnly( ) ;
-        if ( strlen(lDialogName) && ( isTerminalRunning() || terminalName() ) )
-        {
-                return lDialogName ;
-        }
-        else
-        {
-                return NULL ;
-        }
-}
-
-
-static int whiptailPresent( )
-{
-        int lWhiptailPresent ;
-    lWhiptailPresent = whiptailPresentOnly( ) ;
-        if ( lWhiptailPresent && ( isTerminalRunning() || terminalName() ) )
-        {
-                return lWhiptailPresent ;
-        }
-        else
-        {
-                return 0 ;
-        }
-}
-
-
-
-static int graphicMode()
-{
-        return !( tinyfd_forceConsole && (isTerminalRunning() || terminalName()) )
-          && ( getenv("DISPLAY")
-            || (isDarwin() && (!getenv("SSH_TTY") || getenv("DISPLAY") ) ) ) ;
-}
-
-
-static int pactlPresent( )
-{
-        static int lPactlPresent = -1 ;
-        if ( lPactlPresent < 0 )
-        {
-                lPactlPresent = detectPresence("pactl") ;
-        }
-        return lPactlPresent ;
-}
-
-
-static int speakertestPresent( )
-{
-        static int lSpeakertestPresent = -1 ;
-        if ( lSpeakertestPresent < 0 )
-        {
-                lSpeakertestPresent = detectPresence("speaker-test") ;
-        }
-        return lSpeakertestPresent ;
-}
-
-
-static int beepexePresent( )
-{
-        static int lBeepexePresent = -1 ;
-        if ( lBeepexePresent < 0 )
-        {
-                lBeepexePresent = detectPresence("beep.exe") ;
-        }
-        return lBeepexePresent ;
-}
-
-
-static int xmessagePresent( )
-{
-        static int lXmessagePresent = -1 ;
-        if ( lXmessagePresent < 0 )
-        {
-                lXmessagePresent = detectPresence("xmessage");/*if not tty,not on osxpath*/
-        }
-        return lXmessagePresent && graphicMode( ) ;
-}
-
-
-static int gxmessagePresent( )
-{
-    static int lGxmessagePresent = -1 ;
-    if ( lGxmessagePresent < 0 )
-    {
-        lGxmessagePresent = detectPresence("gxmessage") ;
-    }
-    return lGxmessagePresent && graphicMode( ) ;
-}
-
-
-static int gmessagePresent( )
-{
-        static int lGmessagePresent = -1 ;
-        if ( lGmessagePresent < 0 )
-        {
-                lGmessagePresent = detectPresence("gmessage") ;
-        }
-        return lGmessagePresent && graphicMode( ) ;
-}
-
-
-static int notifysendPresent( )
-{
-    static int lNotifysendPresent = -1 ;
-    if ( lNotifysendPresent < 0 )
-    {
-        lNotifysendPresent = detectPresence("notify-send") ;
-    }
-    return lNotifysendPresent && graphicMode( ) ;
-}
-
-
-static int perlPresent( )
-{
-        static int lPerlPresent = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-
-        if ( lPerlPresent < 0 )
-        {
-                lPerlPresent = detectPresence("perl") ;
-                if ( lPerlPresent )
-                {
-                        lIn = popen( "perl -MNet::DBus -e \"Net::DBus->session->get_service('org.freedesktop.Notifications')\" 2>&1" , "r" ) ;
-                        if ( fgets( lBuff , sizeof( lBuff ) , lIn ) == NULL )
-                        {
-                                lPerlPresent = 2 ;
-                        }
-                        pclose( lIn ) ;
-                        if (tinyfd_verbose) printf("perl-dbus %d\n", lPerlPresent);
-                }
-    }
-    return graphicMode() ? lPerlPresent : 0 ;
-}
-
-
-static int afplayPresent( )
-{
-        static int lAfplayPresent = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-
-        if ( lAfplayPresent < 0 )
-        {
-                lAfplayPresent = detectPresence("afplay") ;
-                if ( lAfplayPresent )
-                {
-                        lIn = popen( "test -e /System/Library/Sounds/Ping.aiff || echo Ping" , "r" ) ;
-                        if ( fgets( lBuff , sizeof( lBuff ) , lIn ) == NULL )
-                        {
-                                lAfplayPresent = 2 ;
-                        }
-                        pclose( lIn ) ;
-                        if (tinyfd_verbose) printf("afplay %d\n", lAfplayPresent);
-                }
-        }
-        return graphicMode() ? lAfplayPresent : 0 ;
-}
-
-
-static int xdialogPresent( )
-{
-    static int lXdialogPresent = -1 ;
-    if ( lXdialogPresent < 0 )
-    {
-        lXdialogPresent = detectPresence("Xdialog") ;
-    }
-    return lXdialogPresent && graphicMode( ) ;
-}
-
-
-static int gdialogPresent( )
-{
-    static int lGdialoglPresent = -1 ;
-    if ( lGdialoglPresent < 0 )
-    {
-        lGdialoglPresent = detectPresence( "gdialog" ) ;
-    }
-    return lGdialoglPresent && graphicMode( ) ;
-}
-
-
-static int osascriptPresent( )
-{
-    static int lOsascriptPresent = -1 ;
-    if ( lOsascriptPresent < 0 )
-    {
-                gWarningDisplayed |= !!getenv("SSH_TTY");
-                lOsascriptPresent = detectPresence( "osascript" ) ;
-    }
-        return lOsascriptPresent && graphicMode() && !getenv("SSH_TTY") ;
-}
-
-
-static int kdialogPresent( )
-{
-        static int lKdialogPresent = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-
-        if ( lKdialogPresent < 0 )
-        {
-                lKdialogPresent = detectPresence("kdialog") ;
-                if ( lKdialogPresent && !getenv("SSH_TTY") )
-                {
-                        lIn = popen( "kdialog --attach 2>&1" , "r" ) ;
-                        if ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                        {
-                                if ( ! strstr( "Unknown" , lBuff ) )
-                                {
-                                        lKdialogPresent = 2 ;
-                                        if (tinyfd_verbose) printf("kdialog-attach %d\n", lKdialogPresent);
-                                }
-                        }
-                        pclose( lIn ) ;
-
-                        if (lKdialogPresent == 2)
-                        {
-                                lKdialogPresent = 1 ;
-                                lIn = popen( "kdialog --passivepopup 2>&1" , "r" ) ;
-                                if ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                                {
-                                        if ( ! strstr( "Unknown" , lBuff ) )
-                                        {
-                                                lKdialogPresent = 2 ;
-                                                if (tinyfd_verbose) printf("kdialog-popup %d\n", lKdialogPresent);
-                                        }
-                                }
-                                pclose( lIn ) ;
-                        }
-                }
-        }
-        return graphicMode() ? lKdialogPresent : 0 ;
-}
-
-
-static int qarmaPresent( )
-{
-        static int lQarmaPresent = -1 ;
-        if ( lQarmaPresent < 0 )
-        {
-                lQarmaPresent = detectPresence("qarma") ;
-        }
-        return lQarmaPresent && graphicMode( ) ;
-}
-
-
-static int matedialogPresent( )
-{
-        static int lMatedialogPresent = -1 ;
-        if ( lMatedialogPresent < 0 )
-        {
-                lMatedialogPresent = detectPresence("matedialog") ;
-        }
-        return lMatedialogPresent && graphicMode( ) ;
-}
-
-
-static int shellementaryPresent( )
-{
-        static int lShellementaryPresent = -1 ;
-        if ( lShellementaryPresent < 0 )
-        {
-                lShellementaryPresent = 0 ; /*detectPresence("shellementary"); shellementary is not ready yet */
-        }
-        return lShellementaryPresent && graphicMode( ) ;
-}
-
-
-static int zenityPresent( )
-{
-        static int lZenityPresent = -1 ;
-        if ( lZenityPresent < 0 )
-        {
-                lZenityPresent = detectPresence("zenity") ;
-        }
-        return lZenityPresent && graphicMode( ) ;
-}
-
-
-static int zenity3Present()
-{
-        static int lZenity3Present = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-
-        if ( lZenity3Present < 0 )
-        {
-                lZenity3Present = 0 ;
-                if ( zenityPresent() )
-                {
-                        lIn = popen( "zenity --version" , "r" ) ;
-                        if ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                        {
-                                if ( atoi(lBuff) >= 3 )
-                                {
-                                        lZenity3Present = 3 ;
-                                        if ( atoi(strtok(lBuff,".")+2 ) >= 10 )
-                                        {
-                                                lZenity3Present = 4 ;
-                                        }
-                                }
-                                else if ( ( atoi(lBuff) == 2 ) && ( atoi(strtok(lBuff,".")+2 ) >= 32 ) )
-                                {
-                                        lZenity3Present = 2 ;
-                                }
-                                if (tinyfd_verbose) printf("zenity %d\n", lZenity3Present);
-                        }
-                        pclose( lIn ) ;
-                }
-        }
-        return graphicMode() ? lZenity3Present : 0 ;
-}
-
-
-static int osx9orBetter( )
-{
-        static int lOsx9orBetter = -1 ;
-        char lBuff [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        int V,v;
-
-        if ( lOsx9orBetter < 0 )
-        {
-                lOsx9orBetter = 0 ;
-                lIn = popen( "osascript -e 'set osver to system version of (system info)'" , "r" ) ;
-                if ( ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-                        && ( 2 == sscanf(lBuff, "%d.%d", &V, &v) ) )
-                {
-                        V = V * 100 + v;
-                        if ( V >= 1009 )
-                        {
-                                lOsx9orBetter = 1 ;
-                        }
-                }
-                pclose( lIn ) ;
-                if (tinyfd_verbose) printf("Osx10 = %d, %d = %s\n", lOsx9orBetter, V, lBuff) ; 
-        }
-        return lOsx9orBetter ;
-}
-
-
-static int python2Present( )
-{
-    static int lPython2Present = -1 ;
-        int i;
-
-        if ( lPython2Present < 0 )
-        {
-                lPython2Present = 0 ;
-                strcpy(gPython2Name , "python2" ) ;
-                if ( detectPresence(gPython2Name) ) lPython2Present = 1;
-                else
-                {
-                        for ( i = 9 ; i >= 0 ; i -- )
-                        {
-                                sprintf( gPython2Name , "python2.%d" , i ) ;
-                                if ( detectPresence(gPython2Name) )
-                                {
-                                        lPython2Present = 1;
-                                        break;
-                                }
-                        }
-                        /*if ( ! lPython2Present )
-                        {
-                                strcpy(gPython2Name , "python" ) ;
-                                if ( detectPresence(gPython2Name) ) lPython2Present = 1;
-                        }*/
-                }
-                if (tinyfd_verbose) printf("lPython2Present %d\n", lPython2Present) ;
-                if (tinyfd_verbose) printf("gPython2Name %s\n", gPython2Name) ;
-        }
-        return lPython2Present ;
-}
-
-
-static int python3Present( )
-{
-        static int lPython3Present = -1 ;
-        int i;
-
-        if ( lPython3Present < 0 )
-        {
-                lPython3Present = 0 ;
-                strcpy(gPython3Name , "python3" ) ;
-                if ( detectPresence(gPython3Name) ) lPython3Present = 1;
-                else
-                {
-                        for ( i = 9 ; i >= 0 ; i -- )
-                        {
-                                sprintf( gPython3Name , "python3.%d" , i ) ;
-                                if ( detectPresence(gPython3Name) )
-                                {
-                                        lPython3Present = 1;
-                                        break;
-                                }
-                        }
-                        /*if ( ! lPython3Present )
-                        {
-                                strcpy(gPython3Name , "python" ) ;
-                                if ( detectPresence(gPython3Name) ) lPython3Present = 1;
-                        }*/
-                }
-                if (tinyfd_verbose) printf("lPython3Present %d\n", lPython3Present) ;
-                if (tinyfd_verbose) printf("gPython3Name %s\n", gPython3Name) ;
-        }
-        return lPython3Present ;
-}
-
-
-static int tkinter2Present( )
-{
-    static int lTkinter2Present = -1 ;
-        char lPythonCommand[256];
-        char lPythonParams[256] =
-"-S -c \"try:\n\timport Tkinter;\nexcept:\n\tprint 0;\"";
-
-
-        if ( lTkinter2Present < 0 )
-        {
-                lTkinter2Present = 0 ;
-                if ( python2Present() )
-        {
-                    sprintf( lPythonCommand , "%s %s" , gPython2Name , lPythonParams ) ;
-                    lTkinter2Present = tryCommand(lPythonCommand) ;
-                }
-                if (tinyfd_verbose) printf("lTkinter2Present %d\n", lTkinter2Present) ;
-        }
-        return lTkinter2Present && graphicMode() && !(isDarwin() && getenv("SSH_TTY") );
-}
-
-
-static int tkinter3Present( )
-{
-        static int lTkinter3Present = -1 ;
-        char lPythonCommand[256];
-        char lPythonParams[256] =
-                "-S -c \"try:\n\timport tkinter;\nexcept:\n\tprint(0);\"";
-
-        if ( lTkinter3Present < 0 )
-        {
-                lTkinter3Present = 0 ;
-                if ( python3Present() )
-                {
-                        sprintf( lPythonCommand , "%s %s" , gPython3Name , lPythonParams ) ;
-                        lTkinter3Present = tryCommand(lPythonCommand) ;
-                }
-                if (tinyfd_verbose) printf("lTkinter3Present %d\n", lTkinter3Present) ;
-        }
-        return lTkinter3Present && graphicMode() && !(isDarwin() && getenv("SSH_TTY") );
-}
-
-
-static int pythonDbusPresent( )
-{
-    static int lDbusPresent = -1 ;
-        char lPythonCommand[256];
-        char lPythonParams[256] =
-"-c \"try:\n\timport dbus;bus=dbus.SessionBus();\
-notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');\
-notify=dbus.Interface(notif,'org.freedesktop.Notifications');\nexcept:\n\tprint(0);\"";
-
-        if ( lDbusPresent < 0 )
-        {
-                lDbusPresent = 0 ;
-                if ( python2Present() )
-                {
-                        strcpy(gPythonName , gPython2Name ) ;
-                        sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
-                        lDbusPresent = tryCommand(lPythonCommand) ;
-                }
-
-                if ( ! lDbusPresent && python3Present() )
-                {
-                        strcpy(gPythonName , gPython3Name ) ;
-                        sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
-                        lDbusPresent = tryCommand(lPythonCommand) ;
-                }
-
-                if (tinyfd_verbose) printf("lDbusPresent %d\n", lDbusPresent) ;
-                if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ;
-        }
-        return lDbusPresent && graphicMode() && !(isDarwin() && getenv("SSH_TTY") );
-}
-
-
-static void sigHandler(int sig)
-{
-        FILE * lIn ;
-        if ( ( lIn = popen( "pactl unload-module module-sine" , "r" ) ) )
-        {
-                pclose( lIn ) ;
-        }
-}
-
-void tinyfd_beep()
-{
-        char lDialogString [256] ;
-        FILE * lIn ;
-
-        if ( osascriptPresent() )
-        {
-                if ( afplayPresent() >= 2 )
-                {
-                        strcpy( lDialogString , "afplay /System/Library/Sounds/Ping.aiff") ;
-                }
-                else
-                {
-                        strcpy( lDialogString , "osascript -e 'tell application \"System Events\" to beep'") ;
-                }
-        }
-        else if ( pactlPresent() ) 
-        {
-                signal(SIGINT, sigHandler);
-                /*strcpy( lDialogString , "pactl load-module module-sine frequency=440;sleep .3;pactl unload-module module-sine" ) ;*/
-                strcpy( lDialogString , "thnum=$(pactl load-module module-sine frequency=440);sleep .3;pactl unload-module $thnum" ) ;
-        }
-        else if ( speakertestPresent() ) 
-        {
-                /*strcpy( lDialogString , "timeout -k .3 .3 speaker-test --frequency 440 --test sine > /dev/tty" ) ;*/
-                strcpy( lDialogString , "( speaker-test -t sine -f 440 > /dev/tty )& pid=$!;sleep .3; kill -9 $pid" ) ;
-        }
-        else if ( beepexePresent() ) 
-        {
-                strcpy( lDialogString , "beep.exe 440 300" ) ;
-        }
-        else
-        {
-                strcpy( lDialogString , "printf '\a' > /dev/tty" ) ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-
-        if ( ( lIn = popen( lDialogString , "r" ) ) )
-        {
-                pclose( lIn ) ;
-        }
-
-        if ( pactlPresent() )
-        {
-                signal(SIGINT, SIG_DFL);
-        }
-}
-
-
-int tinyfd_messageBox(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or ""  may contain \n and \t */
-        char const * const aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
-        char const * const aIconType , /* "info" "warning" "error" "question" */
-        int const aDefaultButton ) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-{
-        char lBuff [MAX_PATH_OR_CMD] ;
-        char * lDialogString = NULL ;
-        char * lpDialogString;
-        FILE * lIn ;
-        int lWasGraphicDialog = 0 ;
-        int lWasXterm = 0 ;
-        int lResult ;
-        char lChar ;
-        struct termios infoOri;
-        struct termios info;
-        size_t lTitleLen ;
-        size_t lMessageLen ;
-
-        lBuff[0]='\0';
-
-        lTitleLen =  aTitle ? strlen(aTitle) : 0 ;
-        lMessageLen =  aMessage ? strlen(aMessage) : 0 ;
-        if ( !aTitle || strcmp(aTitle,"tinyfd_query") )
-        {
-                lDialogString = (char *) malloc( MAX_PATH_OR_CMD + lTitleLen + lMessageLen );
-        }
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return 1;}
-
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e 'set {vButton} to {button returned} of ( display dialog \"") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage) ;
-                }
-                strcat(lDialogString, "\" ") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "with title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-                strcat(lDialogString, "with icon ") ;
-                if ( aIconType && ! strcmp( "error" , aIconType ) )
-                {
-                        strcat(lDialogString, "stop " ) ;
-                }
-                else if ( aIconType && ! strcmp( "warning" , aIconType ) )
-                {
-                        strcat(lDialogString, "caution " ) ;
-                }
-                else /* question or info */
-                {
-                        strcat(lDialogString, "note " ) ;
-                }
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                        if ( ! aDefaultButton )
-                        {
-                                strcat( lDialogString ,"default button \"Cancel\" " ) ;
-                        }
-                }
-                else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-                {
-                        strcat( lDialogString ,"buttons {\"No\", \"Yes\"} " ) ;
-                        if (aDefaultButton) 
-                        {
-                                strcat( lDialogString ,"default button \"Yes\" " ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString ,"default button \"No\" " ) ;
-                        }
-                        strcat( lDialogString ,"cancel button \"No\"" ) ;
-                }
-                else if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString ,"buttons {\"No\", \"Yes\", \"Cancel\"} " ) ;
-                        switch (aDefaultButton) 
-                        {
-                                case 1: strcat( lDialogString ,"default button \"Yes\" " ) ; break;
-                                case 2: strcat( lDialogString ,"default button \"No\" " ) ; break;
-                                case 0: strcat( lDialogString ,"default button \"Cancel\" " ) ; break;
-                        }
-                        strcat( lDialogString ,"cancel button \"Cancel\"" ) ;
-                }
-                else
-                {
-                        strcat( lDialogString ,"buttons {\"OK\"} " ) ;
-                        strcat( lDialogString ,"default button \"OK\" " ) ;
-                }
-                strcat( lDialogString, ")' ") ;
-
-                strcat( lDialogString,
-"-e 'if vButton is \"Yes\" then' -e 'return 1'\
- -e 'else if vButton is \"OK\" then' -e 'return 1'\
- -e 'else if vButton is \"No\" then' -e 'return 2'\
- -e 'else' -e 'return 0' -e 'end if' " );
-
-                strcat( lDialogString, "-e 'on error number -128' " ) ;
-                strcat( lDialogString, "-e '0' " );
-
-                strcat( lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return 1;}
-
-                strcpy( lDialogString , "kdialog" ) ;
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-
-                strcat( lDialogString , " --" ) ;
-                if ( aDialogType && ( ! strcmp( "okcancel" , aDialogType )
-                        || ! strcmp( "yesno" , aDialogType ) || ! strcmp( "yesnocancel" , aDialogType ) ) )
-                {
-                        if ( aIconType && ( ! strcmp( "warning" , aIconType )
-                                || ! strcmp( "error" , aIconType ) ) )
-                        {
-                                strcat( lDialogString , "warning" ) ;
-                        }
-                        if ( ! strcmp( "yesnocancel" , aDialogType ) )
-                        {
-                                strcat( lDialogString , "yesnocancel" ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "yesno" ) ;
-                        }
-                }
-                else if ( aIconType && ! strcmp( "error" , aIconType ) )
-                {
-                        strcat( lDialogString , "error" ) ;
-                }
-                else if ( aIconType && ! strcmp( "warning" , aIconType ) )
-                {
-                        strcat( lDialogString , "sorry" ) ;
-                }
-                else
-                {
-                        strcat( lDialogString , "msgbox" ) ;
-                }
-                strcat( lDialogString , " \"" ) ;
-                if ( aMessage )
-                {
-                        strcat( lDialogString , aMessage ) ;
-                }
-                strcat( lDialogString , "\"" ) ;
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                        strcat( lDialogString ,
-                                " --yes-label Ok --no-label Cancel" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-
-                if ( ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString , "; x=$? ;if [ $x = 0 ] ;then echo 1;elif [ $x = 1 ] ;then echo 2;else echo 0;fi");
-                }
-                else
-                {
-                        strcat( lDialogString , ";if [ $? = 0 ];then echo 1;else echo 0;fi");
-                }
-        }
-        else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
-                        strcpy( lDialogString , "szAnswer=$(zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
-                        strcpy( lDialogString , "szAnswer=$(matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return 1;}
-                        strcpy( lDialogString , "szAnswer=$(shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
-                        strcpy( lDialogString , "szAnswer=$(qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat(lDialogString, " --"); 
-
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                                strcat( lDialogString ,
-                                                "question --ok-label=Ok --cancel-label=Cancel" ) ;
-                }
-                else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-                {
-                                strcat( lDialogString , "question" ) ;
-                }
-                else if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString , "list --column \"\" --hide-header \"Yes\" \"No\"" ) ;
-                }
-                else if ( aIconType && ! strcmp( "error" , aIconType ) )
-                {
-                    strcat( lDialogString , "error" ) ;
-                }
-                else if ( aIconType && ! strcmp( "warning" , aIconType ) )
-                {
-                    strcat( lDialogString , "warning" ) ;
-                }
-                else
-                {
-                    strcat( lDialogString , "info" ) ;
-                }
-                if ( aTitle && strlen(aTitle) ) 
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aMessage && strlen(aMessage) ) 
-                {
-                        strcat(lDialogString, " --text=\"") ;
-                        strcat(lDialogString, aMessage) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( (zenity3Present() >= 3) || (!zenityPresent() && (shellementaryPresent() || qarmaPresent()) ) )
-                {
-                        strcat( lDialogString , " --icon-name=dialog-" ) ;
-                        if ( aIconType && (! strcmp( "question" , aIconType )
-                          || ! strcmp( "error" , aIconType )
-                          || ! strcmp( "warning" , aIconType ) ) )
-                        {
-                                strcat( lDialogString , aIconType ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "information" ) ;
-                        }
-                }
-
-                if ( ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString ,
-");if [ $? = 1 ];then echo 0;elif [ $szAnswer = \"No\" ];then echo 2;else echo 1;fi");
-                }
-                else
-                {
-                        strcat( lDialogString , ");if [ $? = 0 ];then echo 1;else echo 0;fi");
-                }
-        }
-        else if ( !gxmessagePresent() && !gmessagePresent() && !gdialogPresent() && !xdialogPresent() && tkinter2Present() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return 1;}
-
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ) )
-                {
-                        strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-                
-                strcat( lDialogString ,
-" -S -c \"import Tkinter,tkMessageBox;root=Tkinter.Tk();root.withdraw();");
-                
-                if ( isDarwin( ) )
-                {
-                        strcat( lDialogString ,
-"import os;os.system('''/usr/bin/osascript -e 'tell app \\\"Finder\\\" to set \
-frontmost of process \\\"Python\\\" to true' ''');");
-                }
-
-                strcat( lDialogString ,"res=tkMessageBox." ) ;
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                  strcat( lDialogString , "askokcancel(" ) ;
-                  if ( aDefaultButton )
-                        {
-                                strcat( lDialogString , "default=tkMessageBox.OK," ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "default=tkMessageBox.CANCEL," ) ;
-                        }
-                }
-                else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-                {
-                        strcat( lDialogString , "askyesno(" ) ;
-                        if ( aDefaultButton )
-                        {
-                                strcat( lDialogString , "default=tkMessageBox.YES," ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "default=tkMessageBox.NO," ) ;
-                        }
-                }
-                else if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString , "askyesnocancel(" ) ;
-                        switch ( aDefaultButton )
-                        {
-                                case 1: strcat( lDialogString , "default=tkMessageBox.YES," ); break;
-                                case 2: strcat( lDialogString , "default=tkMessageBox.NO," ); break;
-                                case 0: strcat( lDialogString , "default=tkMessageBox.CANCEL," ); break;
-                        }
-                }
-                else
-                {
-                                strcat( lDialogString , "showinfo(" ) ;
-                }
-
-                strcat( lDialogString , "icon='" ) ;
-                if ( aIconType && (! strcmp( "question" , aIconType )
-                  || ! strcmp( "error" , aIconType )
-                  || ! strcmp( "warning" , aIconType ) ) )
-                {
-                                strcat( lDialogString , aIconType ) ;
-                }
-                else
-                {
-                                strcat( lDialogString , "info" ) ;
-                }
-                
-                strcat(lDialogString, "',") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                                strcat(lDialogString, "title='") ;
-                                strcat(lDialogString, aTitle) ;
-                                strcat(lDialogString, "',") ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, "message='") ;
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                        strcat(lDialogString, "'") ;
-                }
-
-                if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat(lDialogString, ");\n\
-if res is None :\n\tprint 0\n\
-elif res is False :\n\tprint 2\n\
-else :\n\tprint 1\n\"" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString, ");\n\
-if res is False :\n\tprint 0\n\
-else :\n\tprint 1\n\"" ) ;
-                }
-    }
-        else if ( !gxmessagePresent() && !gmessagePresent() && !gdialogPresent() && !xdialogPresent() && tkinter3Present() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return 1;}
-
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter;from tkinter import messagebox;root=tkinter.Tk();root.withdraw();");
-
-                strcat( lDialogString ,"res=messagebox." ) ;
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                        strcat( lDialogString , "askokcancel(" ) ;
-                        if ( aDefaultButton )
-                        {
-                                strcat( lDialogString , "default=messagebox.OK," ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "default=messagebox.CANCEL," ) ;
-                        }
-                }
-                else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-                {
-                        strcat( lDialogString , "askyesno(" ) ;
-                        if ( aDefaultButton )
-                        {
-                                strcat( lDialogString , "default=messagebox.YES," ) ;
-                        }
-                        else
-                        {
-                                strcat( lDialogString , "default=messagebox.NO," ) ;
-                        }
-                }
-                else if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat( lDialogString , "askyesnocancel(" ) ;
-                        switch ( aDefaultButton )
-                        {
-                        case 1: strcat( lDialogString , "default=messagebox.YES," ); break;
-                        case 2: strcat( lDialogString , "default=messagebox.NO," ); break;
-                        case 0: strcat( lDialogString , "default=messagebox.CANCEL," ); break;
-                        }
-                }
-                else
-                {
-                        strcat( lDialogString , "showinfo(" ) ;
-                }
-
-                strcat( lDialogString , "icon='" ) ;
-                if ( aIconType && (! strcmp( "question" , aIconType )
-                        || ! strcmp( "error" , aIconType )
-                        || ! strcmp( "warning" , aIconType ) ) )
-                {
-                        strcat( lDialogString , aIconType ) ;
-                }
-                else
-                {
-                        strcat( lDialogString , "info" ) ;
-                }
-
-                strcat(lDialogString, "',") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, "message='") ;
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                        strcat(lDialogString, "'") ;
-                }
-
-                if ( aDialogType && ! strcmp( "yesnocancel" , aDialogType ) )
-                {
-                        strcat(lDialogString, ");\n\
-if res is None :\n\tprint(0)\n\
-elif res is False :\n\tprint(2)\n\
-else :\n\tprint 1\n\"" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString, ");\n\
-if res is False :\n\tprint(0)\n\
-else :\n\tprint(1)\n\"" ) ;
-                }
-        }
-        else if ( gxmessagePresent() || gmessagePresent() || (!gdialogPresent() && !xdialogPresent() && xmessagePresent()) )
-        {
-                if ( gxmessagePresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gxmessage");return 1;}
-                        strcpy( lDialogString , "gxmessage");
-                }
-                else if ( gmessagePresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gmessage");return 1;}
-                        strcpy( lDialogString , "gmessage");
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xmessage");return 1;}
-                        strcpy( lDialogString , "xmessage");
-                }
-
-                if ( aDialogType && ! strcmp("okcancel" , aDialogType) )
-                {
-                        strcat( lDialogString , " -buttons Ok:1,Cancel:0");
-                        switch ( aDefaultButton )
-                        {
-                                case 1: strcat( lDialogString , " -default Ok"); break;
-                                case 0: strcat( lDialogString , " -default Cancel"); break;
-                        }
-                }
-                else if ( aDialogType && ! strcmp("yesno" , aDialogType) )
-                {
-                        strcat( lDialogString , " -buttons Yes:1,No:0");
-                        switch ( aDefaultButton )
-                        {
-                                case 1: strcat( lDialogString , " -default Yes"); break;
-                                case 0: strcat( lDialogString , " -default No"); break;
-                        }
-                }
-                else if ( aDialogType && ! strcmp("yesnocancel" , aDialogType) )
-                {
-                        strcat( lDialogString , " -buttons Yes:1,No:2,Cancel:0");
-                        switch ( aDefaultButton )
-                        {
-                                case 1: strcat( lDialogString , " -default Yes"); break;
-                                case 2: strcat( lDialogString , " -default No"); break;
-                                case 0: strcat( lDialogString , " -default Cancel"); break;
-                        }
-                }
-                else
-                {
-                        strcat( lDialogString , " -buttons Ok:1");
-                        strcat( lDialogString , " -default Ok");
-                }
-
-                strcat( lDialogString , " -center \"");
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat( lDialogString , aMessage ) ;
-                }
-                strcat(lDialogString, "\"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat( lDialogString , " -title  \"");
-                        strcat( lDialogString , aTitle ) ;
-                        strcat( lDialogString, "\"" ) ;
-                }
-                strcat( lDialogString , " ; echo $? ");
-        }
-        else if ( xdialogPresent() || gdialogPresent() || dialogName() || whiptailPresent() )
-        {
-                if ( gdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gdialog");return 1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(gdialog " ) ;
-                }
-                else if ( xdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return 1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(Xdialog " ) ;
-                }
-                else if ( dialogName( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return 0;}
-                        if ( isTerminalRunning( ) )
-                        {
-                                strcpy( lDialogString , "(dialog " ) ;
-                        }
-                        else
-                        {
-                                lWasXterm = 1 ;
-                                strcpy( lDialogString , terminalName() ) ;
-                                strcat( lDialogString , "'(" ) ;
-                                strcat( lDialogString , dialogName() ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                }
-                else if ( isTerminalRunning( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"whiptail");return 0;}
-                        strcpy( lDialogString , "(whiptail " ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"whiptail");return 0;}
-                        lWasXterm = 1 ;
-                        strcpy( lDialogString , terminalName() ) ;
-                        strcat( lDialogString , "'(whiptail " ) ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "--title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( !xdialogPresent() && !gdialogPresent() )
-                {
-                        if ( aDialogType && ( !strcmp( "okcancel" , aDialogType ) || !strcmp( "yesno" , aDialogType ) 
-                                || !strcmp( "yesnocancel" , aDialogType ) ) )
-                        {
-                                strcat(lDialogString, "--backtitle \"") ;
-                                strcat(lDialogString, "tab: move focus") ;
-                                strcat(lDialogString, "\" ") ;
-                        }
-                }
-
-                if ( aDialogType && ! strcmp( "okcancel" , aDialogType ) )
-                {
-                        if ( ! aDefaultButton )
-                        {
-                                strcat( lDialogString , "--defaultno " ) ;
-                        }
-                        strcat( lDialogString ,
-                                        "--yes-label \"Ok\" --no-label \"Cancel\" --yesno " ) ;
-                }
-                else if ( aDialogType && ! strcmp( "yesno" , aDialogType ) )
-                {
-                        if ( ! aDefaultButton )
-                        {
-                                strcat( lDialogString , "--defaultno " ) ;
-                        }
-                        strcat( lDialogString , "--yesno " ) ;
-                }
-                else if (aDialogType && !strcmp("yesnocancel", aDialogType))
-                {
-                        if (!aDefaultButton)
-                        {
-                                strcat(lDialogString, "--defaultno ");
-                        }
-                        strcat(lDialogString, "--menu ");
-                }
-                else
-                {
-                        strcat( lDialogString , "--msgbox " ) ;
-
-                }
-                strcat( lDialogString , "\"" ) ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage) ;
-                }
-                strcat(lDialogString, "\" ");
-
-                if ( lWasGraphicDialog )
-                {
-                        if (aDialogType && !strcmp("yesnocancel", aDialogType))
-                        {
-                                strcat(lDialogString,"0 60 0 Yes \"\" No \"\") 2>/tmp/tinyfd.txt;\
-if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
-tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
-                        }
-                        else
-                        {
-                                strcat(lDialogString,
-                                   "10 60 ) 2>&1;if [ $? = 0 ];then echo 1;else echo 0;fi");
-                        }
-                }
-                else
-                {
-                        if (aDialogType && !strcmp("yesnocancel", aDialogType))
-                        {
-                                strcat(lDialogString,"0 60 0 Yes \"\" No \"\" >/dev/tty ) 2>/tmp/tinyfd.txt;\
-                if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
-                tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
-
-                                if ( lWasXterm )
-                                {
-                                        strcat(lDialogString," >/tmp/tinyfd0.txt';cat /tmp/tinyfd0.txt");
-                                }
-                                else
-                                {
-                                        strcat(lDialogString, "; clear >/dev/tty") ;
-                                }
-                        }
-                        else
-                        {
-                                strcat(lDialogString, "10 60 >/dev/tty) 2>&1;if [ $? = 0 ];");
-                                if ( lWasXterm )
-                                {
-                                        strcat( lDialogString ,
-"then\n\techo 1\nelse\n\techo 0\nfi >/tmp/tinyfd.txt';cat /tmp/tinyfd.txt;rm /tmp/tinyfd.txt");
-                                }
-                                else
-                                {
-                                   strcat(lDialogString,
-                                                  "then echo 1;else echo 0;fi;clear >/dev/tty");
-                                }
-                        }
-                }
-        }
-        else if (  isTerminalRunning( ) && terminalName() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return 0;}
-                strcpy( lDialogString , terminalName() ) ;
-                strcat( lDialogString , "'" ) ;
-                if ( !gWarningDisplayed && !tinyfd_forceConsole)
-                {
-                        gWarningDisplayed = 1 ;
-                        strcat( lDialogString , "echo \"" ) ;
-                        strcat( lDialogString, gTitle) ;
-                        strcat( lDialogString , "\";" ) ;
-                        strcat( lDialogString , "echo \"" ) ;
-                        strcat( lDialogString, tinyfd_needs) ;
-                        strcat( lDialogString , "\";echo;echo;" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat( lDialogString , "echo \"" ) ;
-                        strcat( lDialogString, aTitle) ;
-                        strcat( lDialogString , "\";echo;" ) ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat( lDialogString , "echo \"" ) ;
-                        strcat( lDialogString, aMessage) ;
-                        strcat( lDialogString , "\"; " ) ;
-                }
-                if ( aDialogType && !strcmp("yesno",aDialogType) )
-                {
-                        strcat( lDialogString , "echo -n \"y/n: \"; " ) ;
-                        strcat( lDialogString , "stty sane -echo;" ) ;
-                        strcat( lDialogString ,
-                                "answer=$( while ! head -c 1 | grep -i [ny];do true ;done);");
-                        strcat( lDialogString ,
-                                "if echo \"$answer\" | grep -iq \"^y\";then\n");
-                        strcat( lDialogString , "\techo 1\nelse\n\techo 0\nfi" ) ;
-                }
-                else if ( aDialogType && !strcmp("okcancel",aDialogType) )
-                {
-                        strcat( lDialogString , "echo -n \"[O]kay/[C]ancel: \"; " ) ;
-                        strcat( lDialogString , "stty sane -echo;" ) ;
-                        strcat( lDialogString ,
-                                "answer=$( while ! head -c 1 | grep -i [oc];do true ;done);");
-                        strcat( lDialogString ,
-                                "if echo \"$answer\" | grep -iq \"^o\";then\n");
-                        strcat( lDialogString , "\techo 1\nelse\n\techo 0\nfi" ) ;
-                }
-                else if ( aDialogType && !strcmp("yesnocancel",aDialogType) )
-                {
-                        strcat( lDialogString , "echo -n \"[Y]es/[N]o/[C]ancel: \"; " ) ;
-                        strcat( lDialogString , "stty sane -echo;" ) ;
-                        strcat( lDialogString ,
-                                "answer=$( while ! head -c 1 | grep -i [nyc];do true ;done);");
-                        strcat( lDialogString ,
-                                "if echo \"$answer\" | grep -iq \"^y\";then\n\techo 1\n");
-                        strcat( lDialogString , "elif echo \"$answer\" | grep -iq \"^n\";then\n\techo 2\n" ) ;
-                        strcat( lDialogString , "else\n\techo 0\nfi" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString , "echo -n \"press enter to continue \"; ");
-                        strcat( lDialogString , "stty sane -echo;" ) ;
-                        strcat( lDialogString ,
-                                "answer=$( while ! head -c 1;do true ;done);echo 1");
-                }
-                strcat( lDialogString ,
-                        " >/tmp/tinyfd.txt';cat /tmp/tinyfd.txt;rm /tmp/tinyfd.txt");
-        }
-        else if ( !isTerminalRunning() && pythonDbusPresent() && !strcmp("ok" , aDialogType) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python-dbus");return 1;}
-                strcpy( lDialogString , gPythonName ) ;
-                strcat( lDialogString ," -c \"import dbus;bus=dbus.SessionBus();");
-                strcat( lDialogString ,"notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');" ) ;
-                strcat( lDialogString ,"notify=dbus.Interface(notif,'org.freedesktop.Notifications');" ) ;
-                strcat( lDialogString ,"notify.Notify('',0,'" ) ;
-                if ( aIconType && strlen(aIconType) )
-                {
-                        strcat( lDialogString , aIconType ) ;
-                }
-                strcat(lDialogString, "','") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                }
-                strcat(lDialogString, "','") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                }
-                strcat(lDialogString, "','','',5000)\"") ;
-        }
-        else if ( !isTerminalRunning() && (perlPresent() >= 2)  && !strcmp("ok" , aDialogType) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"perl-dbus");return 1;}
-
-                sprintf( lDialogString , "perl -e \"use Net::DBus;\
-                                                                 my \\$sessionBus = Net::DBus->session;\
-                                                                 my \\$notificationsService = \\$sessionBus->get_service('org.freedesktop.Notifications');\
-                                                                 my \\$notificationsObject = \\$notificationsService->get_object('/org/freedesktop/Notifications',\
-                                                                 'org.freedesktop.Notifications');\
-                                                                 my \\$notificationId;\\$notificationId = \\$notificationsObject->Notify(shift, 0, '%s', '%s', '%s', [], {}, -1);\" ",
-                                                                 aIconType?aIconType:"", aTitle?aTitle:"", aMessage?aMessage:"" ) ;
-        }
-        else if ( !isTerminalRunning() && notifysendPresent() && !strcmp("ok" , aDialogType) )
-        {
-
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"notifysend");return 1;}
-                strcpy( lDialogString , "notify-send" ) ;
-                if ( aIconType && strlen(aIconType) )
-                {
-                        strcat( lDialogString , " -i '" ) ;
-                        strcat( lDialogString , aIconType ) ;
-                        strcat( lDialogString , "'" ) ;
-                }
-        strcat( lDialogString , " \"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                        strcat( lDialogString , " | " ) ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-            replaceSubStr( aMessage , "\n\t" , " |  " , lBuff ) ;
-            replaceSubStr( aMessage , "\n" , " | " , lBuff ) ;
-            replaceSubStr( aMessage , "\t" , "  " , lBuff ) ;
-                        strcat(lDialogString, lBuff) ;
-                }
-                strcat( lDialogString , "\"" ) ;
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return 0;}
-                if ( !gWarningDisplayed && !tinyfd_forceConsole)
-                {
-                        gWarningDisplayed = 1 ;
-                        printf("\n\n%s\n", gTitle);
-                        printf("%s\n\n", tinyfd_needs);
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        printf("\n%s\n", aTitle);
-                }
-
-                tcgetattr(0, &infoOri);
-                tcgetattr(0, &info);
-                info.c_lflag &= ~ICANON;
-                info.c_cc[VMIN] = 1;
-                info.c_cc[VTIME] = 0;
-                tcsetattr(0, TCSANOW, &info);
-                if ( aDialogType && !strcmp("yesno",aDialogType) )
-                {
-                        do
-                        {
-                                if ( aMessage && strlen(aMessage) )
-                                {
-                                        printf("\n%s\n",aMessage);
-                                }
-                                printf("y/n: "); fflush(stdout);
-                                lChar = tolower( getchar() ) ;
-                                printf("\n\n");
-                        }
-                        while ( lChar != 'y' && lChar != 'n' );
-                        lResult = lChar == 'y' ? 1 : 0 ;
-                }
-                else if ( aDialogType && !strcmp("okcancel",aDialogType) )
-                {
-                        do
-                        {
-                                if ( aMessage && strlen(aMessage) )
-                                {
-                                        printf("\n%s\n",aMessage);
-                                }
-                                printf("[O]kay/[C]ancel: "); fflush(stdout);
-                                lChar = tolower( getchar() ) ;
-                                printf("\n\n");
-                        }
-                        while ( lChar != 'o' && lChar != 'c' );
-                        lResult = lChar == 'o' ? 1 : 0 ;
-                }
-                else if ( aDialogType && !strcmp("yesnocancel",aDialogType) )
-                {
-                        do
-                        {
-                                if ( aMessage && strlen(aMessage) )
-                                {
-                                        printf("\n%s\n",aMessage);
-                                }
-                                printf("[Y]es/[N]o/[C]ancel: "); fflush(stdout);
-                                lChar = tolower( getchar() ) ;
-                                printf("\n\n");
-                        }
-                        while ( lChar != 'y' && lChar != 'n' && lChar != 'c' );
-                        lResult = (lChar == 'y') ? 1 : (lChar == 'n') ? 2 : 0 ;
-                }
-                else
-                {
-                        if ( aMessage && strlen(aMessage) )
-                        {
-                                printf("\n%s\n\n",aMessage);
-                        }
-                        printf("press enter to continue "); fflush(stdout);
-                        getchar() ;
-                        printf("\n\n"); 
-                        lResult = 1 ;
-                }
-                tcsetattr(0, TCSANOW, &infoOri);
-                free(lDialogString);
-                return lResult ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-
-        if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-        {
-                free(lDialogString);
-                return 0 ;
-        }
-        while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-        {}
-
-        pclose( lIn ) ;
-
-        /* printf( "lBuff: %s len: %lu \n" , lBuff , strlen(lBuff) ) ; */
-        if ( lBuff[strlen( lBuff ) -1] == '\n' )
-        {
-                lBuff[strlen( lBuff ) -1] = '\0' ;
-        }
-        /* printf( "lBuff1: %s len: %lu \n" , lBuff , strlen(lBuff) ) ; */
-
-        if (aDialogType && !strcmp("yesnocancel", aDialogType)) 
-        {
-                if ( lBuff[0]=='1' )
-                { 
-                        if ( !strcmp( lBuff+1 , "Yes" )) strcpy(lBuff,"1");
-                        else if ( !strcmp( lBuff+1 , "No" )) strcpy(lBuff,"2");
-                }
-        }
-        /* printf( "lBuff2: %s len: %lu \n" , lBuff , strlen(lBuff) ) ; */
-
-        lResult =  !strcmp( lBuff , "2" ) ? 2 : !strcmp( lBuff , "1" ) ? 1 : 0;
-
-        /* printf( "lResult: %d\n" , lResult ) ; */
-        free(lDialogString);
-        return lResult ;
-}
-
-
-/* return has only meaning for tinyfd_query */
-int tinyfd_notifyPopup(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or ""  may contain \n and \t */
-        char const * const aIconType ) /* "info" "warning" "error" */
-{
-    char lBuff[MAX_PATH_OR_CMD];
-        char * lDialogString = NULL ;
-    char * lpDialogString ;
-        FILE * lIn ;
-        size_t lTitleLen ;
-        size_t lMessageLen ;
-
-        if ( getenv("SSH_TTY") )
-        {
-                return tinyfd_messageBox(aTitle, aMessage, "ok", aIconType, 0);
-        }
-
-        lTitleLen =  aTitle ? strlen(aTitle) : 0 ;
-        lMessageLen =  aMessage ? strlen(aMessage) : 0 ;
-        if ( !aTitle || strcmp(aTitle,"tinyfd_query") )
-        {
-                lDialogString = (char *) malloc( MAX_PATH_OR_CMD + lTitleLen + lMessageLen );
-        }
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return 1;}
-
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e 'display notification \"") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage) ;
-                }
-                strcat(lDialogString, " \" ") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "with title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-                
-                strcat( lDialogString, "' -e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return 1;}
-                strcpy( lDialogString , "kdialog" ) ;
-
-                if ( aIconType && strlen(aIconType) )
-                {
-                        strcat( lDialogString , " --icon '" ) ;
-                        strcat( lDialogString , aIconType ) ;
-                        strcat( lDialogString , "'" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat( lDialogString , " --title \"" ) ;
-                        strcat( lDialogString , aTitle ) ;
-                        strcat( lDialogString , "\"" ) ;
-                }
-
-                strcat( lDialogString , " --passivepopup" ) ;
-                strcat( lDialogString , " \"" ) ;
-                if ( aMessage )
-                {
-                        strcat( lDialogString , aMessage ) ;
-                }
-                strcat( lDialogString , " \" 5" ) ;
-        }
-        else if ( (zenity3Present()>=4) || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                /* zenity 2.32 has the notification but with a bug: it doesnt return from it */
-                /* zenity 3.8 show the notification as an alert ok cancel box */
-                if ( zenity3Present()>=3 )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
-                        strcpy( lDialogString , "zenity" ) ;
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return 1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                }
-
-                strcat( lDialogString , " --notification"); 
-
-                if ( aIconType && strlen( aIconType ) )
-                {
-                        strcat( lDialogString , " --window-icon '"); 
-                        strcat( lDialogString , aIconType ) ;
-                        strcat( lDialogString , "'" ) ;
-                }
-
-                strcat( lDialogString , " --text \"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\n") ;
-                }
-                if ( aMessage && strlen( aMessage ) )
-                {
-                        strcat( lDialogString , aMessage ) ;
-                }
-                strcat( lDialogString , " \"" ) ;
-        }
-        else if ( perlPresent() >= 2 )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"perl-dbus");return 1;}
-                sprintf( lDialogString , "perl -e \"use Net::DBus;\
-                                                                 my \\$sessionBus = Net::DBus->session;\
-                                                                 my \\$notificationsService = \\$sessionBus->get_service('org.freedesktop.Notifications');\
-                                                                 my \\$notificationsObject = \\$notificationsService->get_object('/org/freedesktop/Notifications',\
-                                                                 'org.freedesktop.Notifications');\
-                                                                 my \\$notificationId;\\$notificationId = \\$notificationsObject->Notify(shift, 0, '%s', '%s', '%s', [], {}, -1);\" ",
-                                                                 aIconType?aIconType:"", aTitle?aTitle:"", aMessage?aMessage:"" ) ;
-        }
-        else if ( pythonDbusPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python-dbus");return 1;}
-                strcpy( lDialogString , gPythonName ) ;
-                strcat( lDialogString ," -c \"import dbus;bus=dbus.SessionBus();");
-                strcat( lDialogString ,"notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');" ) ;
-                strcat( lDialogString ,"notify=dbus.Interface(notif,'org.freedesktop.Notifications');" ) ;
-                strcat( lDialogString ,"notify.Notify('',0,'" ) ;
-                if ( aIconType && strlen(aIconType) )
-                {
-                        strcat( lDialogString , aIconType ) ;
-                }
-                strcat(lDialogString, "','") ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                }
-                strcat(lDialogString, "','") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                }
-                strcat(lDialogString, "','','',5000)\"") ;
-        }
-        else if ( notifysendPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"notifysend");return 1;}
-                strcpy( lDialogString , "notify-send" ) ;
-                if ( aIconType && strlen(aIconType) )
-                {
-                        strcat( lDialogString , " -i '" ) ;
-                        strcat( lDialogString , aIconType ) ;
-                        strcat( lDialogString , "'" ) ;
-                }
-        strcat( lDialogString , " \"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                        strcat( lDialogString , " | " ) ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-            replaceSubStr( aMessage , "\n\t" , " |  " , lBuff ) ;
-            replaceSubStr( aMessage , "\n" , " | " , lBuff ) ;
-            replaceSubStr( aMessage , "\t" , "  " , lBuff ) ;
-                        strcat(lDialogString, lBuff) ;
-                }
-                strcat( lDialogString , "\"" ) ;
-        }
-        else
-        {
-                return tinyfd_messageBox(aTitle, aMessage, "ok", aIconType, 0);
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-
-        if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-        {
-                free(lDialogString);
-                return 0 ;
-        }
-
-        pclose( lIn ) ;
-        free(lDialogString);
-        return 1;
-}
-
-
-/* returns NULL on cancel */
-char const * tinyfd_inputBox(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aMessage , /* NULL or "" may NOT contain \n nor \t */
-        char const * const aDefaultInput ) /* "" , if NULL it's a passwordBox */
-{
-        static char lBuff[MAX_PATH_OR_CMD];
-        char * lDialogString = NULL;
-        char * lpDialogString;
-        FILE * lIn ;
-        int lResult ;
-        int lWasGdialog = 0 ;
-        int lWasGraphicDialog = 0 ;
-        int lWasXterm = 0 ;
-        int lWasBasicXterm = 0 ;
-        struct termios oldt ;
-        struct termios newt ;
-        char * lEOF;
-        size_t lTitleLen ;
-        size_t lMessageLen ;
-
-        lBuff[0]='\0';
-
-        lTitleLen =  aTitle ? strlen(aTitle) : 0 ;
-        lMessageLen =  aMessage ? strlen(aMessage) : 0 ;
-        if ( !aTitle || strcmp(aTitle,"tinyfd_query") )
-        {
-                lDialogString = (char *) malloc( MAX_PATH_OR_CMD + lTitleLen + lMessageLen );
-        }
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return (char const *)1;}
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e 'display dialog \"") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage) ;
-                }
-                strcat(lDialogString, "\" ") ;
-                strcat(lDialogString, "default answer \"") ;
-                if ( aDefaultInput && strlen(aDefaultInput) )
-                {
-                        strcat(lDialogString, aDefaultInput) ;
-                }
-                strcat(lDialogString, "\" ") ;
-                if ( ! aDefaultInput )
-                {
-                        strcat(lDialogString, "hidden answer true ") ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "with title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-                strcat(lDialogString, "with icon note' ") ;
-                strcat(lDialogString, "-e '\"1\" & text returned of result' " );
-                strcat(lDialogString, "-e 'on error number -128' " ) ;
-                strcat(lDialogString, "-e '0' " );
-                strcat(lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat(lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return (char const *)1;}
-                strcpy( lDialogString , "szAnswer=$(kdialog" ) ;
-
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-
-                if ( ! aDefaultInput )
-                {
-                        strcat(lDialogString, " --password ") ;
-                }
-                else
-                {
-                        strcat(lDialogString, " --inputbox ") ;
-
-                }
-                strcat(lDialogString, "\"") ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage ) ;
-                }
-                strcat(lDialogString , "\" \"" ) ;
-                if ( aDefaultInput && strlen(aDefaultInput) )
-                {
-                        strcat(lDialogString, aDefaultInput ) ;
-                }
-                strcat(lDialogString , "\"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                strcat( lDialogString ,
-                        ");if [ $? = 0 ];then echo 1$szAnswer;else echo 0$szAnswer;fi");
-        }
-        else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
-                        strcpy( lDialogString , "szAnswer=$(zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString ,  "szAnswer=$(matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "szAnswer=$(shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString ,  "szAnswer=$(qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat( lDialogString ," --entry" ) ;
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, " --text=\"") ;
-                        strcat(lDialogString, aMessage) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aDefaultInput && strlen(aDefaultInput) )
-                {
-                        strcat(lDialogString, " --entry-text=\"") ;
-                        strcat(lDialogString, aDefaultInput) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                else
-                {
-                        strcat(lDialogString, " --hide-text") ;
-                }
-                strcat( lDialogString ,
-                                ");if [ $? = 0 ];then echo 1$szAnswer;else echo 0$szAnswer;fi");
-        }
-        else if ( gxmessagePresent() || gmessagePresent() )
-        {
-                if ( gxmessagePresent() ) {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gxmessage");return (char const *)1;}
-                        strcpy( lDialogString , "szAnswer=$(gxmessage -buttons Ok:1,Cancel:0 -center \"");
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gmessage");return (char const *)1;}
-                        strcpy( lDialogString , "szAnswer=$(gmessage -buttons Ok:1,Cancel:0 -center \"");
-                }
-
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat( lDialogString , aMessage ) ;
-                }
-                strcat(lDialogString, "\"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat( lDialogString , " -title  \"");
-                        strcat( lDialogString , aTitle ) ;
-                        strcat(lDialogString, "\" " ) ;
-                }
-                strcat(lDialogString, " -entrytext \"" ) ;
-                if ( aDefaultInput && strlen(aDefaultInput) )
-                {
-                        strcat( lDialogString , aDefaultInput ) ;
-                }
-                strcat(lDialogString, "\"" ) ;
-                strcat( lDialogString , ");echo $?$szAnswer");
-        }
-        else if ( !gdialogPresent() && !xdialogPresent() && tkinter2Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ) )
-                {
-                strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-                
-                strcat( lDialogString ,
-" -S -c \"import Tkinter,tkSimpleDialog;root=Tkinter.Tk();root.withdraw();");
-                
-                if ( isDarwin( ) )
-                {
-                        strcat( lDialogString ,
-"import os;os.system('''/usr/bin/osascript -e 'tell app \\\"Finder\\\" to set \
-frontmost of process \\\"Python\\\" to true' ''');");
-                }
-                
-                strcat( lDialogString ,"res=tkSimpleDialog.askstring(" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-
-                        strcat(lDialogString, "prompt='") ;
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aDefaultInput )
-                {
-                        if ( strlen(aDefaultInput) )
-                        {
-                                strcat(lDialogString, "initialvalue='") ;
-                                strcat(lDialogString, aDefaultInput) ;
-                                strcat(lDialogString, "',") ;
-                        }
-                }
-                else
-                {
-                        strcat(lDialogString, "show='*'") ;
-                }
-                strcat(lDialogString, ");\nif res is None :\n\tprint 0");
-                strcat(lDialogString, "\nelse :\n\tprint '1'+res\n\"" ) ;
-        }
-        else if ( !gdialogPresent() && !xdialogPresent() && tkinter3Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter; from tkinter import simpledialog;root=tkinter.Tk();root.withdraw();");
-                strcat( lDialogString ,"res=simpledialog.askstring(" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-
-                        strcat(lDialogString, "prompt='") ;
-                        lpDialogString = lDialogString + strlen(lDialogString);
-                        replaceSubStr( aMessage , "\n" , "\\n" , lpDialogString ) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aDefaultInput )
-                {
-                        if ( strlen(aDefaultInput) )
-                        {
-                                strcat(lDialogString, "initialvalue='") ;
-                                strcat(lDialogString, aDefaultInput) ;
-                                strcat(lDialogString, "',") ;
-                        }
-                }
-                else
-                {
-                        strcat(lDialogString, "show='*'") ;
-                }
-                strcat(lDialogString, ");\nif res is None :\n\tprint(0)");
-                strcat(lDialogString, "\nelse :\n\tprint('1'+res)\n\"" ) ;
-        }
-        else if ( gdialogPresent() || xdialogPresent() || dialogName() || whiptailPresent() )
-        {
-                if ( gdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"gdialog");return (char const *)1;}
-                        lWasGraphicDialog = 1 ;
-                        lWasGdialog = 1 ;
-                        strcpy( lDialogString , "(gdialog " ) ;
-                }
-                else if ( xdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return (char const *)1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(Xdialog " ) ;
-                }
-                else if ( dialogName( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        if ( isTerminalRunning( ) )
-                        {
-                                strcpy( lDialogString , "(dialog " ) ;
-                        }
-                        else
-                        {
-                                lWasXterm = 1 ;
-                                strcpy( lDialogString , terminalName() ) ;
-                                strcat( lDialogString , "'(" ) ;
-                                strcat( lDialogString , dialogName() ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                }
-                else if ( isTerminalRunning( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"whiptail");return (char const *)0;}
-                        strcpy( lDialogString , "(whiptail " ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"whiptail");return (char const *)0;}
-                        lWasXterm = 1 ;
-                        strcpy( lDialogString , terminalName() ) ;
-                        strcat( lDialogString , "'(whiptail " ) ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "--title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( !xdialogPresent() && !gdialogPresent() )
-                {
-                        strcat(lDialogString, "--backtitle \"") ;
-                        strcat(lDialogString, "tab: move focus") ;
-                        if ( ! aDefaultInput && !lWasGdialog )
-                        {
-                                strcat(lDialogString, " (sometimes nothing, no blink nor star, is shown in text field)") ;
-                        }
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( aDefaultInput || lWasGdialog )
-                {
-                        strcat( lDialogString , "--inputbox" ) ;
-                }
-                else
-                {
-                        if ( !lWasGraphicDialog && dialogName() && isDialogVersionBetter09b() )
-                        {
-                                strcat( lDialogString , "--insecure " ) ;
-                        }
-                        strcat( lDialogString , "--passwordbox" ) ;
-                }
-                strcat( lDialogString , " \"" ) ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat(lDialogString, aMessage) ;
-                }
-                strcat(lDialogString,"\" 10 60 ") ;
-                if ( aDefaultInput && strlen(aDefaultInput) )
-                {
-                        strcat(lDialogString, "\"") ;
-                        strcat(lDialogString, aDefaultInput) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-                if ( lWasGraphicDialog )
-                {
-                        strcat(lDialogString,") 2>/tmp/tinyfd.txt;\
-        if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
-        tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
-                }
-                else
-                {
-                        strcat(lDialogString,">/dev/tty ) 2>/tmp/tinyfd.txt;\
-        if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
-        tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
-
-                        if ( lWasXterm )
-                        {
-                strcat(lDialogString," >/tmp/tinyfd0.txt';cat /tmp/tinyfd0.txt");
-                        }
-                        else
-                        {
-                                strcat(lDialogString, "; clear >/dev/tty") ;
-                        }
-                }
-        }
-        else if ( ! isTerminalRunning( ) && terminalName() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-                lWasBasicXterm = 1 ;
-                strcpy( lDialogString , terminalName() ) ;
-                strcat( lDialogString , "'" ) ;
-                if ( !gWarningDisplayed && !tinyfd_forceConsole)
-                {
-                        tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
-                        gWarningDisplayed = 1 ;
-                }
-                if ( aTitle && strlen(aTitle) && !tinyfd_forceConsole)
-                {
-                        strcat( lDialogString , "echo \"" ) ;
-                        strcat( lDialogString, aTitle) ;
-                        strcat( lDialogString , "\";echo;" ) ;
-                }
-                
-                strcat( lDialogString , "echo \"" ) ;
-                if ( aMessage && strlen(aMessage) )
-                {
-                        strcat( lDialogString, aMessage) ;
-                }
-                strcat( lDialogString , "\";read " ) ;
-                if ( ! aDefaultInput )
-                {
-                        strcat( lDialogString , "-s " ) ;
-                }
-                strcat( lDialogString , "-p \"" ) ;
-                strcat( lDialogString , "(esc+enter to cancel): \" ANSWER " ) ;
-                strcat( lDialogString , ";echo 1$ANSWER >/tmp/tinyfd.txt';" ) ;
-                strcat( lDialogString , "cat -v /tmp/tinyfd.txt");
-        }
-        else if ( !gWarningDisplayed && ! isTerminalRunning( ) && ! terminalName() ) {
-          tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
-          gWarningDisplayed = 1 ;
-          return NULL;
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
-                if ( !gWarningDisplayed && !tinyfd_forceConsole)
-                {
-                        tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
-                        gWarningDisplayed = 1 ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        printf("\n%s\n", aTitle);
-                }
-                if ( aMessage && strlen(aMessage) )
-                {
-                        printf("\n%s\n",aMessage);
-                }
-                printf("(esc+enter to cancel): "); fflush(stdout);
-                if ( ! aDefaultInput )
-                {
-                        tcgetattr(STDIN_FILENO, & oldt) ;
-                        newt = oldt ;
-                        newt.c_lflag &= ~ECHO ;
-                        tcsetattr(STDIN_FILENO, TCSANOW, & newt);
-                }
-
-                lEOF = fgets(lBuff, MAX_PATH_OR_CMD, stdin);
-                /* printf("lbuff<%c><%d>\n",lBuff[0],lBuff[0]); */
-                if ( ! lEOF  || (lBuff[0] == '\0') )
-                {
-                        free(lDialogString);
-                        return NULL;
-                }
-
-                if ( lBuff[0] == '\n' )
-                {
-                        lEOF = fgets(lBuff, MAX_PATH_OR_CMD, stdin);
-                        /* printf("lbuff<%c><%d>\n",lBuff[0],lBuff[0]); */
-                        if ( ! lEOF  || (lBuff[0] == '\0') )
-                        {
-                                free(lDialogString);
-                                return NULL;
-                        }
-                }
-
-                if ( ! aDefaultInput )
-                {
-                        tcsetattr(STDIN_FILENO, TCSANOW, & oldt);
-                        printf("\n");
-                }
-                printf("\n");
-                if ( strchr(lBuff,27) )
-                {
-                        free(lDialogString);
-                        return NULL ;
-                }
-                if ( lBuff[strlen( lBuff ) -1] == '\n' )
-                {
-                        lBuff[strlen( lBuff ) -1] = '\0' ;
-                }
-                free(lDialogString);
-                return lBuff ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-        lIn = popen( lDialogString , "r" );
-        if ( ! lIn  )
-        {
-                if ( fileExists("/tmp/tinyfd.txt") )
-                {
-                        wipefile("/tmp/tinyfd.txt");
-                        remove("/tmp/tinyfd.txt");
-                }
-                if ( fileExists("/tmp/tinyfd0.txt") )
-                {
-                        wipefile("/tmp/tinyfd0.txt");
-                        remove("/tmp/tinyfd0.txt");
-                }
-                free(lDialogString);
-                return NULL ;
-        }
-        while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-        {}
-
-        pclose( lIn ) ;
-
-        if ( fileExists("/tmp/tinyfd.txt") )
-        {
-                wipefile("/tmp/tinyfd.txt");
-                remove("/tmp/tinyfd.txt");
-        }
-        if ( fileExists("/tmp/tinyfd0.txt") )
-        {
-                wipefile("/tmp/tinyfd0.txt");
-                remove("/tmp/tinyfd0.txt");
-        }
-
-        /* printf( "len Buff: %lu\n" , strlen(lBuff) ) ; */
-        /* printf( "lBuff0: %s\n" , lBuff ) ; */
-        if ( lBuff[strlen( lBuff ) -1] == '\n' )
-        {
-                lBuff[strlen( lBuff ) -1] = '\0' ;
-        }
-        /* printf( "lBuff1: %s len: %lu \n" , lBuff , strlen(lBuff) ) ; */
-        if ( lWasBasicXterm )
-        {
-                if ( strstr(lBuff,"^[") ) /* esc was pressed */
-                {
-                        free(lDialogString);
-                        return NULL ;
-                }
-        }
-
-        lResult =  strncmp( lBuff , "1" , 1) ? 0 : 1 ;
-        /* printf( "lResult: %d \n" , lResult ) ; */
-        if ( ! lResult )
-        {
-                free(lDialogString);
-                return NULL ;
-        }
-        /* printf( "lBuff+1: %s\n" , lBuff+1 ) ; */
-        free(lDialogString);
-
-        return lBuff+1 ;
-}
-
-
-char const * tinyfd_saveFileDialog(
-    char const * const aTitle , /* NULL or "" */
-    char const * const aDefaultPathAndFile , /* NULL or "" */
-    int const aNumOfFilterPatterns , /* 0 */
-    char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-    char const * const aSingleFilterDescription ) /* NULL or "image files" */
-{
-
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        char lString [MAX_PATH_OR_CMD] ;
-        int i ;
-        int lWasGraphicDialog = 0 ;
-        int lWasXterm = 0 ;
-        char const * p ;
-        FILE * lIn ;
-        lBuff[0]='\0';
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return (char const *)1;}
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"Finder\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e 'POSIX path of ( choose file name " );
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "with prompt \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-                getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                if ( strlen(lString) )
-                {
-                        strcat(lDialogString, "default location \"") ;
-                        strcat(lDialogString, lString ) ;
-                        strcat(lDialogString , "\" " ) ;
-                }
-                getLastName( lString , aDefaultPathAndFile ) ;
-                if ( strlen(lString) )
-                {
-                        strcat(lDialogString, "default name \"") ;
-                        strcat(lDialogString, lString ) ;
-                        strcat(lDialogString , "\" " ) ;
-                }
-                strcat( lDialogString , ")' " ) ;
-                strcat(lDialogString, "-e 'on error number -128' " ) ;
-                strcat(lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return (char const *)1;}
-
-                strcpy( lDialogString , "kdialog" ) ;
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-                strcat( lDialogString , " --getsavefilename " ) ;
-
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        if ( aDefaultPathAndFile[0] != '/' )
-                        {
-                                strcat(lDialogString, "$PWD/") ;
-                        }
-                        strcat(lDialogString, "\"") ;
-                        strcat(lDialogString, aDefaultPathAndFile ) ;
-                        strcat(lDialogString , "\"" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString, "$PWD/") ;
-                }
-
-                if ( aNumOfFilterPatterns > 0 )
-                {
-                        strcat(lDialogString , " \"" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , " | " ) ;
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "\"" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
-                        strcpy( lDialogString , "zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat(lDialogString, " --file-selection --save --confirm-overwrite" ) ;
-
-                if ( aTitle && strlen(aTitle) ) 
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) ) 
-                {
-                        strcat(lDialogString, " --filename=\"") ;
-                        strcat(lDialogString, aDefaultPathAndFile) ;
-                        strcat(lDialogString, "\"") ;
-                }               
-                if ( aNumOfFilterPatterns > 0 )
-                {
-                        strcat( lDialogString , " --file-filter='" ) ;
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                                strcat( lDialogString , " | " ) ;
-                        }
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                        strcat( lDialogString , "' --file-filter='All files | *'" ) ;
-                }
-        }
-        else if ( !xdialogPresent() && tkinter2Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ))
-                {
-                strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-            strcat( lDialogString ,
-" -S -c \"import Tkinter,tkFileDialog;root=Tkinter.Tk();root.withdraw();");
-
-        if ( isDarwin( ) )
-        {
-                        strcat( lDialogString ,
-"import os;os.system('''/usr/bin/osascript -e 'tell app \\\"Finder\\\" to set\
- frontmost of process \\\"Python\\\" to true' ''');");
-                }
-
-                strcat( lDialogString , "print tkFileDialog.asksaveasfilename(");
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-            if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-            {
-                        getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialdir='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                        getLastName( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialfile='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                }
-            if ( ( aNumOfFilterPatterns > 1 )
-                  || ( (aNumOfFilterPatterns == 1) /* test because poor osx behaviour */
-                        && ( aFilterPatterns[0][strlen(aFilterPatterns[0])-1] != '*' ) ) )
-            {
-                        strcat(lDialogString , "filetypes=(" ) ;
-                        strcat( lDialogString , "('" ) ;
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "',(" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , "'" ) ;
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , "'," ) ;
-                        }
-                        strcat( lDialogString , "))," ) ;
-                        strcat( lDialogString , "('All files','*'))" ) ;
-            }
-                strcat( lDialogString , ")\"" ) ;
-        }
-        else if ( !xdialogPresent() && tkinter3Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter;from tkinter import filedialog;root=tkinter.Tk();root.withdraw();");
-                strcat( lDialogString , "print( filedialog.asksaveasfilename(");
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialdir='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                        getLastName( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialfile='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                }
-                if ( ( aNumOfFilterPatterns > 1 )
-                        || ( (aNumOfFilterPatterns == 1) /* test because poor osx behaviour */
-                        && ( aFilterPatterns[0][strlen(aFilterPatterns[0])-1] != '*' ) ) )
-                {
-                        strcat(lDialogString , "filetypes=(" ) ;
-                        strcat( lDialogString , "('" ) ;
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "',(" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , "'" ) ;
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , "'," ) ;
-                        }
-                        strcat( lDialogString , "))," ) ;
-                        strcat( lDialogString , "('All files','*'))" ) ;
-                }
-                strcat( lDialogString , "))\"" ) ;
-        }
-        else if ( xdialogPresent() || dialogName() )
-        {
-                if ( xdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return (char const *)1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(Xdialog " ) ;
-                }
-                else if ( isTerminalRunning( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        strcpy( lDialogString , "(dialog " ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        lWasXterm = 1 ;
-                        strcpy( lDialogString , terminalName() ) ;
-                        strcat( lDialogString , "'(" ) ;
-                        strcat( lDialogString , dialogName() ) ;
-                        strcat( lDialogString , " " ) ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "--title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( !xdialogPresent() && !gdialogPresent() )
-                {
-                        strcat(lDialogString, "--backtitle \"") ;
-                        strcat(lDialogString,
-                                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                strcat( lDialogString , "--fselect \"" ) ;
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        if ( ! strchr(aDefaultPathAndFile, '/') )
-                        {
-                                strcat(lDialogString, "./") ;
-                        }
-                        strcat(lDialogString, aDefaultPathAndFile) ;
-                }
-                else if ( ! isTerminalRunning( ) && !lWasGraphicDialog )
-                {
-                        strcat(lDialogString, getenv("HOME")) ;
-                        strcat(lDialogString, "/") ;
-                }
-                else
-                {
-                        strcat(lDialogString, "./") ;
-                }
-
-                if ( lWasGraphicDialog )
-                {
-                        strcat(lDialogString, "\" 0 60 ) 2>&1 ") ;
-                }
-                else
-                {
-                        strcat(lDialogString, "\" 0 60  >/dev/tty) ") ;
-                        if ( lWasXterm )
-                        {
-                          strcat( lDialogString ,
-                                "2>/tmp/tinyfd.txt';cat /tmp/tinyfd.txt;rm /tmp/tinyfd.txt");
-                        }
-                        else
-                        {
-                                strcat(lDialogString, "2>&1 ; clear >/dev/tty") ;
-                        }
-                }
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){return tinyfd_inputBox(aTitle,NULL,NULL);}
-                p = tinyfd_inputBox( aTitle , "Save file" , "" ) ;
-                getPathWithoutFinalSlash( lString , p ) ;
-                if ( strlen( lString ) && ! dirExists( lString ) )
-                {
-                        return NULL ;
-                }
-                getLastName(lString,p);
-                if ( ! strlen(lString) )
-                {
-                        return NULL;
-                }
-                return p ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-    if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-    {
-        return NULL ;
-    }
-    while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-    {}
-    pclose( lIn ) ;
-    if ( lBuff[strlen( lBuff ) -1] == '\n' )
-    {
-        lBuff[strlen( lBuff ) -1] = '\0' ;
-    }
-        /* printf( "lBuff: %s\n" , lBuff ) ; */
-        if ( ! strlen(lBuff) )
-        {
-                return NULL;
-        }
-    getPathWithoutFinalSlash( lString , lBuff ) ;
-    if ( strlen( lString ) && ! dirExists( lString ) )
-    {
-        return NULL ;
-    }
-        getLastName(lString,lBuff);
-        if ( ! filenameValid(lString) )
-        {
-                return NULL;
-        }
-    return lBuff ;
-}
-
-                 
-/* in case of multiple files, the separator is | */
-char const * tinyfd_openFileDialog(
-    char const * const aTitle , /* NULL or "" */
-    char const * const aDefaultPathAndFile , /* NULL or "" */
-    int const aNumOfFilterPatterns , /* 0 */
-    char const * const * const aFilterPatterns , /* NULL or {"*.jpg","*.png"} */
-    char const * const aSingleFilterDescription , /* NULL or "image files" */
-    int const aAllowMultipleSelects ) /* 0 or 1 */
-{
-        static char lBuff [MAX_MULTIPLE_FILES*MAX_PATH_OR_CMD] ;
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        char lString [MAX_PATH_OR_CMD] ;
-        int i ;
-        FILE * lIn ;
-        char * p ;
-        char const * p2 ;
-        int lWasKdialog = 0 ;
-        int lWasGraphicDialog = 0 ;
-        int lWasXterm = 0 ;
-        lBuff[0]='\0';
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return (char const *)1;}
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e '" );
-    if ( ! aAllowMultipleSelects )
-    {
-
-
-                        strcat( lDialogString , "POSIX path of ( " );
-                }
-                else
-                {
-                        strcat( lDialogString , "set mylist to " );
-                }
-                strcat( lDialogString , "choose file " );
-            if ( aTitle && strlen(aTitle) )
-            {
-                        strcat(lDialogString, "with prompt \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-            }
-                getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                if ( strlen(lString) )
-                {
-                        strcat(lDialogString, "default location \"") ;
-                        strcat(lDialogString, lString ) ;
-                        strcat(lDialogString , "\" " ) ;
-                }
-                if ( aNumOfFilterPatterns > 0 )
-                {
-                        strcat(lDialogString , "of type {\"" );
-                        strcat( lDialogString , aFilterPatterns [0] + 2 ) ;
-                        strcat( lDialogString , "\"" ) ;
-                        for ( i = 1 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , ",\"" ) ;
-                                strcat( lDialogString , aFilterPatterns [i] + 2) ;
-                                strcat( lDialogString , "\"" ) ;
-                        }
-                        strcat( lDialogString , "} " ) ;
-                }
-                if ( aAllowMultipleSelects )
-                {
-                        strcat( lDialogString , "multiple selections allowed true ' " ) ;
-                        strcat( lDialogString ,
-                                        "-e 'set mystring to POSIX path of item 1 of mylist' " );
-                        strcat( lDialogString ,
-                                        "-e 'repeat with  i from 2 to the count of mylist' " );
-                        strcat( lDialogString , "-e 'set mystring to mystring & \"|\"' " );
-                        strcat( lDialogString ,
-                        "-e 'set mystring to mystring & POSIX path of item i of mylist' " );
-                        strcat( lDialogString , "-e 'end repeat' " );
-                        strcat( lDialogString , "-e 'mystring' " );
-                }
-                else
-                {
-                        strcat( lDialogString , ")' " ) ;
-                }
-                strcat(lDialogString, "-e 'on error number -128' " ) ;
-                strcat(lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return (char const *)1;}
-                lWasKdialog = 1 ;
-
-                strcpy( lDialogString , "kdialog" ) ;
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-                strcat( lDialogString , " --getopenfilename " ) ;
-
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        if ( aDefaultPathAndFile[0] != '/' )
-                        {
-                                strcat(lDialogString, "$PWD/") ;
-                        }
-                        strcat(lDialogString, "\"") ;
-                        strcat(lDialogString, aDefaultPathAndFile ) ;
-                        strcat(lDialogString , "\"" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString, "$PWD/") ;
-                }
-
-                if ( aNumOfFilterPatterns > 0 )
-                {
-                        strcat(lDialogString , " \"" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , " | " ) ;
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "\"" ) ;
-                }
-                if ( aAllowMultipleSelects )
-                {
-                        strcat( lDialogString , " --multiple --separate-output" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
-                        strcpy( lDialogString , "zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat( lDialogString , " --file-selection" ) ;
-
-                if ( aAllowMultipleSelects )
-                {
-                        strcat( lDialogString , " --multiple" ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        strcat(lDialogString, " --filename=\"") ;
-                        strcat(lDialogString, aDefaultPathAndFile) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aNumOfFilterPatterns > 0 )
-                {
-                        strcat( lDialogString , " --file-filter='" ) ; 
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                                strcat( lDialogString , " | " ) ;
-                        }
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , " " ) ;
-                        }
-                        strcat( lDialogString , "' --file-filter='All files | *'" ) ;
-                }
-        }
-        else if ( tkinter2Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ) )
-                {
-                strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-                strcat( lDialogString ,
-" -S -c \"import Tkinter,tkFileDialog;root=Tkinter.Tk();root.withdraw();");
-
-        if ( isDarwin( ) )
-        {
-                        strcat( lDialogString ,
-"import os;os.system('''/usr/bin/osascript -e 'tell app \\\"Finder\\\" to set \
-frontmost of process \\\"Python\\\" to true' ''');");
-                }
-                strcat( lDialogString , "lFiles=tkFileDialog.askopenfilename(");
-    if ( aAllowMultipleSelects )
-    {
-                        strcat( lDialogString , "multiple=1," ) ;
-    }
-    if ( aTitle && strlen(aTitle) )
-    {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-    }
-    if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-    {
-                        getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialdir='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                        getLastName( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialfile='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                }
-                if ( ( aNumOfFilterPatterns > 1 )
-                        || ( ( aNumOfFilterPatterns == 1 ) /*test because poor osx behaviour*/
-                                && ( aFilterPatterns[0][strlen(aFilterPatterns[0])-1] != '*' ) ) )
-                {
-                        strcat(lDialogString , "filetypes=(" ) ;
-                        strcat( lDialogString , "('" ) ;
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "',(" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , "'" ) ;
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , "'," ) ;
-                        }
-                        strcat( lDialogString , "))," ) ;
-                        strcat( lDialogString , "('All files','*'))" ) ;
-                }
-                strcat( lDialogString , ");\
-\nif not isinstance(lFiles, tuple):\n\tprint lFiles\nelse:\
-\n\tlFilesString=''\n\tfor lFile in lFiles:\n\t\tlFilesString+=str(lFile)+'|'\
-\n\tprint lFilesString[:-1]\n\"" ) ;
-        }
-        else if ( tkinter3Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter;from tkinter import filedialog;root=tkinter.Tk();root.withdraw();");
-                strcat( lDialogString , "lFiles=filedialog.askopenfilename(");
-                if ( aAllowMultipleSelects )
-                {
-                        strcat( lDialogString , "multiple=1," ) ;
-                }
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        getPathWithoutFinalSlash( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialdir='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                        getLastName( lString , aDefaultPathAndFile ) ;
-                        if ( strlen(lString) )
-                        {
-                                strcat(lDialogString, "initialfile='") ;
-                                strcat(lDialogString, lString ) ;
-                                strcat(lDialogString , "'," ) ;
-                        }
-                }
-                if ( ( aNumOfFilterPatterns > 1 )
-                        || ( ( aNumOfFilterPatterns == 1 ) /*test because poor osx behaviour*/
-                        && ( aFilterPatterns[0][strlen(aFilterPatterns[0])-1] != '*' ) ) )
-                {
-                        strcat(lDialogString , "filetypes=(" ) ;
-                        strcat( lDialogString , "('" ) ;
-                        if ( aSingleFilterDescription && strlen(aSingleFilterDescription) )
-                        {
-                                strcat( lDialogString , aSingleFilterDescription ) ;
-                        }
-                        strcat( lDialogString , "',(" ) ;
-                        for ( i = 0 ; i < aNumOfFilterPatterns ; i ++ )
-                        {
-                                strcat( lDialogString , "'" ) ;
-                                strcat( lDialogString , aFilterPatterns [i] ) ;
-                                strcat( lDialogString , "'," ) ;
-                        }
-                        strcat( lDialogString , "))," ) ;
-                        strcat( lDialogString , "('All files','*'))" ) ;
-                }
-                strcat( lDialogString , ");\
-\nif not isinstance(lFiles, tuple):\n\tprint(lFiles)\nelse:\
-\n\tlFilesString=''\n\tfor lFile in lFiles:\n\t\tlFilesString+=str(lFile)+'|'\
-\n\tprint(lFilesString[:-1])\n\"" ) ;
-        }
-        else if ( xdialogPresent() || dialogName() )
-        {
-                if ( xdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return (char const *)1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(Xdialog " ) ;
-                }
-                else if ( isTerminalRunning( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        strcpy( lDialogString , "(dialog " ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        lWasXterm = 1 ;
-                        strcpy( lDialogString , terminalName() ) ;
-                        strcat( lDialogString , "'(" ) ;
-                        strcat( lDialogString , dialogName() ) ;
-                        strcat( lDialogString , " " ) ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "--title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( !xdialogPresent() && !gdialogPresent() )
-                {
-                        strcat(lDialogString, "--backtitle \"") ;
-                        strcat(lDialogString,
-                                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                strcat( lDialogString , "--fselect \"" ) ;
-                if ( aDefaultPathAndFile && strlen(aDefaultPathAndFile) )
-                {
-                        if ( ! strchr(aDefaultPathAndFile, '/') )
-                        {
-                                strcat(lDialogString, "./") ;
-                        }
-                        strcat(lDialogString, aDefaultPathAndFile) ;
-                }
-                else if ( ! isTerminalRunning( ) && !lWasGraphicDialog )
-                {
-                        strcat(lDialogString, getenv("HOME")) ;
-                        strcat(lDialogString, "/");
-                }
-                else
-                {
-                        strcat(lDialogString, "./") ;
-                }
-
-                if ( lWasGraphicDialog )
-                {
-                        strcat(lDialogString, "\" 0 60 ) 2>&1 ") ;
-                }
-                else
-                {
-                        strcat(lDialogString, "\" 0 60  >/dev/tty) ") ;
-                        if ( lWasXterm )
-                        {
-                                strcat( lDialogString ,
-                                "2>/tmp/tinyfd.txt';cat /tmp/tinyfd.txt;rm /tmp/tinyfd.txt");
-                        }
-                        else
-                        {
-                                strcat(lDialogString, "2>&1 ; clear >/dev/tty") ;
-                        }
-                }
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){return tinyfd_inputBox(aTitle,NULL,NULL);}
-                p2 = tinyfd_inputBox(aTitle, "Open file","");
-                if ( ! fileExists(p2) )
-                {
-                        return NULL ;
-                }
-                return p2 ;
-        }
-
-    if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-    if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-    {
-        return NULL ;
-    }
-        lBuff[0]='\0';
-        p=lBuff;
-        while ( fgets( p , sizeof( lBuff ) , lIn ) != NULL )
-        {
-                p += strlen( p );
-        }
-    pclose( lIn ) ;
-    if ( lBuff[strlen( lBuff ) -1] == '\n' )
-    {
-        lBuff[strlen( lBuff ) -1] = '\0' ;
-    }
-    /* printf( "lBuff: %s\n" , lBuff ) ; */
-        if ( lWasKdialog && aAllowMultipleSelects )
-        {
-                p = lBuff ;
-                while ( ( p = strchr( p , '\n' ) ) )
-                        * p = '|' ;
-        }
-        /* printf( "lBuff2: %s\n" , lBuff ) ; */
-        if ( ! strlen( lBuff )  )
-        {
-                return NULL;
-        }
-        if ( aAllowMultipleSelects && strchr(lBuff, '|') )
-        {
-                p2 = ensureFilesExist( lBuff , lBuff ) ;
-        }
-        else if ( fileExists(lBuff) )
-        {
-                p2 = lBuff ;
-        }
-        else
-        {
-                return NULL ;
-        }
-        /* printf( "lBuff3: %s\n" , p2 ) ; */
-
-        return p2 ;
-}
-
-
-char const * tinyfd_selectFolderDialog(
-        char const * const aTitle , /* "" */
-        char const * const aDefaultPath ) /* "" */
-{
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        char const * p ;
-        int lWasGraphicDialog = 0 ;
-        int lWasXterm = 0 ;
-        lBuff[0]='\0';
-
-        if ( osascriptPresent( ))
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return (char const *)1;}
-                strcpy( lDialogString , "osascript ");
-                if ( ! osx9orBetter() ) strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                strcat( lDialogString , " -e 'try' -e 'POSIX path of ( choose folder ");
-                if ( aTitle && strlen(aTitle) )
-                {
-                strcat(lDialogString, "with prompt \"") ;
-                strcat(lDialogString, aTitle) ;
-                strcat(lDialogString, "\" ") ;
-                }
-                if ( aDefaultPath && strlen(aDefaultPath) )
-                {
-                        strcat(lDialogString, "default location \"") ;
-                        strcat(lDialogString, aDefaultPath ) ;
-                        strcat(lDialogString , "\" " ) ;
-                }
-                strcat( lDialogString , ")' " ) ;
-                strcat(lDialogString, "-e 'on error number -128' " ) ;
-                strcat(lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return (char const *)1;}
-                strcpy( lDialogString , "kdialog" ) ;
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-                strcat( lDialogString , " --getexistingdirectory " ) ;
-
-                if ( aDefaultPath && strlen(aDefaultPath) )
-                {
-                        if ( aDefaultPath[0] != '/' )
-                        {
-                                strcat(lDialogString, "$PWD/") ;
-                        }
-                        strcat(lDialogString, "\"") ;
-                        strcat(lDialogString, aDefaultPath ) ;
-                        strcat(lDialogString , "\"" ) ;
-                }
-                else
-                {
-                        strcat(lDialogString, "$PWD/") ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
-                        strcpy( lDialogString , "zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat( lDialogString , " --file-selection --directory" ) ;
-
-                if ( aTitle && strlen(aTitle) ) 
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-                if ( aDefaultPath && strlen(aDefaultPath) ) 
-                {
-                        strcat(lDialogString, " --filename=\"") ;
-                        strcat(lDialogString, aDefaultPath) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( !xdialogPresent() && tkinter2Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ) )
-                {
-                strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-        strcat( lDialogString ,
-" -S -c \"import Tkinter,tkFileDialog;root=Tkinter.Tk();root.withdraw();");
-
-        if ( isDarwin( ) )
-        {
-                        strcat( lDialogString ,
-"import os;os.system('''/usr/bin/osascript -e 'tell app \\\"Finder\\\" to set \
-frontmost of process \\\"Python\\\" to true' ''');");
-                }
-
-                strcat( lDialogString , "print tkFileDialog.askdirectory(");
-            if ( aTitle && strlen(aTitle) )
-            {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-            }
-        if ( aDefaultPath && strlen(aDefaultPath) )
-        {
-                                strcat(lDialogString, "initialdir='") ;
-                                strcat(lDialogString, aDefaultPath ) ;
-                                strcat(lDialogString , "'" ) ;
-                }
-                strcat( lDialogString , ")\"" ) ;
-        }
-        else if ( !xdialogPresent() && tkinter3Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter;from tkinter import filedialog;root=tkinter.Tk();root.withdraw();");
-                strcat( lDialogString , "print( filedialog.askdirectory(");
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "',") ;
-                }
-                if ( aDefaultPath && strlen(aDefaultPath) )
-                {
-                        strcat(lDialogString, "initialdir='") ;
-                        strcat(lDialogString, aDefaultPath ) ;
-                        strcat(lDialogString , "'" ) ;
-                }
-                strcat( lDialogString , ") )\"" ) ;
-        }
-        else if ( xdialogPresent() || dialogName() )
-        {
-                if ( xdialogPresent( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return (char const *)1;}
-                        lWasGraphicDialog = 1 ;
-                        strcpy( lDialogString , "(Xdialog " ) ;
-                }
-                else if ( isTerminalRunning( ) )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        strcpy( lDialogString , "(dialog " ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"dialog");return (char const *)0;}
-                        lWasXterm = 1 ;
-                        strcpy( lDialogString , terminalName() ) ;
-                        strcat( lDialogString , "'(" ) ;
-                        strcat( lDialogString , dialogName() ) ;
-                        strcat( lDialogString , " " ) ;
-                }
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, "--title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                if ( !xdialogPresent() && !gdialogPresent() )
-                {
-                        strcat(lDialogString, "--backtitle \"") ;
-                        strcat(lDialogString,
-                                "tab: focus | /: populate | spacebar: fill text field | ok: TEXT FIELD ONLY") ;
-                        strcat(lDialogString, "\" ") ;
-                }
-
-                strcat( lDialogString , "--dselect \"" ) ;
-                if ( aDefaultPath && strlen(aDefaultPath) )
-                {
-                        strcat(lDialogString, aDefaultPath) ;
-                        ensureFinalSlash(lDialogString);
-                }
-                else if ( ! isTerminalRunning( ) && !lWasGraphicDialog )
-                {
-                        strcat(lDialogString, getenv("HOME")) ;
-                        strcat(lDialogString, "/");
-                }
-                else
-                {
-                        strcat(lDialogString, "./") ;
-                }
-                
-                if ( lWasGraphicDialog )
-                {
-                        strcat(lDialogString, "\" 0 60 ) 2>&1 ") ;
-                }
-                else
-                {
-                        strcat(lDialogString, "\" 0 60  >/dev/tty) ") ;
-                        if ( lWasXterm )
-                        {
-                          strcat( lDialogString ,
-                                "2>/tmp/tinyfd.txt';cat /tmp/tinyfd.txt;rm /tmp/tinyfd.txt");
-                        }
-                        else
-                        {
-                                strcat(lDialogString, "2>&1 ; clear >/dev/tty") ;
-                        }
-                }
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){return tinyfd_inputBox(aTitle,NULL,NULL);}
-                p = tinyfd_inputBox(aTitle, "Select folder","");
-                if ( !p || ! strlen( p ) || ! dirExists( p ) )
-                {
-                        return NULL ;
-                }
-                return p ;
-        }
-    if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-    if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-    {
-        return NULL ;
-    }
-        while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-        {}
-        pclose( lIn ) ;
-    if ( lBuff[strlen( lBuff ) -1] == '\n' )
-    {
-        lBuff[strlen( lBuff ) -1] = '\0' ;
-    }
-        /* printf( "lBuff: %s\n" , lBuff ) ; */
-        if ( ! strlen( lBuff ) || ! dirExists( lBuff ) )
-        {
-                return NULL ;
-        }
-        return lBuff ;
-}
-
-
-/* returns the hexcolor as a string "#FF0000" */
-/* aoResultRGB also contains the result */
-/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
-/* aDefaultRGB and aoResultRGB can be the same array */
-char const * tinyfd_colorChooser(
-        char const * const aTitle , /* NULL or "" */
-        char const * const aDefaultHexRGB , /* NULL or "#FF0000"*/
-        unsigned char const aDefaultRGB[3] , /* { 0 , 255 , 255 } */
-        unsigned char aoResultRGB[3] ) /* { 0 , 0 , 0 } */
-{
-        static char lBuff [128] ;
-        char lTmp [128] ;
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        char lDefaultHexRGB[8];
-        char * lpDefaultHexRGB;
-        unsigned char lDefaultRGB[3];
-        char const * p;
-        FILE * lIn ;
-        int i ;
-        int lWasZenity3 = 0 ;
-        int lWasOsascript = 0 ;
-        int lWasXdialog = 0 ;
-        lBuff[0]='\0';
-
-        if ( aDefaultHexRGB )
-        {
-                Hex2RGB( aDefaultHexRGB , lDefaultRGB ) ;
-                lpDefaultHexRGB = (char *) aDefaultHexRGB ;
-        }
-        else
-        {
-                lDefaultRGB[0]=aDefaultRGB[0];
-                lDefaultRGB[1]=aDefaultRGB[1];
-                lDefaultRGB[2]=aDefaultRGB[2];
-                RGB2Hex( aDefaultRGB , lDefaultHexRGB ) ;
-                lpDefaultHexRGB = (char *) lDefaultHexRGB ;
-        }
-
-        if ( osascriptPresent( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"applescript");return (char const *)1;}
-                lWasOsascript = 1 ;
-                strcpy( lDialogString , "osascript");
-                                
-                if ( ! osx9orBetter() ) 
-                {
-                        strcat( lDialogString , " -e 'tell application \"System Events\"' -e 'Activate'");
-                        strcat( lDialogString , " -e 'try' -e 'set mycolor to choose color default color {");
-                }
-                else 
-                {
-                        strcat( lDialogString ,
-" -e 'try' -e 'tell app (path to frontmost application as Unicode text) \
-to set mycolor to choose color default color {");
-                }
-
-                sprintf(lTmp, "%d", 256 * lDefaultRGB[0] ) ;
-                strcat(lDialogString, lTmp ) ;
-                strcat(lDialogString, "," ) ;
-                sprintf(lTmp, "%d", 256 * lDefaultRGB[1] ) ;
-                strcat(lDialogString, lTmp ) ;
-                strcat(lDialogString, "," ) ;
-                sprintf(lTmp, "%d", 256 * lDefaultRGB[2] ) ;
-                strcat(lDialogString, lTmp ) ;
-                strcat(lDialogString, "}' " ) ;
-                strcat( lDialogString ,
-"-e 'set mystring to ((item 1 of mycolor) div 256 as integer) as string' " );
-                strcat( lDialogString ,
-"-e 'repeat with i from 2 to the count of mycolor' " );
-                strcat( lDialogString ,
-"-e 'set mystring to mystring & \" \" & ((item i of mycolor) div 256 as integer) as string' " );
-                strcat( lDialogString , "-e 'end repeat' " );
-                strcat( lDialogString , "-e 'mystring' ");
-                strcat(lDialogString, "-e 'on error number -128' " ) ;
-                strcat(lDialogString, "-e 'end try'") ;
-                if ( ! osx9orBetter() ) strcat( lDialogString, " -e 'end tell'") ;
-        }
-        else if ( kdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"kdialog");return (char const *)1;}
-                strcpy( lDialogString , "kdialog" ) ;
-                if ( kdialogPresent() == 2 )
-                {
-                        strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                }
-                sprintf( lDialogString + strlen(lDialogString) , " --getcolor --default '%s'" , lpDefaultHexRGB ) ;
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title \"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( zenity3Present() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                lWasZenity3 = 1 ;
-                if ( zenity3Present() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity3");return (char const *)1;}
-                        strcpy( lDialogString , "zenity" );
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat( lDialogString , " --color-selection --show-palette" ) ;
-                sprintf( lDialogString + strlen(lDialogString), " --color=%s" , lpDefaultHexRGB ) ;
-
-                if ( aTitle && strlen(aTitle) ) 
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-        }
-        else if ( xdialogPresent() )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"xdialog");return (char const *)1;}
-                lWasXdialog = 1 ;
-                strcpy( lDialogString , "Xdialog --colorsel \"" ) ;
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, aTitle) ;
-                }
-                strcat(lDialogString, "\" 0 60 ") ;
-                sprintf(lTmp,"%hhu %hhu %hhu",lDefaultRGB[0],
-                        lDefaultRGB[1],lDefaultRGB[2]);
-                strcat(lDialogString, lTmp) ;
-                strcat(lDialogString, " 2>&1");
-        }
-        else if ( tkinter2Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python2-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython2Name ) ;
-                if ( ! isTerminalRunning( ) && isDarwin( ) )
-                {
-                strcat( lDialogString , " -i" ) ;  /* for osx without console */
-                }
-                
-                strcat( lDialogString ,
-" -S -c \"import Tkinter,tkColorChooser;root=Tkinter.Tk();root.withdraw();");
-
-                if ( isDarwin( ) )
-                {
-                        strcat( lDialogString ,
-"import os;os.system('''osascript -e 'tell app \\\"Finder\\\" to set \
-frontmost of process \\\"Python\\\" to true' ''');");
-                }
-
-                strcat( lDialogString , "res=tkColorChooser.askcolor(color='" ) ;
-                strcat(lDialogString, lpDefaultHexRGB ) ;
-                strcat(lDialogString, "'") ;
-
-
-            if ( aTitle && strlen(aTitle) )
-            {
-                        strcat(lDialogString, ",title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "'") ;
-            }
-                strcat( lDialogString , ");\
-\nif res[1] is not None:\n\tprint res[1]\"" ) ;
-        }
-        else if ( tkinter3Present( ) )
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"python3-tkinter");return (char const *)1;}
-                strcpy( lDialogString , gPython3Name ) ;
-                strcat( lDialogString ,
-                        " -S -c \"import tkinter;from tkinter import colorchooser;root=tkinter.Tk();root.withdraw();");
-                strcat( lDialogString , "res=colorchooser.askcolor(color='" ) ;
-                strcat(lDialogString, lpDefaultHexRGB ) ;
-                strcat(lDialogString, "'") ;
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, ",title='") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "'") ;
-                }
-                strcat( lDialogString , ");\
-\nif res[1] is not None:\n\tprint(res[1])\"" ) ;
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){return tinyfd_inputBox(aTitle,NULL,NULL);}
-                p = tinyfd_inputBox(aTitle,
-                                "Enter hex rgb color (i.e. #f5ca20)",lpDefaultHexRGB);
-                if ( !p || (strlen(p) != 7) || (p[0] != '#') )
-                {
-                        return NULL ;
-                }
-                for ( i = 1 ; i < 7 ; i ++ )
-                {
-                        if ( ! isxdigit( p[i] ) )
-                        {
-                                return NULL ;
-                        }
-                }
-                Hex2RGB(p,aoResultRGB);
-                return p ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-        if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-        {
-                return NULL ;
-    }
-        while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-        {
-        }
-        pclose( lIn ) ;
-    if ( ! strlen( lBuff ) )
-    {
-        return NULL ;
-    }
-        /* printf( "len Buff: %lu\n" , strlen(lBuff) ) ; */
-        /* printf( "lBuff0: %s\n" , lBuff ) ; */
-    if ( lBuff[strlen( lBuff ) -1] == '\n' )
-    {
-        lBuff[strlen( lBuff ) -1] = '\0' ;
-    }
-    
-        if ( lWasZenity3 )
-    {
-                if ( lBuff[0] == '#' )
-                {
-                        if ( strlen(lBuff)>7 )
-                        {
-                                lBuff[3]=lBuff[5];
-                                lBuff[4]=lBuff[6];
-                                lBuff[5]=lBuff[9];
-                                lBuff[6]=lBuff[10];
-                                lBuff[7]='\0';
-                        }
-                Hex2RGB(lBuff,aoResultRGB);
-                }
-                else if ( lBuff[3] == '(' ) {
-                        sscanf(lBuff,"rgb(%hhu,%hhu,%hhu",
-                                        & aoResultRGB[0], & aoResultRGB[1],& aoResultRGB[2]);
-                        RGB2Hex(aoResultRGB,lBuff);
-                }
-                else if ( lBuff[4] == '(' ) {
-                        sscanf(lBuff,"rgba(%hhu,%hhu,%hhu",
-                                        & aoResultRGB[0], & aoResultRGB[1],& aoResultRGB[2]);
-                        RGB2Hex(aoResultRGB,lBuff);
-                }
-    }
-    else if ( lWasOsascript || lWasXdialog )
-    {
-                /* printf( "lBuff: %s\n" , lBuff ) ; */
-        sscanf(lBuff,"%hhu %hhu %hhu",
-                           & aoResultRGB[0], & aoResultRGB[1],& aoResultRGB[2]);
-        RGB2Hex(aoResultRGB,lBuff);
-    }
-    else
-    {
-                Hex2RGB(lBuff,aoResultRGB);
-        }
-        /* printf("%d %d %d\n", aoResultRGB[0],aoResultRGB[1],aoResultRGB[2]); */
-        /* printf( "lBuff: %s\n" , lBuff ) ; */
-        return lBuff ;
-}
-
-
-/* not cross platform - zenity only */
-/* contributed by Attila Dusnoki */
-char const * tinyfd_arrayDialog(
-        char const * const aTitle , /* "" */
-        int const aNumOfColumns , /* 2 */
-        char const * const * const aColumns , /* {"Column 1","Column 2"} */
-        int const aNumOfRows , /* 2 */
-        char const * const * const aCells ) 
-                /* {"Row1 Col1","Row1 Col2","Row2 Col1","Row2 Col2"} */
-{
-        static char lBuff [MAX_PATH_OR_CMD] ;
-        char lDialogString [MAX_PATH_OR_CMD] ;
-        FILE * lIn ;
-        int i ;
-
-        lBuff[0]='\0';
-
-        if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
-        {
-                if ( zenityPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
-                        strcpy( lDialogString , "zenity" ) ;
-                        if ( (zenity3Present() >= 4) && !getenv("SSH_TTY") )
-                        {
-                                strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                else if ( matedialogPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
-                        strcpy( lDialogString , "matedialog" ) ;
-                }
-                else if ( shellementaryPresent() )
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
-                        strcpy( lDialogString , "shellementary" ) ;
-                }
-                else
-                {
-                        if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
-                        strcpy( lDialogString , "qarma" ) ;
-                        if ( !getenv("SSH_TTY") )
-                        {
-                                strcat(lDialogString, " --attach=$(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
-                        }
-                }
-                strcat( lDialogString , " --list --print-column=ALL" ) ;
-
-                if ( aTitle && strlen(aTitle) )
-                {
-                        strcat(lDialogString, " --title=\"") ;
-                        strcat(lDialogString, aTitle) ;
-                        strcat(lDialogString, "\"") ;
-                }
-
-                if ( aColumns && (aNumOfColumns > 0) )
-                {
-                        for ( i = 0 ; i < aNumOfColumns ; i ++ )
-                        {
-                                strcat( lDialogString , " --column=\"" ) ;
-                                strcat( lDialogString , aColumns [i] ) ;
-                                strcat( lDialogString , "\"" ) ;
-                        }
-                }
-
-                if ( aCells && (aNumOfRows > 0) )
-                {
-                        strcat( lDialogString , " " ) ;
-                        for ( i = 0 ; i < aNumOfRows*aNumOfColumns ; i ++ )
-                        {
-                                strcat( lDialogString , "\"" ) ;
-                                strcat( lDialogString , aCells [i] ) ;
-                                strcat( lDialogString , "\" " ) ;
-                        }
-                }
-        }
-        else
-        {
-                if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"");return (char const *)0;}
-                return NULL ;
-        }
-
-        if (tinyfd_verbose) printf( "lDialogString: %s\n" , lDialogString ) ;
-        if ( ! ( lIn = popen( lDialogString , "r" ) ) )
-        {
-                return NULL ;
-        }
-        while ( fgets( lBuff , sizeof( lBuff ) , lIn ) != NULL )
-        {}
-        pclose( lIn ) ;
-        if ( lBuff[strlen( lBuff ) -1] == '\n' )
-        {
-                lBuff[strlen( lBuff ) -1] = '\0' ;
-        }
-        /* printf( "lBuff: %s\n" , lBuff ) ; */
-        if ( ! strlen( lBuff ) )
-        {
-                return NULL ;
-        }
-        return lBuff ;
-}
-#endif /* _WIN32 */
-
-
-/*
-int main( int argc , char * argv[] )
-{
-char const * lTmp;
-char const * lTheSaveFileName;
-char const * lTheOpenFileName;
-char const * lTheSelectFolderName;
-char const * lTheHexColor;
-char const * lWillBeGraphicMode;
-unsigned char lRgbColor[3];
-FILE * lIn;
-char lBuffer[1024];
-char lString[1024];
-char const * lFilterPatterns[2] = { "*.txt", "*.text" };
-
-tinyfd_verbose = argc - 1;
-
-lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL);
-
-strcpy(lBuffer, "v");
-strcat(lBuffer, tinyfd_version);
-if (lWillBeGraphicMode)
-{
-    strcat(lBuffer, "\ngraphic mode: ");
-}
-else
-{
-    strcat(lBuffer, "\nconsole mode: ");
-}
-strcat(lBuffer, tinyfd_response);
-strcat(lBuffer, "\n");
-strcat(lBuffer, tinyfd_needs+78);
-strcpy(lString, "tinyfiledialogs");
-tinyfd_messageBox(lString, lBuffer, "ok", "info", 0);
-
-tinyfd_notifyPopup("the title", "the message\n\tfrom outer-space", "info");
-
-if (lWillBeGraphicMode && !tinyfd_forceConsole)
-{
-        tinyfd_forceConsole = ! tinyfd_messageBox("Hello World",
-                "graphic dialogs [yes] / console mode [no]?",
-                "yesno", "question", 1);
-}
-
-lTmp = tinyfd_inputBox(
-        "a password box", "your password will be revealed", NULL);
-
-if (!lTmp) return 1;
-
-strcpy(lString, lTmp);
-
-lTheSaveFileName = tinyfd_saveFileDialog(
-        "let us save this password",
-        "passwordFile.txt",
-        2,
-        lFilterPatterns,
-        NULL);
-
-if (!lTheSaveFileName)
-{
-        tinyfd_messageBox(
-                "Error",
-                "Save file name is NULL",
-                "ok",
-                "error",
-                1);
-        return 1;
-}
-
-lIn = fopen(lTheSaveFileName, "w");
-if (!lIn)
-{
-        tinyfd_messageBox(
-                "Error",
-                "Can not open this file in write mode",
-                "ok",
-                "error",
-                1);
-        return 1;
-}
-fputs(lString, lIn);
-fclose(lIn);
-
-lTheOpenFileName = tinyfd_openFileDialog(
-        "let us read the password back",
-        "",
-        2,
-        lFilterPatterns,
-        NULL,
-        0);
-
-if (!lTheOpenFileName)
-{
-        tinyfd_messageBox(
-                "Error",
-                "Open file name is NULL",
-                "ok",
-                "error",
-                1);
-        return 1;
-}
-
-lIn = fopen(lTheOpenFileName, "r");
-
-if (!lIn)
-{
-        tinyfd_messageBox(
-                "Error",
-                "Can not open this file in read mode",
-                "ok",
-                "error",
-                1);
-        return(1);
-}
-lBuffer[0] = '\0';
-fgets(lBuffer, sizeof(lBuffer), lIn);
-fclose(lIn);
-
-tinyfd_messageBox("your password is",
-        lBuffer, "ok", "info", 1);
-
-lTheSelectFolderName = tinyfd_selectFolderDialog(
-        "let us just select a directory", NULL);
-
-if (!lTheSelectFolderName)
-{
-        tinyfd_messageBox(
-                "Error",
-                "Select folder name is NULL",
-                "ok",
-                "error",
-                1);
-        return 1;
-}
-
-tinyfd_messageBox("The selected folder is",
-        lTheSelectFolderName, "ok", "info", 1);
-
-lTheHexColor = tinyfd_colorChooser(
-        "choose a nice color",
-        "#FF0077",
-        lRgbColor,
-        lRgbColor);
-
-if (!lTheHexColor)
-{
-        tinyfd_messageBox(
-                "Error",
-                "hexcolor is NULL",
-                "ok",
-                "error",
-                1);
-        return 1;
-}
-
-tinyfd_messageBox("The selected hexcolor is",
-        lTheHexColor, "ok", "info", 1);
-
-        tinyfd_beep();
-
-        return 0;
-}
-*/
-
-#ifdef _MSC_VER
-#pragma warning(default:4996)
-#pragma warning(default:4100)
-#pragma warning(default:4706)
-#endif

+ 0 - 325
tools/rGuiLayout/src/external/tinyfiledialogs.h

@@ -1,325 +0,0 @@
-/*_________
- /         \ tinyfiledialogs.h v3.3.1 [Feb 16, 2018] zlib licence
- |tiny file| Unique header file created [November 9, 2014]
- | dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
- \____  ___/ http://tinyfiledialogs.sourceforge.net
-      \|     git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
-		 ____________________________________________
-		|                                            |
-		|   email: tinyfiledialogs at ysengrin.com   |
-		|____________________________________________|
-     ________________________________________________________________________
-    |                                                                        |
-    | the windows only wchar_t UTF-16 prototypes are at the end of this file |
-    |________________________________________________________________________|
-
-Please 1) let me know If you are using it on exotic hardware / OS / compiler
-       2) leave a 1-word review on Sourceforge.
-	   3) upvote my stackoverflow answer/advert https://stackoverflow.com/a/47651444
-
-tiny file dialogs (cross-platform C C++)
-InputBox PasswordBox MessageBox ColorPicker
-OpenFileDialog SaveFileDialog SelectFolderDialog
-Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
-SSH supported via automatic switch to console mode or X11 forwarding
-
-a C file + a header (add them to your C or C++ project) with 8 functions:
-- beep
-- notify popup
-- message & question
-- input & password
-- save file
-- open file(s)
-- select folder
-- color picker
-
-Complements OpenGL GLFW GLUT GLUI VTK SFML TGUI SDL Ogre Unity3d ION OpenCV
-CEGUI MathGL GLM CPW GLOW IMGUI MyGUI GLT NGL STB & GUI less programs
-
-NO INIT
-NO MAIN LOOP
-NO LINKING
-NO INCLUDE
-
-The dialogs can be forced into console mode
-
-Windows (XP to 10) ASCII MBCS UTF-8 UTF-16
-- native code & vbs create the graphic dialogs
-- enhanced console mode can use dialog.exe from
-http://andrear.altervista.org/home/cdialog.php
-- basic console input
-
-Unix (command line calls) ASCII UTF-8
-- applescript, kdialog, zenity
-- python (2 or 3) + tkinter + python-dbus (optional)
-- dialog (opens a console if needed)
-- basic console input
-The same executable can run across desktops & distributions
-
-C89 & C++98 compliant: tested with C & C++ compilers
-VisualStudio MinGW-gcc GCC Clang TinyCC OpenWatcom-v2 BorlandC SunCC
-on Windows Mac Linux Bsd Solaris Minix Raspbian
-using Gnome Kde Enlightenment Mate Cinnamon Unity Lxde Lxqt Xfce
-WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
-
-Bindings for LUA and C# dll, Haskell
-Included in LWJGL(java), Rust, Allegrobasic
-
-- License -
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software.  If you use this software
-in a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef TINYFILEDIALOGS_H
-#define TINYFILEDIALOGS_H
-
-/* #define TINYFD_NOLIB */
-/* On windows, define TINYFD_NOLIB here
-if you don't want to include the code creating the graphic dialogs.
-Then you won't need to link against Comdlg32.lib and Ole32.lib */
-
-/* if tinydialogs.c is compiled as C++ code rather than C code,
-you may need to comment out:
-extern "C" {
-and the corresponding closing bracket near the end of this file:
-}
-*/
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
-extern char tinyfd_version[8]; /* contains tinyfd current version number */
-extern int tinyfd_verbose; /* 0 (default) or 1 : on unix, prints the command line calls */
-extern char tinyfd_needs[]; /* info about requirements */
-
-#ifdef _WIN32
-/* for UTF-16 use the functions at the end of this files */
-extern int tinyfd_winUtf8; /* 0 (default MBCS) or 1 (UTF-8)*/
-/* on windows string char can be 0:MBCS or 1:UTF-8
-unless your code is really prepared for UTF-8 on windows, leave this on MBSC.
-Or you can use the UTF-16 (wchar) prototypes at the end of ths file.*/
-#endif
-
-extern int tinyfd_forceConsole;  /* 0 (default) or 1 */
-/* for unix & windows: 0 (graphic mode) or 1 (console mode).
-0: try to use a graphic solution, if it fails then it uses console mode.
-1: forces all dialogs into console mode even when an X server is present,
-  if the package dialog (and a console is present) or dialog.exe is installed.
-  on windows it only make sense for console applications */
-
-extern char tinyfd_response[1024];
-/* if you pass "tinyfd_query" as aTitle,
-the functions will not display the dialogs
-but will return 0 for console mode, 1 for graphic mode.
-tinyfd_response is then filled with the retain solution.
-possible values for tinyfd_response are (all lowercase)
-for graphic mode:
-  windows_wchar windows
-  applescript kdialog zenity zenity3 matedialog qarma
-  python2-tkinter python3-tkinter python-dbus perl-dbus
-  gxmessage gmessage xmessage xdialog gdialog
-for console mode:
-  dialog whiptail basicinput */
-
-void tinyfd_beep();
-
-int tinyfd_notifyPopup(
-	char const * const aTitle, /* NULL or "" */
-	char const * const aMessage, /* NULL or "" may contain \n \t */
-	char const * const aIconType); /* "info" "warning" "error" */
-		/* return has only meaning for tinyfd_query */
-
-int tinyfd_messageBox(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aMessage , /* NULL or "" may contain \n \t */
-	char const * const aDialogType , /* "ok" "okcancel" "yesno" "yesnocancel" */
-	char const * const aIconType , /* "info" "warning" "error" "question" */
-	int const aDefaultButton ) ;
-		/* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */
-
-char const * tinyfd_inputBox(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aMessage , /* NULL or "" may NOT contain \n \t on windows */
-	char const * const aDefaultInput ) ;  /* "" , if NULL it's a passwordBox */
-		/* returns NULL on cancel */
-
-char const * tinyfd_saveFileDialog(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aDefaultPathAndFile , /* NULL or "" */
-	int const aNumOfFilterPatterns , /* 0 */
-	char const * const * const aFilterPatterns , /* NULL | {"*.jpg","*.png"} */
-	char const * const aSingleFilterDescription ) ; /* NULL | "text files" */
-		/* returns NULL on cancel */
-
-char const * tinyfd_openFileDialog(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aDefaultPathAndFile , /* NULL or "" */
-	int const aNumOfFilterPatterns , /* 0 */
-	char const * const * const aFilterPatterns , /* NULL {"*.jpg","*.png"} */
-	char const * const aSingleFilterDescription , /* NULL | "image files" */
-	int const aAllowMultipleSelects ) ; /* 0 or 1 */
-		/* in case of multiple files, the separator is | */
-		/* returns NULL on cancel */
-
-char const * tinyfd_selectFolderDialog(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aDefaultPath ) ; /* NULL or "" */
-		/* returns NULL on cancel */
-
-char const * tinyfd_colorChooser(
-	char const * const aTitle , /* NULL or "" */
-	char const * const aDefaultHexRGB , /* NULL or "#FF0000" */
-	unsigned char const aDefaultRGB[3] , /* { 0 , 255 , 255 } */
-	unsigned char aoResultRGB[3] ) ; /* { 0 , 0 , 0 } */
-		/* returns the hexcolor as a string "#FF0000" */
-		/* aoResultRGB also contains the result */
-		/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
-		/* aDefaultRGB and aoResultRGB can be the same array */
-		/* returns NULL on cancel */
-
-
-/************ NOT CROSS PLATFORM SECTION STARTS HERE ************************/
-#ifdef _WIN32
-#ifndef TINYFD_NOLIB
-
-/* windows only - utf-16 version */
-int tinyfd_notifyPopupW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aMessage, /* NULL or L"" may contain \n \t */
-	wchar_t const * const aIconType); /* L"info" L"warning" L"error" */
-
-/* windows only - utf-16 version */
-int tinyfd_messageBoxW(
-	wchar_t const * const aTitle , /* NULL or L"" */
-	wchar_t const * const aMessage, /* NULL or L"" may contain \n \t */
-	wchar_t const * const aDialogType, /* L"ok" L"okcancel" L"yesno" */
-	wchar_t const * const aIconType, /* L"info" L"warning" L"error" L"question" */
-	int const aDefaultButton ); /* 0 for cancel/no , 1 for ok/yes */
-		/* returns 0 for cancel/no , 1 for ok/yes */
-
-/* windows only - utf-16 version */
-wchar_t const * tinyfd_inputBoxW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aMessage, /* NULL or L"" may NOT contain \n nor \t */
-	wchar_t const * const aDefaultInput ); /* L"" , if NULL it's a passwordBox */
-	
-/* windows only - utf-16 version */
-wchar_t const * tinyfd_saveFileDialogW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aDefaultPathAndFile, /* NULL or L"" */
-	int const aNumOfFilterPatterns, /* 0 */
-	wchar_t const * const * const aFilterPatterns, /* NULL or {L"*.jpg",L"*.png"} */
-	wchar_t const * const aSingleFilterDescription); /* NULL or L"image files" */
-		/* returns NULL on cancel */
-
-/* windows only - utf-16 version */
-wchar_t const * tinyfd_openFileDialogW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aDefaultPathAndFile, /* NULL or L"" */
-	int const aNumOfFilterPatterns , /* 0 */
-	wchar_t const * const * const aFilterPatterns, /* NULL {L"*.jpg",L"*.png"} */
-	wchar_t const * const aSingleFilterDescription, /* NULL or L"image files" */
-	int const aAllowMultipleSelects ) ; /* 0 or 1 */
-		/* in case of multiple files, the separator is | */
-		/* returns NULL on cancel */
-
-/* windows only - utf-16 version */
-wchar_t const * tinyfd_selectFolderDialogW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aDefaultPath); /* NULL or L"" */
-		/* returns NULL on cancel */
-
-/* windows only - utf-16 version */
-wchar_t const * tinyfd_colorChooserW(
-	wchar_t const * const aTitle, /* NULL or L"" */
-	wchar_t const * const aDefaultHexRGB, /* NULL or L"#FF0000" */
-	unsigned char const aDefaultRGB[3] , /* { 0 , 255 , 255 } */
-	unsigned char aoResultRGB[3] ) ; /* { 0 , 0 , 0 } */
-		/* returns the hexcolor as a string L"#FF0000" */
-		/* aoResultRGB also contains the result */
-		/* aDefaultRGB is used only if aDefaultHexRGB is NULL */
-		/* aDefaultRGB and aoResultRGB can be the same array */
-		/* returns NULL on cancel */
-
-
-#endif /*TINYFD_NOLIB*/
-#else /*_WIN32*/
-
-/* unix zenity only */
-char const * tinyfd_arrayDialog(
-	char const * const aTitle , /* NULL or "" */
-	int const aNumOfColumns , /* 2 */
-	char const * const * const aColumns, /* {"Column 1","Column 2"} */
-	int const aNumOfRows, /* 2 */
-	char const * const * const aCells);
-		/* {"Row1 Col1","Row1 Col2","Row2 Col1","Row2 Col2"} */
-
-#endif /*_WIN32 */
-
-#ifdef	__cplusplus
-}
-#endif
-
-#endif /* TINYFILEDIALOGS_H */
-
-/*
-- This is not for android nor ios.
-- The code is pure C, perfectly compatible with C++.
-- the windows only wchar_t (utf-16) prototypes are in the header file
-- windows is fully supported from XP to 10 (maybe even older versions)
-- C# & LUA via dll, see example files
-- OSX supported from 10.4 to latest (maybe even older versions)
-- Avoid using " and ' in titles and messages.
-- There's one file filter only, it may contain several patterns.
-- If no filter description is provided,
-  the list of patterns will become the description.
-- char const * filterPatterns[3] = { "*.obj" , "*.stl" , "*.dxf" } ;
-- On windows char defaults to MBCS, set tinyfd_winUtf8=1 to use UTF-8
-- On windows link against Comdlg32.lib and Ole32.lib
-  This linking is not compulsary for console mode (see above).
-- On unix: it tries command line calls, so no such need.
-- On unix you need one of the following:
-  applescript, kdialog, zenity, matedialog, shellementary, qarma,
-  python (2 or 3)/tkinter/python-dbus (optional), Xdialog
-  or dialog (opens terminal if running without console) or xterm.
-- One of those is already included on most (if not all) desktops.
-- In the absence of those it will use gdialog, gxmessage or whiptail
-  with a textinputbox.
-- If nothing is found, it switches to basic console input,
-  it opens a console if needed (requires xterm + bash).
-- Use windows separators on windows and unix separators on unix.
-- String memory is preallocated statically for all the returned values.
-- File and path names are tested before return, they are valid.
-- If you pass only a path instead of path + filename,
-  make sure it ends with a separator.
-- tinyfd_forceConsole=1; at run time, forces dialogs into console mode.
-- On windows, console mode only make sense for console applications.
-- On windows, Console mode is not implemented for wchar_T UTF-16.
-- Mutiple selects are not allowed in console mode.
-- The package dialog must be installed to run in enhanced console mode.
-  It is already installed on most unix systems.
-- On osx, the package dialog can be installed via
-  http://macappstore.org/dialog or http://macports.org
-- On windows, for enhanced console mode,
-  dialog.exe should be copied somewhere on your executable path.
-  It can be found at the bottom of the following page:
-  http://andrear.altervista.org/home/cdialog.php
-- If dialog is missing, it will switch to basic console input.
-- You can query the type of dialog that will be use.
-- MinGW needs gcc >= v4.9 otherwise some headers are incomplete.
-- The Hello World (and a bit more) is on the sourceforge site:
-*/

+ 0 - 2351
tools/rGuiLayout/src/rguilayout.c

@@ -1,2351 +0,0 @@
-/*******************************************************************************************
-*
-*   rGuiLayout v1.1 - raygui layout editor
-*
-*   Compile this program using:
-*       gcc -o rguilayout.exe rguilayout.c external/tinyfiledialogs.c -I..\.. \ 
-*       -lraylib -lopengl32 -lgdi32 -lcomdlg32 -lole32 -std=c99 -Wall
-*
-*   CONTRIBUTORS:
-*       Ramon Santamaria:   Supervision, review, design, update and maintenance...
-*       Adria Arranz:       Design and implementation (2018)
-*       Jordi Jorba:        Design and implementation (2018)
-*
-*   LICENSE: zlib/libpng
-*
-*   Copyright (c) 2014-2018 raylib technologies (@raysan5)
-*
-*   This software is provided "as-is", without any express or implied warranty. In no event
-*   will the authors be held liable for any damages arising from the use of this software.
-*
-*   Permission is granted to anyone to use this software for any purpose, including commercial
-*   applications, and to alter it and redistribute it freely, subject to the following restrictions:
-*
-*     1. The origin of this software must not be misrepresented; you must not claim that you
-*     wrote the original software. If you use this software in a product, an acknowledgment
-*     in the product documentation would be appreciated but is not required.
-*
-*     2. Altered source versions must be plainly marked as such, and must not be misrepresented
-*     as being the original software.
-*
-*     3. This notice may not be removed or altered from any source distribution.
-*
-**********************************************************************************************/
-
-#include "raylib.h"
-
-#define RAYGUI_IMPLEMENTATION
-#define RAYGUI_STYLE_SAVE_LOAD
-//#define RAYGUI_STYLE_DEFAULT_DARK
-#include "raygui.h"
-
-#include "external/easings.h"
-#include "external/tinyfiledialogs.h"   // Open/Save file dialogs
-
-#include <stdlib.h>
-
-//----------------------------------------------------------------------------------
-// Defines and Macros
-//----------------------------------------------------------------------------------
-#define MAX_GUI_CONTROLS        256         // Maximum number of gui controls
-#define MAX_ANCHOR_POINTS         8         // Maximum number of anchor points
-#define ANCHOR_RADIUS            20         // Default anchor radius
-
-#define MAX_CONTROL_TEXT_LENGTH  64         // Maximum length of control text
-#define MAX_CONTROL_NAME_LENGTH  32         // Maximum length of control name (used on code generation)
-
-#define GRID_LINE_SPACING         5         // Grid line spacing in pixels
-
-#define MOVEMENT_FRAME_SPEED     10         // Controls movement speed in pixels per frame
-
-#define PALETTE_EASING_FRAMES    30         // Controls the easing time in frames     
-
-//----------------------------------------------------------------------------------
-// Types and Structures Definition
-//----------------------------------------------------------------------------------
-typedef enum {
-    WINDOWBOX = 0,
-    GROUPBOX,
-    LINE,
-    PANEL,
-    LABEL, 
-    BUTTON,
-    TOGGLE, 
-    TOGGLEGROUP,
-    CHECKBOX,
-    COMBOBOX,
-    DROPDOWNBOX,
-    SPINNER,
-    VALUEBOX,
-    TEXTBOX,
-    SLIDER, 
-    SLIDERBAR, 
-    PROGRESSBAR,
-    STATUSBAR,
-    LISTVIEW,
-    COLORPICKER,
-    DUMMYREC
-} GuiControlType;
-
-// Anchor point type
-typedef struct {
-    int id;
-    int x;
-    int y;
-    bool enabled;
-    bool hidding;
-} AnchorPoint;
-
-// Gui control type
-typedef struct {
-    int id;
-    int type;
-    Rectangle rec;
-    unsigned char name[MAX_CONTROL_NAME_LENGTH];
-    unsigned char text[MAX_CONTROL_TEXT_LENGTH];
-    AnchorPoint *ap;
-} GuiControl;
-
-// Gui layout type
-typedef struct {
-    int controlsCount;
-    AnchorPoint anchors[MAX_ANCHOR_POINTS];
-    GuiControl controls[MAX_GUI_CONTROLS];
-} GuiLayout;
-
-// Gui layout configuration type
-typedef struct {
-    int width;
-    int height;
-    unsigned char name[64];
-    unsigned char version[32];
-    unsigned char company[128];
-    unsigned char description[256];
-    bool defineRecs;
-    bool exportAnchors;
-    bool exportAnchor0;
-    bool fullComments;
-    bool defineTexts;
-    bool cropWindow;
-    bool fullVariables;
-} GuiLayoutConfig;
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-static int screenWidth = 800;
-static int screenHeight = 600;
-
-static GuiLayout layout = { 0 };
-
-const char *controlTypeName[] = { "WINDOWBOX", "GROUPBOX", "LINE", "PANEL", "LABEL", "BUTTON", "TOGGLE", "TOGGLEGROUP", "CHECKBOX", "COMBOBOX", "DROPDOWNBOX", "SPINNER", "VALUEBOX", "TEXTBOX", "SLIDER", "SLIDERBAR", "PROGRESSBAR", "STATUSBAR", "LISTVIEW", "COLORPICKER", "DUMMYREC" };
-const char *controlTypeNameLow[] = { "WindowBox", "GroupBox", "Line", "Panel", "Label", "Button", "Toggle", "ToggleGroup", "CheckBox", "ComboBox", "DropdownBox", "Spinner", "ValueBox", "TextBox", "Slider", "SliderBar", "ProgressBar", "StatusBar", "ListView", "ColorPicker", "DummyRec" };
-const char *controlTypeNameShort[] = { "wdwbox", "grpbox", "lne", "pnl", "lbl", "btn", "tgl", "tglgrp", "chkbox", "combox", "ddwnbox", "spnr", "vlbox", "txtbox", "sldr", "sldrb", "prgssb", "stsb", "lstvw", "clrpckr", "dmyrc" };
-
-static bool cancelSave = false;
-static char loadedFileName[128] = "\0";
-//----------------------------------------------------------------------------------
-// Module specific Functions Declaration
-//----------------------------------------------------------------------------------
-static void ShowSaveLayoutDialog(void);                                 // Show save layout dialog
-static void ShowExportLayoutDialog(GuiLayoutConfig config);             // Show export layout dialog
-static void SaveLayoutRGL(const char *fileName, bool binary);           // Save gui layout project information
-static void LoadLayoutRGL(const char *fileName);                        // Load gui layout project information
-static void GenerateCode(const char *fileName, GuiLayoutConfig config); // Generate C code for gui layout
-static void GenerateCodeFromRGL(const char *fileName);                  // Generate C code from .rgl file
-static char *GetControlAnchorRec(int anchorId, Rectangle controlRec, GuiLayoutConfig config);   // Get control rectangle
-
-//----------------------------------------------------------------------------------
-// Main Entry point
-//----------------------------------------------------------------------------------
-int main()
-{
-    // Initialization
-    //--------------------------------------------------------------------------------------
-    SetConfigFlags(FLAG_WINDOW_RESIZABLE);
-    InitWindow(screenWidth, screenHeight, "rGuiLayout v1.1");
-    SetExitKey(0);
-
-    // General app variables
-    Vector2 mouse;
-    bool exitWindow = false;            // Exit window flag
-    bool snapMode = false;              // Snap mode flag (KEY_S)
-    bool showGrid = true;               // Show grid flag (KEY_G)
-    bool controlDrag = false;           // Control drag mode
-    bool controlGlobalPos = false;      // Control global position mode
-    bool textEditMode = false;          // Control text edit mode (KEY_T)
-    bool nameEditMode = false;          // Control name edit mode (KEY_N)
-    
-    int framesCounter = 0;
-    int framesCounterSnap = 0;
-    int selectedControl = -1;
-    int storedControl = -1;
-    int focusedControl = -1;
-    int selectedType = WINDOWBOX;
-    int selectedTypeDraw = LABEL;
-    Vector2 panControlOffset = { 0 };
-    Vector2 prevControlPosition = { 0 };
-    
-    int textArrayPos = 0;
-    
-    const char *listData[3] = { "ONE", "TWO", "THREE" };    // ToggleGroup, ComboBox, DropdownBox default data
-    const char *listViewData[4] = { "WINDOWBOX", "GROUPBOX", "LINE", "PANEL" }; // ListView default data
-
-    // Anchors control variables
-    AnchorPoint auxAnchor = { 9, 0, 0, 0 };
-    bool anchorMode = false;
-    bool anchorLinkMode = false;
-    bool anchorLockMode = false;
-    bool anchorPosEditMode = false;
-    int selectedAnchor = -1;
-    int linkedAnchor = -1;
-    int storedAnchor = -1;
-
-    // Help panel variables
-    int helpPositionX = -300;
-    int helpCounter = 0;
-    int helpStartPositionX = -300;
-    int helpDeltaPositionX = 0;
-    bool helpActive = false;
-
-    // Rectangles used on controls preview drawing
-    Rectangle defaultRec[21] = {
-        (Rectangle){ 0, 0, 125, 50},            // WINDOWBOX
-        (Rectangle){ 0, 0, 125, 30},            // GROUPBOX
-        (Rectangle){ 0, 0, 125, 25 },           // LINE
-        (Rectangle){ 0, 0, 125, 35 },           // PANEL
-        (Rectangle){ 0, 0, 126, 25 },           // LABEL
-        (Rectangle){ 0, 0, 125, 30 },           // BUTTON
-        (Rectangle){ 0, 0, 90, 25 },            // TOGGLE
-        (Rectangle){ 0, 0, 125, 25 },           // TOGGLEGROUP
-        (Rectangle){ 0, 0, 15, 15},             // CHECKBOX
-        (Rectangle){ 0, 0, 125, 25 },           // COMBOBOX
-        (Rectangle){ 0, 0, 125, 25 },           // DROPDOWNBOX
-        (Rectangle){ 0, 0, 125, 25 },           // SPINNER
-        (Rectangle){ 0, 0, 125, 25 },           // VALUEBOX
-        (Rectangle){ 0, 0, 125, 25 },           // TEXTBOX
-        (Rectangle){ 0, 0, 125, 15 },           // SLIDER
-        (Rectangle){ 0, 0, 125, 15 },           // SLIDERBAR
-        (Rectangle){ 0, 0, 125, 15 },           // PROGRESSBAR
-        (Rectangle){ 0, 0, 125, 25 },           // STATUSBAR
-        (Rectangle){ 0, 0, 125, 75 },           // LISTVIEW
-        (Rectangle){ 0, 0, 95, 95 },            // COLORPICKER
-        (Rectangle){ 0, 0, 125, 30 }            // DUMMYREC
-    };
-    
-    // Initialize anchor points to default values
-    for (int i = 0; i < MAX_ANCHOR_POINTS; i++)
-    {
-        layout.anchors[i].id = i;
-        layout.anchors[i].x = 0;
-        layout.anchors[i].y = 0;
-        layout.anchors[i].enabled = false;
-        layout.anchors[i].hidding = false;
-    }
-
-    layout.anchors[0].enabled = true;      // Enable layout parent anchor (0, 0)
-    
-    // Initialize layout controls data
-    for (int i = 0; i < MAX_GUI_CONTROLS; i++)
-    {
-        layout.controls[i].id = 0;
-        layout.controls[i].type = 0;
-        layout.controls[i].rec = (Rectangle){ 0, 0, 0, 0 };
-        memset(layout.controls[i].text, 0, MAX_CONTROL_TEXT_LENGTH);
-        memset(layout.controls[i].name, 0, MAX_CONTROL_NAME_LENGTH);
-        layout.controls[i].ap = &layout.anchors[0];  // By default, set parent anchor
-    }
-       
-    // Define palette variables
-    Rectangle palettePanel = { GetScreenWidth() + 130, 20, 135, 870 };
-    bool paletteMode = false;
-    int paletteSelect = -1;
-    int paletteEasingIn = 0;
-    int paletteEasingOut = PALETTE_EASING_FRAMES;
-    int paletteStartPosX = GetScreenWidth() + 130;
-
-    // Define palette rectangles
-    Rectangle paletteRecs[21] = {
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 5, 125, 50 },            // WindowBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 65, 125, 30 },        // GroupBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 105, 125, 25 },        // Line
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 140, 125, 35 },        // Panel
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 185, 126, 25 },        // Label
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 220, 125, 30 },        // Button
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 260, 90, 25 },        // Toggle
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 295, 125, 25 },        // ToggleGroup
-        (Rectangle){ palettePanel.x + 105, palettePanel.y + 265, 15, 15 },        // CheckBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 330, 125, 25 },        // ComboBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 365, 125, 25 },        // DropdownBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 400, 125, 25 },        // Spinner
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 435, 125, 25 },        // ValueBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 470, 125, 25 },        // TextBox
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 505, 125, 15 },        // Slider
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 530, 125, 15 },        // SliderBar
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 555, 125, 15 },        // ProgressBar
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 580, 125, 25 },        // StatusBar
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 615, 125, 75 },        // ListView
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 700, 95, 95 },        // ColorPicker
-        (Rectangle){ palettePanel.x + 5, palettePanel.y + 835, 125, 30 }        // DummyRec
-    };
-    
-    // Tracemap (background image for reference) variables
-    Texture2D tracemap = { 0 };
-    Rectangle tracemapRec = { 0 };
-    bool tracemapEditMode = false;
-    float tracemapFade = 0.5f;
-    
-    // loadedTexture for checking if texture is a tracemap or a style
-    Texture2D loadedTexture = { 0 };
-    
-    // Very basic undo system
-    // Undo last-selected rectangle changes
-    // Undo text/name editing on cancel (KEY_ESC)
-    int undoSelectedControl = -1;
-    Rectangle undoLastRec;
-    char prevControlText[MAX_CONTROL_TEXT_LENGTH];
-    char prevControlName[MAX_CONTROL_NAME_LENGTH];
-
-    // Close layout window variables
-    bool closingWindowActive = false;
-    
-    // Generate code options window variables
-    Vector2 exportWindowPos = { 50, 50 };
-    bool generateWindowActive = false;
-    int toolNameSize = 32;
-    int toolVersionSize = 32;
-    int companySize = 32;
-    int toolDescriptionSize = 32;
-    
-    // Generate code configuration
-    GuiLayoutConfig config;
-    memset(&config, 0, sizeof(GuiLayoutConfig));
-    config.width = 800;
-    config.height = 600;
-    strcpy(config.name, "layout_file_name");
-    strcpy(config.version, "1.0-dev");
-    strcpy(config.company, "raylib technologies");
-    strcpy(config.description, "tool description");
-    config.defineRecs = false;
-    config.exportAnchors = false;
-    config.exportAnchor0 = false;
-    config.fullComments = false;
-    config.defineTexts = false;
-    config.fullVariables = false;
-    
-    // Delete current layout and reset variables
-    bool resetWindowActive = false;
-    bool resetLayout = false;
-    
-    SetTargetFPS(120);
-    //--------------------------------------------------------------------------------------
-
-    // Main game loop
-    while (!exitWindow)    // Detect window close button or ESC key
-    {
-        // Update
-        //----------------------------------------------------------------------------------
-        framesCounterSnap++;
-        mouse = GetMousePosition();
-
-        if (WindowShouldClose()) exitWindow = true;
-        
-        // Show save layout message window on ESC
-        if (IsKeyPressed(KEY_ESCAPE) && !textEditMode && !nameEditMode)
-        {
-            if (layout.controlsCount <= 0) exitWindow = true;
-            else if (generateWindowActive) generateWindowActive = false;
-            else if (resetWindowActive) resetWindowActive = false;
-            else
-            {
-                closingWindowActive = !closingWindowActive;
-                selectedControl = -1;
-            }
-        }
-
-        // Enables or disables snapMode if not in textEditMode
-        if (IsKeyPressed(KEY_S) && (!textEditMode) && (!nameEditMode)) snapMode = !snapMode;
-        
-        // Enables or disables position reference information(anchor reference or global reference)
-        if (IsKeyPressed(KEY_F) && (!textEditMode) && (!nameEditMode)) controlGlobalPos = !controlGlobalPos;
-        
-        // Toggle help info
-        if (IsKeyPressed(KEY_TAB) && !helpActive)
-        {
-            helpStartPositionX = helpPositionX;
-            helpDeltaPositionX = 0 - helpStartPositionX;
-            helpCounter = 0;
-            helpActive = true;
-        }
-        else if (IsKeyPressed(KEY_TAB) && helpActive)
-        {
-            helpStartPositionX = helpPositionX;
-            helpDeltaPositionX = -300 - helpStartPositionX;
-            helpCounter = 0;
-            helpActive = false;
-        }
-        
-        if (helpActive)
-        {
-            helpCounter++;
-            if (helpCounter >= 60) helpCounter = 60;
-            helpPositionX = (int)EaseCubicInOut(helpCounter, helpStartPositionX, helpDeltaPositionX, 60);
-        }
-        else
-        {
-            helpCounter++;
-            if (helpCounter >= 60) helpCounter = 60;
-            helpPositionX = (int)EaseCubicInOut(helpCounter, helpStartPositionX, helpDeltaPositionX, 60);
-        }
-        
-        // Controls palette selector logic
-        if ((IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) && (!anchorMode) && (!paletteMode))
-        {
-            paletteMode = true;
-            paletteEasingOut = 0;
-        }
-        else if ((IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) && (!anchorMode) && (paletteMode))
-        {
-            paletteMode = false;
-            paletteEasingIn = 0;
-        }
-        
-        if (paletteMode)
-        {
-            paletteEasingIn++;
-            if (paletteEasingIn >= PALETTE_EASING_FRAMES) paletteEasingIn = PALETTE_EASING_FRAMES;
-            palettePanel.x = (int)EaseCubicInOut(paletteEasingIn, paletteStartPosX,(GetScreenWidth() - 145) - paletteStartPosX, PALETTE_EASING_FRAMES);
-            
-            for (int i = 0; i < 21; i++)
-            {
-                if (CheckCollisionPointRec(mouse, paletteRecs[i]))
-                {
-                    paletteSelect = i;
-                    if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selectedType = i;
-                    break;
-                }
-                else paletteSelect = -1;
-            }
-        }
-        else 
-        {
-            paletteStartPosX = GetScreenWidth() + 130;
-            paletteEasingOut++;
-            if (paletteEasingOut >= PALETTE_EASING_FRAMES) paletteEasingOut = PALETTE_EASING_FRAMES;
-            palettePanel.x = (int)EaseCubicInOut(paletteEasingOut, (GetScreenWidth() - 145), paletteStartPosX - (GetScreenWidth() - 145), PALETTE_EASING_FRAMES);
-        }
-          
-        for (int i = 0; i < 21; i++)
-        {
-            if (i == 8) paletteRecs[i].x = palettePanel.x + 105;
-            else paletteRecs[i].x = palettePanel.x + 5;
-        }
-        
-        // Create new control 
-        if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (focusedControl == -1) && (selectedControl == -1) && !anchorMode && !tracemapEditMode && !closingWindowActive && !generateWindowActive && (!resetWindowActive) && !CheckCollisionPointRec(mouse, palettePanel))
-        {
-            // Add new control (button)
-            layout.controls[layout.controlsCount].id = layout.controlsCount;
-            layout.controls[layout.controlsCount].type = selectedType;
-            layout.controls[layout.controlsCount].rec = (Rectangle){  mouse.x - defaultRec[selectedType].width/2, mouse.y - defaultRec[selectedType].height/2, defaultRec[selectedType].width, defaultRec[selectedType].height };
-            if ((layout.controls[layout.controlsCount].type == LABEL) || (layout.controls[layout.controlsCount].type == TEXTBOX) || (layout.controls[layout.controlsCount].type == BUTTON) || (layout.controls[layout.controlsCount].type == TOGGLE)
-                || (layout.controls[layout.controlsCount].type == GROUPBOX) || (layout.controls[layout.controlsCount].type == WINDOWBOX) || (layout.controls[layout.controlsCount].type == STATUSBAR) || (layout.controls[layout.controlsCount].type == DUMMYREC)) strcpy(layout.controls[layout.controlsCount].text, "SAMPLE TEXT");
-            strcpy(layout.controls[layout.controlsCount].name, FormatText("%s%03i", controlTypeNameLow[layout.controls[layout.controlsCount].type], layout.controlsCount));
-            layout.controls[layout.controlsCount].ap = &layout.anchors[0];        // Default anchor point (0, 0)
-            
-            for (int i = 0; i < layout.controlsCount; i++)
-            {
-                if (CheckCollisionPointRec(mouse, (Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }) && layout.controls[i].type == WINDOWBOX) layout.controls[layout.controlsCount].ap = layout.controls[i].ap;
-            }
-            
-            if (layout.controls[layout.controlsCount].type == WINDOWBOX)
-            {
-                for (int i = 1; i < MAX_ANCHOR_POINTS; i++)
-                {
-                    if (!layout.anchors[i].enabled)
-                    {
-                        layout.anchors[i].x = layout.controls[layout.controlsCount].rec.x;
-                        layout.anchors[i].y = layout.controls[layout.controlsCount].rec.y;
-                        
-                        if (snapMode)
-                        {
-                            int offsetX = layout.anchors[i].x%GRID_LINE_SPACING;
-                            int offsetY = layout.anchors[i].y%GRID_LINE_SPACING;
-                            
-                            if (offsetX >= GRID_LINE_SPACING/2) layout.anchors[i].x += (GRID_LINE_SPACING - offsetX);
-                            else layout.anchors[i].x -= offsetX;
-                            
-                            if (offsetY >= GRID_LINE_SPACING/2) layout.anchors[i].y += (GRID_LINE_SPACING - offsetY);
-                            else layout.anchors[i].y -= offsetY;
-                        }
-                        
-                        layout.controls[layout.controlsCount].rec.x = layout.anchors[i].x;
-                        layout.controls[layout.controlsCount].rec.y = layout.anchors[i].y;
-                        
-                        layout.anchors[i].enabled = true;
-                        layout.controls[layout.controlsCount].ap = &layout.anchors[i];
-                        break;
-                    }
-                }
-            }
-                             
-            layout.controls[layout.controlsCount].rec.x -= layout.controls[layout.controlsCount].ap->x;
-            layout.controls[layout.controlsCount].rec.y -= layout.controls[layout.controlsCount].ap->y;
-            layout.controlsCount++;     
-        }
-        else
-        {
-            if (!(controlDrag || tracemapEditMode || anchorLockMode || closingWindowActive || generateWindowActive || resetWindowActive))
-            {
-                // Check selected control (on mouse hover)
-                for (int i = layout.controlsCount; i >= 0; i--)
-                {
-                    if ((layout.controls[i].type == WINDOWBOX) && (!layout.controls[i].ap->hidding) && (CheckCollisionPointRec(mouse, (Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, 24 })))
-                    {
-                        focusedControl = i;
-                        
-                        if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && !anchorLinkMode && !anchorMode)
-                        {
-                            selectedControl = focusedControl;
-                        }
-                        
-                        if (undoSelectedControl != focusedControl) 
-                        {
-                            undoSelectedControl = focusedControl;
-                            undoLastRec = layout.controls[i].rec;
-                        }
-                        break;
-                    }
-                    else if ((!layout.controls[i].ap->hidding) && (CheckCollisionPointRec(mouse, (Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }) && layout.controls[i].type != WINDOWBOX))
-                    {
-                        focusedControl = i;
-                        
-                        if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && !anchorLinkMode && !anchorMode)
-                        {
-                            selectedControl = focusedControl;
-                        }
-                        
-                        if (undoSelectedControl != focusedControl) 
-                        {
-                            undoSelectedControl = focusedControl;
-                            undoLastRec = layout.controls[i].rec;
-                        }
-                        break;
-                    }
-                    else 
-                    {
-                        focusedControl = -1;
-                        
-                        if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selectedControl = -1;
-                    }
-                }
-            }
-        }
-        
-        // Change controls layer order (position inside array)
-        if (IsKeyDown(KEY_LEFT_ALT) && (focusedControl != -1))
-        {
-            if ((IsKeyPressed(KEY_UP)) && (focusedControl < layout.controlsCount - 1))
-            {
-                // Move control towards beginning of array
-                GuiControl auxControl = layout.controls[focusedControl];
-                layout.controls[focusedControl] = layout.controls[focusedControl + 1];
-                layout.controls[focusedControl].id -= 1;
-                layout.controls[focusedControl + 1] = auxControl;
-                layout.controls[focusedControl + 1].id += 1;
-                selectedControl = -1;
-            }
-            else if ((IsKeyPressed(KEY_DOWN)) && (focusedControl > 0))
-            {
-                // Move control towards end of array
-                GuiControl auxControl = layout.controls[focusedControl];
-                layout.controls[focusedControl] = layout.controls[focusedControl - 1];
-                layout.controls[focusedControl].id += 1;
-                layout.controls[focusedControl - 1] = auxControl;
-                layout.controls[focusedControl - 1].id -= 1;
-                selectedControl = -1;
-            }
-        }
-        
-
-        
-        if (selectedControl != -1 && !textEditMode && !nameEditMode && !anchorMode)
-        {
-            if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-            {
-                controlDrag = true;
-                panControlOffset = mouse;
-                prevControlPosition = (Vector2){ layout.controls[selectedControl].rec.x, layout.controls[selectedControl].rec.y };
-            }
-            else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
-            {
-                controlDrag = false;
-            } 
-             
-            if (controlDrag)
-            {
-                layout.controls[selectedControl].rec.x = prevControlPosition.x + (mouse.x - panControlOffset.x);
-                layout.controls[selectedControl].rec.y = prevControlPosition.y + (mouse.y - panControlOffset.y);
-
-                // Snap to grid position and size
-                if (snapMode)
-                {
-                    // Snap rectangle position to closer snap point
-                    int offsetX = (int)layout.controls[selectedControl].rec.x%GRID_LINE_SPACING;
-                    int offsetY = (int)layout.controls[selectedControl].rec.y%GRID_LINE_SPACING;
-                    
-                    if (offsetX >= GRID_LINE_SPACING/2) layout.controls[selectedControl].rec.x += (GRID_LINE_SPACING - offsetX);
-                    else layout.controls[selectedControl].rec.x -= offsetX;
-                    
-                    if (offsetY >= GRID_LINE_SPACING/2) layout.controls[selectedControl].rec.y += (GRID_LINE_SPACING - offsetY);
-                    else layout.controls[selectedControl].rec.y -= offsetY;
-                }
-            }
-            
-            if (!IsKeyDown(KEY_LEFT_ALT) && (selectedControl != -1))
-            {
-                if (snapMode)
-                {
-                    if (IsKeyDown(KEY_LEFT_CONTROL))
-                    {
-                        // Control modifier of width and height
-                        if (IsKeyDown(KEY_LEFT_SHIFT))
-                        {
-                            if (IsKeyPressed(KEY_RIGHT)) layout.controls[selectedControl].rec.width += GRID_LINE_SPACING;
-                            else if (IsKeyPressed(KEY_LEFT)) layout.controls[selectedControl].rec.width -= GRID_LINE_SPACING;
-
-                            if (IsKeyPressed(KEY_UP)) layout.controls[selectedControl].rec.height -= GRID_LINE_SPACING;
-                            else if (IsKeyPressed(KEY_DOWN)) layout.controls[selectedControl].rec.height += GRID_LINE_SPACING;
-                        }
-                        else
-                        {
-                            if (IsKeyDown(KEY_RIGHT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.width += GRID_LINE_SPACING;
-                            else if (IsKeyDown(KEY_LEFT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.width -= GRID_LINE_SPACING;
-
-                            if (IsKeyDown(KEY_UP) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.height -= GRID_LINE_SPACING;
-                            else if (IsKeyDown(KEY_DOWN) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.height += GRID_LINE_SPACING;
-                        }
-                    }
-                    else 
-                    {
-                        // Control modifier of position
-                        if (IsKeyDown(KEY_LEFT_SHIFT))
-                        {
-                            if (IsKeyPressed(KEY_RIGHT)) layout.controls[selectedControl].rec.x += GRID_LINE_SPACING;
-                            else if (IsKeyPressed(KEY_LEFT)) layout.controls[selectedControl].rec.x -= GRID_LINE_SPACING;
-                            
-                            if (IsKeyPressed(KEY_UP)) layout.controls[selectedControl].rec.y -= GRID_LINE_SPACING;
-                            else if (IsKeyPressed(KEY_DOWN)) layout.controls[selectedControl].rec.y += GRID_LINE_SPACING;
-                        }
-                        else
-                        {
-                            if (IsKeyDown(KEY_RIGHT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.x += GRID_LINE_SPACING;
-                            else if (IsKeyDown(KEY_LEFT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.x -= GRID_LINE_SPACING;
-                            
-                            if (IsKeyDown(KEY_UP) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.y -= GRID_LINE_SPACING;
-                            else if (IsKeyDown(KEY_DOWN) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.controls[selectedControl].rec.y += GRID_LINE_SPACING;
-                        }
-                        
-                    }
-                }
-                else
-                {
-                    if (IsKeyDown(KEY_LEFT_CONTROL))
-                    {
-                        // Control modifier for a more precise sizing                  
-                        if (IsKeyDown(KEY_LEFT_SHIFT))
-                        {
-                            // Control modifier of position 
-                            if (IsKeyPressed(KEY_RIGHT)) layout.controls[selectedControl].rec.width++;
-                            else if (IsKeyPressed(KEY_LEFT)) layout.controls[selectedControl].rec.width--;
-                            
-                            if (IsKeyPressed(KEY_UP)) layout.controls[selectedControl].rec.height--;
-                            else if (IsKeyPressed(KEY_DOWN)) layout.controls[selectedControl].rec.height++;
-                        }
-                        else
-                        {
-                            if (IsKeyDown(KEY_RIGHT)) layout.controls[selectedControl].rec.width++;
-                            else if (IsKeyDown(KEY_LEFT)) layout.controls[selectedControl].rec.width--;
-
-                            if (IsKeyDown(KEY_UP)) layout.controls[selectedControl].rec.height--;
-                            else if (IsKeyDown(KEY_DOWN)) layout.controls[selectedControl].rec.height++;
-                        }
-                    }
-                    else
-                    {
-                        if (IsKeyDown(KEY_LEFT_SHIFT))
-                        {
-                            // Control modifier for a more precise sizing
-                            if (IsKeyPressed(KEY_RIGHT)) layout.controls[selectedControl].rec.x++;
-                            else if (IsKeyPressed(KEY_LEFT)) layout.controls[selectedControl].rec.x--;
-
-                            if (IsKeyPressed(KEY_UP)) layout.controls[selectedControl].rec.y--;
-                            else if (IsKeyPressed(KEY_DOWN)) layout.controls[selectedControl].rec.y++;
-                        }
-                        else
-                        {
-                            if (IsKeyDown(KEY_RIGHT)) layout.controls[selectedControl].rec.x++;
-                            else if (IsKeyDown(KEY_LEFT)) layout.controls[selectedControl].rec.x--;
-                            
-                            if (IsKeyDown(KEY_UP)) layout.controls[selectedControl].rec.y--;
-                            else if (IsKeyDown(KEY_DOWN)) layout.controls[selectedControl].rec.y++;
-                        }
-                    }
-                }
-            }
-
-            // Unlinks the control selected from its current anchor
-            if (IsKeyPressed(KEY_U))
-            {
-                layout.controls[selectedControl].rec.x += layout.controls[selectedControl].ap->x;
-                layout.controls[selectedControl].rec.y += layout.controls[selectedControl].ap->y;
-                layout.controls[selectedControl].ap = &layout.anchors[0];
-            }
-        }
-
-        // Updates the selectedType with the MouseWheel
-        selectedType -= GetMouseWheelMove();
-        
-        if (selectedType < WINDOWBOX) selectedType = WINDOWBOX;
-        else if (selectedType > DUMMYREC) selectedType = DUMMYREC;
-        
-        selectedTypeDraw = selectedType;
-        
-        if (focusedControl != -1)
-        {
-            // Delete focused control and shift array position
-            if (IsKeyPressed(KEY_DELETE))
-            {
-                for (int i = focusedControl; i < layout.controlsCount; i++)
-                {
-                    layout.controls[i].type = layout.controls[i + 1].type;
-                    layout.controls[i].rec = layout.controls[i + 1].rec;
-                    memset(layout.controls[i].text, 0, MAX_CONTROL_TEXT_LENGTH);
-                    memset(layout.controls[i].name, 0, MAX_CONTROL_NAME_LENGTH);
-                    strcpy(layout.controls[i].text, layout.controls[i + 1].text);
-                    strcpy(layout.controls[i].name, layout.controls[i + 1].name);
-                    layout.controls[i].ap = layout.controls[i + 1].ap;
-                }
-
-                layout.controlsCount--;
-                focusedControl = -1;
-                selectedControl = -1;
-            }
-        }
-        
-        // Updates the defaultRec[selectedType] position
-        defaultRec[selectedType].x = mouse.x - defaultRec[selectedType].width/2;
-        defaultRec[selectedType].y = mouse.y - defaultRec[selectedType].height/2;
-
-        // Mouse snap
-        // NOTE: Snap point changes when GRID_LINE_SPACING/2 has been surpassed in X and Y
-        if ((snapMode) && (selectedControl == -1))
-        {
-            int offsetX = (int)mouse.x%GRID_LINE_SPACING;
-            int offsetY = (int)mouse.y%GRID_LINE_SPACING;
-            
-            if (offsetX >= GRID_LINE_SPACING/2) mouse.x += (GRID_LINE_SPACING - offsetX);
-            else mouse.x -= offsetX;
-            
-            if (offsetY >= GRID_LINE_SPACING/2) mouse.y += (GRID_LINE_SPACING - offsetY);
-            else mouse.y -= offsetY;
-            
-            // SnapMode of the DrawingControls
-            // Snap rectangle position to closer snap point
-            offsetX = (int)defaultRec[selectedType].x%GRID_LINE_SPACING;
-            offsetY = (int)defaultRec[selectedType].y%GRID_LINE_SPACING;
-
-            if (offsetX >= GRID_LINE_SPACING/2) defaultRec[selectedType].x += (GRID_LINE_SPACING - offsetX);
-            else defaultRec[selectedType].x -= offsetX;
-
-            if (offsetY >= GRID_LINE_SPACING/2) defaultRec[selectedType].y += (GRID_LINE_SPACING - offsetY);
-            else defaultRec[selectedType].y -= offsetY;      
-        }
-        
-        // Resize the controller aplying the snap
-        if ((IsKeyDown(KEY_LEFT_CONTROL)) && (!textEditMode) && (!nameEditMode) && (IsKeyPressed(KEY_R)) && (selectedControl != -1))
-        {
-            int offsetX = (int)layout.controls[selectedControl].rec.width%GRID_LINE_SPACING;
-            int offsetY = (int)layout.controls[selectedControl].rec.height%GRID_LINE_SPACING;
-            
-            if (offsetX >= GRID_LINE_SPACING/2) layout.controls[selectedControl].rec.width += (GRID_LINE_SPACING - offsetX);
-            else layout.controls[selectedControl].rec.width -= offsetX;
-            
-            if (offsetY >= GRID_LINE_SPACING/2) layout.controls[selectedControl].rec.height += (GRID_LINE_SPACING - offsetY);
-            else layout.controls[selectedControl].rec.height -= offsetY;
-        }
-        
-        // Check if control has text to edit
-        if (textEditMode)
-        {
-            // Locks the selectedControl for text editing
-            selectedControl = storedControl;
-            int key = GetKeyPressed();
-            int keyCount = strlen(layout.controls[selectedControl].text); // Keeps track of text length
-
-            if (IsKeyPressed(KEY_LEFT)) textArrayPos--;
-            else if (IsKeyPressed(KEY_RIGHT)) textArrayPos++;
-            
-            if (textArrayPos >= 0) textArrayPos = 0;
-            else if (textArrayPos <= keyCount*(-1)) textArrayPos = keyCount*(-1);
-            
-            // Replaces characters with pressed keys or '\0' in case of backspace
-            // NOTE: Only allow keys in range [32..125]
-            if (((key >= 32) && (key <= 125)) && (keyCount < MAX_CONTROL_TEXT_LENGTH - 1))
-            {
-                for (int i = keyCount; i > keyCount + textArrayPos; i--)
-                {
-                    layout.controls[selectedControl].text[i] = layout.controls[selectedControl].text[i - 1];
-                }
-                layout.controls[selectedControl].text[keyCount + textArrayPos] = (unsigned char)key;
-            }
-            
-            if ((textArrayPos == 0))
-            {
-                if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE_TEXT))
-                {
-                    layout.controls[selectedControl].text[keyCount - 1] = '\0';
-                    framesCounterSnap = 0;
-                    if (keyCount < 0) keyCount = 0;
-                }
-                else if ((keyCount > 0) && IsKeyDown(KEY_BACKSPACE_TEXT))
-                {
-                    if ((framesCounterSnap > 60) && ((framesCounterSnap%4) == 0)) layout.controls[selectedControl].text[keyCount - 1] = '\0';
-                    if (keyCount < 0) keyCount = 0;
-                }
-            }
-            else if(textArrayPos*(-1) != keyCount)
-            {
-                if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE_TEXT))
-                {
-                    framesCounterSnap = 0;
-                    for (int i = -1; i <= -textArrayPos; i++)
-                    {
-                        layout.controls[selectedControl].text[keyCount + textArrayPos + i] = layout.controls[selectedControl].text[keyCount + textArrayPos + i + 1];
-                        if (i == -textArrayPos) layout.controls[selectedControl].text[keyCount - 1] = '\0';
-                    }
-                }
-                else if ((keyCount > 0) && IsKeyDown(KEY_BACKSPACE_TEXT))
-                {
-                    if ((framesCounterSnap > 60) && ((framesCounterSnap%4) == 0))
-                    {
-                        for (int i = -1; i <= -textArrayPos; i++)
-                        {
-                            layout.controls[selectedControl].text[keyCount + textArrayPos + i] = layout.controls[selectedControl].text[keyCount + textArrayPos + i + 1];
-                            if (i == -textArrayPos) layout.controls[selectedControl].text[keyCount - 1] = '\0';
-                        }
-                    }
-                }
-            }
-            
-            // Used to show the cursor('|') in textEditMode 
-            if (keyCount < MAX_CONTROL_TEXT_LENGTH) framesCounter++;
-            else if (keyCount == MAX_CONTROL_TEXT_LENGTH) framesCounter = 21;
-        }
-        
-        if ((nameEditMode))
-        {
-            // Locks the selectedControl for text editing
-            selectedControl = storedControl;
-            int key = GetKeyPressed();
-            int keyCount = strlen(layout.controls[selectedControl].name); // Keeps track of name length
-       
-            // Replaces characters with pressed keys or '\0' in case of backspace
-            // NOTE: Only allow keys in range [48..57], [65..90] and [97..122]
-            if ((((key >= 48) && (key <= 57)) || ((key >= 65) && (key <= 90)) || ((key >= 97) && (key <= 122))) && (keyCount < MAX_CONTROL_NAME_LENGTH - 1))
-            {
-                layout.controls[selectedControl].name[keyCount] = (unsigned char)key;
-            }
-            
-            if ((keyCount > 0) && IsKeyPressed(KEY_BACKSPACE_TEXT))
-            {
-                layout.controls[selectedControl].name[keyCount - 1] = '\0';
-                if (keyCount < 0) keyCount = 0;
-            }
-            
-            // Used to show the cursor('|') in textEditMode 
-            if (keyCount < MAX_CONTROL_NAME_LENGTH) framesCounter++;
-            else if (keyCount == MAX_CONTROL_NAME_LENGTH) framesCounter = 21;
-        }
-        
-        // Turns off textEditMode
-        if (textEditMode && IsKeyPressed(KEY_ENTER)) 
-        {
-            textEditMode = false;
-            framesCounter = 0;
-        }
-        else if (textEditMode && IsKeyPressed(KEY_ESCAPE)) 
-        {
-            textEditMode = false;
-            memset(layout.controls[selectedControl].text, 0, MAX_CONTROL_TEXT_LENGTH);
-            strcpy(layout.controls[selectedControl].text, prevControlText);
-            framesCounter = 0;
-        }
-        
-        if (nameEditMode && IsKeyPressed(KEY_ENTER)) 
-        {
-            nameEditMode = false;
-            framesCounter = 0;
-        }
-        else if (nameEditMode && IsKeyPressed(KEY_ESCAPE)) 
-        {
-            nameEditMode = false;
-            memset(layout.controls[selectedControl].name, 0, MAX_CONTROL_NAME_LENGTH);
-            strcpy(layout.controls[selectedControl].name, prevControlName);
-            framesCounter = 0;
-        }
-        
-        // Turns on textEditMode
-        if (IsKeyPressed(KEY_T) && !nameEditMode && (selectedControl != -1) && (!generateWindowActive) && (!anchorMode) &&
-           ((layout.controls[selectedControl].type == LABEL) || (layout.controls[selectedControl].type == CHECKBOX) || (layout.controls[selectedControl].type == SLIDERBAR) || (layout.controls[selectedControl].type == SLIDER) || (layout.controls[selectedControl].type == TEXTBOX) || (layout.controls[selectedControl].type == BUTTON) || (layout.controls[selectedControl].type == TOGGLE) || (layout.controls[selectedControl].type == GROUPBOX) || (layout.controls[selectedControl].type == WINDOWBOX) || (layout.controls[selectedControl].type == STATUSBAR) || (layout.controls[selectedControl].type == DUMMYREC)))
-        {   
-            textEditMode = true;
-            textArrayPos = 0;
-            storedControl = selectedControl;
-            strcpy(prevControlText, layout.controls[selectedControl].text);
-        }
-        
-        // Turns on NameEditMode
-        if (IsKeyPressed(KEY_N) && (!IsKeyDown(KEY_LEFT_CONTROL)) && (!resetWindowActive) && !textEditMode && (selectedControl != -1) && (!generateWindowActive))
-        {
-            nameEditMode = true;
-            strcpy(prevControlName, layout.controls[selectedControl].name);
-            storedControl = selectedControl;
-        }
-
-        // Checks if mouse is over an anchor
-        if (!(anchorLinkMode || controlDrag || anchorLockMode))
-        {
-            for (int i = 1; i < MAX_ANCHOR_POINTS; i++)
-            {
-                if (CheckCollisionPointCircle(mouse, (Vector2){ layout.anchors[i].x, layout.anchors[i].y }, ANCHOR_RADIUS))
-                {
-                    selectedAnchor = i;
-                    if (layout.anchors[selectedAnchor].enabled) anchorMode = true;
-                    break;
-                }
-                else 
-                {
-                    selectedAnchor = -1;
-                    if (!IsKeyDown(KEY_A)) anchorMode = false;
-                }
-            }
-        }
-
-        // Selected control lock logic
-        if (anchorLockMode)
-        {
-            selectedAnchor = storedAnchor;
-            anchorMode = true;
-            
-            if (snapMode)
-            {
-                if (IsKeyDown(KEY_LEFT_SHIFT))
-                {
-                    if (IsKeyPressed(KEY_RIGHT)) layout.anchors[selectedAnchor].x+= GRID_LINE_SPACING;
-                    else if (IsKeyPressed(KEY_LEFT)) layout.anchors[selectedAnchor].x-= GRID_LINE_SPACING;
-                    
-                    if (IsKeyPressed(KEY_UP)) layout.anchors[selectedAnchor].y-= GRID_LINE_SPACING;
-                    else if (IsKeyPressed(KEY_DOWN)) layout.anchors[selectedAnchor].y+= GRID_LINE_SPACING;
-                }
-                else
-                {
-                    if (IsKeyDown(KEY_RIGHT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.anchors[selectedAnchor].x+= GRID_LINE_SPACING;
-                    else if (IsKeyDown(KEY_LEFT) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.anchors[selectedAnchor].x-= GRID_LINE_SPACING;
-                    
-                    if (IsKeyDown(KEY_UP) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.anchors[selectedAnchor].y-= GRID_LINE_SPACING;
-                    else if (IsKeyDown(KEY_DOWN) && ((framesCounterSnap%MOVEMENT_FRAME_SPEED) == 0)) layout.anchors[selectedAnchor].y+= GRID_LINE_SPACING;
-                }
-            }
-            else
-            {
-                if (IsKeyDown(KEY_LEFT_SHIFT))
-                {
-                    if (IsKeyPressed(KEY_RIGHT)) layout.anchors[selectedAnchor].x++;
-                    else if (IsKeyPressed(KEY_LEFT)) layout.anchors[selectedAnchor].x--;
-                    
-                    if (IsKeyPressed(KEY_UP)) layout.anchors[selectedAnchor].y--;
-                    else if (IsKeyPressed(KEY_DOWN)) layout.anchors[selectedAnchor].y++;
-                }
-                else
-                {
-                    if (IsKeyDown(KEY_RIGHT)) layout.anchors[selectedAnchor].x++;
-                    else if (IsKeyDown(KEY_LEFT)) layout.anchors[selectedAnchor].x--;
-                    
-                    if (IsKeyDown(KEY_UP)) layout.anchors[selectedAnchor].y--;
-                    else if (IsKeyDown(KEY_DOWN)) layout.anchors[selectedAnchor].y++;
-                }
-            }
-        }
-
-        // Create and edit anchor points
-        if (anchorMode && (!generateWindowActive) && (!resetWindowActive) && (!closingWindowActive))
-        {
-            // On mouse click anchor is created
-            if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && (selectedAnchor == -1) && (selectedControl == -1))
-            {
-                for (int i = 1; i < MAX_ANCHOR_POINTS; i++)
-                {
-                    if (!layout.anchors[i].enabled)
-                    {
-                        layout.anchors[i].x = mouse.x;
-                        layout.anchors[i].y = mouse.y;
-                        layout.anchors[i].enabled = true;
-                        anchorMode = false;
-                        break;
-                    }
-                }
-            }
-
-            if (IsKeyPressed(KEY_SPACE) && !nameEditMode && !textEditMode && (selectedAnchor != -1) && !anchorLockMode && anchorMode) 
-            {
-                anchorLockMode = true;
-                storedAnchor = selectedAnchor;
-            }
-            else if (IsKeyPressed(KEY_SPACE) && (selectedAnchor != -1)) anchorLockMode = false;
-            
-            if (selectedAnchor > 0)
-            {
-                // Unlinks and deletes the selected anchor point
-                if (IsKeyPressed(KEY_DELETE) && (!anchorLinkMode))
-                {
-                    for (int i = 0; i < layout.controlsCount; i++)
-                    {
-                        if (layout.controls[i].ap->id == selectedAnchor) 
-                        {
-                            layout.controls[i].rec.x += layout.controls[i].ap->x;
-                            layout.controls[i].rec.y += layout.controls[i].ap->y;
-                            layout.controls[i].ap = &layout.anchors[0];
-                        }
-                    }
-                    layout.anchors[selectedAnchor].x = 0;
-                    layout.anchors[selectedAnchor].y = 0;
-                    layout.anchors[selectedAnchor].enabled = false;
-                    layout.anchors[selectedAnchor].hidding = false;
-                    anchorMode = false;
-                    anchorLockMode = false;
-                }
-                
-                if (!anchorLockMode && (!anchorLinkMode))
-                {
-                    // Allows to drag an anchor without losing collision
-                    if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && IsKeyDown(KEY_A))
-                    {
-                        controlDrag = true;
-                        anchorPosEditMode = true;
-                        
-                        for (int i = 0; i < layout.controlsCount; i++)
-                        {
-                            if (layout.controls[i].ap->id == selectedAnchor) 
-                            {
-                                layout.controls[i].rec.x += layout.controls[i].ap->x;
-                                layout.controls[i].rec.y += layout.controls[i].ap->y;
-                                layout.controls[i].ap = &auxAnchor;
-                            }
-                        } 
-                    }
-                    else if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) controlDrag = true;
-                    
-                    if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
-                    {     
-                        if (anchorPosEditMode)
-                        {
-                            for (int i = 0; i < layout.controlsCount; i++)
-                            {
-                                if (layout.controls[i].ap->id == 9) 
-                                {
-                                    layout.controls[i].rec.x += layout.controls[i].ap->x;
-                                    layout.controls[i].rec.y += layout.controls[i].ap->y;
-                                    layout.controls[i].ap = &layout.anchors[selectedAnchor];
-                                    layout.controls[i].rec.x -= layout.anchors[selectedAnchor].x;
-                                    layout.controls[i].rec.y -= layout.anchors[selectedAnchor].y;
-                                }
-                            } 
-                            
-                            anchorPosEditMode = false;
-                        }
-                        
-                        controlDrag = false;
-                        selectedAnchor = -1;
-                        anchorMode = false;
-                    }
-                    
-                    // Moves the anchor to the mouse position
-                    if (controlDrag)
-                    {
-                        layout.anchors[selectedAnchor].x = mouse.x;
-                        layout.anchors[selectedAnchor].y = mouse.y;
-                    }
-                }
-                
-                // Enables the linking between anchor and control
-                if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON))
-                {
-                    linkedAnchor = selectedAnchor;
-                    anchorLinkMode = true;
-                }
-                
-                // Links the selected control to the current anchor
-                if (IsMouseButtonReleased(MOUSE_RIGHT_BUTTON))
-                {
-                    if (focusedControl != -1)
-                    {
-                        layout.controls[focusedControl].rec.x += layout.controls[focusedControl].ap->x;
-                        layout.controls[focusedControl].rec.y += layout.controls[focusedControl].ap->y;
-                        layout.controls[focusedControl].ap = &layout.anchors[linkedAnchor];
-                        layout.controls[focusedControl].rec.x -= layout.anchors[linkedAnchor].x;
-                        layout.controls[focusedControl].rec.y -= layout.anchors[linkedAnchor].y;
-                    }
-                    
-                    anchorLinkMode = false;  
-                    anchorMode = false;                    
-                }
-                
-                // Hide/Unhide selected anchor linked controls
-                if (IsKeyPressed(KEY_H) && (!anchorLinkMode)) layout.anchors[selectedAnchor].hidding = !layout.anchors[selectedAnchor].hidding;
-            }
-        }
-
-        // Enable anchor mode editing
-        if (IsKeyDown(KEY_A) && !nameEditMode && !textEditMode && (layout.controls[selectedControl].type != TEXTBOX)) anchorMode = true;
-
-        // Checks the minimum size of the rec
-        if (selectedControl != -1)
-        {
-            // Sets the minimum limit of the width
-            if (layout.controls[selectedControl].type == LABEL || layout.controls[selectedControl].type == BUTTON || layout.controls[selectedControl].type == TOGGLE || layout.controls[selectedControl].type == TEXTBOX)
-            {
-                if (layout.controls[selectedControl].rec.width <  MeasureText(layout.controls[selectedControl].text , style[DEFAULT_TEXT_SIZE])) layout.controls[selectedControl].rec.width = MeasureText(layout.controls[selectedControl].text , style[DEFAULT_TEXT_SIZE]);
-            }
-            else if (layout.controls[selectedControl].type == WINDOWBOX || layout.controls[selectedControl].type == GROUPBOX || layout.controls[selectedControl].type == STATUSBAR) 
-            {
-                if (layout.controls[selectedControl].rec.width <  MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]) + 31) layout.controls[selectedControl].rec.width = MeasureText(layout.controls[selectedControl].text , style[DEFAULT_TEXT_SIZE]) + 31;
-            }
-            else if (layout.controls[selectedControl].type == CHECKBOX)
-            {
-                if (layout.controls[selectedControl].rec.width <= 10) layout.controls[selectedControl].rec.width = 10;
-            }
-            else if (layout.controls[selectedControl].rec.width <= 20) layout.controls[selectedControl].rec.width = 20;
-            
-            // Sets the minimum limit of the height
-            if (layout.controls[selectedControl].type == WINDOWBOX) 
-            { 
-                if (layout.controls[selectedControl].rec.height < 50) layout.controls[selectedControl].rec.height = 50;
-            }
-            else if (layout.controls[selectedControl].type == PROGRESSBAR || layout.controls[selectedControl].type == SLIDER || layout.controls[selectedControl].type == SLIDERBAR || layout.controls[selectedControl].type == CHECKBOX || layout.controls[selectedControl].type == LINE)
-            {
-                if (layout.controls[selectedControl].rec.height <= 10 ) layout.controls[selectedControl].rec.height = 10;
-            }
-            else if (layout.controls[selectedControl].rec.height <= 20) layout.controls[selectedControl].rec.height = 20;
-        }
-  
-        // Shows or hides the grid
-        if (IsKeyPressed(KEY_G) && (!nameEditMode) && (!textEditMode) && (!generateWindowActive)) showGrid = !showGrid;
-        
-        // Drop files logic
-        if (IsFileDropped())
-        {
-            int fileCount = 0;
-            char **droppedFiles = { 0 };
-            char droppedFileName[256]; 
-            droppedFiles = GetDroppedFiles(&fileCount);
-            strcpy(droppedFileName, droppedFiles[0]);
-            
-            if (IsFileExtension(droppedFileName, ".rgl")) 
-            {
-                selectedControl = -1;
-                LoadLayoutRGL(droppedFileName);
-                strcpy(loadedFileName, droppedFileName);
-                SetWindowTitle(FormatText("rGuiLayout v1.1 - %s", GetFileName(loadedFileName)));
-            }
-            else if (IsFileExtension(droppedFileName, ".rgs")) GuiLoadStyle(droppedFileName);
-            else if (IsFileExtension(droppedFileName, ".png"))
-            {
-                if (loadedTexture.id > 0) UnloadTexture(loadedTexture);
-                loadedTexture = LoadTexture(droppedFileName);
-                
-                if (loadedTexture.width == 64 && loadedTexture.height == 16) GuiLoadStyleImage(droppedFileName);
-                else
-                {
-                    if (tracemap.id > 0) UnloadTexture(tracemap);
-                    tracemap = LoadTexture(droppedFileName);
-                }
-                
-                UnloadTexture(loadedTexture);
-                
-                SetTextureFilter(tracemap, FILTER_BILINEAR);
-                
-                tracemapRec.width = tracemap.width;
-                tracemapRec.height = tracemap.height; 
-            }
-
-            ClearDroppedFiles();
-        }
-        
-        // Duplicate selected control
-        if ((IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_D)) && (selectedControl != -1) && !anchorMode)
-        {
-            // Add a copy of selected control 
-            layout.controls[layout.controlsCount].id = layout.controlsCount;
-            layout.controls[layout.controlsCount].type = layout.controls[selectedControl].type;
-            layout.controls[layout.controlsCount].rec = layout.controls[selectedControl].rec;
-            layout.controls[layout.controlsCount].rec.x += 10;
-            layout.controls[layout.controlsCount].rec.y += 10;
-            strcpy(layout.controls[layout.controlsCount].text, layout.controls[selectedControl].text);
-            strcpy(layout.controls[layout.controlsCount].name, FormatText("%s%03i", controlTypeNameLow[layout.controls[layout.controlsCount].type], layout.controlsCount));
-            layout.controls[layout.controlsCount].ap = layout.controls[selectedControl].ap;            // Default anchor point (0, 0)
-            
-            layout.controlsCount++;
-        }
-     
-        // Save layout file dialog logic
-        if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyDown(KEY_LEFT_SHIFT) && IsKeyPressed(KEY_S)) ShowSaveLayoutDialog();
-        else if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_S)) 
-        {
-            if (loadedFileName[0] == '\0') ShowSaveLayoutDialog();
-            else SaveLayoutRGL(loadedFileName, false);
-        }
-        
-        // Open laout file dialog logic
-        if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_O))
-        {
-            // Open file dialog
-            const char *filters[] = { "*.rgl" };
-            const char *fileName = tinyfd_openFileDialog("Load raygui layout file", "", 1, filters, "raygui Layout Files (*.rgl)", 0);
-            
-            if (fileName != NULL) LoadLayoutRGL(fileName);
-        }
-        
-        // Activate code generation export window
-        if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_ENTER) && !closingWindowActive) generateWindowActive = true;
-
-        if (generateWindowActive)   // Keep window in the middle of screen
-        {
-            exportWindowPos.x = GetScreenWidth()/2 - 200;
-            exportWindowPos.y = GetScreenHeight()/2 - 112;
-        }
-        
-        // Tracemap texture control logic
-        if (tracemap.id > 0)
-        {
-            // Toggles Texture editting mode between true or false
-            if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_T)) tracemapEditMode = !tracemapEditMode;
-            
-            if (tracemapEditMode)
-            {
-                int offsetX = (int)mouse.x%GRID_LINE_SPACING;
-                int offsetY = (int)mouse.y%GRID_LINE_SPACING;
-                
-                // Moves the texture with the mouse
-                if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
-                {
-                    panControlOffset = mouse;
-                    prevControlPosition = (Vector2){ tracemapRec.x, tracemapRec.y };
-                }
-                
-                if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
-                {
-                    tracemapRec.x = prevControlPosition.x + (mouse.x - panControlOffset.x);
-                    tracemapRec.y = prevControlPosition.y + (mouse.y - panControlOffset.y);
-                        
-                    if (snapMode)
-                    {
-                        if (offsetX >= GRID_LINE_SPACING/2) mouse.x += (GRID_LINE_SPACING - offsetX);
-                        else mouse.x -= offsetX;
-                        
-                        if (offsetY >= GRID_LINE_SPACING/2) mouse.y += (GRID_LINE_SPACING - offsetY);
-                        else mouse.y -= offsetY;
-                        
-                        offsetX = (int)tracemapRec.x%GRID_LINE_SPACING;
-                        offsetY = (int)tracemapRec.y%GRID_LINE_SPACING;
-                        
-                        if (offsetX >= GRID_LINE_SPACING/2) tracemapRec.x += (GRID_LINE_SPACING - offsetX);
-                        else tracemapRec.x -= offsetX;
-                        
-                        if (offsetY >= GRID_LINE_SPACING/2) tracemapRec.y += (GRID_LINE_SPACING - offsetY);
-                        else tracemapRec.y -= offsetY;
-                    }
-                }  
-
-                // Moves and scales the texture with snap.
-                if (IsKeyDown(KEY_LEFT_CONTROL))
-                {
-                    tracemapRec.height -= GetMouseWheelMove();
-                    tracemapRec.width -= GetMouseWheelMove();
-                }
-                else 
-                {
-                    tracemapRec.height -= 10*GetMouseWheelMove();
-                    tracemapRec.width -= 10*GetMouseWheelMove();
-                }
-                
-                tracemap.height = tracemapRec.height;
-                tracemap.width = tracemapRec.width;
-                
-                // Change texture fade
-                if (IsKeyDown(KEY_LEFT_CONTROL))
-                {
-                    if (IsKeyDown(KEY_LEFT_SHIFT))
-                    {
-                        if (IsKeyPressed(KEY_LEFT)) tracemapRec.x--;
-                        else if (IsKeyPressed(KEY_RIGHT)) tracemapRec.x++;
-                        
-                        if (IsKeyPressed(KEY_UP)) tracemapRec.y--;
-                        else if (IsKeyPressed(KEY_DOWN)) tracemapRec.y++;
-                    }
-                    else
-                    {
-                        if (IsKeyDown(KEY_LEFT)) tracemapRec.x--;
-                        else if (IsKeyDown(KEY_RIGHT)) tracemapRec.x++;
-                        
-                        if (IsKeyDown(KEY_UP)) tracemapRec.y--;
-                        else if (IsKeyDown(KEY_DOWN)) tracemapRec.y++;
-                    }
-                }
-                else
-                {
-                    if (IsKeyDown(KEY_LEFT)) tracemapFade-= 0.01f;
-                    else if (IsKeyDown(KEY_RIGHT)) tracemapFade+=0.01f; 
-                }
-                
-                if (tracemapFade < 0) tracemapFade = 0;
-                else if (tracemapFade > 1) tracemapFade = 1;
-                
-                // Deletes the texture and resets it
-                if (IsKeyPressed(KEY_DELETE))
-                {
-                    UnloadTexture(tracemap);
-                    tracemap.id = 0;
-                    tracemapEditMode = false;
-                    tracemapRec.x = 0;
-                    tracemapRec.y = 0;
-                }
-            }
-        }
-        
-        if ((IsKeyDown(KEY_LEFT_CONTROL)) && (IsKeyPressed(KEY_Z))) layout.controls[undoSelectedControl].rec = undoLastRec;
-        
-        if ((IsKeyDown(KEY_LEFT_CONTROL)) && (IsKeyPressed(KEY_N)) && (!generateWindowActive) && (!closingWindowActive))
-        {
-            resetWindowActive = true;
-            resetLayout = false;
-        }
-        
-        if (resetWindowActive && resetLayout)
-        {
-            // Resets all controls to default values
-            for (int i = selectedControl; i < layout.controlsCount; i++)
-            {
-                layout.controls[i].id = 0;
-                layout.controls[i].type = 0;
-                layout.controls[i].rec = (Rectangle){ 0, 0, 0, 0 };
-                memset(layout.controls[i].text, 0, MAX_CONTROL_TEXT_LENGTH);
-                memset(layout.controls[i].name, 0, MAX_CONTROL_NAME_LENGTH);
-                layout.controls[i].ap = &layout.anchors[0];  // By default, set parent anchor
-            }
-            
-            // Resets anchor points to default values
-            for (int i = 0; i < MAX_ANCHOR_POINTS; i++)
-            {
-                layout.anchors[i].x = 0;
-                layout.anchors[i].y = 0;
-                layout.anchors[i].enabled = false;
-                layout.anchors[i].hidding = false;
-            }
-            
-            SetWindowTitle("rGuiLayout v1.1");
-            strcpy(loadedFileName, "\0");
-            layout.controlsCount = 0;
-            resetWindowActive = false;
-        }
-        //----------------------------------------------------------------------------------
-
-        // Draw
-        //----------------------------------------------------------------------------------
-        BeginDrawing();
-
-            ClearBackground(RAYWHITE);
-            
-            // TODO: Draw global app screen limits (black rectangle with black default anchor)
-
-            if (showGrid) GuiGrid((Rectangle){ 0, 0, GetScreenWidth(), GetScreenHeight() }, GRID_LINE_SPACING, 5, false);
-            
-            // Draw the texture if loaded
-            if (tracemap.id > 0)
-            {
-                DrawTexture(tracemap, tracemapRec.x, tracemapRec.y, Fade(WHITE, tracemapFade));
-                
-                // Draw the tracemap rectangle
-                if (tracemapEditMode) DrawRectangleLines(tracemapRec.x, tracemapRec.y, tracemapRec.width, tracemapRec.height, RED);
-                else DrawRectangleLines(tracemapRec.x, tracemapRec.y, tracemapRec.width, tracemapRec.height, GRAY);
-            }
-            
-            for (int i = 0; i < layout.controlsCount; i++)
-            {
-                // Draws the Controls when placed on the grid.
-                if (!layout.controls[i].ap->hidding)
-                {
-                    switch (layout.controls[i].type)
-                    {
-                        case WINDOWBOX: 
-                        {
-                            GuiFade(0.8f);
-                            GuiWindowBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text);
-                            GuiFade(1.0f);
-                        }break;
-                        case GROUPBOX: GuiGroupBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text); break;
-                        case LINE: GuiLine((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 1); break;
-                        case PANEL: 
-                        {
-                            GuiFade(0.8f);
-                            GuiPanel((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height });
-                            GuiFade(1.0f);
-                        }break;
-                        case LABEL: GuiLabel((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text); break;
-                        case BUTTON: GuiButton((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text); break;
-                        case TOGGLE: GuiToggleButton((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text, false); break;
-                        case TOGGLEGROUP: GuiToggleGroup((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, listData, 3, 1); break;
-                        case CHECKBOX: GuiCheckBoxEx((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, false, layout.controls[i].text); break;
-                        case COMBOBOX: GuiComboBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, listData, 3, 1); break;
-                        case DROPDOWNBOX: GuiDropdownBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, listData, 3, 2); break;
-                        case SPINNER: GuiSpinner((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 42, 3, 25); break;
-                        case VALUEBOX: GuiValueBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 42, 100); break;
-                        case TEXTBOX: GuiTextBox((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text, MAX_CONTROL_TEXT_LENGTH, false); break;
-                        case SLIDER: GuiSliderEx((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 42, 0, 100, layout.controls[i].text, true); break;
-                        case SLIDERBAR: GuiSliderBarEx((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 40, 0, 100, layout.controls[i].text, true); break;
-                        case PROGRESSBAR: GuiProgressBarEx((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, 40, 0, 100, true); break;
-                        case STATUSBAR: GuiStatusBar((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text, 15); break;
-                        case LISTVIEW: GuiListView((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, listViewData, 4, 1); break;
-                        case COLORPICKER: GuiColorPicker((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, RED); break;
-                        case DUMMYREC: GuiDummyRec((Rectangle){ layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, layout.controls[i].rec.width, layout.controls[i].rec.height }, layout.controls[i].text); break;
-                        default: break;
-                    }
-                    
-                    if ((layout.controls[i].ap->id == selectedAnchor) && (layout.controls[i].ap->id > 0)) DrawLine(layout.controls[i].ap->x, layout.controls[i].ap->y, layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, RED);
-                    
-                }
-                else if ((layout.controls[i].ap->id == selectedAnchor) && (layout.controls[i].ap->id > 0)) DrawLine(layout.controls[i].ap->x, layout.controls[i].ap->y, layout.controls[i].ap->x + layout.controls[i].rec.x, layout.controls[i].ap->y + layout.controls[i].rec.y, BLUE);
-            }
-            
-            // Draws the defaultRec[selectedType] of the control selected
-            if ((selectedControl == -1) && (focusedControl == -1 )&& !anchorMode && !tracemapEditMode && !closingWindowActive && !generateWindowActive && !(CheckCollisionPointRec(mouse, palettePanel)))
-            {
-                GuiFade(0.5f);
-                switch (selectedTypeDraw)
-                {
-                    case WINDOWBOX: GuiWindowBox(defaultRec[selectedTypeDraw], "WINDOW BOX"); break;
-                    case GROUPBOX: GuiGroupBox(defaultRec[selectedTypeDraw], "GROUP BOX"); break;
-                    case LINE: GuiLine(defaultRec[selectedTypeDraw], 1); break;
-                    case PANEL: GuiPanel(defaultRec[selectedTypeDraw]); break;
-                    case LABEL: GuiLabel(defaultRec[selectedTypeDraw], "TEXT SAMPLE"); break;
-                    case BUTTON: GuiButton(defaultRec[selectedTypeDraw], "BUTTON"); break;
-                    case TOGGLE: GuiToggleButton(defaultRec[selectedTypeDraw], "TOGGLE", false); break;
-                    case TOGGLEGROUP: GuiToggleGroup(defaultRec[selectedTypeDraw], listData, 3, 1); break;
-                    case CHECKBOX: GuiCheckBoxEx(defaultRec[selectedTypeDraw], false, "TEXT SAMPLE"); break;
-                    case COMBOBOX: GuiComboBox(defaultRec[selectedTypeDraw], listData, 3, 1); break;
-                    case DROPDOWNBOX: GuiDropdownBox(defaultRec[selectedTypeDraw], listData, 3, 2); break;
-                    case SPINNER: GuiSpinner(defaultRec[selectedTypeDraw], 42, 3, 25); break;
-                    case VALUEBOX: GuiValueBox(defaultRec[selectedTypeDraw], 42, 100); break;
-                    case TEXTBOX: GuiTextBox(defaultRec[selectedTypeDraw], "TEXTBOX", 7, false); break;
-                    case SLIDER: GuiSliderEx(defaultRec[selectedTypeDraw], 42, 0, 100, "TEXT SAMPLE", true); break;
-                    case SLIDERBAR: GuiSliderBarEx(defaultRec[selectedTypeDraw], 40, 0, 100, "TEXT SAMPLE", true); break;
-                    case PROGRESSBAR: GuiProgressBarEx(defaultRec[selectedTypeDraw], 40, 0, 100, true); break;
-                    case STATUSBAR: GuiStatusBar(defaultRec[selectedTypeDraw], "STATUS BAR", 15); break;
-                    case LISTVIEW: GuiListView(defaultRec[selectedTypeDraw], listViewData, 4, 1); break;
-                    case COLORPICKER: GuiColorPicker(defaultRec[selectedTypeDraw], RED); break;
-                    case DUMMYREC: GuiDummyRec(defaultRec[selectedTypeDraw], "DUMMY REC"); break;
-                    default: break;
-                }
-                
-                GuiFade(1.0f);
-            }
-
-            // Draw the anchorPoints
-            for (int i = 0; i < MAX_ANCHOR_POINTS; i++)
-            {
-                if ((layout.anchors[i].enabled) && (layout.anchors[i].x != 0) && (layout.anchors[i].y != 0))
-                {
-                    if (layout.anchors[i].id == selectedAnchor && anchorPosEditMode)
-                    {
-                        // Draw the anchor that is currently moving
-                        DrawCircle(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(ORANGE, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, ORANGE);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, ORANGE);
-                    }
-                    if (layout.anchors[i].id == selectedAnchor && IsKeyDown(KEY_A))
-                    {
-                        // Draw the anchor that is currently moving
-                        DrawCircle(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(ORANGE, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, ORANGE);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, ORANGE);
-                    }
-                    else if (layout.anchors[i].hidding && layout.anchors[i].id == selectedAnchor)
-                    {
-                        // Draw idle anchor
-                        DrawCircle(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(BLUE, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, BLUE);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, BLUE);
-                        DrawText(FormatText("[%i, %i]", layout.anchors[i].x, layout.anchors[i].y), layout.anchors[i].x, layout.anchors[i].y - 25, 20, BLUE);
-                    }
-                    else if (layout.anchors[i].id == selectedAnchor)
-                    {
-                        // Draw the selected anchor
-                        DrawCircle(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(RED, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, RED);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, RED);
-                        DrawText(FormatText("[%i, %i]", layout.anchors[i].x, layout.anchors[i].y), layout.anchors[i].x, layout.anchors[i].y - 25, 20, RED);
-                    } 
-                    else if (layout.anchors[i].hidding)
-                    {
-                        // Draw idle anchor
-                        DrawCircleLines(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(BLUE, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, BLUE);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, BLUE);
-                    }
-                    else
-                    {
-                        // Draw idle anchor
-                        DrawCircleLines(layout.anchors[i].x, layout.anchors[i].y, ANCHOR_RADIUS, Fade(RED, 0.5f));
-                        DrawRectangle(layout.anchors[i].x - ANCHOR_RADIUS - 5, layout.anchors[i].y, ANCHOR_RADIUS*2 + 10, 1, RED);
-                        DrawRectangle(layout.anchors[i].x, layout.anchors[i].y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, RED);
-                    }
-                }
-            }
-            
-            // Draw selected control selection rectangle (transparent RED/WHITE)
-            if (((selectedControl != -1) || (focusedControl != -1)) && (selectedControl < layout.controlsCount))
-            {
-                if (selectedControl != -1) DrawRectangleRec((Rectangle){ layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.x, layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.y, layout.controls[selectedControl].rec.width, layout.controls[selectedControl].rec.height }, (nameEditMode) ? Fade(WHITE, 0.7f) : Fade(RED, 0.5f));
-                
-                if (focusedControl != -1) DrawRectangleLinesEx((Rectangle){ layout.controls[focusedControl].ap->x + layout.controls[focusedControl].rec.x, layout.controls[focusedControl].ap->y + layout.controls[focusedControl].rec.y, layout.controls[focusedControl].rec.width, layout.controls[focusedControl].rec.height }, 1, RED);
-            }
-            
-            // Draw anchor lines
-            if ((selectedControl != -1) && layout.controls[selectedControl].ap->id > 0 && !layout.controls[selectedControl].ap->hidding) DrawLine(layout.controls[selectedControl].ap->x, layout.controls[selectedControl].ap->y, layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.x, layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.y, RED);
-            else if ((selectedControl != -1) && layout.controls[selectedControl].ap->id > 0 && layout.controls[selectedControl].ap->hidding) DrawLine(layout.controls[selectedControl].ap->x, layout.controls[selectedControl].ap->y, layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.x, layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.y, BLUE);
-            
-            if ((focusedControl != -1) && layout.controls[focusedControl].ap->id > 0 && !layout.controls[focusedControl].ap->hidding) DrawLine(layout.controls[focusedControl].ap->x, layout.controls[focusedControl].ap->y, layout.controls[focusedControl].ap->x + layout.controls[focusedControl].rec.x, layout.controls[focusedControl].ap->y + layout.controls[focusedControl].rec.y, RED);
-            else if ((focusedControl != -1) && layout.controls[focusedControl].ap->id > 0 && layout.controls[focusedControl].ap->hidding) DrawLine(layout.controls[focusedControl].ap->x, layout.controls[focusedControl].ap->y, layout.controls[focusedControl].ap->x + layout.controls[focusedControl].rec.x, layout.controls[focusedControl].ap->y + layout.controls[focusedControl].rec.y, BLUE);
-                
-            // Draw cursor (control mode or anchor mode)
-            if ((selectedControl == -1)  && (selectedAnchor == -1))
-            {
-                if (anchorMode)
-                {
-                    DrawCircleLines(mouse.x, mouse.y, ANCHOR_RADIUS, Fade(RED, 0.5f));
-                    DrawRectangle(mouse.x - ANCHOR_RADIUS - 5, mouse.y, ANCHOR_RADIUS*2 + 10, 1, RED);
-                    DrawRectangle(mouse.x , mouse.y - ANCHOR_RADIUS - 5, 1, ANCHOR_RADIUS*2 + 10, RED);
-                }
-                else 
-                {
-                    DrawRectangle(mouse.x - 8, mouse.y, 17, 1, RED);
-                    DrawRectangle(mouse.x, mouse.y - 8, 1, 17, RED);
-                }
-            }
-
-            // Draw cursor on textEditMode
-            if (textEditMode)
-            {
-               if (((framesCounter/20)%2) == 0)
-               {
-                    if (layout.controls[selectedControl].type == LABEL) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]), layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2 + layout.controls[selectedControl].rec.height/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == TEXTBOX) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]) + 4, layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2 + layout.controls[selectedControl].rec.height/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == GROUPBOX) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + 15 + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]), layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == WINDOWBOX) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + 10 + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]), layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y + style[DEFAULT_TEXT_SIZE]/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == STATUSBAR) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + 15 + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]), layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2 + layout.controls[selectedControl].rec.height/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == CHECKBOX) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.width + 5 + MeasureText(layout.controls[selectedControl].text, style[DEFAULT_TEXT_SIZE]), layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2 + layout.controls[selectedControl].rec.height/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else if (layout.controls[selectedControl].type == SLIDERBAR || layout.controls[selectedControl].type == SLIDER) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x - 5, layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - style[DEFAULT_TEXT_SIZE]/2 + layout.controls[selectedControl].rec.height/2, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-                    else DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.width/2 + MeasureText(layout.controls[selectedControl].text , style[DEFAULT_TEXT_SIZE])/2 + 2, layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.height/2 - 6, style[DEFAULT_TEXT_SIZE] + 2, BLACK);
-               }
-            }
-            
-            // Draw nameEditMode
-            if (nameEditMode)
-            {
-                DrawText(FormatText("%s", layout.controls[selectedControl].name), layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x + layout.controls[selectedControl].rec.width/2 - MeasureText(layout.controls[selectedControl].name, style[DEFAULT_TEXT_SIZE]*2)/2, layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.height/2 - 10, style[DEFAULT_TEXT_SIZE]*2, BLACK);
-                    
-                if (((framesCounter/20)%2) == 0) DrawText("|", layout.controls[selectedControl].rec.x + layout.controls[selectedControl].rec.width/2 + layout.controls[selectedControl].ap->x + MeasureText(layout.controls[selectedControl].name, style[DEFAULT_TEXT_SIZE]*2)/2 + 2, layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y + layout.controls[selectedControl].rec.height/2 - 10, style[DEFAULT_TEXT_SIZE]*2 + 2, BLACK);                   
-            }
-            else if ((IsKeyDown(KEY_N)) && (!textEditMode) && (!generateWindowActive) && (!resetWindowActive))
-            {
-                if (layout.controlsCount > 0) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(WHITE, 0.7f));
-                
-                for (int i = 0; i < layout.controlsCount; i++)
-                {
-                    // Draws the Controls when placed on the grid.
-                    if (!layout.controls[i].ap->hidding)
-                    DrawText(FormatText("%s", layout.controls[i].name), layout.controls[i].rec.x + layout.controls[i].ap->x + layout.controls[i].rec.width/2 - MeasureText(layout.controls[i].name, style[DEFAULT_TEXT_SIZE]*2)/2, layout.controls[i].rec.y + layout.controls[i].ap->y + layout.controls[i].rec.height/2 - 10, style[DEFAULT_TEXT_SIZE]*2, BLACK);
-                }
-            }
-
-
-            // Draw anchor linking line
-            if (anchorLinkMode) DrawLine(layout.anchors[linkedAnchor].x, layout.anchors[linkedAnchor].y, mouse.x, mouse.y, BLACK);
-
-            // Draw Rectangle Info
-            if (selectedControl != -1)
-            {
-                if (!controlGlobalPos) DrawText(FormatText("[%i, %i, %i, %i]", (int)layout.controls[selectedControl].rec.x, (int)layout.controls[selectedControl].rec.y, (int)layout.controls[selectedControl].rec.width, (int)layout.controls[selectedControl].rec.height), (int)layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x, (int)layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - 30, 20, MAROON);
-                else DrawText(FormatText("[%i, %i, %i, %i]", (int)layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x, (int)layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y, (int)layout.controls[selectedControl].rec.width, (int)layout.controls[selectedControl].rec.height), (int)layout.controls[selectedControl].rec.x + layout.controls[selectedControl].ap->x, (int)layout.controls[selectedControl].rec.y + layout.controls[selectedControl].ap->y - 30, 20, RED);
-            }
-                
-            // Draw Image info
-            if (tracemapEditMode) DrawText(FormatText("[%i, %i, %i, %i]", tracemapRec.x, tracemapRec.y, tracemapRec.width, tracemapRec.height), tracemapRec.x + 25, tracemapRec.y + 25, 20, MAROON);
-
-            // Draw the id of all controls
-            if (IsKeyDown(KEY_LEFT_ALT)) 
-            {
-                for (int i = layout.controlsCount - 1; i >= 0; i--) DrawText(FormatText("[%i]", layout.controls[i].id), layout.controls[i].rec.x + layout.controls[i].ap->x + layout.controls[i].rec.width, layout.controls[i].rec.y + layout.controls[i].ap->y - 10, 10, BLUE);  
-            }
-            // Draw the help listData (by default is out of screen)
-            if (helpPositionX > -280)
-            {
-                DrawRectangleRec((Rectangle){ helpPositionX + 20, 15, 280, 550 }, GetColor(style[DEFAULT_BACKGROUND_COLOR]));
-                GuiGroupBox((Rectangle){ helpPositionX + 20, 15, 280, 550 }, "TAB - Shortcuts");
-                GuiLabel((Rectangle){ helpPositionX + 30, 30, 0, 0 }, "G - Toggle grid mode");
-                GuiLabel((Rectangle){ helpPositionX + 30, 50, 0, 0 }, "S - Toggle snap to grid mode");
-                GuiLabel((Rectangle){ helpPositionX + 30, 70, 0, 0 }, "F - Toggle control position (global/anchor)");
-                GuiLine((Rectangle){ helpPositionX + 30, 85, 260, 10 }, 1);
-                GuiLabel((Rectangle){ helpPositionX + 30, 100, 0, 0 }, "SPACE - Lock/unlock control for editing");
-                GuiLabel((Rectangle){ helpPositionX + 30, 120, 0, 0 }, "ARROWS - Edit control position");
-                GuiLabel((Rectangle){ helpPositionX + 30, 140, 0, 0 }, "LSHIFT + ARROWS - Smooth edit position");
-                GuiLabel((Rectangle){ helpPositionX + 30, 160, 0, 0 }, "LCTRL + ARROWS - Edit control scale");   
-                GuiLabel((Rectangle){ helpPositionX + 30, 180, 0, 0 }, "LCTRL + LSHIFT + ARROWS - Smooth edit scale");
-                GuiLabel((Rectangle){ helpPositionX + 30, 200, 0, 0 }, "LCTRL + R - Resize control to closest snap");
-                GuiLabel((Rectangle){ helpPositionX + 30, 220, 0, 0 }, "LCTRL + D - Duplicate selected control");
-                GuiLabel((Rectangle){ helpPositionX + 30, 240, 0, 0 }, "LCTRL + N - Resets layout");
-                GuiLabel((Rectangle){ helpPositionX + 30, 260, 0, 0 }, "DEL - Delete selected control");
-                GuiLine((Rectangle){ helpPositionX + 30, 275, 260, 10 }, 1);
-                GuiLabel((Rectangle){ helpPositionX + 30, 290, 0, 0 }, "T - Control text editing (if possible)");
-                GuiLabel((Rectangle){ helpPositionX + 30, 310, 0, 0 }, "N - Control name editing ");
-                GuiLabel((Rectangle){ helpPositionX + 30, 330, 0, 0 }, "ESC - Exit text/name editing mode");
-                GuiLabel((Rectangle){ helpPositionX + 30, 350, 0, 0 }, "ENTER - Validate text/name edition");
-                GuiLine((Rectangle){ helpPositionX + 30, 365, 260, 10 }, 1);
-                GuiLabel((Rectangle){ helpPositionX + 30, 380, 0, 0 }, "LALT + UP/DOWN - Control layer order");
-                GuiLine((Rectangle){ helpPositionX + 30, 395, 260, 10 }, 1);
-                GuiLabel((Rectangle){ helpPositionX + 30, 410, 0, 0 }, "A - Anchor editing mode");
-                GuiLabel((Rectangle){ helpPositionX + 30, 430, 0, 0 }, "RMB - Link anchor to control");
-                GuiLabel((Rectangle){ helpPositionX + 30, 450, 0, 0 }, "U - Unlink control from anchor");
-                GuiLabel((Rectangle){ helpPositionX + 30, 470, 0, 0 }, "H - Hide/Unhide controls for selected anchor");
-                GuiLine((Rectangle){ helpPositionX + 30, 485, 260, 10 }, 1);
-                GuiLabel((Rectangle){ helpPositionX + 30, 500, 0, 0 }, "LCTRL + S - Save layout file (.rgl)");
-                GuiLabel((Rectangle){ helpPositionX + 30, 520, 0, 0 }, "LCTRL + O - Open layout file (.rgl)");
-                GuiLabel((Rectangle){ helpPositionX + 30, 540, 0, 0 }, "LCTRL + ENTER - Export layout to code");
-            }
-
-            // Draw right panel controls palette
-            GuiPanel(palettePanel);
-            
-            GuiWindowBox(paletteRecs[0], "WindowBox");
-            GuiGroupBox(paletteRecs[1], "GroupBox");
-            GuiLine(paletteRecs[2], 1);
-            GuiPanel(paletteRecs[3]);
-            GuiLabel(paletteRecs[4], "Label (SAMPLE TEXT)");
-            GuiButton(paletteRecs[5], "Button");
-            GuiToggleButton(paletteRecs[6], "Toggle", false); 
-            GuiCheckBox(paletteRecs[8], false); 
-            GuiToggleGroup(paletteRecs[7], listData, 3, 0); 
-            GuiComboBox(paletteRecs[9],  listData, 3, 0); 
-            GuiDropdownBox(paletteRecs[10], listData, 3, 0); 
-            GuiSpinner(paletteRecs[11], 42, 100, 25);
-            GuiValueBox(paletteRecs[12], 42, 100); 
-            GuiTextBox(paletteRecs[13], "TEXTBOX", 7, false);
-            GuiSlider(paletteRecs[14], 42, 0, 100);
-            GuiSliderBar(paletteRecs[15], 42, 0, 100);
-            GuiProgressBar(paletteRecs[16], 42, 0, 100);
-            GuiStatusBar(paletteRecs[17], "StatusBar", 10);
-            GuiListView(paletteRecs[18], listData, 3, 1); 
-            GuiColorPicker(paletteRecs[19], RED);
-            GuiDummyRec(paletteRecs[20], "DummyRec");
-
-            DrawRectangleRec(paletteRecs[selectedType], Fade(RED, 0.5f));
-            
-            if (paletteSelect > -1) DrawRectangleLinesEx(paletteRecs[paletteSelect], 1, RED);
-        
-            // Draw export options window
-            if (generateWindowActive)
-            {
-                DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(WHITE, 0.7f));
-                generateWindowActive = !GuiWindowBox((Rectangle){ exportWindowPos.x, exportWindowPos.y, 400, 225 }, "Generate Code Options - layout");
-                
-                GuiLabel((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 35, 65, 25 }, "Name:");
-                GuiTextBox((Rectangle){ exportWindowPos.x + 75, exportWindowPos.y + 35, 135, 25 }, config.name, toolNameSize, true);
-                GuiLabel((Rectangle){ exportWindowPos.x + 225, exportWindowPos.y + 35, 50, 25 }, "Version:");
-                GuiTextBox((Rectangle){ exportWindowPos.x + 275, exportWindowPos.y + 35, 115, 25 }, config.version, toolVersionSize, true);
-                GuiLabel((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 65, 65, 25 }, "Window size:");
-                config.width = GuiValueBox((Rectangle){ exportWindowPos.x + 75, exportWindowPos.y + 65, 60, 25 }, config.width, 1000); 
-                GuiLabel((Rectangle){ exportWindowPos.x + 140, exportWindowPos.y + 65, 10, 25 }, "x");
-                config.height = GuiValueBox((Rectangle){ exportWindowPos.x + 150, exportWindowPos.y + 65, 60, 25 }, config.height, 1000);
-                GuiLabel((Rectangle){ exportWindowPos.x + 225, exportWindowPos.y + 65, 50, 25 }, "Company:");
-                GuiTextBox((Rectangle){ exportWindowPos.x + 275, exportWindowPos.y + 65, 115, 25 }, config.company, companySize, true);
-                GuiLabel((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 95, 65, 25 }, "Description:");
-                GuiTextBox((Rectangle){ exportWindowPos.x + 75, exportWindowPos.y + 95, 315, 55 }, config.description, toolDescriptionSize, true);
-                config.defineRecs = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 160, 15, 15 }, config.defineRecs, "Define Rectangles"); 
-                config.defineTexts = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 180, 15, 15 }, config.defineTexts, "Define text const");
-                config.exportAnchors = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 140, exportWindowPos.y + 160, 15, 15 }, config.exportAnchors, "Export anchors");
-                config.exportAnchor0 = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 140, exportWindowPos.y + 180, 15, 15 }, config.exportAnchor0, "Export anchor 0");
-                config.fullComments = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 140, exportWindowPos.y + 200, 15, 15 }, config.fullComments, "Full comments");
-                config.cropWindow = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 275, exportWindowPos.y + 160, 15, 15 }, config.cropWindow, "Crop to Window");
-                config.fullVariables = GuiCheckBoxEx((Rectangle){ exportWindowPos.x + 10, exportWindowPos.y + 200, 15, 15 }, config.fullVariables, "Full variables");
-
-                if (GuiButton((Rectangle){ exportWindowPos.x + 275, exportWindowPos.y + 185, 115, 30 }, "Generate Code"))
-                {
-                    ShowExportLayoutDialog(config);
-                    generateWindowActive = false;
-                }
-            }
-    
-            // Draw status bar bottom with debug information
-            GuiStatusBar((Rectangle){ 0, GetScreenHeight() - 24, 126, 24}, FormatText("MOUSE: (%i, %i)", (int)mouse.x, (int)mouse.y), 15);
-            GuiStatusBar((Rectangle){ 124, GetScreenHeight() - 24, 81, 24}, (snapMode ? "SNAP: ON" : "SNAP: OFF"), 10);
-            GuiStatusBar((Rectangle){ 204, GetScreenHeight() - 24, 145, 24}, FormatText("CONTROLS COUNT: %i", layout.controlsCount), 20);
-            if (selectedControl != -1) GuiStatusBar((Rectangle){ 348, GetScreenHeight() - 24, GetScreenWidth() - 348, 24}, FormatText("SELECTED CONTROL: #%03i  |  %s  |  REC (%i, %i, %i, %i)  |  %s", selectedControl, controlTypeName[layout.controls[selectedControl].type], (int)layout.controls[selectedControl].rec.x, (int)layout.controls[selectedControl].rec.y, (int)layout.controls[selectedControl].rec.width, (int)layout.controls[selectedControl].rec.height, layout.controls[selectedControl].name), 15);
-            else GuiStatusBar((Rectangle){ 348, GetScreenHeight() - 24, GetScreenWidth() - 348, 24}, "", 15);
-            
-            // Draw ending message window (save)
-            if (closingWindowActive)
-            {
-                DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(WHITE, 0.7f));
-                closingWindowActive = !GuiWindowBox((Rectangle){ GetScreenWidth()/2 - 125, GetScreenHeight()/2 - 50, 250, 100 }, "Closing rGuiLayout");
-                
-                GuiLabel((Rectangle){ GetScreenWidth()/2 - 95, GetScreenHeight()/2 - 60, 200, 100 }, "Do you want to save before quitting?");
-                
-                if (GuiButton((Rectangle){ GetScreenWidth()/2 - 94, GetScreenHeight()/2 + 10, 85, 25 }, "Yes")) 
-                { 
-                    cancelSave = false;
-                    ShowSaveLayoutDialog();
-                    if (cancelSave) exitWindow = true;
-                }
-                else if (GuiButton((Rectangle){ GetScreenWidth()/2 + 10, GetScreenHeight()/2 + 10, 85, 25 }, "No")) { exitWindow = true; }
-            }
-            
-            // Draw reset message window (save)
-            if (resetWindowActive)
-            {
-                DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(WHITE, 0.7f));
-                resetWindowActive = !GuiWindowBox((Rectangle){ GetScreenWidth()/2 - 125, GetScreenHeight()/2 - 50, 250, 100 }, "Creating new layout");
-                
-                GuiLabel((Rectangle){ GetScreenWidth()/2 - 95, GetScreenHeight()/2 - 60, 200, 100 }, "Do you want to save the current layout?");
-                
-                if (GuiButton((Rectangle){ GetScreenWidth()/2 - 94, GetScreenHeight()/2 + 10, 85, 25 }, "Yes")) 
-                { 
-                    cancelSave = false;
-                    ShowSaveLayoutDialog();
-                    if (cancelSave) resetLayout = true;
-                }
-                else if (GuiButton((Rectangle){ GetScreenWidth()/2 + 10, GetScreenHeight()/2 + 10, 85, 25 }, "No")) { resetLayout = true; }
-            }
-            
-        EndDrawing();
-        //----------------------------------------------------------------------------------
-    }
-
-    // De-Initialization
-    //--------------------------------------------------------------------------------------
-    UnloadTexture(tracemap);
-    
-    CloseWindow();        // Close window and OpenGL context
-    //--------------------------------------------------------------------------------------
-
-    return 0;
-}
-
-//----------------------------------------------------------------------------------
-// Module specific Functions Definition
-//----------------------------------------------------------------------------------
-
-// Show save layout dialog
-static void ShowSaveLayoutDialog(void)
-{
-    const char *filters[] = { "*.rgl" };
-    const char *fileName = tinyfd_saveFileDialog("Save raygui layout text file", "", 1, filters, "raygui Layout Files (*.rgl)");
-
-    // Save layout.controls file (text or binary)
-    if (fileName != NULL)
-    {
-        char outFileName[64] = { 0 };
-        strcpy(outFileName, fileName);
-        if (GetExtension(fileName) == NULL) strcat(outFileName, ".rgl\0");     // No extension provided
-        SaveLayoutRGL(outFileName, false);
-        strcpy(loadedFileName, outFileName);
-        SetWindowTitle(FormatText("rGuiLayout v1.1 - %s", GetFileName(loadedFileName)));
-        cancelSave = true;
-    }
-}
-
-// Show save layout dialog
-static void ShowExportLayoutDialog(GuiLayoutConfig config)
-{
-    const char *filters[] = { "*.c", "*.go", "*.lua" };
-    const char *fileName = tinyfd_saveFileDialog("Generate code file", config.name, 3, filters, "Code file");
-
-    if (fileName != NULL)
-    {
-        char outFileName[64] = { 0 };
-        strcpy(outFileName, fileName);
-        if (GetExtension(fileName) == NULL) strcat(outFileName, ".c\0");     // No extension provided
-        GenerateCode(outFileName, config);
-    }
-}
-
-// Save gui layout information
-static void SaveLayoutRGL(const char *fileName, bool binary)
-{
-    if (binary)
-    {
-        #define RGL_FILE_VERSION_BINARY 100
-        
-        FILE *rglFile = fopen(fileName, "wb");
-
-        if (rglFile != NULL)
-        {
-            // Write some header info (12 bytes)
-            // id: "RGL "       - 4 bytes
-            // version: 100     - 2 bytes
-            // reserved         - 2 bytes
-            
-            char signature[5] = "RGL ";
-            short version = RGL_FILE_VERSION_BINARY;
-            short reserved = 0;
-
-            fwrite(signature, 1, 4, rglFile);
-            fwrite(&version, 1, sizeof(short), rglFile);
-            fwrite(&reserved, 1, sizeof(short), rglFile);
-            
-            fwrite(&layout, 1, sizeof(GuiLayout), rglFile);
-
-            fclose(rglFile);  
-        }
-    }
-    else 
-    {
-        #define RGL_FILE_VERSION_TEXT "1.0"
-        
-        FILE *rglFile = fopen(fileName, "wt");
-
-        if (rglFile != NULL)
-        {
-             // Write some description comments
-            fprintf(rglFile, "#\n# rgl text file (v%s) - raygui layout text file generated using rGuiLayout\n#\n", RGL_FILE_VERSION_TEXT);
-            fprintf(rglFile, "# Total number of controls:     %i\n", layout.controlsCount);
-            fprintf(rglFile, "# Anchor info:   a <id> <posx> <posy> <enabled>\n");
-            fprintf(rglFile, "# Control info:  c <id> <type> <name> <rectangle> <anchor_id> <text>\n#\n");
-
-            for (int i = 0; i < MAX_ANCHOR_POINTS; i++)
-            {
-                fprintf(rglFile, "a %03i %i %i %i\n", layout.anchors[i].id, layout.anchors[i].x, layout.anchors[i].y, layout.anchors[i].enabled);
-            }
-            
-            for (int i = 0; i < layout.controlsCount; i++)
-            {
-                fprintf(rglFile, "c %03i %i %s %i %i %i %i %i %s\n", layout.controls[i].id, layout.controls[i].type, layout.controls[i].name, (int)layout.controls[i].rec.x, (int)layout.controls[i].rec.y, (int)layout.controls[i].rec.width, (int)layout.controls[i].rec.height, layout.controls[i].ap->id, layout.controls[i].text);
-            }
-
-            fclose(rglFile);
-        }
-    }
-}
-
-// Import gui layout information
-// NOTE: Updates global variable: layout
-static void LoadLayoutRGL(const char *fileName)
-{
-    char buffer[256];
-    bool tryBinary = false;
-    
-    int anchorId = 0;       // TODO: Review!!!
-    int anchorX = 0;
-    int anchorY = 0;
-    int anchorCounter = 0;
-
-    FILE *rglFile = fopen(fileName, "rt");
-    
-    if (rglFile != NULL)
-    {
-        // Reset all the controls
-        for (int i = 0; i < MAX_GUI_CONTROLS; i++)
-        {
-            layout.controls[i].id = 0;
-            layout.controls[i].type = 0;
-            layout.controls[i].rec = (Rectangle){ 0, 0, 0, 0 };
-            memset(layout.controls[i].text, 0, MAX_CONTROL_TEXT_LENGTH);
-            memset(layout.controls[i].name, 0, MAX_CONTROL_NAME_LENGTH);
-            layout.controls[i].ap = &layout.anchors[0];
-        }
-        for (int i = 0; i < MAX_ANCHOR_POINTS; i++) layout.anchors[i].hidding = false;
-        
-        fgets(buffer, 256, rglFile);
-
-        if (buffer[0] != 'R')   // Text file!
-        {
-            layout.controlsCount = 0;
-            
-            while (!feof(rglFile))
-            {
-                if ((buffer[0] != '\n') && (buffer[0] != '#') && (buffer[0] == 'a'))
-                {
-                    sscanf(buffer, "a %03i %i %i %i", &layout.anchors[anchorCounter].id, &layout.anchors[anchorCounter].x, &layout.anchors[anchorCounter].y, &layout.anchors[anchorCounter].enabled);
-                    //printf("a %03i %i %i %i\n", layout.anchors[anchorCounter].id, layout.anchors[anchorCounter].x, layout.anchors[anchorCounter].y, layout.anchors[anchorCounter].enabled);
-                    anchorCounter++;
-                }
-                else if ((buffer[0] != '\n') && (buffer[0] != '#') && (buffer[0] == 'c'))
-                {
-                    sscanf(buffer, "c %d %i %s %f %f %f %f %d %[^\n]s", &layout.controls[layout.controlsCount].id, &layout.controls[layout.controlsCount].type, layout.controls[layout.controlsCount].name, &layout.controls[layout.controlsCount].rec.x, &layout.controls[layout.controlsCount].rec.y, &layout.controls[layout.controlsCount].rec.width, &layout.controls[layout.controlsCount].rec.height, &anchorId, layout.controls[layout.controlsCount].text);
-                    //printf("c %d %i %i %i %i %i %i %s\n", layout.controls[layout.controlsCount].id, layout.controls[layout.controlsCount].type, layout.controls[layout.controlsCount].rec.x, layout.controls[layout.controlsCount].rec.y, layout.controls[layout.controlsCount].rec.width, layout.controls[layout.controlsCount].rec.height, anchorId, layout.controls[layout.controlsCount].text);
-                    
-                    layout.controls[layout.controlsCount].ap = &layout.anchors[anchorId];
-                    layout.controlsCount++;
-                }
-                fgets(buffer, 256, rglFile);
-            }
-        }
-        else tryBinary = true;
-        
-        fclose(rglFile);
-    }
-    
-    if (tryBinary)
-    {
-        FILE *rglFile = fopen(fileName, "rb");
-    
-        if (rglFile != NULL)
-        {
-            char signature[5] = "";
-            short version = 0;
-            short reserved = 0;
-
-            fread(signature, 1, 4, rglFile);
-            fread(&version, 1, sizeof(short), rglFile);
-            fread(&reserved, 1, sizeof(short), rglFile);
-
-            if ((signature[0] == 'R') &&
-                (signature[1] == 'G') &&
-                (signature[2] == 'L') &&
-                (signature[3] == ' ')) fread(&layout, 1, sizeof(GuiLayout), rglFile);
-            else TraceLog(LOG_WARNING, "[raygui] Invalid layout file");
-            
-            printf("[GuiLayout] Controls counter: %i\n", layout.controlsCount);
-           
-            fclose(rglFile);
-        }
-    }
-
-    printf("[GuiLayout] Layout data loaded successfully\n");
-}
-
-static char *GetControlAnchorRec(int anchorId, Rectangle controlRec, GuiLayoutConfig config)
-{
-    static char text[512];
-    memset(text, 0, 512);
-    
-    if (config.exportAnchors && config.exportAnchor0) strcpy(text, FormatText("(Rectangle){ anchor%02i.x + %i, anchor%02i.y + %i, %i, %i }", anchorId, (int)controlRec.x, anchorId, (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-    else if (config.exportAnchors && !config.exportAnchor0) 
-    {
-        if (anchorId > 0) strcpy(text, FormatText("(Rectangle){ anchor%02i.x + %i, anchor%02i.y + %i, %i, %i }", anchorId, (int)controlRec.x, anchorId, (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-        else strcpy(text, FormatText("(Rectangle){ %i, %i, %i, %i }", (int)controlRec.x, (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-
-    }
-    else if (!config.exportAnchors && config.exportAnchor0)
-    {
-        if (anchorId > 0) strcpy(text, FormatText("(Rectangle){ %i, %i, %i, %i }", layout.anchors[anchorId].x + (int)controlRec.x, layout.anchors[anchorId].y + (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-        else strcpy(text, FormatText("(Rectangle){ anchor%02i.x + %i, anchor%02i.y + %i, %i, %i }", anchorId, (int)controlRec.x, anchorId, (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-    }
-    else strcpy(text, FormatText("(Rectangle){ %i, %i, %i, %i }", layout.anchors[anchorId].x + (int)controlRec.x, layout.anchors[anchorId].y + (int)controlRec.y, (int)controlRec.width, (int)controlRec.height));
-    
-    return text;
-}
-
-static char *ExportFullVariables(int controlType, char *name, GuiLayoutConfig config)
-{
-    static char text[512];
-    memset(text, 0, 512);
-    
-    switch(controlType)
-    {
-        case SLIDER: 
-        case SLIDERBAR:
-        {
-            if (config.fullVariables) strcpy(text, FormatText("%sMinValue, %sMaxValue", name, name));
-            else strcpy(text, "0, 100");
-        } break;
-        
-        case DROPDOWNBOX:
-        case COMBOBOX:
-        case LISTVIEW:
-        case TOGGLEGROUP:
-        {
-            if (config.fullVariables) strcpy(text, FormatText("%sCount", name));
-            else strcpy(text, "3");
-        } break;
-        
-        case TEXTBOX:
-        {
-            if (config.fullVariables) strcpy(text, FormatText("%sSize", name));
-            else strcpy(text, FormatText("%i", MAX_CONTROL_TEXT_LENGTH));
-        } break;
-    }
-    
-    return text;
-}
-
-// Generate C code for gui layout
-static void GenerateCode(const char *fileName, GuiLayoutConfig config)
-{
-    FILE *ftool = fopen(fileName, "wt");
-    
-    fprintf(ftool, "/*******************************************************************************************\n");
-    fprintf(ftool, "*\n");
-    fprintf(ftool, "*   %s - %s\n", config.name, config.description);
-    fprintf(ftool, "*\n");
-    fprintf(ftool, "*   LICENSE: zlib/libpng\n");
-    fprintf(ftool, "*\n");
-    fprintf(ftool, "*   Copyright (c) %i %s\n", 2018, config.company);
-    fprintf(ftool, "*\n");
-    fprintf(ftool, "**********************************************************************************************/\n\n");
-    fprintf(ftool, "#include \"raylib.h\"\n\n");
-    fprintf(ftool, "#define RAYGUI_IMPLEMENTATION\n");
-    fprintf(ftool, "#include \"raygui.h\"\n\n");
-    fprintf(ftool, "//----------------------------------------------------------------------------------\n");
-    fprintf(ftool, "// Controls Functions Declaration\n");
-    fprintf(ftool, "//----------------------------------------------------------------------------------\n");
-    
-    for (int i = 0; i < layout.controlsCount; i++) 
-    {
-        if (layout.controls[i].type == BUTTON) fprintf(ftool, "static void %s();        // %s: %s logic\n", layout.controls[i].name, controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-    }
-
-    fprintf(ftool, "\n");
-    fprintf(ftool, "//------------------------------------------------------------------------------------\n");
-    fprintf(ftool, "// Program main entry point\n");
-    fprintf(ftool, "//------------------------------------------------------------------------------------\n");
-    fprintf(ftool, "int main()\n");
-    fprintf(ftool, "{\n");
-    fprintf(ftool, "    // Initialization\n");
-    fprintf(ftool, "    //---------------------------------------------------------------------------------------\n");
-    fprintf(ftool, "    int screenWidth = %i;\n", config.width);
-    fprintf(ftool, "    int screenHeight = %i;\n\n", config.height);
-    fprintf(ftool, "    InitWindow(screenWidth, screenHeight, \"%s\");\n\n", config.name);
-    
-    fprintf(ftool, "    // %s: controls initialization\n", config.name);
-    fprintf(ftool, "    //----------------------------------------------------------------------------------\n");
-
-    // TODO: Use config.exportAnchors and config.exportAnchor0
-    if (config.exportAnchors)
-    {
-        fprintf(ftool, "    // Anchor points\n");
-        
-        for(int i = 0; i < MAX_ANCHOR_POINTS; i++)
-        {
-            for (int j = 0; j < layout.controlsCount; j++)
-            {
-                if (layout.controls[j].ap->id == layout.anchors[i].id)
-                {
-                    if ((!config.exportAnchor0) && layout.controls[j].ap->id == 0) break;
-                    fprintf(ftool, "    Vector2 %s%02i = { %i, %i };\n", "anchor", i, layout.anchors[i].x, layout.anchors[i].y);
-                    break;
-                }
-            }
-        }
-    }
-    
-    if (!config.fullComments) fprintf(ftool, "\n");
-
-    // Define controls variables
-    // TODO: Use config.fullComments
-    for (int i = 0; i < layout.controlsCount; i++)
-    {
-        switch (layout.controls[i].type)
-        {
-            // Bools
-            case WINDOWBOX:
-            case TOGGLE:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    bool %sActive = true;\n", layout.controls[i].name);
-            }
-            break;
-            
-            case CHECKBOX: 
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    bool %sChecked = false;\n", layout.controls[i].name);
-            }
-            break;
-            
-            // Const text
-            case LABEL:
-            {
-                if (config.defineTexts)
-                {
-                    if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                    fprintf(ftool, "    const char *%sText = \"%s\";\n", layout.controls[i].name, layout.controls[i].text);
-                }
-            }
-            break;
-            
-            case STATUSBAR:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    char *%sText = \"%s\";\n", layout.controls[i].name, layout.controls[i].text);
-            }
-            break;
-            
-            case DROPDOWNBOX:
-            case COMBOBOX:
-            case LISTVIEW:
-            case TOGGLEGROUP:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                if (config.fullVariables) fprintf(ftool, "    int %sCount = 3;\n", layout.controls[i].name);
-                fprintf(ftool, "    int %sActive = 0;\n", layout.controls[i].name);
-                fprintf(ftool, "    const char *%sTextList[3] = { \"ONE\", \"TWO\", \"THREE\" };\n", layout.controls[i].name);
-            }
-            break;
-            
-            // Floats
-            case SLIDER: 
-            case SLIDERBAR:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    float %sValue = 50.0f;\n", layout.controls[i].name);
-                if (config.fullVariables)
-                {
-                    fprintf(ftool, "    const float %sMinValue = 0.0f;\n", layout.controls[i].name);
-                    fprintf(ftool, "    const float %sMaxValue = 100.0f;\n", layout.controls[i].name);
-                }
-            }
-            break;
-            case PROGRESSBAR:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    float %sValue = 50.0f;\n", layout.controls[i].name);
-            }            
-            break;
-            
-            // Ints
-            case VALUEBOX:
-            case SPINNER:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    int %sValue = 0;\n", layout.controls[i].name);
-            }     
-            break;
-            
-            // Colors
-            case COLORPICKER:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                fprintf(ftool, "    Color %sValue;\n", layout.controls[i].name);
-            }
-            break;
-
-            case TEXTBOX:
-            {
-                if (config.fullComments) fprintf(ftool, "    \n    // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-                if (config.fullVariables) fprintf(ftool, "    int %sSize = %i;\n", layout.controls[i].name, MAX_CONTROL_TEXT_LENGTH);
-                fprintf(ftool, "    char %sText[%i] = \"%s\";\n", layout.controls[i].name, MAX_CONTROL_TEXT_LENGTH, layout.controls[i].text);           
-            }
-            default: break;
-        }
-    }
-
-    if (config.defineRecs)
-    {
-        // Define controls rectangles
-        fprintf(ftool, "\n    // Define controls rectangles\n");
-        fprintf(ftool, "    Rectangle layoutRecs[%i] = {\n", layout.controlsCount);
-        
-        for (int i = 0; i < layout.controlsCount; i++)
-        {
-            fprintf(ftool, "        %s", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config));
-            
-            if (i == layout.controlsCount - 1) fprintf(ftool, "        // %s: %s\n    };\n\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-            else fprintf(ftool, ",        // %s: %s\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-        }
-    }
-    
-    fprintf(ftool, "    //----------------------------------------------------------------------------------\n\n");
-    
-    fprintf(ftool, "    SetTargetFPS(60);\n");
-    fprintf(ftool, "    //--------------------------------------------------------------------------------------\n\n");
-    fprintf(ftool, "    // Main game loop\n");
-    fprintf(ftool, "    while (!WindowShouldClose())    // Detect window close button or ESC key\n");
-    fprintf(ftool, "    {\n");
-    fprintf(ftool, "        // Update\n");
-    fprintf(ftool, "        //----------------------------------------------------------------------------------\n");
-    fprintf(ftool, "        // TODO: Implement required update logic\n");
-    fprintf(ftool, "        //----------------------------------------------------------------------------------\n\n");
-    fprintf(ftool, "        // Draw\n");
-    fprintf(ftool, "        //----------------------------------------------------------------------------------\n");
-    fprintf(ftool, "        BeginDrawing();\n\n");
-    fprintf(ftool, "            ClearBackground(GetColor(style[DEFAULT_BACKGROUND_COLOR]));\n\n");
-
-    fprintf(ftool, "            // raygui: controls drawing\n");
-    fprintf(ftool, "            //----------------------------------------------------------------------------------\n");
-    
-    // Draw all controls
-    if (!config.defineRecs)
-    {
-        for (int i = 0; i < layout.controlsCount; i++)
-        {
-            switch (layout.controls[i].type)
-            {
-                case LABEL:
-                {
-                    if (config.defineTexts) fprintf(ftool, "            GuiLabel(%s, %sText);\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name);
-                    else fprintf(ftool, "            GuiLabel(%s, \"%s\");\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text);
-                } 
-                break;
-                case BUTTON: fprintf(ftool, "            if (GuiButton(%s, \"%s\")) %s(); \n\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text, layout.controls[i].name); break;
-                case VALUEBOX: fprintf(ftool, "            %sValue = GuiValueBox(%s, %sValue, 100);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name); break;
-                case TOGGLE: fprintf(ftool, "            %sActive = GuiToggleButton(%s, \"%s\", %sActive);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text, layout.controls[i].name); break;
-                case TOGGLEGROUP: fprintf(ftool, "            %sActive = GuiToggleGroup(%s, %sTextList, %s, %sActive);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case SLIDER: 
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sValue = GuiSliderEx(%s, %sValue, %s, \"%s\", true);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].text);
-                    else fprintf(ftool, "            %sValue = GuiSlider(%s, %sValue, %s);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config));
-                } break;
-                case SLIDERBAR: 
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sValue = GuiSliderBarEx(%s, %sValue, %s, \"%s\", true);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].text);
-                    else fprintf(ftool, "            %sValue = GuiSliderBar(%s, %sValue, %s);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config));
-                } break;
-                case PROGRESSBAR: fprintf(ftool, "            %sValue = GuiProgressBarEx(%s, %sValue, 0, 100, true);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name); break;
-                case SPINNER: fprintf(ftool, "            %sValue = GuiSpinner(%s, %sValue, 100, 25);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name); break;
-                case COMBOBOX: fprintf(ftool, "            %sActive = GuiComboBox(%s, %sTextList, %s, %sActive);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case CHECKBOX: 
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sChecked = GuiCheckBoxEx(%s, %sChecked, \"%s\");\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, layout.controls[i].text);
-                    else fprintf(ftool, "            %sChecked = GuiCheckBox(%s, %sChecked); \n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name);
-                } break;
-                case LISTVIEW: fprintf(ftool, "            %sActive = GuiListView(%s, %sTextList, %s, %sActive);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case TEXTBOX: fprintf(ftool, "            GuiTextBox(%s, %sText, %s, true);\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config)); break;
-                case GROUPBOX: fprintf(ftool, "            GuiGroupBox(%s, \"%s\");\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text); break;
-                case WINDOWBOX:
-                {
-                    fprintf(ftool, "            if (%sActive)\n            {\n", layout.controls[i].name);
-                    fprintf(ftool, "                %sActive = !GuiWindowBox(%s, \"%s\");\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text);
-                    fprintf(ftool, "            }\n");
-                }break;
-                case DUMMYREC: fprintf(ftool, "            GuiDummyRec(%s, \"%s\");\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].text); break;
-                case DROPDOWNBOX: fprintf(ftool, "            %sActive = GuiDropdownBox(%s, %sTextList, %s, %sActive);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case STATUSBAR: fprintf(ftool, "            GuiStatusBar(%s, %sText, 10);\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name); break;
-                case COLORPICKER: fprintf(ftool, "            %sValue = GuiColorPicker(%s, %sValue);\n", layout.controls[i].name, GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config), layout.controls[i].name); break;
-                case LINE: fprintf(ftool, "            GuiLine(%s, 1);\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config)); break;
-                case PANEL: fprintf(ftool, "            GuiPanel(%s);\n", GetControlAnchorRec(layout.controls[i].ap->id, layout.controls[i].rec, config)); break;
-                
-                default: break;
-            }
-        }
-    }
-    else 
-    {
-        for (int i = 0; i < layout.controlsCount; i++)
-        {
-            switch (layout.controls[i].type)
-            {
-                case LABEL: 
-                {
-                    if (config.defineTexts) fprintf(ftool, "            GuiLabel(layoutRecs[%i], %sText);\n", i, layout.controls[i].name);
-                    else fprintf(ftool, "            GuiLabel(layoutRecs[%i], \"%s\");\n", i, layout.controls[i].text);
-                } break;
-                case BUTTON: fprintf(ftool, "            if (GuiButton(layoutRecs[%i], \"%s\")) %s();\n\n", i, layout.controls[i].text, layout.controls[i].name); break;
-                case VALUEBOX: fprintf(ftool, "            %sValue = GuiValueBox(layoutRecs[%i], %sValue, 100);\n",layout.controls[i].name, i, layout.controls[i].name); break;
-                case TOGGLE: fprintf(ftool, "            %sActive = GuiToggleButton(layoutRecs[%i], \"%s\", %sActive);\n", layout.controls[i].name, i, layout.controls[i].text, layout.controls[i].name); break;
-                case TOGGLEGROUP: fprintf(ftool, "            %sActive = GuiToggleGroup(layoutRecs[%i], %sTextList, %s, %sActive);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case SLIDER:
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sValue = GuiSliderEx(layoutRecs[%i], %sValue, %s, \"%s\", true);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].text);
-                    else fprintf(ftool, "            %sValue = GuiSlider(layoutRecs[%i], %sValue, %s);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config));
-                } break;
-                case SLIDERBAR: 
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sValue = GuiSliderBarEx(layoutRecs[%i], %sValue, %s, \"%s\", true);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].text);
-                    else fprintf(ftool, "            %sValue = GuiSliderBar(layoutRecs[%i], %sValue, %s);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config));
-                } break;
-                case PROGRESSBAR: fprintf(ftool, "            %sValue = GuiProgressBarEx(layoutRecs[%i], %sValue, %s, true);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config)); break;
-                case SPINNER: fprintf(ftool, "            %sValue = GuiSpinner(layoutRecs[%i], %sValue, 100, 25);\n", layout.controls[i].name, i, layout.controls[i].name); break;
-                case COMBOBOX: fprintf(ftool, "            %sActive = GuiComboBox(layoutRecs[%i], %sTextList, %s, %sActive);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case CHECKBOX:
-                {
-                    if (layout.controls[i].text[0] != '\0') fprintf(ftool, "            %sChecked = GuiCheckBoxEx(layoutRecs[%i], %sChecked, \"%s\");\n", layout.controls[i].name, i, layout.controls[i].name, layout.controls[i].text);
-                    else fprintf(ftool, "            %sChecked = GuiCheckBox(layoutRecs[%i], %sChecked);\n", layout.controls[i].name, i, layout.controls[i].name);
-                } break;
-                case LISTVIEW: fprintf(ftool, "            %sActive = GuiListView(layoutRecs[%i], %sTextList, %s, %sActive);\n", layout.controls[i].name, i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config), layout.controls[i].name); break;
-                case TEXTBOX: fprintf(ftool, "            GuiTextBox(layoutRecs[%i], %sText, %s, true);\n", i, layout.controls[i].name, ExportFullVariables(layout.controls[i].type, layout.controls[i].name, config)); break;
-                case GROUPBOX: fprintf(ftool, "            GuiGroupBox(layoutRecs[%i], \"%s\");\n", i, layout.controls[i].text); break;
-                case WINDOWBOX:
-                {
-                    fprintf(ftool, "            if (%sActive)\n            {\n", layout.controls[i].name);
-                    fprintf(ftool, "                %sActive = !GuiWindowBox(layoutRecs[%i], \"%s\");\n", layout.controls[i].name, i, layout.controls[i].text);
-                    fprintf(ftool, "            }\n");
-                }break;
-                case DUMMYREC: fprintf(ftool, "            GuiDummyRec(layoutRecs[%i], \"%s\");\n", i, layout.controls[i].text); break;
-                case DROPDOWNBOX: fprintf(ftool, "            %sActive = GuiDropdownBox(layoutRecs[%i], %sTextList, %sCount, %sActive);\n", layout.controls[i].name, i, layout.controls[i].name, layout.controls[i].name, layout.controls[i].name); break;
-                case STATUSBAR: fprintf(ftool, "            GuiStatusBar(layoutRecs[%i], %sText, 10);\n", i, layout.controls[i].name); break;
-                case COLORPICKER: fprintf(ftool, "            %sValue = GuiColorPicker(layoutRecs[%i], %sValue);\n", layout.controls[i].name, i, layout.controls[i].name); break;
-                case LINE: fprintf(ftool, "            GuiLine(layoutRecs[%i], 1);\n", i); break;
-                case PANEL: fprintf(ftool, "            GuiPanel(layoutRecs[%i]);\n", i); break;
-                default: break;
-            }
-        }
-    }
-    fprintf(ftool, "            //----------------------------------------------------------------------------------\n\n");
-    fprintf(ftool, "        EndDrawing();\n");
-    fprintf(ftool, "        //----------------------------------------------------------------------------------\n");
-    fprintf(ftool, "    }\n\n");
-    fprintf(ftool, "    // De-Initialization\n");
-    fprintf(ftool, "    //--------------------------------------------------------------------------------------\n");
-    fprintf(ftool, "    CloseWindow();        // Close window and OpenGL context\n");
-    fprintf(ftool, "    //--------------------------------------------------------------------------------------\n\n");
-    fprintf(ftool, "    return 0;\n");
-    fprintf(ftool, "}\n\n");
-
-    fprintf(ftool, "//------------------------------------------------------------------------------------\n");
-    fprintf(ftool, "// Controls Functions Definitions (local)\n");
-    fprintf(ftool, "//------------------------------------------------------------------------------------\n");
-    
-    for (int i = 0; i < layout.controlsCount; i++)
-    {
-        if (layout.controls[i].type == BUTTON)
-        {
-            fprintf(ftool, "// %s: %s logic\n", controlTypeNameLow[layout.controls[i].type], layout.controls[i].name);
-            fprintf(ftool, "static void %s()\n{\n    // TODO: Implement control logic\n}\n\n", layout.controls[i].name);
-        }
-    }
-
-    fclose(ftool);
-}
-
-// Generate C code from .rgl file
-static void GenerateCodeFromRGL(const char *fileName)
-{
-    if (IsFileExtension(fileName, ".rgl"))
-    {
-        LoadLayoutRGL(fileName);    // Updates global: layout.controls
-        
-        int len = strlen(fileName);
-        char outName[256] = { 0 };
-        strcpy(outName, fileName);
-        outName[len - 3] = 'c';
-        outName[len - 2] = '\0';
-        
-        GuiLayoutConfig config;
-        memset(&config, 0, sizeof(GuiLayoutConfig));
-        
-        config.width = 800;
-        config.height = 600;
-        strcpy(config.name, "layout_file_name");
-        strcpy(config.version, "1.0-dev");
-        strcpy(config.company, "raylib technologies");
-        strcpy(config.description, "tool description");
-        config.defineRecs = false;
-        config.exportAnchors = true;
-        config.exportAnchor0 = false;
-        config.fullComments = true;
-        
-        // Generate C code for gui layout.controls
-        GenerateCode(outName, config);
-    }
-    else printf("Input RGL file not valid\n");
-}

BIN
tools/rGuiLayout/src/rguilayout.ico


+ 0 - 27
tools/rGuiLayout/src/rguilayout.rc

@@ -1,27 +0,0 @@
-GLFW_ICON ICON "rguilayout.ico"
-
-1 VERSIONINFO
-FILEVERSION     1,0,0,0
-PRODUCTVERSION  1,0,0,0
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-	//BLOCK "080904E4" 	// English UK
-    BLOCK "040904E4"	// English US
-    BEGIN
-	  //VALUE "CompanyName", "My Company Name"
-      VALUE "FileDescription", "rGuiLayout - raygui layout editor"
-      VALUE "FileVersion", "1.0"
-      VALUE "InternalName", "rguilayout"
-      VALUE "LegalCopyright", "(c) 2017 raylib technologies (@raysan5)"
-      //VALUE "OriginalFilename", "raylib_app.exe"
-      VALUE "ProductName", "rGuiLayout"
-      VALUE "ProductVersion", "1.0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-	//VALUE "Translation", 0x809, 1252	// English UK
-    VALUE "Translation", 0x409, 1252	// English US
-  END
-END

BIN
tools/rGuiLayout/src/rguilayout_icon