mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-05 13:49:17 -05:00
Updated tinyfiledialogs library
This commit is contained in:
406
tools/rGuiStyler/external/tinyfiledialogs.c
vendored
406
tools/rGuiStyler/external/tinyfiledialogs.c
vendored
@ -1,10 +1,9 @@
|
|||||||
/*_________
|
/*_________
|
||||||
/ \ tinyfiledialogs.c v3.2.3 [Nov 2, 2017] zlib licence
|
/ \ tinyfiledialogs.c v3.3.1 [Feb 16, 2018] zlib licence
|
||||||
|tiny file| Unique code file created [November 9, 2014]
|
|tiny file| Unique code file created [November 9, 2014]
|
||||||
| dialogs | Copyright (c) 2014 - 2017 Guillaume Vareille http://ysengrin.com
|
| dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
|
||||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||||
\|
|
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||||
git://git.code.sf.net/p/tinyfiledialogs/code
|
|
||||||
____________________________________________
|
____________________________________________
|
||||||
| |
|
| |
|
||||||
| email: tinyfiledialogs at ysengrin.com |
|
| email: tinyfiledialogs at ysengrin.com |
|
||||||
@ -14,13 +13,9 @@
|
|||||||
| the windows only wchar_t UTF-16 prototypes are in the header file |
|
| the windows only wchar_t UTF-16 prototypes are in the header file |
|
||||||
|___________________________________________________________________|
|
|___________________________________________________________________|
|
||||||
|
|
||||||
A big thank you for contributions, bug corrections & thorough testing to:
|
Please 1) let me know If you are using it on exotic hardware / OS / compiler
|
||||||
- Don Heyse http://ldglite.sf.net for bug corrections & thorough testing!
|
2) leave a 1-word review on Sourceforge.
|
||||||
- Paul Rouget
|
3) upvote my stackoverflow answer/advert https://stackoverflow.com/a/47651444
|
||||||
|
|
||||||
Please 1) Let me know If you are using it on exotic hardware / OS / compiler
|
|
||||||
2) If yo have a sourceforge account, leave a 3-word review on Sourceforge.
|
|
||||||
It helps the ranking on google.
|
|
||||||
|
|
||||||
tiny file dialogs (cross-platform C C++)
|
tiny file dialogs (cross-platform C C++)
|
||||||
InputBox PasswordBox MessageBox ColorPicker
|
InputBox PasswordBox MessageBox ColorPicker
|
||||||
@ -28,7 +23,7 @@ OpenFileDialog SaveFileDialog SelectFolderDialog
|
|||||||
Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
|
Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
|
||||||
SSH supported via automatic switch to console mode or X11 forwarding
|
SSH supported via automatic switch to console mode or X11 forwarding
|
||||||
|
|
||||||
One C file (add it to your C or C++ project) with 8 functions:
|
a C file + a header (add them to your C or C++ project) with 8 functions:
|
||||||
- beep
|
- beep
|
||||||
- notify popup
|
- notify popup
|
||||||
- message & question
|
- message & question
|
||||||
@ -62,12 +57,17 @@ Unix (command line calls) ASCII UTF-8
|
|||||||
The same executable can run across desktops & distributions
|
The same executable can run across desktops & distributions
|
||||||
|
|
||||||
C89 & C++98 compliant: tested with C & C++ compilers
|
C89 & C++98 compliant: tested with C & C++ compilers
|
||||||
on VisualStudio MinGW Mac Linux Bsd Solaris Minix Raspbian
|
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
|
using Gnome Kde Enlightenment Mate Cinnamon Unity Lxde Lxqt Xfce
|
||||||
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
||||||
|
|
||||||
bindings for LUA and C# dll, Haskell
|
Bindings for LUA and C# dll, Haskell
|
||||||
included in LWJGL(java), Rust, Allegrobasic
|
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 -
|
- License -
|
||||||
|
|
||||||
@ -99,6 +99,9 @@ misrepresented as being the original software.
|
|||||||
/* #define TINYFD_NOLIB */
|
/* #define TINYFD_NOLIB */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#define _getch getch
|
||||||
|
#endif
|
||||||
#ifndef _WIN32_WINNT
|
#ifndef _WIN32_WINNT
|
||||||
#define _WIN32_WINNT 0x0500
|
#define _WIN32_WINNT 0x0500
|
||||||
#endif
|
#endif
|
||||||
@ -110,7 +113,8 @@ misrepresented as being the original software.
|
|||||||
#endif /*TINYFD_NOSELECTFOLDERWIN*/
|
#endif /*TINYFD_NOSELECTFOLDERWIN*/
|
||||||
#endif
|
#endif
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
/*#include <io.h>*/
|
#include <commdlg.h>
|
||||||
|
#define TINYFD_NOCCSUNICODE
|
||||||
#define SLASH "\\"
|
#define SLASH "\\"
|
||||||
int tinyfd_winUtf8 = 0 ; /* on windows string char can be 0:MBCS or 1:UTF-8 */
|
int tinyfd_winUtf8 = 0 ; /* on windows string char can be 0:MBCS or 1:UTF-8 */
|
||||||
#else
|
#else
|
||||||
@ -119,15 +123,16 @@ misrepresented as being the original software.
|
|||||||
#include <dirent.h> /* on old systems try <sys/dir.h> instead */
|
#include <dirent.h> /* on old systems try <sys/dir.h> instead */
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
#include <signal.h> /* on old systems try <sys/signal.h> instead */
|
||||||
#define SLASH "/"
|
#define SLASH "/"
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#define MAX_PATH_OR_CMD 1024 /* _MAX_PATH or MAX_PATH */
|
#define MAX_PATH_OR_CMD 1024 /* _MAX_PATH or MAX_PATH */
|
||||||
#define MAX_MULTIPLE_FILES 32
|
#define MAX_MULTIPLE_FILES 32
|
||||||
|
|
||||||
char tinyfd_version [8] = "3.2.3";
|
char tinyfd_version [8] = "3.3.1";
|
||||||
|
|
||||||
int tinyfd_verbose = 0 ; /* print on unix the command line calls */
|
int tinyfd_verbose = 0 ; /* on unix: prints the command line calls */
|
||||||
|
|
||||||
#if defined(TINYFD_NOLIB) && defined(_WIN32)
|
#if defined(TINYFD_NOLIB) && defined(_WIN32)
|
||||||
int tinyfd_forceConsole = 1 ;
|
int tinyfd_forceConsole = 1 ;
|
||||||
@ -163,7 +168,7 @@ static int gWarningDisplayed = 0 ;
|
|||||||
static char gTitle[]="missing software! (we will try basic console input)";
|
static char gTitle[]="missing software! (we will try basic console input)";
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static char gMessageWin[] = "\
|
char tinyfd_needs[] = "\
|
||||||
___________\n\
|
___________\n\
|
||||||
/ \\ \n\
|
/ \\ \n\
|
||||||
| tiny file |\n\
|
| tiny file |\n\
|
||||||
@ -175,7 +180,7 @@ static char gMessageWin[] = "\
|
|||||||
\nor dialog.exe (enhanced console mode)\
|
\nor dialog.exe (enhanced console mode)\
|
||||||
\nor a console for basic input";
|
\nor a console for basic input";
|
||||||
#else
|
#else
|
||||||
static char gMessageUnix[] = "\
|
char tinyfd_needs[] = "\
|
||||||
___________\n\
|
___________\n\
|
||||||
/ \\ \n\
|
/ \\ \n\
|
||||||
| tiny file |\n\
|
| tiny file |\n\
|
||||||
@ -185,11 +190,13 @@ static char gMessageUnix[] = "\
|
|||||||
\ntiny file dialogs on UNIX needs:\
|
\ntiny file dialogs on UNIX needs:\
|
||||||
\n applescript\
|
\n applescript\
|
||||||
\nor kdialog\
|
\nor kdialog\
|
||||||
\nor zenity\
|
\nor zenity (or matedialog or qarma)\
|
||||||
\nor python (2 or 3) + tkinter + python-dbus (optional)\
|
\nor python (2 or 3)\
|
||||||
\nor dialog (opens a console if needed)\
|
\n + tkinter + python-dbus (optional)\
|
||||||
\nor xterm + bash (opens a console for basic input)\
|
\nor dialog (opens console if needed)\
|
||||||
\nor it will use the existing console for basic input";
|
\nor xterm + bash\
|
||||||
|
\n (opens console for basic input)\
|
||||||
|
\nor existing console for basic input";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -329,7 +336,7 @@ static void replaceSubStr( char const * const aSource ,
|
|||||||
char const * pOccurence ;
|
char const * pOccurence ;
|
||||||
char const * p ;
|
char const * p ;
|
||||||
char const * lNewSubStr = "" ;
|
char const * lNewSubStr = "" ;
|
||||||
int lOldSubLen = strlen( aOldSubStr ) ;
|
size_t lOldSubLen = strlen( aOldSubStr ) ;
|
||||||
|
|
||||||
if ( ! aSource )
|
if ( ! aSource )
|
||||||
{
|
{
|
||||||
@ -478,6 +485,7 @@ static int dirExists(char const * const aDirPath)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void tinyfd_beep()
|
void tinyfd_beep()
|
||||||
{
|
{
|
||||||
printf("\a");
|
printf("\a");
|
||||||
@ -487,9 +495,10 @@ void tinyfd_beep()
|
|||||||
|
|
||||||
void tinyfd_beep()
|
void tinyfd_beep()
|
||||||
{
|
{
|
||||||
Beep(400,300);
|
Beep(440,300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wipefileW(wchar_t const * const aFilename)
|
static void wipefileW(wchar_t const * const aFilename)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -606,7 +615,7 @@ static void RGB2HexW(
|
|||||||
{
|
{
|
||||||
/* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); */
|
/* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); */
|
||||||
swprintf(aoResultHexRGB,
|
swprintf(aoResultHexRGB,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
8,
|
8,
|
||||||
#endif
|
#endif
|
||||||
L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]);
|
L"#%02hhx%02hhx%02hhx", aRGB[0], aRGB[1], aRGB[2]);
|
||||||
@ -790,7 +799,7 @@ static char const * ensureFilesExist(char * const aDestination,
|
|||||||
char * lDestination = aDestination;
|
char * lDestination = aDestination;
|
||||||
char const * p;
|
char const * p;
|
||||||
char const * p2;
|
char const * p2;
|
||||||
int lLen;
|
size_t lLen;
|
||||||
|
|
||||||
if (!aSourcePathsAndNames)
|
if (!aSourcePathsAndNames)
|
||||||
{
|
{
|
||||||
@ -836,7 +845,7 @@ static int __stdcall EnumThreadWndProc(HWND hwnd, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
wchar_t lTitleName[MAX_PATH];
|
wchar_t lTitleName[MAX_PATH];
|
||||||
GetWindowTextW(hwnd, lTitleName, MAX_PATH);
|
GetWindowTextW(hwnd, lTitleName, MAX_PATH);
|
||||||
/* wprintf(L"lTitleName %s \n", lTitleName); */
|
/* wprintf(L"lTitleName %ls \n", lTitleName); */
|
||||||
if (wcscmp(L"tinyfiledialogsTopWindow", lTitleName) == 0)
|
if (wcscmp(L"tinyfiledialogsTopWindow", lTitleName) == 0)
|
||||||
{
|
{
|
||||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
@ -982,9 +991,9 @@ int tinyfd_notifyPopupW(
|
|||||||
wchar_t const * const aIconType) /* L"info" L"warning" L"error" */
|
wchar_t const * const aIconType) /* L"info" L"warning" L"error" */
|
||||||
{
|
{
|
||||||
wchar_t * lDialogString;
|
wchar_t * lDialogString;
|
||||||
int lTitleLen;
|
size_t lTitleLen;
|
||||||
int lMessageLen;
|
size_t lMessageLen;
|
||||||
int lDialogStringLen;
|
size_t lDialogStringLen;
|
||||||
|
|
||||||
if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return 1; }
|
if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return 1; }
|
||||||
|
|
||||||
@ -1036,7 +1045,7 @@ Show-BalloonTip");
|
|||||||
}
|
}
|
||||||
wcscat(lDialogString, L"\"");
|
wcscat(lDialogString, L"\"");
|
||||||
|
|
||||||
/* wprintf ( L"lDialogString: %s\n" , lDialogString ) ; */
|
/* wprintf ( L"lDialogString: %ls\n" , lDialogString ) ; */
|
||||||
|
|
||||||
hiddenConsoleW(lDialogString, aTitle, 0);
|
hiddenConsoleW(lDialogString, aTitle, 0);
|
||||||
free(lDialogString);
|
free(lDialogString);
|
||||||
@ -1085,9 +1094,9 @@ wchar_t const * tinyfd_inputBoxW(
|
|||||||
FILE * lIn;
|
FILE * lIn;
|
||||||
FILE * lFile;
|
FILE * lFile;
|
||||||
int lResult;
|
int lResult;
|
||||||
int lTitleLen;
|
size_t lTitleLen;
|
||||||
int lMessageLen;
|
size_t lMessageLen;
|
||||||
int lDialogStringLen;
|
size_t lDialogStringLen;
|
||||||
|
|
||||||
if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
|
if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return (wchar_t const *)1; }
|
||||||
|
|
||||||
@ -1099,7 +1108,7 @@ wchar_t const * tinyfd_inputBoxW(
|
|||||||
if (aDefaultInput)
|
if (aDefaultInput)
|
||||||
{
|
{
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs", _wgetenv(L"USERPROFILE"));
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs", _wgetenv(L"USERPROFILE"));
|
||||||
@ -1107,7 +1116,7 @@ wchar_t const * tinyfd_inputBoxW(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.hta", _wgetenv(L"USERPROFILE"));
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.hta", _wgetenv(L"USERPROFILE"));
|
||||||
@ -1238,11 +1247,18 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
|||||||
if (aDefaultInput)
|
if (aDefaultInput)
|
||||||
{
|
{
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.txt",_wgetenv(L"USERPROFILE"));
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.txt",_wgetenv(L"USERPROFILE"));
|
||||||
lFile = _wfopen(lDialogString, L"wt, ccs=UNICODE");
|
|
||||||
|
#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);
|
fclose(lFile);
|
||||||
|
|
||||||
wcscpy(lDialogString, L"cmd.exe /c cscript.exe //U //Nologo ");
|
wcscpy(lDialogString, L"cmd.exe /c cscript.exe //U //Nologo ");
|
||||||
@ -1255,30 +1271,39 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
|||||||
L"cmd.exe /c mshta.exe %USERPROFILE%\\AppData\\Local\\Temp\\tinyfd.hta");
|
L"cmd.exe /c mshta.exe %USERPROFILE%\\AppData\\Local\\Temp\\tinyfd.hta");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf ( "lDialogString: %s\n" , lDialogString ) ; */
|
/* wprintf ( "lDialogString: %ls\n" , lDialogString ) ; */
|
||||||
|
|
||||||
hiddenConsoleW(lDialogString, aTitle, 1);
|
hiddenConsoleW(lDialogString, aTitle, 1);
|
||||||
|
|
||||||
if (aDefaultInput)
|
|
||||||
{
|
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%s\\AppData\\Local\\Temp\\tinyfd.txt", _wgetenv(L"USERPROFILE"));
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.txt", _wgetenv(L"USERPROFILE"));
|
||||||
if (!(lIn = _wfopen(lDialogString, L"rt, ccs=UNICODE")))
|
/* 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);
|
_wremove(lDialogString);
|
||||||
free(lDialogString);
|
free(lDialogString);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef TINYFD_NOCCSUNICODE
|
||||||
|
fgets((char *)lBuff, 2*MAX_PATH_OR_CMD, lIn);
|
||||||
|
#else
|
||||||
fgetws(lBuff, MAX_PATH_OR_CMD, lIn);
|
fgetws(lBuff, MAX_PATH_OR_CMD, lIn);
|
||||||
|
#endif
|
||||||
fclose(lIn);
|
fclose(lIn);
|
||||||
|
wipefileW(lDialogString);
|
||||||
_wremove(lDialogString);
|
_wremove(lDialogString);
|
||||||
|
|
||||||
|
if (aDefaultInput)
|
||||||
|
{
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs",
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs",
|
||||||
@ -1287,34 +1312,20 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
swprintf(lDialogString,
|
swprintf(lDialogString,
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||||
lDialogStringLen,
|
lDialogStringLen,
|
||||||
#endif
|
#endif
|
||||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.txt",
|
L"%ls\\AppData\\Local\\Temp\\tinyfd.hta",
|
||||||
_wgetenv(L"USERPROFILE"));
|
|
||||||
if (!(lIn = _wfopen(lDialogString, L"rt, ccs=UNICODE")))
|
|
||||||
{
|
|
||||||
_wremove(lDialogString);
|
|
||||||
free(lDialogString);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fgetws(lBuff, MAX_PATH_OR_CMD, lIn);
|
|
||||||
fclose(lIn);
|
|
||||||
|
|
||||||
wipefileW(lDialogString);
|
|
||||||
_wremove(lDialogString);
|
|
||||||
swprintf(lDialogString,
|
|
||||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
|
||||||
lDialogStringLen,
|
|
||||||
#endif
|
|
||||||
L"%s\\AppData\\Local\\Temp\\tinyfd.hta",
|
|
||||||
_wgetenv(L"USERPROFILE"));
|
_wgetenv(L"USERPROFILE"));
|
||||||
}
|
}
|
||||||
_wremove(lDialogString);
|
_wremove(lDialogString);
|
||||||
free(lDialogString);
|
free(lDialogString);
|
||||||
/* printf( "aoBuff: %s\n" , aoBuff ) ; */
|
/* wprintf( L"lBuff: %ls\n" , lBuff ) ; */
|
||||||
lResult = wcsncmp(lBuff, L"1", 1) ? 0 : 1;
|
#ifdef TINYFD_NOCCSUNICODE
|
||||||
|
lResult = !wcsncmp(lBuff+1, L"1", 1);
|
||||||
|
#else
|
||||||
|
lResult = !wcsncmp(lBuff, L"1", 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* printf( "lResult: %d \n" , lResult ) ; */
|
/* printf( "lResult: %d \n" , lResult ) ; */
|
||||||
if (!lResult)
|
if (!lResult)
|
||||||
@ -1322,8 +1333,12 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf( "aoBuff+1: %s\n" , aoBuff+1 ) ; */
|
/* wprintf( "lBuff+1: %ls\n" , lBuff+1 ) ; */
|
||||||
|
#ifdef TINYFD_NOCCSUNICODE
|
||||||
|
return lBuff + 2;
|
||||||
|
#else
|
||||||
return lBuff + 1;
|
return lBuff + 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1444,7 +1459,7 @@ wchar_t const * tinyfd_saveFileDialogW(
|
|||||||
ofn.nMaxFileTitle = MAX_PATH_OR_CMD/2;
|
ofn.nMaxFileTitle = MAX_PATH_OR_CMD/2;
|
||||||
ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
|
ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
|
||||||
ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
|
ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
|
||||||
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR;
|
ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST ;
|
||||||
ofn.nFileOffset = 0;
|
ofn.nFileOffset = 0;
|
||||||
ofn.nFileExtension = 0;
|
ofn.nFileExtension = 0;
|
||||||
ofn.lpstrDefExt = NULL;
|
ofn.lpstrDefExt = NULL;
|
||||||
@ -1594,7 +1609,7 @@ wchar_t const * tinyfd_openFileDialogW(
|
|||||||
ofn.nMaxFileTitle = MAX_PATH_OR_CMD / 2;
|
ofn.nMaxFileTitle = MAX_PATH_OR_CMD / 2;
|
||||||
ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
|
ofn.lpstrInitialDir = lDirname && wcslen(lDirname) ? lDirname : NULL;
|
||||||
ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
|
ofn.lpstrTitle = aTitle && wcslen(aTitle) ? aTitle : NULL;
|
||||||
ofn.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR;
|
ofn.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
||||||
ofn.nFileOffset = 0;
|
ofn.nFileOffset = 0;
|
||||||
ofn.nFileExtension = 0;
|
ofn.nFileExtension = 0;
|
||||||
ofn.lpstrDefExt = NULL;
|
ofn.lpstrDefExt = NULL;
|
||||||
@ -1839,7 +1854,7 @@ wchar_t const * tinyfd_colorChooserW(
|
|||||||
cc.hInstance = NULL;
|
cc.hInstance = NULL;
|
||||||
cc.rgbResult = RGB(lDefaultRGB[0], lDefaultRGB[1], lDefaultRGB[2]);
|
cc.rgbResult = RGB(lDefaultRGB[0], lDefaultRGB[1], lDefaultRGB[2]);
|
||||||
cc.lpCustColors = crCustColors;
|
cc.lpCustColors = crCustColors;
|
||||||
cc.Flags = CC_RGBINIT | CC_FULLOPEN;
|
cc.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ANYCOLOR ;
|
||||||
cc.lCustData = 0;
|
cc.lCustData = 0;
|
||||||
cc.lpfnHook = NULL;
|
cc.lpfnHook = NULL;
|
||||||
cc.lpTemplateName = NULL;
|
cc.lpTemplateName = NULL;
|
||||||
@ -2764,7 +2779,7 @@ int tinyfd_messageBox(
|
|||||||
{
|
{
|
||||||
gWarningDisplayed = 1;
|
gWarningDisplayed = 1;
|
||||||
printf("\n\n%s\n", gTitle);
|
printf("\n\n%s\n", gTitle);
|
||||||
printf("%s\n\n", gMessageWin);
|
printf("%s\n\n", tinyfd_needs);
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) )
|
if ( aTitle && strlen(aTitle) )
|
||||||
{
|
{
|
||||||
@ -2890,7 +2905,7 @@ char const * tinyfd_inputBox(
|
|||||||
{
|
{
|
||||||
gWarningDisplayed = 1 ;
|
gWarningDisplayed = 1 ;
|
||||||
printf("\n\n%s\n", gTitle);
|
printf("\n\n%s\n", gTitle);
|
||||||
printf("%s\n\n", gMessageWin);
|
printf("%s\n\n", tinyfd_needs);
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) )
|
if ( aTitle && strlen(aTitle) )
|
||||||
{
|
{
|
||||||
@ -3509,14 +3524,14 @@ static int speakertestPresent( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int beepPresent( )
|
static int beepexePresent( )
|
||||||
{
|
{
|
||||||
static int lBeepPresent = -1 ;
|
static int lBeepexePresent = -1 ;
|
||||||
if ( lBeepPresent < 0 )
|
if ( lBeepexePresent < 0 )
|
||||||
{
|
{
|
||||||
lBeepPresent = detectPresence("beep") ;
|
lBeepexePresent = detectPresence("beep.exe") ;
|
||||||
}
|
}
|
||||||
return lBeepPresent ;
|
return lBeepexePresent ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3588,6 +3603,30 @@ static int perlPresent( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 xdialogPresent( )
|
||||||
{
|
{
|
||||||
static int lXdialogPresent = -1 ;
|
static int lXdialogPresent = -1 ;
|
||||||
@ -3686,6 +3725,17 @@ static int matedialogPresent( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 zenityPresent( )
|
||||||
{
|
{
|
||||||
static int lZenityPresent = -1 ;
|
static int lZenityPresent = -1 ;
|
||||||
@ -3714,6 +3764,10 @@ static int zenity3Present()
|
|||||||
if ( atoi(lBuff) >= 3 )
|
if ( atoi(lBuff) >= 3 )
|
||||||
{
|
{
|
||||||
lZenity3Present = 3 ;
|
lZenity3Present = 3 ;
|
||||||
|
if ( atoi(strtok(lBuff,".")+2 ) >= 10 )
|
||||||
|
{
|
||||||
|
lZenity3Present = 4 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( ( atoi(lBuff) == 2 ) && ( atoi(strtok(lBuff,".")+2 ) >= 32 ) )
|
else if ( ( atoi(lBuff) == 2 ) && ( atoi(strtok(lBuff,".")+2 ) >= 32 ) )
|
||||||
{
|
{
|
||||||
@ -3776,11 +3830,11 @@ static int python2Present( )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! lPython2Present )
|
/*if ( ! lPython2Present )
|
||||||
{
|
{
|
||||||
strcpy(gPython2Name , "python" ) ;
|
strcpy(gPython2Name , "python" ) ;
|
||||||
if ( detectPresence(gPython2Name) ) lPython2Present = 1;
|
if ( detectPresence(gPython2Name) ) lPython2Present = 1;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
if (tinyfd_verbose) printf("lPython2Present %d\n", lPython2Present) ;
|
if (tinyfd_verbose) printf("lPython2Present %d\n", lPython2Present) ;
|
||||||
if (tinyfd_verbose) printf("gPython2Name %s\n", gPython2Name) ;
|
if (tinyfd_verbose) printf("gPython2Name %s\n", gPython2Name) ;
|
||||||
@ -3810,11 +3864,11 @@ static int python3Present( )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! lPython3Present )
|
/*if ( ! lPython3Present )
|
||||||
{
|
{
|
||||||
strcpy(gPython3Name , "python" ) ;
|
strcpy(gPython3Name , "python" ) ;
|
||||||
if ( detectPresence(gPython3Name) ) lPython3Present = 1;
|
if ( detectPresence(gPython3Name) ) lPython3Present = 1;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
if (tinyfd_verbose) printf("lPython3Present %d\n", lPython3Present) ;
|
if (tinyfd_verbose) printf("lPython3Present %d\n", lPython3Present) ;
|
||||||
if (tinyfd_verbose) printf("gPython3Name %s\n", gPython3Name) ;
|
if (tinyfd_verbose) printf("gPython3Name %s\n", gPython3Name) ;
|
||||||
@ -3871,24 +3925,27 @@ static int pythonDbusPresent( )
|
|||||||
static int lDbusPresent = -1 ;
|
static int lDbusPresent = -1 ;
|
||||||
char lPythonCommand[256];
|
char lPythonCommand[256];
|
||||||
char lPythonParams[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);\"";
|
"-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 )
|
if ( lDbusPresent < 0 )
|
||||||
{
|
{
|
||||||
lDbusPresent = 0 ;
|
lDbusPresent = 0 ;
|
||||||
if ( python3Present() )
|
if ( python2Present() )
|
||||||
|
{
|
||||||
|
strcpy(gPythonName , gPython2Name ) ;
|
||||||
|
sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
|
||||||
|
lDbusPresent = tryCommand(lPythonCommand) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! lDbusPresent && python3Present() )
|
||||||
{
|
{
|
||||||
strcpy(gPythonName , gPython3Name ) ;
|
strcpy(gPythonName , gPython3Name ) ;
|
||||||
sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
|
sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
|
||||||
lDbusPresent = tryCommand(lPythonCommand) ;
|
lDbusPresent = tryCommand(lPythonCommand) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! lDbusPresent && python2Present() )
|
|
||||||
{
|
|
||||||
strcpy(gPythonName , gPython2Name ) ;
|
|
||||||
sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
|
|
||||||
lDbusPresent = tryCommand(lPythonCommand) ;
|
|
||||||
}
|
|
||||||
if (tinyfd_verbose) printf("lDbusPresent %d\n", lDbusPresent) ;
|
if (tinyfd_verbose) printf("lDbusPresent %d\n", lDbusPresent) ;
|
||||||
if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ;
|
if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ;
|
||||||
}
|
}
|
||||||
@ -3896,27 +3953,45 @@ static int pythonDbusPresent( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void sigHandler(int sig)
|
||||||
|
{
|
||||||
|
FILE * lIn ;
|
||||||
|
if ( ( lIn = popen( "pactl unload-module module-sine" , "r" ) ) )
|
||||||
|
{
|
||||||
|
pclose( lIn ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tinyfd_beep()
|
void tinyfd_beep()
|
||||||
{
|
{
|
||||||
char lDialogString [64] ;
|
char lDialogString [256] ;
|
||||||
FILE * lIn ;
|
FILE * lIn ;
|
||||||
|
|
||||||
if ( osascriptPresent() )
|
if ( osascriptPresent() )
|
||||||
|
{
|
||||||
|
if ( afplayPresent() >= 2 )
|
||||||
|
{
|
||||||
|
strcpy( lDialogString , "afplay /System/Library/Sounds/Ping.aiff") ;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
strcpy( lDialogString , "osascript -e 'tell application \"System Events\" to beep'") ;
|
strcpy( lDialogString , "osascript -e 'tell application \"System Events\" to beep'") ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if ( pactlPresent() )
|
else if ( pactlPresent() )
|
||||||
{
|
{
|
||||||
strcpy( lDialogString , "pactl load-module module-sine frequency=400;sleep .3;pactl unload-module module-sine" ) ;
|
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() )
|
else if ( speakertestPresent() )
|
||||||
{
|
{
|
||||||
/* strcpy( lDialogString , "( speaker-test -t sine -f 1000 )& pid=$! ; sleep 0.3s ; kill -9 $pid" ) ; */
|
/*strcpy( lDialogString , "timeout -k .3 .3 speaker-test --frequency 440 --test sine > /dev/tty" ) ;*/
|
||||||
strcpy( lDialogString , "timeout .3 speaker-test --frequency 400 --test sine" ) ;
|
strcpy( lDialogString , "( speaker-test -t sine -f 440 > /dev/tty )& pid=$!;sleep .3; kill -9 $pid" ) ;
|
||||||
}
|
}
|
||||||
else if ( beepPresent() )
|
else if ( beepexePresent() )
|
||||||
{
|
{
|
||||||
strcpy( lDialogString , "beep -f 400 -l 300" ) ;
|
strcpy( lDialogString , "beep.exe 440 300" ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3929,6 +4004,11 @@ void tinyfd_beep()
|
|||||||
{
|
{
|
||||||
pclose( lIn ) ;
|
pclose( lIn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pactlPresent() )
|
||||||
|
{
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3949,8 +4029,8 @@ int tinyfd_messageBox(
|
|||||||
char lChar ;
|
char lChar ;
|
||||||
struct termios infoOri;
|
struct termios infoOri;
|
||||||
struct termios info;
|
struct termios info;
|
||||||
int lTitleLen ;
|
size_t lTitleLen ;
|
||||||
int lMessageLen ;
|
size_t lMessageLen ;
|
||||||
|
|
||||||
lBuff[0]='\0';
|
lBuff[0]='\0';
|
||||||
|
|
||||||
@ -4031,7 +4111,10 @@ int tinyfd_messageBox(
|
|||||||
strcat( lDialogString, ")' ") ;
|
strcat( lDialogString, ")' ") ;
|
||||||
|
|
||||||
strcat( lDialogString,
|
strcat( lDialogString,
|
||||||
"-e 'if vButton is \"Yes\" then' -e 'return 1' -e 'else if vButton is \"No\" then' -e 'return 2' -e 'else' -e 'return 0' -e 'end if' " );
|
"-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 'on error number -128' " ) ;
|
||||||
strcat( lDialogString, "-e '0' " );
|
strcat( lDialogString, "-e '0' " );
|
||||||
@ -4106,13 +4189,13 @@ int tinyfd_messageBox(
|
|||||||
strcat( lDialogString , ";if [ $? = 0 ];then echo 1;else echo 0;fi");
|
strcat( lDialogString , ";if [ $? = 0 ];then echo 1;else echo 0;fi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
|
||||||
strcpy( lDialogString , "szAnswer=$(zenity" ) ;
|
strcpy( lDialogString , "szAnswer=$(zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat(lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -4122,6 +4205,11 @@ int tinyfd_messageBox(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
|
||||||
strcpy( lDialogString , "szAnswer=$(matedialog" ) ;
|
strcpy( lDialogString , "szAnswer=$(matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return 1;}
|
||||||
|
strcpy( lDialogString , "szAnswer=$(shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
|
||||||
@ -4170,7 +4258,7 @@ int tinyfd_messageBox(
|
|||||||
strcat(lDialogString, aMessage) ;
|
strcat(lDialogString, aMessage) ;
|
||||||
strcat(lDialogString, "\"") ;
|
strcat(lDialogString, "\"") ;
|
||||||
}
|
}
|
||||||
if ( (zenity3Present() >= 3) || qarmaPresent() )
|
if ( (zenity3Present() >= 3) || (!zenityPresent() && (shellementaryPresent() || qarmaPresent()) ) )
|
||||||
{
|
{
|
||||||
strcat( lDialogString , " --icon-name=dialog-" ) ;
|
strcat( lDialogString , " --icon-name=dialog-" ) ;
|
||||||
if ( aIconType && (! strcmp( "question" , aIconType )
|
if ( aIconType && (! strcmp( "question" , aIconType )
|
||||||
@ -4596,7 +4684,7 @@ tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ! isTerminalRunning( ) && terminalName() )
|
else if ( isTerminalRunning( ) && terminalName() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return 0;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return 0;}
|
||||||
strcpy( lDialogString , terminalName() ) ;
|
strcpy( lDialogString , terminalName() ) ;
|
||||||
@ -4608,7 +4696,7 @@ tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
|
|||||||
strcat( lDialogString, gTitle) ;
|
strcat( lDialogString, gTitle) ;
|
||||||
strcat( lDialogString , "\";" ) ;
|
strcat( lDialogString , "\";" ) ;
|
||||||
strcat( lDialogString , "echo \"" ) ;
|
strcat( lDialogString , "echo \"" ) ;
|
||||||
strcat( lDialogString, gMessageUnix) ;
|
strcat( lDialogString, tinyfd_needs) ;
|
||||||
strcat( lDialogString , "\";echo;echo;" ) ;
|
strcat( lDialogString , "\";echo;echo;" ) ;
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) )
|
if ( aTitle && strlen(aTitle) )
|
||||||
@ -4734,7 +4822,7 @@ tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
|
|||||||
{
|
{
|
||||||
gWarningDisplayed = 1 ;
|
gWarningDisplayed = 1 ;
|
||||||
printf("\n\n%s\n", gTitle);
|
printf("\n\n%s\n", gTitle);
|
||||||
printf("%s\n\n", gMessageUnix);
|
printf("%s\n\n", tinyfd_needs);
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) )
|
if ( aTitle && strlen(aTitle) )
|
||||||
{
|
{
|
||||||
@ -4855,8 +4943,8 @@ int tinyfd_notifyPopup(
|
|||||||
char * lDialogString = NULL ;
|
char * lDialogString = NULL ;
|
||||||
char * lpDialogString ;
|
char * lpDialogString ;
|
||||||
FILE * lIn ;
|
FILE * lIn ;
|
||||||
int lTitleLen ;
|
size_t lTitleLen ;
|
||||||
int lMessageLen ;
|
size_t lMessageLen ;
|
||||||
|
|
||||||
if ( getenv("SSH_TTY") )
|
if ( getenv("SSH_TTY") )
|
||||||
{
|
{
|
||||||
@ -4918,9 +5006,10 @@ int tinyfd_notifyPopup(
|
|||||||
}
|
}
|
||||||
strcat( lDialogString , " \" 5" ) ;
|
strcat( lDialogString , " \" 5" ) ;
|
||||||
}
|
}
|
||||||
else if ( (zenity3Present()>=3) || matedialogPresent() || qarmaPresent() )
|
else if ( (zenity3Present()>=4) || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
/* zenity 2.32 has the notification but with a bug: it doesnt return from it */
|
/* 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 ( zenity3Present()>=3 )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
|
||||||
@ -4931,6 +5020,11 @@ int tinyfd_notifyPopup(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return 1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return 1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return 1;}
|
||||||
@ -5056,8 +5150,8 @@ char const * tinyfd_inputBox(
|
|||||||
struct termios oldt ;
|
struct termios oldt ;
|
||||||
struct termios newt ;
|
struct termios newt ;
|
||||||
char * lEOF;
|
char * lEOF;
|
||||||
int lTitleLen ;
|
size_t lTitleLen ;
|
||||||
int lMessageLen ;
|
size_t lMessageLen ;
|
||||||
|
|
||||||
lBuff[0]='\0';
|
lBuff[0]='\0';
|
||||||
|
|
||||||
@ -5141,13 +5235,13 @@ char const * tinyfd_inputBox(
|
|||||||
strcat( lDialogString ,
|
strcat( lDialogString ,
|
||||||
");if [ $? = 0 ];then echo 1$szAnswer;else echo 0$szAnswer;fi");
|
");if [ $? = 0 ];then echo 1$szAnswer;else echo 0$szAnswer;fi");
|
||||||
}
|
}
|
||||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||||
strcpy( lDialogString , "szAnswer=$(zenity" ) ;
|
strcpy( lDialogString , "szAnswer=$(zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -5157,6 +5251,11 @@ char const * tinyfd_inputBox(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "szAnswer=$(matedialog" ) ;
|
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
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -5427,7 +5526,7 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
|||||||
strcat( lDialogString , "'" ) ;
|
strcat( lDialogString , "'" ) ;
|
||||||
if ( !gWarningDisplayed && !tinyfd_forceConsole)
|
if ( !gWarningDisplayed && !tinyfd_forceConsole)
|
||||||
{
|
{
|
||||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||||
gWarningDisplayed = 1 ;
|
gWarningDisplayed = 1 ;
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) && !tinyfd_forceConsole)
|
if ( aTitle && strlen(aTitle) && !tinyfd_forceConsole)
|
||||||
@ -5453,7 +5552,7 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
|||||||
strcat( lDialogString , "cat -v /tmp/tinyfd.txt");
|
strcat( lDialogString , "cat -v /tmp/tinyfd.txt");
|
||||||
}
|
}
|
||||||
else if ( !gWarningDisplayed && ! isTerminalRunning( ) && ! terminalName() ) {
|
else if ( !gWarningDisplayed && ! isTerminalRunning( ) && ! terminalName() ) {
|
||||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||||
gWarningDisplayed = 1 ;
|
gWarningDisplayed = 1 ;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -5462,7 +5561,7 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"basicinput");return (char const *)0;}
|
||||||
if ( !gWarningDisplayed && !tinyfd_forceConsole)
|
if ( !gWarningDisplayed && !tinyfd_forceConsole)
|
||||||
{
|
{
|
||||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||||
gWarningDisplayed = 1 ;
|
gWarningDisplayed = 1 ;
|
||||||
}
|
}
|
||||||
if ( aTitle && strlen(aTitle) )
|
if ( aTitle && strlen(aTitle) )
|
||||||
@ -5680,13 +5779,13 @@ char const * tinyfd_saveFileDialog(
|
|||||||
strcat(lDialogString, "\"") ;
|
strcat(lDialogString, "\"") ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||||
strcpy( lDialogString , "zenity" ) ;
|
strcpy( lDialogString , "zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -5696,6 +5795,11 @@ char const * tinyfd_saveFileDialog(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -6112,13 +6216,13 @@ char const * tinyfd_openFileDialog(
|
|||||||
strcat(lDialogString, "\"") ;
|
strcat(lDialogString, "\"") ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||||
strcpy( lDialogString , "zenity" ) ;
|
strcpy( lDialogString , "zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -6128,6 +6232,11 @@ char const * tinyfd_openFileDialog(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -6499,13 +6608,13 @@ char const * tinyfd_selectFolderDialog(
|
|||||||
strcat(lDialogString, "\"") ;
|
strcat(lDialogString, "\"") ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
else if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||||
strcpy( lDialogString , "zenity" ) ;
|
strcpy( lDialogString , "zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -6515,6 +6624,11 @@ char const * tinyfd_selectFolderDialog(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -6790,14 +6904,14 @@ to set mycolor to choose color default color {");
|
|||||||
strcat(lDialogString, "\"") ;
|
strcat(lDialogString, "\"") ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( zenity3Present() || matedialogPresent() || qarmaPresent() )
|
else if ( zenity3Present() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
lWasZenity3 = 1 ;
|
lWasZenity3 = 1 ;
|
||||||
if ( zenity3Present() )
|
if ( zenity3Present() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity3");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity3");return (char const *)1;}
|
||||||
strcpy( lDialogString , "zenity" );
|
strcpy( lDialogString , "zenity" );
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -6807,6 +6921,11 @@ to set mycolor to choose color default color {");
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -6992,13 +7111,13 @@ char const * tinyfd_arrayDialog(
|
|||||||
|
|
||||||
lBuff[0]='\0';
|
lBuff[0]='\0';
|
||||||
|
|
||||||
if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
if ( zenityPresent() || matedialogPresent() || shellementaryPresent() || qarmaPresent() )
|
||||||
{
|
{
|
||||||
if ( zenityPresent() )
|
if ( zenityPresent() )
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||||
strcpy( lDialogString , "zenity" ) ;
|
strcpy( lDialogString , "zenity" ) ;
|
||||||
if ( (zenity3Present() >= 3) && !getenv("SSH_TTY") )
|
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 */
|
strcat( lDialogString, " --attach=$(sleep .01;xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2)"); /* contribution: Paul Rouget */
|
||||||
}
|
}
|
||||||
@ -7008,6 +7127,11 @@ char const * tinyfd_arrayDialog(
|
|||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"matedialog");return (char const *)1;}
|
||||||
strcpy( lDialogString , "matedialog" ) ;
|
strcpy( lDialogString , "matedialog" ) ;
|
||||||
}
|
}
|
||||||
|
else if ( shellementaryPresent() )
|
||||||
|
{
|
||||||
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"shellementary");return (char const *)1;}
|
||||||
|
strcpy( lDialogString , "shellementary" ) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
if (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"qarma");return (char const *)1;}
|
||||||
@ -7087,28 +7211,28 @@ char const * lWillBeGraphicMode;
|
|||||||
unsigned char lRgbColor[3];
|
unsigned char lRgbColor[3];
|
||||||
FILE * lIn;
|
FILE * lIn;
|
||||||
char lBuffer[1024];
|
char lBuffer[1024];
|
||||||
char lThePassword[1024];
|
char lString[1024];
|
||||||
char const * lFilterPatterns[2] = { "*.txt", "*.text" };
|
char const * lFilterPatterns[2] = { "*.txt", "*.text" };
|
||||||
|
|
||||||
tinyfd_verbose = argc - 1;
|
tinyfd_verbose = argc - 1;
|
||||||
|
|
||||||
tinyfd_beep();
|
|
||||||
|
|
||||||
lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL);
|
lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL);
|
||||||
|
|
||||||
|
strcpy(lBuffer, "v");
|
||||||
|
strcat(lBuffer, tinyfd_version);
|
||||||
if (lWillBeGraphicMode)
|
if (lWillBeGraphicMode)
|
||||||
{
|
{
|
||||||
strcpy(lBuffer, "graphic mode: ");
|
strcat(lBuffer, "\ngraphic mode: ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(lBuffer, "console mode: ");
|
strcat(lBuffer, "\nconsole mode: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(lBuffer, tinyfd_response);
|
strcat(lBuffer, tinyfd_response);
|
||||||
strcpy(lThePassword, "tinyfiledialogs v");
|
strcat(lBuffer, "\n");
|
||||||
strcat(lThePassword, tinyfd_version);
|
strcat(lBuffer, tinyfd_needs+78);
|
||||||
tinyfd_messageBox(lThePassword, lBuffer, "ok", "info", 0);
|
strcpy(lString, "tinyfiledialogs");
|
||||||
|
tinyfd_messageBox(lString, lBuffer, "ok", "info", 0);
|
||||||
|
|
||||||
tinyfd_notifyPopup("the title", "the message\n\tfrom outer-space", "info");
|
tinyfd_notifyPopup("the title", "the message\n\tfrom outer-space", "info");
|
||||||
|
|
||||||
@ -7124,7 +7248,7 @@ lTmp = tinyfd_inputBox(
|
|||||||
|
|
||||||
if (!lTmp) return 1;
|
if (!lTmp) return 1;
|
||||||
|
|
||||||
strcpy(lThePassword, lTmp);
|
strcpy(lString, lTmp);
|
||||||
|
|
||||||
lTheSaveFileName = tinyfd_saveFileDialog(
|
lTheSaveFileName = tinyfd_saveFileDialog(
|
||||||
"let us save this password",
|
"let us save this password",
|
||||||
@ -7155,7 +7279,7 @@ if (!lIn)
|
|||||||
1);
|
1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fputs(lThePassword, lIn);
|
fputs(lString, lIn);
|
||||||
fclose(lIn);
|
fclose(lIn);
|
||||||
|
|
||||||
lTheOpenFileName = tinyfd_openFileDialog(
|
lTheOpenFileName = tinyfd_openFileDialog(
|
||||||
@ -7233,6 +7357,8 @@ if (!lTheHexColor)
|
|||||||
tinyfd_messageBox("The selected hexcolor is",
|
tinyfd_messageBox("The selected hexcolor is",
|
||||||
lTheHexColor, "ok", "info", 1);
|
lTheHexColor, "ok", "info", 1);
|
||||||
|
|
||||||
|
tinyfd_beep();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
38
tools/rGuiStyler/external/tinyfiledialogs.h
vendored
38
tools/rGuiStyler/external/tinyfiledialogs.h
vendored
@ -1,10 +1,9 @@
|
|||||||
/*_________
|
/*_________
|
||||||
/ \ tinyfiledialogs.h v3.2.3 [Nov 2, 2017] zlib licence
|
/ \ tinyfiledialogs.h v3.3.1 [Feb 16, 2018] zlib licence
|
||||||
|tiny file| Unique header file created [November 9, 2014]
|
|tiny file| Unique header file created [November 9, 2014]
|
||||||
| dialogs | Copyright (c) 2014 - 2017 Guillaume Vareille http://ysengrin.com
|
| dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
|
||||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||||
\|
|
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||||
git://git.code.sf.net/p/tinyfiledialogs/code
|
|
||||||
____________________________________________
|
____________________________________________
|
||||||
| |
|
| |
|
||||||
| email: tinyfiledialogs at ysengrin.com |
|
| email: tinyfiledialogs at ysengrin.com |
|
||||||
@ -14,11 +13,9 @@
|
|||||||
| the windows only wchar_t UTF-16 prototypes are at the end of this file |
|
| the windows only wchar_t UTF-16 prototypes are at the end of this file |
|
||||||
|________________________________________________________________________|
|
|________________________________________________________________________|
|
||||||
|
|
||||||
A big thank you to Don Heyse http://ldglite.sf.net for bug corrections & thorough testing!
|
Please 1) let me know If you are using it on exotic hardware / OS / compiler
|
||||||
|
2) leave a 1-word review on Sourceforge.
|
||||||
Please 1) Let me know If you are using it on exotic hardware / OS / compiler
|
3) upvote my stackoverflow answer/advert https://stackoverflow.com/a/47651444
|
||||||
2) If yo have a sourceforge account, leave a 3-word review on Sourceforge.
|
|
||||||
It helps the ranking on google.
|
|
||||||
|
|
||||||
tiny file dialogs (cross-platform C C++)
|
tiny file dialogs (cross-platform C C++)
|
||||||
InputBox PasswordBox MessageBox ColorPicker
|
InputBox PasswordBox MessageBox ColorPicker
|
||||||
@ -26,7 +23,7 @@ OpenFileDialog SaveFileDialog SelectFolderDialog
|
|||||||
Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
|
Native dialog library for WINDOWS MAC OSX GTK+ QT CONSOLE & more
|
||||||
SSH supported via automatic switch to console mode or X11 forwarding
|
SSH supported via automatic switch to console mode or X11 forwarding
|
||||||
|
|
||||||
One C file (add it to your C or C++ project) with 8 functions:
|
a C file + a header (add them to your C or C++ project) with 8 functions:
|
||||||
- beep
|
- beep
|
||||||
- notify popup
|
- notify popup
|
||||||
- message & question
|
- message & question
|
||||||
@ -60,12 +57,13 @@ Unix (command line calls) ASCII UTF-8
|
|||||||
The same executable can run across desktops & distributions
|
The same executable can run across desktops & distributions
|
||||||
|
|
||||||
C89 & C++98 compliant: tested with C & C++ compilers
|
C89 & C++98 compliant: tested with C & C++ compilers
|
||||||
on VisualStudio MinGW Mac Linux Bsd Solaris Minix Raspbian
|
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
|
using Gnome Kde Enlightenment Mate Cinnamon Unity Lxde Lxqt Xfce
|
||||||
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
||||||
|
|
||||||
bindings for LUA and C# dll, Haskell
|
Bindings for LUA and C# dll, Haskell
|
||||||
included in LWJGL(java), Rust, Allegrobasic
|
Included in LWJGL(java), Rust, Allegrobasic
|
||||||
|
|
||||||
- License -
|
- License -
|
||||||
|
|
||||||
@ -105,8 +103,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char tinyfd_version[8]; /* contains tinyfd current version number */
|
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 int tinyfd_verbose; /* 0 (default) or 1 : on unix, prints the command line calls */
|
||||||
|
extern char tinyfd_needs[]; /* info about requirements */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* for UTF-16 use the functions at the end of this files */
|
/* for UTF-16 use the functions at the end of this files */
|
||||||
@ -284,7 +282,7 @@ char const * tinyfd_arrayDialog(
|
|||||||
- the windows only wchar_t (utf-16) prototypes are in the header file
|
- 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)
|
- windows is fully supported from XP to 10 (maybe even older versions)
|
||||||
- C# & LUA via dll, see example files
|
- C# & LUA via dll, see example files
|
||||||
- OSX supported from 10.4 to 10.11 (maybe even older versions)
|
- OSX supported from 10.4 to latest (maybe even older versions)
|
||||||
- Avoid using " and ' in titles and messages.
|
- Avoid using " and ' in titles and messages.
|
||||||
- There's one file filter only, it may contain several patterns.
|
- There's one file filter only, it may contain several patterns.
|
||||||
- If no filter description is provided,
|
- If no filter description is provided,
|
||||||
@ -294,9 +292,10 @@ char const * tinyfd_arrayDialog(
|
|||||||
- On windows link against Comdlg32.lib and Ole32.lib
|
- On windows link against Comdlg32.lib and Ole32.lib
|
||||||
This linking is not compulsary for console mode (see above).
|
This linking is not compulsary for console mode (see above).
|
||||||
- On unix: it tries command line calls, so no such need.
|
- On unix: it tries command line calls, so no such need.
|
||||||
- On unix you need applescript, kdialog, zenity, matedialog, qarma,
|
- On unix you need one of the following:
|
||||||
python (2 or 3)/tkinter/python-dbus (optional),
|
applescript, kdialog, zenity, matedialog, shellementary, qarma,
|
||||||
Xdialog or dialog (opens terminal if running without console).
|
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.
|
- One of those is already included on most (if not all) desktops.
|
||||||
- In the absence of those it will use gdialog, gxmessage or whiptail
|
- In the absence of those it will use gdialog, gxmessage or whiptail
|
||||||
with a textinputbox.
|
with a textinputbox.
|
||||||
@ -313,7 +312,8 @@ char const * tinyfd_arrayDialog(
|
|||||||
- Mutiple selects are not allowed in console mode.
|
- Mutiple selects are not allowed in console mode.
|
||||||
- The package dialog must be installed to run in enhanced console mode.
|
- The package dialog must be installed to run in enhanced console mode.
|
||||||
It is already installed on most unix systems.
|
It is already installed on most unix systems.
|
||||||
- On osx, the package dialog can be installed via http://macports.org
|
- On osx, the package dialog can be installed via
|
||||||
|
http://macappstore.org/dialog or http://macports.org
|
||||||
- On windows, for enhanced console mode,
|
- On windows, for enhanced console mode,
|
||||||
dialog.exe should be copied somewhere on your executable path.
|
dialog.exe should be copied somewhere on your executable path.
|
||||||
It can be found at the bottom of the following page:
|
It can be found at the bottom of the following page:
|
||||||
|
|||||||
Reference in New Issue
Block a user