2019-02-25 16:52:53 +00:00
|
|
|
/*
|
|
|
|
Copyright 2019 flyinghead
|
|
|
|
|
|
|
|
This file is part of reicast.
|
|
|
|
|
|
|
|
reicast is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
reicast is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with reicast. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "gui_util.h"
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
2019-09-07 12:37:39 +00:00
|
|
|
#include <cstdlib>
|
2019-02-25 16:52:53 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
#include "stdclass.h"
|
2021-01-19 10:11:01 +00:00
|
|
|
#include "oslib/directory.h"
|
2019-02-25 16:52:53 +00:00
|
|
|
#include "imgui/imgui.h"
|
2020-11-25 12:54:27 +00:00
|
|
|
#include "imgui/imgui_internal.h"
|
2021-06-07 10:18:05 +00:00
|
|
|
#include "hw/maple/maple_devs.h"
|
2019-02-25 16:52:53 +00:00
|
|
|
|
|
|
|
static std::string select_current_directory;
|
2021-04-06 09:41:04 +00:00
|
|
|
static std::vector<std::string> subfolders;
|
|
|
|
static std::vector<std::string> folderFiles;
|
2019-03-27 20:09:53 +00:00
|
|
|
bool subfolders_read;
|
2019-02-25 16:52:53 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
static const std::string separators = "/\\";
|
|
|
|
static const std::string native_separator = "\\";
|
|
|
|
#else
|
|
|
|
static const std::string separators = "/";
|
|
|
|
static const std::string native_separator = "/";
|
|
|
|
#endif
|
2019-03-04 20:49:36 +00:00
|
|
|
#define PSEUDO_ROOT ":"
|
2019-02-25 16:52:53 +00:00
|
|
|
|
2021-06-07 10:18:05 +00:00
|
|
|
extern int insetLeft, insetRight, insetTop, insetBottom;
|
|
|
|
|
2021-04-06 09:41:04 +00:00
|
|
|
void select_file_popup(const char *prompt, StringCallback callback,
|
|
|
|
bool selectFile, const std::string& selectExtension)
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
|
|
|
if (select_current_directory.empty())
|
|
|
|
{
|
2019-08-25 16:38:36 +00:00
|
|
|
#if defined(__ANDROID__)
|
2021-01-19 10:11:01 +00:00
|
|
|
const char *home = nowide::getenv("REICAST_HOME");
|
2019-02-25 16:52:53 +00:00
|
|
|
if (home != NULL)
|
2019-03-04 20:49:36 +00:00
|
|
|
{
|
|
|
|
const char *pcolon = strchr(home, ':');
|
|
|
|
if (pcolon != NULL)
|
|
|
|
select_current_directory = std::string(home, pcolon - home);
|
|
|
|
else
|
|
|
|
select_current_directory = home;
|
|
|
|
}
|
2021-03-13 10:37:13 +00:00
|
|
|
#elif defined(__unix__) || defined(__APPLE__)
|
2021-01-19 10:11:01 +00:00
|
|
|
const char *home = nowide::getenv("HOME");
|
2019-02-25 16:52:53 +00:00
|
|
|
if (home != NULL)
|
|
|
|
select_current_directory = home;
|
2019-08-25 17:29:56 +00:00
|
|
|
#elif defined(_WIN32)
|
2021-01-19 10:11:01 +00:00
|
|
|
if (nowide::getenv("HOMEPATH") != NULL)
|
2019-02-25 18:15:59 +00:00
|
|
|
{
|
2021-01-19 10:11:01 +00:00
|
|
|
const char *home_drive = nowide::getenv("HOMEDRIVE");
|
2019-02-25 18:15:59 +00:00
|
|
|
if (home_drive != NULL)
|
|
|
|
select_current_directory = home_drive;
|
2021-01-19 10:11:01 +00:00
|
|
|
select_current_directory += nowide::getenv("HOMEPATH");
|
2019-02-25 18:15:59 +00:00
|
|
|
}
|
2021-07-14 18:55:22 +00:00
|
|
|
#elif defined(__SWITCH__)
|
|
|
|
select_current_directory = "/";
|
2019-02-25 16:52:53 +00:00
|
|
|
#endif
|
|
|
|
if (select_current_directory.empty())
|
|
|
|
{
|
|
|
|
select_current_directory = get_writable_config_path("");
|
|
|
|
if (select_current_directory.empty())
|
|
|
|
select_current_directory = ".";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-07 10:18:05 +00:00
|
|
|
fullScreenWindow(true);
|
2019-02-25 16:52:53 +00:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
|
|
|
|
|
|
|
|
if (ImGui::BeginPopupModal(prompt, NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize ))
|
|
|
|
{
|
|
|
|
std::string path = select_current_directory;
|
2020-11-25 12:54:27 +00:00
|
|
|
std::string::size_type last_sep = path.find_last_of(separators);
|
2019-02-25 16:52:53 +00:00
|
|
|
if (last_sep == path.size() - 1)
|
|
|
|
path.pop_back();
|
|
|
|
|
|
|
|
static std::string error_message;
|
|
|
|
|
|
|
|
if (!subfolders_read)
|
|
|
|
{
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.clear();
|
|
|
|
folderFiles.clear();
|
2019-02-25 16:52:53 +00:00
|
|
|
error_message.clear();
|
|
|
|
#ifdef _WIN32
|
2019-03-04 20:49:36 +00:00
|
|
|
if (select_current_directory == PSEUDO_ROOT)
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
2019-02-25 18:15:59 +00:00
|
|
|
error_message = "Drives";
|
2019-02-25 16:52:53 +00:00
|
|
|
// List all the drives
|
|
|
|
u32 drives = GetLogicalDrives();
|
|
|
|
for (int i = 0; i < 32; i++)
|
|
|
|
if ((drives & (1 << i)) != 0)
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.push_back(std::string(1, (char)('A' + i)) + ":\\");
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
|
|
|
else
|
2019-08-25 16:38:36 +00:00
|
|
|
#elif __ANDROID__
|
2019-03-04 20:49:36 +00:00
|
|
|
if (select_current_directory == PSEUDO_ROOT)
|
|
|
|
{
|
|
|
|
error_message = "Storage Locations";
|
2021-01-19 15:58:26 +00:00
|
|
|
const char *home = nowide::getenv("REICAST_HOME");
|
2019-03-04 20:49:36 +00:00
|
|
|
while (home != NULL)
|
|
|
|
{
|
|
|
|
const char *pcolon = strchr(home, ':');
|
|
|
|
if (pcolon != NULL)
|
|
|
|
{
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.push_back(std::string(home, pcolon - home));
|
2019-03-04 20:49:36 +00:00
|
|
|
home = pcolon + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.push_back(home);
|
2019-03-04 20:49:36 +00:00
|
|
|
home = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2019-02-25 16:52:53 +00:00
|
|
|
#endif
|
|
|
|
{
|
2021-01-19 10:11:01 +00:00
|
|
|
DIR *dir = flycast::opendir(select_current_directory.c_str());
|
2019-02-25 16:52:53 +00:00
|
|
|
if (dir == NULL)
|
|
|
|
{
|
|
|
|
error_message = "Cannot read " + select_current_directory;
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.emplace_back("..");
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bool dotdot_seen = false;
|
|
|
|
while (true)
|
|
|
|
{
|
2021-01-19 10:11:01 +00:00
|
|
|
struct dirent *entry = flycast::readdir(dir);
|
2019-02-25 16:52:53 +00:00
|
|
|
if (entry == NULL)
|
|
|
|
break;
|
2019-10-06 08:58:44 +00:00
|
|
|
std::string name(entry->d_name);
|
2021-02-01 11:40:52 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
extern std::string os_PrecomposedString(std::string string);
|
|
|
|
name = os_PrecomposedString(name);
|
|
|
|
#endif
|
2019-02-25 16:52:53 +00:00
|
|
|
if (name == ".")
|
|
|
|
continue;
|
|
|
|
std::string child_path = path + "/" + name;
|
2019-02-25 18:15:59 +00:00
|
|
|
bool is_dir = false;
|
|
|
|
#ifndef _WIN32
|
|
|
|
if (entry->d_type == DT_DIR)
|
|
|
|
is_dir = true;
|
2019-02-25 16:52:53 +00:00
|
|
|
if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK)
|
2019-02-25 18:15:59 +00:00
|
|
|
#endif
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
|
|
|
struct stat st;
|
2021-01-19 10:11:01 +00:00
|
|
|
if (flycast::stat(child_path.c_str(), &st) != 0)
|
2019-02-25 16:52:53 +00:00
|
|
|
continue;
|
|
|
|
if (S_ISDIR(st.st_mode))
|
2019-02-25 18:15:59 +00:00
|
|
|
is_dir = true;
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
2021-01-19 10:11:01 +00:00
|
|
|
if (is_dir && flycast::access(child_path.c_str(), R_OK) == 0)
|
2019-03-04 20:49:36 +00:00
|
|
|
{
|
|
|
|
if (name == "..")
|
|
|
|
dotdot_seen = true;
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.push_back(name);
|
2019-03-04 20:49:36 +00:00
|
|
|
}
|
2020-11-03 21:41:05 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string extension = get_file_extension(name);
|
2021-04-06 09:41:04 +00:00
|
|
|
if (selectFile)
|
|
|
|
{
|
|
|
|
if (extension == selectExtension)
|
|
|
|
folderFiles.push_back(name);
|
|
|
|
}
|
|
|
|
else if (extension == "zip" || extension == "7z" || extension == "chd"
|
|
|
|
|| extension == "gdi" || extension == "cdi" || extension == "cue"
|
|
|
|
|| (!config::HideLegacyNaomiRoms
|
|
|
|
&& (extension == "bin" || extension == "lst" || extension == "dat")))
|
|
|
|
folderFiles.push_back(name);
|
2020-11-03 21:41:05 +00:00
|
|
|
}
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
2021-01-19 10:11:01 +00:00
|
|
|
flycast::closedir(dir);
|
2021-07-14 18:55:22 +00:00
|
|
|
#if defined(_WIN32) || defined(__ANDROID__) || defined(__SWITCH__)
|
2019-02-25 16:52:53 +00:00
|
|
|
if (!dotdot_seen)
|
2021-04-06 09:41:04 +00:00
|
|
|
subfolders.emplace_back("..");
|
|
|
|
#else
|
|
|
|
(void)dotdot_seen;
|
2019-02-25 16:52:53 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-06 09:41:04 +00:00
|
|
|
std::stable_sort(subfolders.begin(), subfolders.end());
|
|
|
|
std::stable_sort(folderFiles.begin(), folderFiles.end());
|
2019-02-25 16:52:53 +00:00
|
|
|
subfolders_read = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Text("%s", error_message.empty() ? select_current_directory.c_str() : error_message.c_str());
|
2021-04-06 09:41:04 +00:00
|
|
|
ImGui::BeginChild(ImGui::GetID("dir_list"), ImVec2(0, - 30 * gui_get_scaling() - ImGui::GetStyle().ItemSpacing.y), true);
|
2019-02-25 16:52:53 +00:00
|
|
|
|
2021-04-06 09:41:04 +00:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(8 * gui_get_scaling(), 20 * gui_get_scaling())); // from 8, 4
|
2019-02-25 16:52:53 +00:00
|
|
|
|
|
|
|
|
2021-04-06 09:41:04 +00:00
|
|
|
for (const auto& name : subfolders)
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
|
|
|
std::string child_path;
|
|
|
|
if (name == "..")
|
|
|
|
{
|
|
|
|
std::string::size_type last_sep = path.find_last_of(separators);
|
|
|
|
if (last_sep == std::string::npos)
|
|
|
|
{
|
|
|
|
if (path.empty())
|
|
|
|
// Root folder
|
|
|
|
continue;
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (path.size() == 2 && path[1] == ':')
|
2019-03-04 20:49:36 +00:00
|
|
|
child_path = PSEUDO_ROOT;
|
2019-02-25 16:52:53 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (path == ".")
|
|
|
|
child_path = "..";
|
|
|
|
else if (path == "..")
|
|
|
|
child_path = ".." + native_separator + "..";
|
|
|
|
else
|
|
|
|
child_path = ".";
|
|
|
|
}
|
|
|
|
else if (last_sep == 0)
|
|
|
|
child_path = native_separator;
|
|
|
|
else if (path.size() >= 2 && path.substr(path.size() - 2) == "..")
|
|
|
|
child_path = path + native_separator + "..";
|
|
|
|
else
|
2019-02-25 18:15:59 +00:00
|
|
|
{
|
2019-02-25 16:52:53 +00:00
|
|
|
child_path = path.substr(0, last_sep);
|
2019-02-25 18:15:59 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (child_path.size() == 2 && child_path[1] == ':') // C: -> C:/
|
|
|
|
child_path += native_separator;
|
|
|
|
#endif
|
|
|
|
}
|
2019-08-25 16:38:36 +00:00
|
|
|
#ifdef __ANDROID__
|
2019-03-04 20:49:36 +00:00
|
|
|
if (access(child_path.c_str(), R_OK) != 0)
|
|
|
|
child_path = PSEUDO_ROOT;
|
|
|
|
#endif
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-25 16:38:36 +00:00
|
|
|
#if defined(_WIN32) || defined(__ANDROID__)
|
2019-03-04 20:49:36 +00:00
|
|
|
if (path == PSEUDO_ROOT)
|
2019-02-25 18:15:59 +00:00
|
|
|
child_path = name;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
child_path = path + native_separator + name;
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
|
|
|
if (ImGui::Selectable(name.c_str()))
|
|
|
|
{
|
|
|
|
subfolders_read = false;
|
|
|
|
select_current_directory = child_path;
|
|
|
|
}
|
|
|
|
}
|
2021-04-06 09:41:04 +00:00
|
|
|
ImGui::PushStyleColor(ImGuiCol_Text, { 1, 1, 1, selectFile ? 1.f : 0.3f });
|
|
|
|
for (const auto& name : folderFiles)
|
2020-11-03 21:41:05 +00:00
|
|
|
{
|
2021-04-06 09:41:04 +00:00
|
|
|
if (selectFile)
|
|
|
|
{
|
|
|
|
if (ImGui::Selectable(name.c_str()))
|
|
|
|
{
|
|
|
|
subfolders_read = false;
|
|
|
|
callback(false, select_current_directory + native_separator + name);
|
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ImGui::Text("%s", name.c_str());
|
|
|
|
}
|
2020-11-03 21:41:05 +00:00
|
|
|
}
|
|
|
|
ImGui::PopStyleColor();
|
|
|
|
|
2021-06-07 10:18:05 +00:00
|
|
|
scrollWhenDraggingOnVoid();
|
|
|
|
windowDragScroll();
|
|
|
|
|
2019-02-25 16:52:53 +00:00
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::EndChild();
|
2021-04-06 09:41:04 +00:00
|
|
|
if (!selectFile)
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
2021-04-06 09:41:04 +00:00
|
|
|
if (ImGui::Button("Select Current Directory", ImVec2(0, 30 * gui_get_scaling())))
|
|
|
|
{
|
|
|
|
subfolders_read = false;
|
|
|
|
callback(false, select_current_directory);
|
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2019-02-25 16:52:53 +00:00
|
|
|
}
|
2021-04-06 09:41:04 +00:00
|
|
|
if (ImGui::Button("Cancel", ImVec2(0, 30 * gui_get_scaling())))
|
2019-02-25 16:52:53 +00:00
|
|
|
{
|
|
|
|
subfolders_read = false;
|
|
|
|
callback(true, "");
|
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndPopup();
|
|
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
2020-11-25 12:54:27 +00:00
|
|
|
|
|
|
|
// See https://github.com/ocornut/imgui/issues/3379
|
2021-06-07 10:18:05 +00:00
|
|
|
void scrollWhenDraggingOnVoid(ImGuiMouseButton mouse_button)
|
2020-11-25 12:54:27 +00:00
|
|
|
{
|
|
|
|
ImGuiContext& g = *ImGui::GetCurrentContext();
|
|
|
|
ImGuiWindow* window = g.CurrentWindow;
|
2021-06-07 10:18:05 +00:00
|
|
|
while ((window->Flags & ImGuiWindowFlags_ChildWindow) && window->ScrollMax.x == 0.0f && window->ScrollMax.y == 0.0f)
|
|
|
|
window = window->ParentWindow;
|
2020-11-25 12:54:27 +00:00
|
|
|
bool hovered = false;
|
|
|
|
bool held = false;
|
2021-06-04 09:11:23 +00:00
|
|
|
ImGuiButtonFlags button_flags = (mouse_button == ImGuiMouseButton_Left) ? ImGuiButtonFlags_MouseButtonLeft
|
|
|
|
: (mouse_button == ImGuiMouseButton_Right) ? ImGuiButtonFlags_MouseButtonRight : ImGuiButtonFlags_MouseButtonMiddle;
|
2020-11-25 12:54:27 +00:00
|
|
|
if (g.HoveredId == 0) // If nothing hovered so far in the frame (not same as IsAnyItemHovered()!)
|
|
|
|
ImGui::ButtonBehavior(window->Rect(), window->GetID("##scrolldraggingoverlay"), &hovered, &held, button_flags);
|
2021-06-07 10:18:05 +00:00
|
|
|
const ImVec2& delta = ImGui::GetIO().MouseDelta;
|
|
|
|
if (held && delta != ImVec2())
|
|
|
|
{
|
|
|
|
window->DragScrolling = true;
|
|
|
|
window->ScrollSpeed = delta;
|
|
|
|
}
|
2020-11-25 12:54:27 +00:00
|
|
|
}
|
2021-02-01 11:38:29 +00:00
|
|
|
|
|
|
|
static void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short* accumulative_offsets, int accumulative_offsets_count, ImWchar* out_ranges)
|
|
|
|
{
|
|
|
|
for (int n = 0; n < accumulative_offsets_count; n++, out_ranges += 2)
|
|
|
|
{
|
|
|
|
out_ranges[0] = out_ranges[1] = (ImWchar)(base_codepoint + accumulative_offsets[n]);
|
|
|
|
base_codepoint += accumulative_offsets[n];
|
|
|
|
}
|
|
|
|
out_ranges[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ImWchar* GetGlyphRangesChineseSimplifiedOfficial()
|
|
|
|
{
|
|
|
|
// Store all official characters for Simplified Chinese.
|
|
|
|
// Sourced from https://en.wikipedia.org/wiki/Table_of_General_Standard_Chinese_Characters
|
|
|
|
// (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.)
|
|
|
|
static const short accumulative_offsets_from_0x4E00[] =
|
|
|
|
{
|
|
|
|
0,1,2,4,1,1,1,1,2,1,1,1,1,2,1,1,1,2,1,1,1,1,1,1,4,2,1,2,3,1,2,3,2,2,4,1,1,1,2,1,4,1,2,3,1,2,1,1,1,1,1,2,1,1,2,2,1,3,1,1,1,1,1,5,3,7,1,2,5,6,
|
|
|
|
8,2,1,2,1,1,1,1,2,1,1,1,1,3,2,1,4,2,1,2,1,1,1,1,1,2,1,1,1,4,1,2,1,2,1,1,5,1,1,1,1,1,1,1,1,2,1,1,2,1,3,2,1,1,1,1,1,1,4,1,1,2,2,1,1,3,2,1,1,
|
|
|
|
4,2,1,2,1,1,4,2,2,2,7,1,1,1,2,1,1,1,1,6,1,1,1,1,3,1,1,2,1,1,1,1,1,3,1,2,2,1,2,2,2,2,2,2,1,1,3,2,3,7,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,3,1,
|
|
|
|
1,4,3,3,1,3,1,2,2,2,1,1,1,1,1,2,1,1,1,4,1,2,2,2,2,3,3,1,3,2,3,3,2,1,1,1,1,1,2,2,1,5,1,4,6,4,1,1,5,3,1,1,1,1,6,1,1,1,2,1,1,1,2,2,3,2,1,1,1,
|
|
|
|
2,1,1,2,2,2,1,2,2,4,14,1,2,3,1,1,1,3,1,1,2,2,1,2,4,1,1,1,1,1,2,1,1,6,6,1,1,2,3,2,4,1,4,2,1,4,2,5,2,5,4,7,1,3,2,4,1,4,3,1,1,3,2,3,1,4,5,3,
|
|
|
|
14,2,2,1,1,3,6,8,1,12,7,1,5,2,4,12,1,5,1,1,2,3,2,6,11,1,4,7,15,5,13,1,11,1,1,2,1,1,1,2,1,2,2,4,3,1,1,4,2,6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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,
|
|
|
|
1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,315,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,
|
|
|
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,10,1,1,2,5,1,3,6,1,1,3,7,
|
|
|
|
2,7,18,1,2,2,1,6,3,2,4,1,1,2,3,4,3,1,1,2,1,1,1,3,2,2,1,5,10,2,1,2,13,2,1,2,2,1,4,2,7,2,7,2,1,3,2,6,2,2,2,1,3,6,2,7,1,46,1,1,1,1,1,1,1,1,1,
|
|
|
|
1,1,1,1,13,1,1,4,1,2,43,1,1
|
|
|
|
};
|
|
|
|
static ImWchar base_ranges[] = // not zero-terminated
|
|
|
|
{
|
|
|
|
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
|
|
|
0x2000, 0x206F, // General Punctuation
|
|
|
|
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
|
|
|
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
|
|
|
0xFF00, 0xFFEF // Half-width characters
|
|
|
|
};
|
|
|
|
static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 };
|
|
|
|
if (!full_ranges[0])
|
|
|
|
{
|
|
|
|
memcpy(full_ranges, base_ranges, sizeof(base_ranges));
|
|
|
|
UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges));
|
|
|
|
}
|
|
|
|
return &full_ranges[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
const ImWchar* GetGlyphRangesChineseTraditionalOfficial()
|
|
|
|
{
|
|
|
|
// Store all official characters for Traditional Chinese.
|
|
|
|
// Sourced from https://https://en.wikipedia.org/wiki/List_of_Graphemes_of_Commonly-Used_Chinese_Characters
|
|
|
|
// (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.)
|
|
|
|
static const short accumulative_offsets_from_0x4E00[] =
|
|
|
|
{
|
|
|
|
0,1,2,5,1,1,1,2,3,1,3,1,1,2,1,5,1,3,4,5,2,5,6,1,2,8,2,6,2,1,1,3,1,3,2,1,4,1,1,10,10,11,4,4,2,3,1,2,3,1,2,1,4,2,3,1,2,3,1,1,2,3,1,1,1,12,6,1,
|
|
|
|
2,1,2,1,3,1,2,7,1,1,1,1,1,5,1,4,1,1,11,2,1,3,5,1,1,2,2,8,1,3,2,1,1,4,4,22,1,4,2,2,2,2,1,6,3,1,1,5,1,1,1,1,3,1,2,2,2,1,1,1,2,3,6,3,3,1,3,2,6,
|
|
|
|
4,4,3,2,3,2,2,7,5,2,17,1,6,1,9,3,1,1,6,4,1,1,1,6,1,2,3,1,1,1,1,13,1,4,5,2,4,2,6,3,2,1,1,2,2,1,2,2,2,1,1,5,2,2,2,1,2,1,1,1,2,9,6,7,4,2,3,2,1,
|
|
|
|
6,5,2,9,15,1,1,1,6,3,5,8,4,5,2,1,9,10,1,5,1,2,2,4,3,7,10,2,4,1,4,9,2,2,7,3,4,4,2,5,2,2,4,1,7,2,2,4,7,2,9,8,5,5,4,1,2,1,1,1,1,1,1,2,1,1,4,1,2,
|
|
|
|
1,2,5,6,3,2,1,1,2,1,1,1,3,4,1,1,1,4,4,9,1,3,4,1,3,11,2,2,1,7,4,6,1,6,9,5,1,1,15,1,3,1,15,1,2,3,2,1,1,3,3,1,2,3,1,1,2,4,3,1,5,6,7,4,1,1,1,3,2,
|
|
|
|
6,1,1,2,1,6,2,4,3,1,1,1,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62,7,1,7,1,4,19,3,1,1,4,14,7,1,1,12,8,3,
|
|
|
|
7,13,8,3,2,1,9,11,5,1,2,1,10,5,4,2,21,8,26,26,3,27,1,30,21,16,6,18,8,4,10,3,22,2,1,32,1,109,4,10,1,2,16,3,12,6,8,3,2,19,4,18,12,3,1,9,2,6,
|
|
|
|
23,38,5,14,17,4,14,20,1,32,4,87,4,3,1,2,12,7,1,4,6,2,6,4,1,10,7,1,1,1,5,10,1,1,2,3,4,3,1,1,1,2,8,7,5,3,16,1,6,5,2,4,7,12,8,7,3,12,1,7,13,2,
|
|
|
|
2,3,4,2,6,5,22,3,4,8,
|
|
|
|
};
|
|
|
|
static ImWchar base_ranges[] = // not zero-terminated
|
|
|
|
{
|
|
|
|
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
|
|
|
0x2000, 0x206F, // General Punctuation
|
|
|
|
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
|
|
|
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
|
|
|
0xFF00, 0xFFEF // Half-width characters
|
|
|
|
};
|
|
|
|
static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 };
|
|
|
|
if (!full_ranges[0])
|
|
|
|
{
|
|
|
|
memcpy(full_ranges, base_ranges, sizeof(base_ranges));
|
|
|
|
UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges));
|
|
|
|
}
|
|
|
|
return &full_ranges[0];
|
|
|
|
}
|
2021-03-01 09:13:40 +00:00
|
|
|
|
|
|
|
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
|
|
|
void ShowHelpMarker(const char* desc)
|
|
|
|
{
|
|
|
|
ImGui::TextDisabled("(?)");
|
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
{
|
|
|
|
ImGui::BeginTooltip();
|
2021-06-04 09:11:23 +00:00
|
|
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 25.0f);
|
2021-03-01 09:13:40 +00:00
|
|
|
ImGui::TextUnformatted(desc);
|
|
|
|
ImGui::PopTextWrapPos();
|
|
|
|
ImGui::EndTooltip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<bool PerGameOption>
|
|
|
|
bool OptionCheckbox(const char *name, config::Option<bool, PerGameOption>& option, const char *help)
|
|
|
|
{
|
|
|
|
bool b = option;
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
|
|
|
}
|
|
|
|
bool pressed = ImGui::Checkbox(name, &b);
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
if (pressed)
|
|
|
|
option.set(b);
|
|
|
|
if (help != nullptr)
|
|
|
|
{
|
|
|
|
ImGui::SameLine();
|
|
|
|
ShowHelpMarker(help);
|
|
|
|
}
|
|
|
|
return pressed;
|
|
|
|
}
|
|
|
|
template bool OptionCheckbox(const char *name, config::Option<bool, true>& option, const char *help);
|
|
|
|
template bool OptionCheckbox(const char *name, config::Option<bool, false>& option, const char *help);
|
|
|
|
|
|
|
|
bool OptionSlider(const char *name, config::Option<int>& option, int min, int max, const char *help)
|
|
|
|
{
|
|
|
|
int v = option;
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
|
|
|
}
|
|
|
|
bool valueChanged = ImGui::SliderInt(name, &v, min, max);
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
else if (valueChanged)
|
|
|
|
option.set(v);
|
|
|
|
if (help != nullptr)
|
|
|
|
{
|
|
|
|
ImGui::SameLine();
|
|
|
|
ShowHelpMarker(help);
|
|
|
|
}
|
|
|
|
return valueChanged;
|
|
|
|
}
|
|
|
|
|
2021-06-07 10:18:05 +00:00
|
|
|
bool OptionArrowButtons(const char *name, config::Option<int>& option, int min, int max, const char *help)
|
|
|
|
{
|
|
|
|
const float innerSpacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.f, 0.5f)); // Left
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_FrameBg]);
|
|
|
|
float width = ImGui::CalcItemWidth() - innerSpacing * 2.0f - ImGui::GetFrameHeight() * 2.0f;
|
|
|
|
ImGui::ButtonEx(std::to_string((int)option).c_str(), ImVec2(width, 0), ImGuiButtonFlags_Disabled);
|
|
|
|
ImGui::PopStyleColor();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
ImGui::SameLine(0.0f, innerSpacing);
|
|
|
|
ImGui::PushButtonRepeat(true);
|
|
|
|
bool valueChanged = false;
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
|
|
|
}
|
|
|
|
std::string id = "##" + std::string(name);
|
|
|
|
if (ImGui::ArrowButton((id + "left").c_str(), ImGuiDir_Left)) { option.set(std::max(min, option - 1)); valueChanged = true; }
|
|
|
|
ImGui::SameLine(0.0f, innerSpacing);
|
|
|
|
if (ImGui::ArrowButton((id + "right").c_str(), ImGuiDir_Right)) { option.set(std::min(max, option + 1)); valueChanged = true; }
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
ImGui::PopButtonRepeat();
|
|
|
|
ImGui::SameLine(0.0f, innerSpacing);
|
|
|
|
ImGui::Text("%s", name);
|
|
|
|
if (help != nullptr)
|
|
|
|
{
|
|
|
|
ImGui::SameLine();
|
|
|
|
ShowHelpMarker(help);
|
|
|
|
}
|
|
|
|
return valueChanged;
|
|
|
|
}
|
|
|
|
|
2021-03-01 09:13:40 +00:00
|
|
|
template<typename T>
|
|
|
|
bool OptionRadioButton(const char *name, config::Option<T>& option, T value, const char *help)
|
|
|
|
{
|
|
|
|
int v = (int)option;
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
|
|
|
}
|
|
|
|
bool pressed = ImGui::RadioButton(name, &v, (int)value);
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
if (pressed)
|
|
|
|
option.set((T)v);
|
|
|
|
if (help != nullptr)
|
|
|
|
{
|
|
|
|
ImGui::SameLine();
|
|
|
|
ShowHelpMarker(help);
|
|
|
|
}
|
|
|
|
return pressed;
|
|
|
|
}
|
|
|
|
template bool OptionRadioButton<bool>(const char *name, config::Option<bool>& option, bool value, const char *help);
|
|
|
|
template bool OptionRadioButton<int>(const char *name, config::Option<int>& option, int value, const char *help);
|
|
|
|
|
|
|
|
void OptionComboBox(const char *name, config::Option<int>& option, const char *values[], int count,
|
|
|
|
const char *help)
|
|
|
|
{
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
|
|
|
}
|
|
|
|
if (ImGui::BeginCombo(name, values[option], ImGuiComboFlags_None))
|
|
|
|
{
|
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
bool is_selected = option == i;
|
|
|
|
if (ImGui::Selectable(values[i], &is_selected))
|
|
|
|
option = i;
|
|
|
|
if (is_selected)
|
|
|
|
ImGui::SetItemDefaultFocus();
|
|
|
|
}
|
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
if (option.isReadOnly())
|
|
|
|
{
|
|
|
|
ImGui::PopItemFlag();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
if (help != nullptr)
|
|
|
|
{
|
|
|
|
ImGui::SameLine();
|
|
|
|
ShowHelpMarker(help);
|
|
|
|
}
|
|
|
|
}
|
2021-06-07 10:18:05 +00:00
|
|
|
|
|
|
|
void fullScreenWindow(bool modal)
|
|
|
|
{
|
|
|
|
if (!modal)
|
|
|
|
{
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0);
|
|
|
|
|
|
|
|
if (insetLeft > 0)
|
|
|
|
{
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(insetLeft, ImGui::GetIO().DisplaySize.y));
|
|
|
|
ImGui::Begin("##insetLeft", NULL, ImGuiWindowFlags_NoDecoration);
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
if (insetRight > 0)
|
|
|
|
{
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - insetRight, 0));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(insetRight, ImGui::GetIO().DisplaySize.y));
|
|
|
|
ImGui::Begin("##insetRight", NULL, ImGuiWindowFlags_NoDecoration);
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
if (insetTop > 0)
|
|
|
|
{
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x, insetTop));
|
|
|
|
ImGui::Begin("##insetTop", NULL, ImGuiWindowFlags_NoDecoration);
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
if (insetBottom > 0)
|
|
|
|
{
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(0, ImGui::GetIO().DisplaySize.y - insetBottom));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x, insetBottom));
|
|
|
|
ImGui::Begin("##insetBottom", NULL, ImGuiWindowFlags_NoDecoration);
|
|
|
|
ImGui::End();
|
|
|
|
}
|
|
|
|
ImGui::PopStyleVar(2);
|
|
|
|
}
|
|
|
|
ImGui::SetNextWindowPos(ImVec2(insetLeft, insetTop));
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(ImGui::GetIO().DisplaySize.x - insetLeft - insetRight, ImGui::GetIO().DisplaySize.y - insetTop - insetBottom));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void computeScrollSpeed(float &v)
|
|
|
|
{
|
|
|
|
constexpr float friction = 3.f;
|
|
|
|
if (std::abs(v) > friction)
|
|
|
|
{
|
|
|
|
float sign = (v > 0.f) - (v < 0.f);
|
|
|
|
v -= friction * sign;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
v = 0.f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void windowDragScroll()
|
|
|
|
{
|
|
|
|
ImGuiWindow *window = ImGui::GetCurrentWindow();
|
|
|
|
if (window->DragScrolling)
|
|
|
|
{
|
|
|
|
if (!ImGui::GetIO().MouseDown[ImGuiMouseButton_Left])
|
|
|
|
{
|
|
|
|
computeScrollSpeed(window->ScrollSpeed.x);
|
|
|
|
computeScrollSpeed(window->ScrollSpeed.y);
|
|
|
|
if (window->ScrollSpeed == ImVec2())
|
|
|
|
{
|
|
|
|
window->DragScrolling = false;
|
|
|
|
// FIXME we should really move the mouse off-screen after a touch up and this wouldn't be necessary
|
|
|
|
// the only problem is tool tips
|
2021-06-07 18:53:31 +00:00
|
|
|
gui_set_mouse_position(-1, -1);
|
2021-06-07 10:18:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ImVec2 delta = ImGui::GetMouseDragDelta(ImGuiMouseButton_Left);
|
|
|
|
if (delta != ImVec2())
|
|
|
|
ImGui::ResetMouseDragDelta();
|
|
|
|
window->ScrollSpeed = delta;
|
|
|
|
}
|
|
|
|
if (window->DragScrolling)
|
|
|
|
{
|
|
|
|
ImGui::SetScrollX(window, window->Scroll.x - window->ScrollSpeed.x);
|
|
|
|
ImGui::SetScrollY(window, window->Scroll.y - window->ScrollSpeed.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|