Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/C++/g_unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,19 +535,30 @@ extern "C" LV_DLL_EXPORT gu_result gu_is_text_utf8(const char* str, int32_t* is_
// Dialog API //
////////////////

extern "C" LV_DLL_EXPORT gu_result gu_open_file_dialog(const char* title, const char* default_path, int32_t num_filter_patterns, const char** filter_patterns, const char* filter_description, int32_t allow_multi_select, int32_t* cancelled, intptr_t* path_pointer, int32_t* path_length, intptr_t* paths_pointer, int32_t* num_paths)
extern "C" LV_DLL_EXPORT gu_result gu_open_file_dialog(const char* title, const char* default_path, int32_t num_filter_patterns, const char* filter_patterns, const char* filter_description, int32_t allow_multi_select, int32_t* cancelled, intptr_t* path_pointer, int32_t* path_length, intptr_t* paths_pointer, int32_t* num_paths)
{
*path_length = 0;
*path_pointer = 0;
*paths_pointer = 0;
*num_paths = 0;
*cancelled = 0;

std::string _title = (strlen(title) > 0) ? title : "Choose or Enter Path of Folder";
std::string _title = (strlen(title) > 0) ? title : "Choose or Enter Path of File";
std::string _default_path = (strlen(default_path) > 0) ? default_path : pfd::path::home();
pfd::opt _option = allow_multi_select ? pfd::opt::multiselect : pfd::opt::none;

auto selection = pfd::open_file(_title, _default_path, { "All Files (*.*)", "*" }, _option).result();
std::vector<std::string> filters = { "All Files (*.*)", "*" }; // Valeur par d�faut des filtres
std::string filter_patterns_str(filter_patterns);
std::string filter_description_str(filter_description);

if (!filter_patterns_str.empty()) {
filters.clear(); // Clear default filters if specific filters are provided

filters.push_back(filter_description_str);
filters.push_back(filter_patterns_str);
}

auto selection = pfd::open_file(_title, _default_path, filters, _option).result();

// User cancelled the dialog
if (selection.size() == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/C++/g_unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extern "C" LV_DLL_EXPORT gu_result gu_is_text_utf8(const char* str, int32_t* is_
////////////////
// Dialog API //
////////////////
extern "C" LV_DLL_EXPORT gu_result gu_open_file_dialog(const char* title, const char* default_path, int32_t num_filter_patterns, const char** filter_patterns, const char* filter_description, int32_t allow_multi_select, int32_t* cancelled, intptr_t* path_pointer, int32_t* path_length, intptr_t* paths_pointer, int32_t* num_paths);
extern "C" LV_DLL_EXPORT gu_result gu_open_file_dialog(const char* title, const char* default_path, int32_t num_filter_patterns, const char* filter_patterns, const char* filter_description, int32_t allow_multi_select, int32_t* cancelled, intptr_t* path_pointer, int32_t* path_length, intptr_t* paths_pointer, int32_t* num_paths);
extern "C" LV_DLL_EXPORT gu_result gu_select_folder_dialog(const char* title, const char* default_path, int32_t* cancelled, intptr_t* path_pointer, int32_t* path_length);
extern "C" LV_DLL_EXPORT gu_result gu_message_box(const char* title, const char* message, int32_t choice, int32_t icon, int32_t* user_selection);
extern "C" LV_DLL_EXPORT gu_result gu_input_box(const char* title, const char* message, const char* default_input, intptr_t* input_pointer, int32_t* input_size);
Expand Down
196 changes: 98 additions & 98 deletions src/C++/g_unicode.rc
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,3,0,0
PRODUCTVERSION 0,3,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "G-Unicode"
VALUE "FileVersion", "0.3.0.0"
VALUE "InternalName", "g_unicode.dll"
VALUE "OriginalFilename", "g_unicode.dll"
VALUE "ProductName", "G-Unicode"
VALUE "ProductVersion", "0.3.0.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Anglais (�tats-Unis) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,3,0,1
PRODUCTVERSION 0,3,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "G-Unicode"
VALUE "FileVersion", "0.3.0.1"
VALUE "InternalName", "g_unicode.dll"
VALUE "OriginalFilename", "g_unicode.dll"
VALUE "ProductName", "G-Unicode"
VALUE "ProductVersion", "0.3.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // Anglais (�tats-Unis) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
4 changes: 3 additions & 1 deletion src/LabVIEW/G-Unicode.lvproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<Item Name="Examples" Type="Folder">
<Item Name="Tree Browser.lvlib" Type="Library" URL="../G-Unicode/Examples/Tree Browser/Tree Browser.lvlib"/>
<Item Name="Unicode Input Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Input Example.vi"/>
<Item Name="Unicode List Folder Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode List Folder Example.vi"/>
<Item Name="Unicode Path With LabVIEW File IO Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Path With LabVIEW File IO Example.vi"/>
<Item Name="Unicode Picture Control Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Picture Control Example.vi"/>
<Item Name="Unicode Read Text File Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Read Text File Example.vi"/>
Expand All @@ -79,6 +78,7 @@
<Item Name="Unicode Tree File Browser Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Tree File Browser Example.vi"/>
<Item Name="Unicode Tab Page Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Tab Page Example.vi"/>
<Item Name="Unicode Write Text File Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Write Text File Example.vi"/>
<Item Name="Unicode Open File With Filters.vi" Type="VI" URL="../G-Unicode/Examples/Unicode Open File With Filters.vi"/>
</Item>
<Item Name="QuickDrop Plugins" Type="Folder">
<Item Name="G-Unicode UTF-8 Class Editor.vi" Type="VI" URL="../G-Unicode/QuickDrop Plugins/G-Unicode UTF-8 Class Editor.vi"/>
Expand Down Expand Up @@ -165,6 +165,8 @@
<Item Name="user32.dll" Type="Document" URL="user32.dll">
<Property Name="NI.PreserveRelativePath" Type="Bool">true</Property>
</Item>
<Item Name="g_unicode_64.dll" Type="Document" URL="../G-Unicode/lib/g_unicode_64.dll"/>
<Item Name="Unicode List Folder Example.vi" Type="VI" URL="../G-Unicode/Examples/Unicode List Folder Example.vi"/>
</Item>
<Item Name="Build Specifications" Type="Build"/>
</Item>
Expand Down
Binary file not shown.
Binary file modified src/LabVIEW/G-Unicode/File IO/File Dialog (Unicode).vim
Binary file not shown.
Binary file modified src/LabVIEW/G-Unicode/Private/Library/gu_open_file_dialog.vi
Binary file not shown.
Binary file modified src/LabVIEW/G-Unicode/lib/g_unicode_32.dll
Binary file not shown.
Binary file modified src/LabVIEW/G-Unicode/lib/g_unicode_64.dll
Binary file not shown.