mirror of
https://github.com/raysan5/raygui.git
synced 2026-02-08 07:09:18 -05:00
Updated tinyfiledialogs library
This commit is contained in:
408
tools/rGuiStyler/external/tinyfiledialogs.c
vendored
408
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]
|
||||
| dialogs | Copyright (c) 2014 - 2017 Guillaume Vareille http://ysengrin.com
|
||||
| dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
|
||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||
\|
|
||||
git://git.code.sf.net/p/tinyfiledialogs/code
|
||||
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||
____________________________________________
|
||||
| |
|
||||
| email: tinyfiledialogs at ysengrin.com |
|
||||
@ -14,13 +13,9 @@
|
||||
| the windows only wchar_t UTF-16 prototypes are in the header file |
|
||||
|___________________________________________________________________|
|
||||
|
||||
A big thank you for contributions, bug corrections & thorough testing to:
|
||||
- Don Heyse http://ldglite.sf.net for bug corrections & thorough testing!
|
||||
- Paul Rouget
|
||||
|
||||
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.
|
||||
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
|
||||
@ -28,7 +23,7 @@ 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
|
||||
|
||||
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
|
||||
- notify popup
|
||||
- message & question
|
||||
@ -62,12 +57,17 @@ Unix (command line calls) ASCII UTF-8
|
||||
The same executable can run across desktops & distributions
|
||||
|
||||
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
|
||||
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
||||
|
||||
bindings for LUA and C# dll, Haskell
|
||||
included in LWJGL(java), Rust, Allegrobasic
|
||||
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 -
|
||||
|
||||
@ -99,6 +99,9 @@ misrepresented as being the original software.
|
||||
/* #define TINYFD_NOLIB */
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef __BORLANDC__
|
||||
#define _getch getch
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
@ -110,7 +113,8 @@ misrepresented as being the original software.
|
||||
#endif /*TINYFD_NOSELECTFOLDERWIN*/
|
||||
#endif
|
||||
#include <conio.h>
|
||||
/*#include <io.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
|
||||
@ -119,15 +123,16 @@ misrepresented as being the original software.
|
||||
#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.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)
|
||||
int tinyfd_forceConsole = 1 ;
|
||||
@ -163,7 +168,7 @@ static int gWarningDisplayed = 0 ;
|
||||
static char gTitle[]="missing software! (we will try basic console input)";
|
||||
|
||||
#ifdef _WIN32
|
||||
static char gMessageWin[] = "\
|
||||
char tinyfd_needs[] = "\
|
||||
___________\n\
|
||||
/ \\ \n\
|
||||
| tiny file |\n\
|
||||
@ -175,7 +180,7 @@ static char gMessageWin[] = "\
|
||||
\nor dialog.exe (enhanced console mode)\
|
||||
\nor a console for basic input";
|
||||
#else
|
||||
static char gMessageUnix[] = "\
|
||||
char tinyfd_needs[] = "\
|
||||
___________\n\
|
||||
/ \\ \n\
|
||||
| tiny file |\n\
|
||||
@ -185,11 +190,13 @@ static char gMessageUnix[] = "\
|
||||
\ntiny file dialogs on UNIX needs:\
|
||||
\n applescript\
|
||||
\nor kdialog\
|
||||
\nor zenity\
|
||||
\nor python (2 or 3) + tkinter + python-dbus (optional)\
|
||||
\nor dialog (opens a console if needed)\
|
||||
\nor xterm + bash (opens a console for basic input)\
|
||||
\nor it will use the existing console for basic input";
|
||||
\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
|
||||
@ -329,7 +336,7 @@ static void replaceSubStr( char const * const aSource ,
|
||||
char const * pOccurence ;
|
||||
char const * p ;
|
||||
char const * lNewSubStr = "" ;
|
||||
int lOldSubLen = strlen( aOldSubStr ) ;
|
||||
size_t lOldSubLen = strlen( aOldSubStr ) ;
|
||||
|
||||
if ( ! aSource )
|
||||
{
|
||||
@ -478,6 +485,7 @@ static int dirExists(char const * const aDirPath)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void tinyfd_beep()
|
||||
{
|
||||
printf("\a");
|
||||
@ -487,9 +495,10 @@ void tinyfd_beep()
|
||||
|
||||
void tinyfd_beep()
|
||||
{
|
||||
Beep(400,300);
|
||||
Beep(440,300);
|
||||
}
|
||||
|
||||
|
||||
static void wipefileW(wchar_t const * const aFilename)
|
||||
{
|
||||
int i;
|
||||
@ -606,7 +615,7 @@ static void RGB2HexW(
|
||||
{
|
||||
/* wprintf(L"aoResultHexRGB %s\n", aoResultHexRGB); */
|
||||
swprintf(aoResultHexRGB,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
8,
|
||||
#endif
|
||||
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 const * p;
|
||||
char const * p2;
|
||||
int lLen;
|
||||
size_t lLen;
|
||||
|
||||
if (!aSourcePathsAndNames)
|
||||
{
|
||||
@ -836,7 +845,7 @@ static int __stdcall EnumThreadWndProc(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
wchar_t 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)
|
||||
{
|
||||
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 * lDialogString;
|
||||
int lTitleLen;
|
||||
int lMessageLen;
|
||||
int lDialogStringLen;
|
||||
size_t lTitleLen;
|
||||
size_t lMessageLen;
|
||||
size_t lDialogStringLen;
|
||||
|
||||
if (aTitle&&!wcscmp(aTitle, L"tinyfd_query")){ strcpy(tinyfd_response, "windows_wchar"); return 1; }
|
||||
|
||||
@ -1036,7 +1045,7 @@ Show-BalloonTip");
|
||||
}
|
||||
wcscat(lDialogString, L"\"");
|
||||
|
||||
/* wprintf ( L"lDialogString: %s\n" , lDialogString ) ; */
|
||||
/* wprintf ( L"lDialogString: %ls\n" , lDialogString ) ; */
|
||||
|
||||
hiddenConsoleW(lDialogString, aTitle, 0);
|
||||
free(lDialogString);
|
||||
@ -1085,9 +1094,9 @@ wchar_t const * tinyfd_inputBoxW(
|
||||
FILE * lIn;
|
||||
FILE * lFile;
|
||||
int lResult;
|
||||
int lTitleLen;
|
||||
int lMessageLen;
|
||||
int lDialogStringLen;
|
||||
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; }
|
||||
|
||||
@ -1099,7 +1108,7 @@ wchar_t const * tinyfd_inputBoxW(
|
||||
if (aDefaultInput)
|
||||
{
|
||||
swprintf(lDialogString,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs", _wgetenv(L"USERPROFILE"));
|
||||
@ -1107,7 +1116,7 @@ wchar_t const * tinyfd_inputBoxW(
|
||||
else
|
||||
{
|
||||
swprintf(lDialogString,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
swprintf(lDialogString,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
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);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
/* printf ( "lDialogString: %s\n" , lDialogString ) ; */
|
||||
/* wprintf ( "lDialogString: %ls\n" , lDialogString ) ; */
|
||||
|
||||
hiddenConsoleW(lDialogString, aTitle, 1);
|
||||
|
||||
if (aDefaultInput)
|
||||
{
|
||||
swprintf(lDialogString,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
L"%s\\AppData\\Local\\Temp\\tinyfd.txt", _wgetenv(L"USERPROFILE"));
|
||||
if (!(lIn = _wfopen(lDialogString, L"rt, ccs=UNICODE")))
|
||||
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(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.vbs",
|
||||
@ -1287,34 +1312,20 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
||||
else
|
||||
{
|
||||
swprintf(lDialogString,
|
||||
#if !defined(__GNUC__) || (__GNUC__) >= 5
|
||||
#if !defined(__BORLANDC__) && !defined(__TINYC__) && ( !defined(__GNUC__) || (__GNUC__) >= 5 )
|
||||
lDialogStringLen,
|
||||
#endif
|
||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.txt",
|
||||
_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",
|
||||
L"%ls\\AppData\\Local\\Temp\\tinyfd.hta",
|
||||
_wgetenv(L"USERPROFILE"));
|
||||
}
|
||||
_wremove(lDialogString);
|
||||
free(lDialogString);
|
||||
/* printf( "aoBuff: %s\n" , aoBuff ) ; */
|
||||
lResult = wcsncmp(lBuff, L"1", 1) ? 0 : 1;
|
||||
/* 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)
|
||||
@ -1322,8 +1333,12 @@ name = 'txt_input' value = '' style = 'float:left;width:100%' ><BR>\n\
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
/* printf( "aoBuff+1: %s\n" , aoBuff+1 ) ; */
|
||||
return lBuff + 1 ;
|
||||
/* wprintf( "lBuff+1: %ls\n" , lBuff+1 ) ; */
|
||||
#ifdef TINYFD_NOCCSUNICODE
|
||||
return lBuff + 2;
|
||||
#else
|
||||
return lBuff + 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1444,7 +1459,7 @@ wchar_t const * tinyfd_saveFileDialogW(
|
||||
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.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST ;
|
||||
ofn.nFileOffset = 0;
|
||||
ofn.nFileExtension = 0;
|
||||
ofn.lpstrDefExt = NULL;
|
||||
@ -1594,7 +1609,7 @@ wchar_t const * tinyfd_openFileDialogW(
|
||||
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.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
||||
ofn.nFileOffset = 0;
|
||||
ofn.nFileExtension = 0;
|
||||
ofn.lpstrDefExt = NULL;
|
||||
@ -1839,7 +1854,7 @@ wchar_t const * tinyfd_colorChooserW(
|
||||
cc.hInstance = NULL;
|
||||
cc.rgbResult = RGB(lDefaultRGB[0], lDefaultRGB[1], lDefaultRGB[2]);
|
||||
cc.lpCustColors = crCustColors;
|
||||
cc.Flags = CC_RGBINIT | CC_FULLOPEN;
|
||||
cc.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ANYCOLOR ;
|
||||
cc.lCustData = 0;
|
||||
cc.lpfnHook = NULL;
|
||||
cc.lpTemplateName = NULL;
|
||||
@ -2764,7 +2779,7 @@ int tinyfd_messageBox(
|
||||
{
|
||||
gWarningDisplayed = 1;
|
||||
printf("\n\n%s\n", gTitle);
|
||||
printf("%s\n\n", gMessageWin);
|
||||
printf("%s\n\n", tinyfd_needs);
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) )
|
||||
{
|
||||
@ -2890,7 +2905,7 @@ char const * tinyfd_inputBox(
|
||||
{
|
||||
gWarningDisplayed = 1 ;
|
||||
printf("\n\n%s\n", gTitle);
|
||||
printf("%s\n\n", gMessageWin);
|
||||
printf("%s\n\n", tinyfd_needs);
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) )
|
||||
{
|
||||
@ -3509,14 +3524,14 @@ static int speakertestPresent( )
|
||||
}
|
||||
|
||||
|
||||
static int beepPresent( )
|
||||
static int beepexePresent( )
|
||||
{
|
||||
static int lBeepPresent = -1 ;
|
||||
if ( lBeepPresent < 0 )
|
||||
static int lBeepexePresent = -1 ;
|
||||
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 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 lZenityPresent = -1 ;
|
||||
@ -3714,6 +3764,10 @@ static int zenity3Present()
|
||||
if ( atoi(lBuff) >= 3 )
|
||||
{
|
||||
lZenity3Present = 3 ;
|
||||
if ( atoi(strtok(lBuff,".")+2 ) >= 10 )
|
||||
{
|
||||
lZenity3Present = 4 ;
|
||||
}
|
||||
}
|
||||
else if ( ( atoi(lBuff) == 2 ) && ( atoi(strtok(lBuff,".")+2 ) >= 32 ) )
|
||||
{
|
||||
@ -3776,11 +3830,11 @@ static int python2Present( )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ! lPython2Present )
|
||||
/*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) ;
|
||||
@ -3810,11 +3864,11 @@ static int python3Present( )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ! lPython3Present )
|
||||
/*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) ;
|
||||
@ -3871,24 +3925,27 @@ 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);\"";
|
||||
"-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 ( python3Present() )
|
||||
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 ( ! 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("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()
|
||||
{
|
||||
char lDialogString [64] ;
|
||||
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() )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
/* strcpy( lDialogString , "( speaker-test -t sine -f 1000 )& pid=$! ; sleep 0.3s ; kill -9 $pid" ) ; */
|
||||
strcpy( lDialogString , "timeout .3 speaker-test --frequency 400 --test sine" ) ;
|
||||
/*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 ( beepPresent() )
|
||||
else if ( beepexePresent() )
|
||||
{
|
||||
strcpy( lDialogString , "beep -f 400 -l 300" ) ;
|
||||
strcpy( lDialogString , "beep.exe 440 300" ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3929,6 +4004,11 @@ void tinyfd_beep()
|
||||
{
|
||||
pclose( lIn ) ;
|
||||
}
|
||||
|
||||
if ( pactlPresent() )
|
||||
{
|
||||
signal(SIGINT, SIG_DFL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3949,8 +4029,8 @@ int tinyfd_messageBox(
|
||||
char lChar ;
|
||||
struct termios infoOri;
|
||||
struct termios info;
|
||||
int lTitleLen ;
|
||||
int lMessageLen ;
|
||||
size_t lTitleLen ;
|
||||
size_t lMessageLen ;
|
||||
|
||||
lBuff[0]='\0';
|
||||
|
||||
@ -4031,7 +4111,10 @@ int tinyfd_messageBox(
|
||||
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 '0' " );
|
||||
@ -4106,13 +4189,13 @@ int tinyfd_messageBox(
|
||||
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 (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return 1;}
|
||||
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 */
|
||||
}
|
||||
@ -4122,6 +4205,11 @@ int tinyfd_messageBox(
|
||||
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;}
|
||||
@ -4170,7 +4258,7 @@ int tinyfd_messageBox(
|
||||
strcat(lDialogString, aMessage) ;
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
if ( (zenity3Present() >= 3) || qarmaPresent() )
|
||||
if ( (zenity3Present() >= 3) || (!zenityPresent() && (shellementaryPresent() || qarmaPresent()) ) )
|
||||
{
|
||||
strcat( lDialogString , " --icon-name=dialog-" ) ;
|
||||
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;}
|
||||
strcpy( lDialogString , terminalName() ) ;
|
||||
@ -4608,7 +4696,7 @@ tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
|
||||
strcat( lDialogString, gTitle) ;
|
||||
strcat( lDialogString , "\";" ) ;
|
||||
strcat( lDialogString , "echo \"" ) ;
|
||||
strcat( lDialogString, gMessageUnix) ;
|
||||
strcat( lDialogString, tinyfd_needs) ;
|
||||
strcat( lDialogString , "\";echo;echo;" ) ;
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) )
|
||||
@ -4734,7 +4822,7 @@ tinyfdRes=$(cat /tmp/tinyfd.txt);echo $tinyfdBool$tinyfdRes") ;
|
||||
{
|
||||
gWarningDisplayed = 1 ;
|
||||
printf("\n\n%s\n", gTitle);
|
||||
printf("%s\n\n", gMessageUnix);
|
||||
printf("%s\n\n", tinyfd_needs);
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) )
|
||||
{
|
||||
@ -4855,8 +4943,8 @@ int tinyfd_notifyPopup(
|
||||
char * lDialogString = NULL ;
|
||||
char * lpDialogString ;
|
||||
FILE * lIn ;
|
||||
int lTitleLen ;
|
||||
int lMessageLen ;
|
||||
size_t lTitleLen ;
|
||||
size_t lMessageLen ;
|
||||
|
||||
if ( getenv("SSH_TTY") )
|
||||
{
|
||||
@ -4918,9 +5006,10 @@ int tinyfd_notifyPopup(
|
||||
}
|
||||
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 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;}
|
||||
@ -4931,6 +5020,11 @@ int tinyfd_notifyPopup(
|
||||
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;}
|
||||
@ -5056,8 +5150,8 @@ char const * tinyfd_inputBox(
|
||||
struct termios oldt ;
|
||||
struct termios newt ;
|
||||
char * lEOF;
|
||||
int lTitleLen ;
|
||||
int lMessageLen ;
|
||||
size_t lTitleLen ;
|
||||
size_t lMessageLen ;
|
||||
|
||||
lBuff[0]='\0';
|
||||
|
||||
@ -5141,13 +5235,13 @@ char const * tinyfd_inputBox(
|
||||
strcat( lDialogString ,
|
||||
");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 (aTitle&&!strcmp(aTitle,"tinyfd_query")){strcpy(tinyfd_response,"zenity");return (char const *)1;}
|
||||
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 */
|
||||
}
|
||||
@ -5157,6 +5251,11 @@ char const * tinyfd_inputBox(
|
||||
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;}
|
||||
@ -5427,7 +5526,7 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
||||
strcat( lDialogString , "'" ) ;
|
||||
if ( !gWarningDisplayed && !tinyfd_forceConsole)
|
||||
{
|
||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
||||
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||
gWarningDisplayed = 1 ;
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) && !tinyfd_forceConsole)
|
||||
@ -5453,7 +5552,7 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
||||
strcat( lDialogString , "cat -v /tmp/tinyfd.txt");
|
||||
}
|
||||
else if ( !gWarningDisplayed && ! isTerminalRunning( ) && ! terminalName() ) {
|
||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
||||
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||
gWarningDisplayed = 1 ;
|
||||
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 ( !gWarningDisplayed && !tinyfd_forceConsole)
|
||||
{
|
||||
tinyfd_messageBox(gTitle,gMessageUnix,"ok","warning",0);
|
||||
tinyfd_messageBox(gTitle,tinyfd_needs,"ok","warning",0);
|
||||
gWarningDisplayed = 1 ;
|
||||
}
|
||||
if ( aTitle && strlen(aTitle) )
|
||||
@ -5680,13 +5779,13 @@ char const * tinyfd_saveFileDialog(
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
}
|
||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
||||
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() >= 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 */
|
||||
}
|
||||
@ -5696,6 +5795,11 @@ char const * tinyfd_saveFileDialog(
|
||||
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;}
|
||||
@ -6112,13 +6216,13 @@ char const * tinyfd_openFileDialog(
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
}
|
||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
||||
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() >= 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 */
|
||||
}
|
||||
@ -6128,6 +6232,11 @@ char const * tinyfd_openFileDialog(
|
||||
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;}
|
||||
@ -6499,13 +6608,13 @@ char const * tinyfd_selectFolderDialog(
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
}
|
||||
else if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
||||
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() >= 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 */
|
||||
}
|
||||
@ -6515,6 +6624,11 @@ char const * tinyfd_selectFolderDialog(
|
||||
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;}
|
||||
@ -6790,14 +6904,14 @@ to set mycolor to choose color default color {");
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
}
|
||||
else if ( zenity3Present() || matedialogPresent() || qarmaPresent() )
|
||||
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() >= 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 */
|
||||
}
|
||||
@ -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;}
|
||||
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;}
|
||||
@ -6992,13 +7111,13 @@ char const * tinyfd_arrayDialog(
|
||||
|
||||
lBuff[0]='\0';
|
||||
|
||||
if ( zenityPresent() || matedialogPresent() || qarmaPresent() )
|
||||
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() >= 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 */
|
||||
}
|
||||
@ -7008,6 +7127,11 @@ char const * tinyfd_arrayDialog(
|
||||
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;}
|
||||
@ -7087,28 +7211,28 @@ char const * lWillBeGraphicMode;
|
||||
unsigned char lRgbColor[3];
|
||||
FILE * lIn;
|
||||
char lBuffer[1024];
|
||||
char lThePassword[1024];
|
||||
char lString[1024];
|
||||
char const * lFilterPatterns[2] = { "*.txt", "*.text" };
|
||||
|
||||
tinyfd_verbose = argc - 1;
|
||||
|
||||
tinyfd_beep();
|
||||
|
||||
lWillBeGraphicMode = tinyfd_inputBox("tinyfd_query", NULL, NULL);
|
||||
|
||||
strcpy(lBuffer, "v");
|
||||
strcat(lBuffer, tinyfd_version);
|
||||
if (lWillBeGraphicMode)
|
||||
{
|
||||
strcpy(lBuffer, "graphic mode: ");
|
||||
strcat(lBuffer, "\ngraphic mode: ");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(lBuffer, "console mode: ");
|
||||
strcat(lBuffer, "\nconsole mode: ");
|
||||
}
|
||||
|
||||
strcat(lBuffer, tinyfd_response);
|
||||
strcpy(lThePassword, "tinyfiledialogs v");
|
||||
strcat(lThePassword, tinyfd_version);
|
||||
tinyfd_messageBox(lThePassword, lBuffer, "ok", "info", 0);
|
||||
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");
|
||||
|
||||
@ -7124,7 +7248,7 @@ lTmp = tinyfd_inputBox(
|
||||
|
||||
if (!lTmp) return 1;
|
||||
|
||||
strcpy(lThePassword, lTmp);
|
||||
strcpy(lString, lTmp);
|
||||
|
||||
lTheSaveFileName = tinyfd_saveFileDialog(
|
||||
"let us save this password",
|
||||
@ -7155,7 +7279,7 @@ if (!lIn)
|
||||
1);
|
||||
return 1;
|
||||
}
|
||||
fputs(lThePassword, lIn);
|
||||
fputs(lString, lIn);
|
||||
fclose(lIn);
|
||||
|
||||
lTheOpenFileName = tinyfd_openFileDialog(
|
||||
@ -7233,6 +7357,8 @@ if (!lTheHexColor)
|
||||
tinyfd_messageBox("The selected hexcolor is",
|
||||
lTheHexColor, "ok", "info", 1);
|
||||
|
||||
tinyfd_beep();
|
||||
|
||||
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]
|
||||
| dialogs | Copyright (c) 2014 - 2017 Guillaume Vareille http://ysengrin.com
|
||||
| dialogs | Copyright (c) 2014 - 2018 Guillaume Vareille http://ysengrin.com
|
||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||
\|
|
||||
git://git.code.sf.net/p/tinyfiledialogs/code
|
||||
\| git clone http://git.code.sf.net/p/tinyfiledialogs/code tinyfd
|
||||
____________________________________________
|
||||
| |
|
||||
| email: tinyfiledialogs at ysengrin.com |
|
||||
@ -14,11 +13,9 @@
|
||||
| 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) If yo have a sourceforge account, leave a 3-word review on Sourceforge.
|
||||
It helps the ranking on google.
|
||||
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
|
||||
@ -26,7 +23,7 @@ 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
|
||||
|
||||
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
|
||||
- notify popup
|
||||
- message & question
|
||||
@ -60,12 +57,13 @@ Unix (command line calls) ASCII UTF-8
|
||||
The same executable can run across desktops & distributions
|
||||
|
||||
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
|
||||
WindowMaker IceWm Cde Jds OpenBox Awesome Jwm Xdm
|
||||
|
||||
bindings for LUA and C# dll, Haskell
|
||||
included in LWJGL(java), Rust, Allegrobasic
|
||||
Bindings for LUA and C# dll, Haskell
|
||||
Included in LWJGL(java), Rust, Allegrobasic
|
||||
|
||||
- License -
|
||||
|
||||
@ -105,8 +103,8 @@ 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 */
|
||||
@ -284,7 +282,7 @@ char const * tinyfd_arrayDialog(
|
||||
- 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 10.11 (maybe even older versions)
|
||||
- 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,
|
||||
@ -294,9 +292,10 @@ char const * tinyfd_arrayDialog(
|
||||
- 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 applescript, kdialog, zenity, matedialog, qarma,
|
||||
python (2 or 3)/tkinter/python-dbus (optional),
|
||||
Xdialog or dialog (opens terminal if running without console).
|
||||
- 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.
|
||||
@ -313,7 +312,8 @@ char const * tinyfd_arrayDialog(
|
||||
- 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://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,
|
||||
dialog.exe should be copied somewhere on your executable path.
|
||||
It can be found at the bottom of the following page:
|
||||
|
||||
Reference in New Issue
Block a user