Working on tool
This commit is contained in:
parent
47dc4455e2
commit
9a7082c4ea
77
tools/rGuiStyler/external/tinyfiledialogs.c
vendored
77
tools/rGuiStyler/external/tinyfiledialogs.c
vendored
@ -1,10 +1,10 @@
|
||||
/*
|
||||
_________
|
||||
/ \ tinyfiledialogs.c v2.5.6 [August 6, 2016] zlib licence
|
||||
/ \ tinyfiledialogs.c v2.5.8 [September 13, 2016] zlib licence
|
||||
|tiny file| Unique code file of "tiny file dialogs" created [November 9, 2014]
|
||||
| dialogs | Copyright (c) 2014 - 2016 Guillaume Vareille http://ysengrin.com
|
||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||
\| mailto:tinfyfiledialogs@ysengrin.com
|
||||
\| mailto:tinyfiledialogs@ysengrin.com
|
||||
|
||||
A big thank you to Don Heyse http://ldglite.sf.net for
|
||||
his code contributions, bug corrections & thorough testing!
|
||||
@ -39,7 +39,7 @@ NO MAIN LOOP
|
||||
|
||||
The dialogs can be forced into console mode
|
||||
|
||||
Windows [UTF-8 + UTF-16]
|
||||
Windows [MBCS + UTF-8 + UTF-16]
|
||||
- native code & some vbs create the graphic dialogs
|
||||
- enhanced console mode can use dialog.exe from
|
||||
http://andrear.altervista.org/home/cdialog.php
|
||||
@ -87,13 +87,10 @@ misrepresented as being the original software.
|
||||
#include "tinyfiledialogs.h"
|
||||
/* #define TINYFD_NOLIB //*/
|
||||
|
||||
#define _MAX_FNAME 128 // Ray
|
||||
#define _MAX_EXT 16 // Ray
|
||||
#define _MAX_FNAME 256 // Ray
|
||||
#define _MAX_EXT 256 // Ray
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4996) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#pragma warning(disable:4100) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#pragma warning(disable:4706) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#endif
|
||||
@ -105,6 +102,7 @@ misrepresented as being the original software.
|
||||
#include <conio.h>
|
||||
/*#include <io.h>*/
|
||||
#define SLASH "\\"
|
||||
/* tinyfd_winUtf8 is not ready yet, do not modify */
|
||||
int tinyfd_winUtf8 = 0 ; /* on windows string char can be 0:MBSC or 1:UTF-8 */
|
||||
#else
|
||||
#include <limits.h>
|
||||
@ -118,7 +116,7 @@ misrepresented as being the original software.
|
||||
#define MAX_PATH_OR_CMD 1024 /* _MAX_PATH or MAX_PATH */
|
||||
#define MAX_MULTIPLE_FILES 32
|
||||
|
||||
char tinyfd_version [8] = "2.5.6";
|
||||
char tinyfd_version [8] = "2.5.8";
|
||||
|
||||
#if defined(TINYFD_NOLIB) && defined(_WIN32)
|
||||
int tinyfd_forceConsole = 1 ;
|
||||
@ -159,6 +157,11 @@ static char gAsciiArt[] ="\
|
||||
\\_____ ____/\n\
|
||||
\\|";
|
||||
|
||||
#ifdef _WIN32
|
||||
static char gMessageWin[] = "tiny file dialogs on Windows needs:\n\t\
|
||||
a graphic display\nor\tdialog.exe (enhanced console mode)\
|
||||
\nor\ta console for basic input";
|
||||
#else
|
||||
static char gMessageUnix[] = "tiny file dialogs on UNIX needs:\n\tapplescript\
|
||||
\nor\tzenity (version 3 for the color chooser)\
|
||||
\nor\tmatedialog\nor\tkdialog\
|
||||
@ -166,10 +169,13 @@ static char gMessageUnix[] = "tiny file dialogs on UNIX needs:\n\tapplescript\
|
||||
\nor\tdialog (opens a console if needed)\
|
||||
\nor\twhiptail, gdialog, gxmessage or xmessage (really?)\
|
||||
\nor\tit will open a console (if needed) for basic input (you had it comming!)";
|
||||
#endif
|
||||
|
||||
static char gMessageWin[] = "tiny file dialogs on Windows needs:\n\t\
|
||||
a graphic display\nor\tdialog.exe (enhanced console mode)\
|
||||
\nor\ta console for basic input";
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4996) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#pragma warning(disable:4100) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#pragma warning(disable:4706) /* allows usage of strncpy, strcpy, strcat, sprintf, fopen */
|
||||
#endif
|
||||
|
||||
static char * getPathWithoutFinalSlash(
|
||||
char * const aoDestination, /* make sure it is allocated, use _MAX_PATH */
|
||||
@ -276,8 +282,12 @@ static void RGB2Hex( unsigned char const aRGB [3] ,
|
||||
{
|
||||
if ( aRGB )
|
||||
{
|
||||
sprintf(aoResultHexRGB,"#%02hhx%02hhx%02hhx",
|
||||
aRGB[0],aRGB[1],aRGB[2]);
|
||||
#if defined(__GNUC__) && defined(_WIN32)
|
||||
sprintf(aoResultHexRGB, "#%02hx%02hx%02hx",
|
||||
#else
|
||||
sprintf(aoResultHexRGB, "#%02hhx%02hhx%02hhx",
|
||||
#endif
|
||||
aRGB[0], aRGB[1], aRGB[2]);
|
||||
/* printf("aoResultHexRGB %s\n", aoResultHexRGB); //*/
|
||||
}
|
||||
else
|
||||
@ -610,7 +620,7 @@ static char * utf16to8(wchar_t const * const aUtf16string)
|
||||
}
|
||||
|
||||
|
||||
static DWORD const runSilentA(char const * const aString)
|
||||
static void runSilentA(char const * const aString)
|
||||
{
|
||||
STARTUPINFOA StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInfo;
|
||||
@ -652,7 +662,7 @@ static DWORD const runSilentA(char const * const aString)
|
||||
&StartupInfo, &ProcessInfo))
|
||||
{
|
||||
free(lArgs);
|
||||
return GetLastError();
|
||||
return; /* GetLastError(); */
|
||||
}
|
||||
|
||||
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
|
||||
@ -663,11 +673,11 @@ static DWORD const runSilentA(char const * const aString)
|
||||
CloseHandle(ProcessInfo.hProcess);
|
||||
|
||||
free(lArgs);
|
||||
return rc;
|
||||
return; /* rc */
|
||||
}
|
||||
|
||||
|
||||
static DWORD const runSilentW(wchar_t const * const aString)
|
||||
static void runSilentW(wchar_t const * const aString)
|
||||
{
|
||||
STARTUPINFOW StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInfo;
|
||||
@ -710,7 +720,7 @@ static DWORD const runSilentW(wchar_t const * const aString)
|
||||
&StartupInfo, &ProcessInfo))
|
||||
{
|
||||
free(lArgs);
|
||||
return GetLastError();
|
||||
return; /* GetLastError(); */
|
||||
}
|
||||
|
||||
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
|
||||
@ -723,7 +733,7 @@ static DWORD const runSilentW(wchar_t const * const aString)
|
||||
CloseHandle(ProcessInfo.hProcess);
|
||||
|
||||
free(lArgs);
|
||||
return rc;
|
||||
return; /* rc */
|
||||
}
|
||||
|
||||
|
||||
@ -837,7 +847,6 @@ static char const * inputBoxWinGui(
|
||||
|
||||
#ifndef TINYFD_NOLIB
|
||||
wchar_t * lDialogStringW;
|
||||
DWORD lDword;
|
||||
#endif
|
||||
|
||||
lTitleLen = aTitle ? strlen(aTitle) : 0 ;
|
||||
@ -1013,12 +1022,12 @@ name = 'txt_input' style = 'font-size: 11px;' value = '' ><BR>\n\
|
||||
if (tinyfd_winUtf8)
|
||||
{
|
||||
lDialogStringW = utf8to16(lDialogString);
|
||||
lDword = runSilentW(lDialogStringW);
|
||||
runSilentW(lDialogStringW);
|
||||
free(lDialogStringW);
|
||||
}
|
||||
else
|
||||
{
|
||||
lDword = runSilentA(lDialogString);
|
||||
runSilentA(lDialogString);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3323,7 +3332,7 @@ int tinyfd_messageBox (
|
||||
strcat ( lDialogString , "information" ) ;
|
||||
}
|
||||
}
|
||||
strcat ( lDialogString , ";if [$? = 0];then echo 1;else echo 0;fi");
|
||||
strcat ( lDialogString , ";if [ $? = 0 ];then echo 1;else echo 0;fi");
|
||||
}
|
||||
else if ( kdialogPresent() )
|
||||
{
|
||||
@ -3369,7 +3378,7 @@ int tinyfd_messageBox (
|
||||
strcat(lDialogString, aTitle) ;
|
||||
strcat(lDialogString, "\"") ;
|
||||
}
|
||||
strcat ( lDialogString , ";if [$? = 0];then echo 1;else echo 0;fi");
|
||||
strcat ( lDialogString , ";if [ $? = 0 ];then echo 1;else echo 0;fi");
|
||||
}
|
||||
else if ( ! xdialogPresent() && tkinter2Present ( ) )
|
||||
{
|
||||
@ -3609,11 +3618,11 @@ else :\n\tprint 1\n\"" ) ;
|
||||
if ( lWasGraphicDialog )
|
||||
{
|
||||
strcat(lDialogString,
|
||||
"\" 10 60 ) 2>&1;if [$? = 0];then echo 1;else echo 0;fi");
|
||||
"\" 10 60 ) 2>&1;if [ $? = 0 ];then echo 1;else echo 0;fi");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(lDialogString, "\" 10 60 >/dev/tty) 2>&1;if [$? = 0];");
|
||||
strcat(lDialogString, "\" 10 60 >/dev/tty) 2>&1;if [ $? = 0 ];");
|
||||
if ( lWasXterm )
|
||||
{
|
||||
strcat ( lDialogString ,
|
||||
@ -3879,7 +3888,7 @@ char const * tinyfd_inputBox(
|
||||
strcat(lDialogString, " --hide-text") ;
|
||||
}
|
||||
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 ( kdialogPresent() )
|
||||
{
|
||||
@ -3912,7 +3921,7 @@ 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 ( ! xdialogPresent() && tkinter2Present ( ) )
|
||||
{
|
||||
@ -4074,14 +4083,14 @@ frontmost of process \\\"Python\\\" to true' ''');");
|
||||
if ( lWasGraphicDialog )
|
||||
{
|
||||
strcat(lDialogString,") 2>/tmp/tinyfd.txt;\
|
||||
if [$? = 0];then tinyfdBool=1;else tinyfdBool=0;fi;\
|
||||
if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
|
||||
tinyfdRes=$(cat /tmp/tinyfd.txt);\
|
||||
rm /tmp/tinyfd.txt;echo $tinyfdBool$tinyfdRes") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(lDialogString,">/dev/tty ) 2>/tmp/tinyfd.txt;\
|
||||
if [$? = 0];then tinyfdBool=1;else tinyfdBool=0;fi;\
|
||||
if [ $? = 0 ];then tinyfdBool=1;else tinyfdBool=0;fi;\
|
||||
tinyfdRes=$(cat /tmp/tinyfd.txt);\
|
||||
rm /tmp/tinyfd.txt;echo $tinyfdBool$tinyfdRes") ;
|
||||
if ( lWasXterm )
|
||||
@ -5447,7 +5456,7 @@ char const * tinyfd_arrayDialog (
|
||||
|
||||
|
||||
/*
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
char const * lTmp;
|
||||
char const * lTheSaveFileName;
|
||||
@ -5598,10 +5607,12 @@ if (!lTheHexColor)
|
||||
|
||||
tinyfd_messageBox("The selected hexcolor is",
|
||||
lTheHexColor, "ok", "info", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4996)
|
||||
#pragma warning(default:4100)
|
||||
#pragma warning(default:4706)
|
||||
|
7
tools/rGuiStyler/external/tinyfiledialogs.h
vendored
7
tools/rGuiStyler/external/tinyfiledialogs.h
vendored
@ -1,10 +1,10 @@
|
||||
/*
|
||||
_________
|
||||
/ \ tinyfiledialogs.h v2.5.6 [August 6, 2016] zlib licence
|
||||
/ \ tinyfiledialogs.h v2.5.8 [September 13, 2016] zlib licence
|
||||
|tiny file| Unique header file of "tiny file dialogs" created [November 9, 2014]
|
||||
| dialogs | Copyright (c) 2014 - 2016 Guillaume Vareille http://ysengrin.com
|
||||
\____ ___/ http://tinyfiledialogs.sourceforge.net
|
||||
\| mailto:tinfyfiledialogs@ysengrin.com
|
||||
\| mailto:tinyfiledialogs@ysengrin.com
|
||||
|
||||
A big thank you to Don Heyse http://ldglite.sf.net for
|
||||
his code contributions, bug corrections & thorough testing!
|
||||
@ -39,7 +39,7 @@ NO MAIN LOOP
|
||||
|
||||
The dialogs can be forced into console mode
|
||||
|
||||
Windows [UTF-8 + UTF-16]
|
||||
Windows [MBCS + UTF-8 + UTF-16]
|
||||
- native code & some vbs create the graphic dialogs
|
||||
- enhanced console mode can use dialog.exe from
|
||||
http://andrear.altervista.org/home/cdialog.php
|
||||
@ -100,6 +100,7 @@ extern "C" {
|
||||
extern char tinyfd_version[8]; /* contains tinyfd current version number */
|
||||
|
||||
#ifdef _WIN32
|
||||
/* tinyfd_winUtf8 is not ready yet, do not modify */
|
||||
extern int tinyfd_winUtf8; /* 0 (default) or 1 */
|
||||
/* on windows string char can be 0:MBSC or 1:UTF-8 (work in progress)
|
||||
unless your code is really prepared for it, leave this on MBSC.
|
||||
|
@ -293,15 +293,13 @@ int main()
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsFileDropped())
|
||||
{
|
||||
/*
|
||||
guiPropertySelected = -1;
|
||||
droppedFiles = GetDroppedFiles(&count);
|
||||
fileName = droppedFiles[0];
|
||||
//fileName = droppedFiles[0];
|
||||
|
||||
//BtnLoadStyle();
|
||||
|
||||
//ClearDroppedFiles();
|
||||
*/
|
||||
ClearDroppedFiles();
|
||||
}
|
||||
|
||||
if (guiElementSelected == PROGRESSBAR)
|
||||
@ -310,6 +308,8 @@ int main()
|
||||
progressValue += 0.005f;
|
||||
}
|
||||
|
||||
// NOTE: REVIEW!!! -> CRASHES APP... (ironically, in MSVC works perfectly)
|
||||
/*
|
||||
for (int i = 0; i < NUM_ELEMENTS; i++)
|
||||
{
|
||||
if (CheckCollisionPointRec(GetMousePosition(), guiElementRec[i]))
|
||||
@ -457,7 +457,7 @@ int main()
|
||||
bgColor = GetColor(GetStyleProperty(BACKGROUND_COLOR));
|
||||
SetStyleProperty(guiPropertySelected, GetHexValue(colorPickerValue));
|
||||
}
|
||||
|
||||
*/
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
Loading…
x
Reference in New Issue
Block a user