diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4890912 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Clion project files +/.idea +/cmake-build* +/build* +/bin diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..869fc0d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.15) +project(UnInstall CXX) + +#==================================================== +# Enable policy +#==================================================== +# enable CMAKE_MSVC_RUNTIME_LIBRARY +cmake_policy(SET CMP0091 NEW) + +#==================================================== +# Set default build to release +#==================================================== +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type, one of: Release, Debug" FORCE) +endif () +message("Build type for UnInstall: ${CMAKE_BUILD_TYPE}") + +# check platform for build +set(IS_x64_PLATFORM FALSE) +if ("$ENV{PLATFORM}" MATCHES "x64") + set(IS_x64_PLATFORM TRUE) +endif () + +# Get plugin version from src/version.hpp and put it in PLUGIN_VERSION +function(plugin_extract_version) + file(READ "${CMAKE_CURRENT_LIST_DIR}/src/version.hpp" file_contents) + string(REGEX MATCH "PLUGIN_VER_MAJOR ([0-9]+)" _ "${file_contents}") + if (NOT CMAKE_MATCH_COUNT EQUAL 1) + message(FATAL_ERROR "Could not extract major version number from version.hpp") + endif () + set(ver_major ${CMAKE_MATCH_1}) + + string(REGEX MATCH "PLUGIN_VER_MINOR ([0-9]+)" _ "${file_contents}") + if (NOT CMAKE_MATCH_COUNT EQUAL 1) + message(FATAL_ERROR "Could not extract minor version number from version.hpp") + endif () + + set(ver_minor ${CMAKE_MATCH_1}) + string(REGEX MATCH "PLUGIN_VER_PATCH ([0-9]+)" _ "${file_contents}") + if (NOT CMAKE_MATCH_COUNT EQUAL 1) + message(FATAL_ERROR "Could not extract patch version number from version.hpp") + endif () + set(ver_patch ${CMAKE_MATCH_1}) + + set(PLUGIN_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE) +endfunction() + +plugin_extract_version() +add_subdirectory(./src) diff --git a/EPlugin.cpp b/EPlugin.cpp deleted file mode 100644 index 9432c5f..0000000 --- a/EPlugin.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "guid.hpp" - -static struct PluginStartupInfo Info; -static struct FarStandardFunctions FSF; - -const TCHAR* GetMsg(int MsgId) -{ -#ifdef FARAPI3 - return(Info.GetMsg(&MainGuid,MsgId)); -#else - return(Info.GetMsg(Info.ModuleNumber,MsgId)); -#endif -} - -void ShowHelp(const TCHAR * HelpTopic) -{ - Info.ShowHelp(Info.ModuleName,HelpTopic,0); -} - -int EMessage(const TCHAR * const * s, int nType, int n) -{ -#ifdef FARAPI3 - return Info.Message(&MainGuid, &AnyMessage, FMSG_ALLINONE|nType, NULL, s, - 0, // FMSG_ALLINONE - n); // -#else - return Info.Message(Info.ModuleNumber, FMSG_ALLINONE|nType, NULL, s, - 0, // FMSG_ALLINONE - n); // -#endif -} - -int DrawMessage(int nType, int n, char *msg, ...) -{ - int total = 0; - TCHAR * string = NULL; - va_list ap; - TCHAR * arg; - va_start(ap, msg); - - while((arg = va_arg(ap,TCHAR*))!= 0) - { - total += lstrlen(arg) + 1; // - } - - va_end(ap); - total--; // - string = (TCHAR *) realloc(string, sizeof(TCHAR)*(total + 1)); - string[0]=_T('\0'); - va_start(ap, msg); - - while((arg = va_arg(ap,TCHAR*))!= NULL) - { - StringCchCat(string, total+1, arg); - StringCchCat(string, total+1, _T("\n")); - } - - va_end(ap); - string[total]=_T('\0'); - int result = EMessage((const TCHAR * const *) string, nType, n); - realloc(string, 0); - return result; -} - -const TCHAR * strstri(const TCHAR *s, const TCHAR *c) -{ - if(c) - { - int l = lstrlen(c); - - for(const TCHAR *p = s ; *p ; p++) - if(FSF.LStrnicmp(p, c, l) == 0) - return p; - } - - return NULL; -} - -TCHAR * strnstri(TCHAR *s, const TCHAR *c, int n) -{ - if(c) - { - int l = min(lstrlen(c), n); - - for(TCHAR *p = s ; *p ; p++) - if(FSF.LStrnicmp(p, c, l) == 0) - return p; - } - - return NULL; -} - -TCHAR * unQuote(TCHAR *vStr) -{ - unsigned l; - l = lstrlen(vStr); - - if(*vStr == _T('\"')) - memmove(vStr,vStr+1,l*sizeof(TCHAR)); - - l = lstrlen(vStr); - - if(vStr[l-1] == _T('\"')) - vStr[l-1] = _T('\0'); - - return(vStr); -} diff --git a/Lang.templ b/Lang.templ deleted file mode 100644 index da7917c..0000000 --- a/Lang.templ +++ /dev/null @@ -1,237 +0,0 @@ -#hpp file name -FarLang.h -#number of languages -2 -#id:0 language file name, language name, language description -UnInstall_Rus.lng Russian "Russian (Русский)" -#id:1 language file name, language name, language description -UnInstall_Eng.lng English "English" - -#head of the hpp file -hhead: -hhead:#pragma once -hhead: - -#tail of the hpp file -#htail: -#htail: -#and so on as much as needed - -#-------------------------------------------------------------------- -#now come the lng feeds -#-------------------------------------------------------------------- -#first comes the text name from the enum which can be preceded with -#comments that will go to the hpp file -#h://This comment will appear before MYes -#he://This comment will appear after MYes -#MYes -#now come the lng lines for all the languages in the order defined -#above, they can be preceded with comments as shown below -#l://This comment will appear in all the lng files before the lng line -#le://This comment will appear in all the lng files after the lng line -#ls://This comment will appear only in Russian lng file before the lng line -#lse://This comment will appear only in Russian lng file after the lng line -#"Да" -#ls://This comment will appear only in English lng file before the lng line -#lse://This comment will appear only in English lng file after the lng line -#"Yes" -#ls://This comment will appear only in Czech lng file before the lng line -#lse://This comment will appear only in Czech lng file after the lng line -#upd:"Ano" -# -#lng lines marked with "upd:" will cause a warning to be printed to the -#screen reminding that this line should be updated/translated - - -MPlugIn=0 -l:// Plugin title -"Удаление программ" -"UnInstall" - -MBtnOk -l:// Buttons -"OK" -"OK" - -MBtnCancel -"Отмена" -"Cancel" - -MWaitingCompletion -l:// Waiting for UnInstall complete -"Ожидание завершения команды" -"Waiting for the command completion" - -MShowInEditor -l:// Configuration dialog -"Показывать в &редакторе" -"Show in the &Editor" - -MShowInViewer -"Показывать в &просмотрщике" -"Show in the &Viewer" - -MEnterWaitCompletion -"Enter: &ожидать завершения" -"Enter: &wait for completion" - -MUseElevation -"Повышать полномочи&я" -"&Use elevation" - -MLowPriority -"Запуск с &низким приоритетом" -"Start with &low priority" - -MForceMsiUse -"&Всегда использовать MsiExec" -"&Force use MsiExec" - -MEnterAction -"Ente&r: " -"Ente&r: " - -MShiftEnterAction -"Shif&t-Enter:" -"Shif&t-Enter:" - -MActionUninstallWait -"Удаление (ждать)" -"Uninstall (wait)" - -MActionUninstall -"Удаление" -"Uninstall" - -MActionModifyWait -"Изменить (ждать)" -"Modify (wait)" - -MActionModify -"Изменить" -"Modify" - -MActionRepairWait -"Восстановить (ждать)" -"Repair (wait)" - -MActionRepair -"Восстановить" -"Repair" - -MActionMenu -"Меню" -"Menu" - -MUninstallEntry -l:// Entry info dialog title -"Запись о деинсталляции" -"Uninstall Entry" - -MUninstallEntryMSI -"Запись о деинсталляции (Windows Installer)" -"Uninstall Entry (Windows Installer)" - -MName -l:// Entry info labels -"&Название:" -"&Name:" - -MSubKeyName -"К&люч в реестре:" -"Sub&key name:" - -MInstallLocation -"&Расположение:" -"&Install location:" - -MModifyCommand -"Команда для из&менения:" -"&Modify command:" - -MUninstallCommand -"Команда для &деинсталляции:" -"&Uninstall command:" - -MPublisher -"&Издатель:" -"&Publisher:" - -MSupportInfo -"&Техническая поддержка:" -"&Support information:" - -MProductUpdates -"&Обновления продукта:" -"Product &updates:" - -MComments -"&Комментарий:" -"&Comments:" - -MVersion -"&Версия:" -"&Version:" - -MInstallDate -"Д&ата установки:" -"Install &date:" - -MBottomLine -l:// Menu's top and bottom lines -"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" -"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" - -MFilter -"Filter: [%s], Entries: [%d/%d]" -"Filter: [%s], Entries: [%d/%d]" - -MMenuBottomLine1 -"{Normal priority} F7" -"{Normal priority} F7" - -MMenuBottomLine2 -" {Low priority} F7" -" {Low priority} F7" - -MMenuTopLine -"Выберите действие" -"Select action" - -MMenuTopLineN -"Действие для %u элементов" -"Action for %u items" - -MListHKLMx86 -l:// Install location (registry) -"Mx86" -"Mx86" - -MListHKLMx64 -"Mx64" -"Mx64" - -MListHKLM -"HKLM" -"HKLM" - -MListHKCU -"HKCU" -"HKCU" - -MRunProgErr -l:// Error messages and confirmations -"Ошибка при запуске программы" -"Error of running program" - -MCancelledByUser -"Отменено пользователем" -"Cancelled by user" - -MDelRegErr -"Ошибка при удалении информации о деустановке" -"Error of deleting uninstall info" - -MConfirm -"Удаление программ\nВы действительно хотите удалить запись о программе?\n%s\nДа\nНет" -"UnInstall\nDo you wish to delete the uninstall entry?\n%s\nOk\nCancel" diff --git a/Memory.h b/Memory.h deleted file mode 100644 index 8a56fbb..0000000 --- a/Memory.h +++ /dev/null @@ -1,93 +0,0 @@ -HANDLE varHeap; - -bool InitHeap() // run it in begin of program -{ - varHeap = GetProcessHeap(); - return (varHeap != NULL); -} - -void * my_realloc(void * block, size_t size) -{ - if (!size) // size == 0 - { - if (block) // block != NULL - HeapFree(varHeap, 0, block); - return NULL; - } - if (block) // block != NULL - return HeapReAlloc(varHeap, HEAP_ZERO_MEMORY, block, size); - else // block == NULL - return HeapAlloc(varHeap, HEAP_ZERO_MEMORY, size); -} - -void * operator new(size_t size) -{ - return HeapAlloc(varHeap, HEAP_ZERO_MEMORY, size); -} - -void operator delete(void * block) -{ - HeapFree(varHeap, 0, block); -} - -void * operator new[](size_t size) -{ - return HeapAlloc(varHeap, HEAP_ZERO_MEMORY, size); -} - -void operator delete[](void * block) -{ - HeapFree(varHeap, 0, block); -} - -void * memcpy(void *dst, const void *src, size_t count) -{ - void *ret = dst; - - while (count--) - { - *(char *)dst = *(char *)src; - dst = (char *)dst + 1; - src = (char *)src + 1; - } - return(ret); -} - -void * memmove(void *dst, const void *src, size_t count) -{ - void *ret = dst; - if (dst <= src || (char *)dst >= ((char *)src + count)) - { - while (count--) - { - *(char *)dst = *(char *)src; - dst = (char *)dst + 1; - src = (char *)src + 1; - } - } - else - { - dst = (char *)dst + count - 1; - src = (char *)src + count - 1; - - while (count--) - { - *(char *)dst = *(char *)src; - dst = (char *)dst - 1; - src = (char *)src - 1; - } - } - return(ret); -} - -void * memset(void *dst, int val, size_t count) -{ - void *start = dst; - - while (count--) - { - *(char *)dst = (char)val; - dst = (char *)dst + 1; - } - return(start); -} diff --git a/README.md b/README.md new file mode 100644 index 0000000..2743b63 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +UnInstall +========== + +Плагин для Far Manager 3. + +Плагин выполняет функции элемента панели управления "Установка и удаление программ". Преимуществом является более быстрое построение списка доступных программ и наличие фильтра. \ No newline at end of file diff --git a/ReadMe.Rus.txt b/ReadMe.Rus.txt index d40d470..6cf3de1 100644 --- a/ReadMe.Rus.txt +++ b/ReadMe.Rus.txt @@ -1,4 +1,4 @@ - Это прямой аналог UnInst Д. Жемерова. +Это прямой аналог UnInst Д. Жемерова. Что побудило меня написать аналог это плагина ? - при смене языка UnInst некорректно менял название в меню плагинов - в нем неудобно искать нужную программу, нет фильтра, нельзя быстро перейти diff --git a/TechInfo.Rus.reg b/TechInfo.Rus.reg deleted file mode 100644 index 0443ba4..0000000 --- a/TechInfo.Rus.reg +++ /dev/null @@ -1,45 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\Software\Far2\Plugins\UnInstall] -;------------------------------------------------------------------------ -; ᪨ ⨯: ᪨ ⨯; .. , 祭 -; ⥭ ॥. -; ॥: , 㦭 ᯮ짮 ᮧ -; 祭 ॥. -; 祭: 祭. -; 祭 㬮砭: 祭 㬮砭 㤥 ᢮ -; ࠬ, ᫨ 㦨 祭 -; ॥. -; ᠭ: ᠭ ᯮ짮 祭. -;------------------------------------------------------------------------ - - -;------------------------------------------------------------------------ -; ᪨ ⨯: -; ॥: REG_DWORD -; 祭: WhereWork -; 祭 㬮砭: 3 -; ᠭ: -; -; ᫨ ⠭ 祭: -; 0 - 㤥 ࠡ ⮫쪮 -; 1 - 㤥 ࠡ , ணࠬ ᬮ -; 2 - 㤥 ࠡ , । -; 3 - 㤥 ࠡ , ணࠬ ᬮ, । -; . 1 ⢥砥 ணࠬ ᬮ, 2 - ।, -; -"WhereWork"=dword:00000000 - -;------------------------------------------------------------------------ -; ᪨ ⨯: ᪨ -; ॥: REG_DWORD -; 祭: EnterFunction -; 祭 㬮砭: 0 -; ᠭ: -; -; ᫨ ⠭ 筮 祭, ०, ஬ 㤥 -; 砭 믮 ணࠬ 㤥 뢠 Enter, Shift-Enter. -; .. ४⥫ 㭪権 Enter Shift-Enter. ன ० - 䮭 -; ० -; -"EnterFunction"=dword:00000001 diff --git a/UnInstall.def b/UnInstall.def deleted file mode 100644 index fca2912..0000000 --- a/UnInstall.def +++ /dev/null @@ -1,6 +0,0 @@ -EXPORTS - GetMinFarVersion - SetStartupInfo - GetPluginInfo - OpenPlugin - Configure diff --git a/UnInstall.rc b/UnInstall.rc deleted file mode 100644 index 6122b98..0000000 --- a/UnInstall.rc +++ /dev/null @@ -1,33 +0,0 @@ -#include -1 VERSIONINFO -FILEVERSION <(VER_MAJOR)>,<(VER_MINOR)>,<(VER_PATCH)>,0 -PRODUCTVERSION <(VER_MAJOR)>,<(VER_MINOR)>,<(VER_PATCH)>,0 -FILEOS VOS__WINDOWS32 -FILETYPE VFT_DLL -#ifdef DEBUG -FILEFLAGS VS_FF_DEBUG -#endif -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "04090000" - BEGIN - VALUE "FileVersion", "<(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)>.0\0" - VALUE "ProductVersion", "<(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)>.0\0" -#ifdef x64 - VALUE "FileDescription", "<(NAME)> for Far Manager 2 x64\0" -#else - VALUE "FileDescription", "<(NAME)> for Far Manager 2\0" -#endif - VALUE "OriginalFilename", "<(MODULE)>.dll\0" -#ifdef DEBUG - VALUE "SpecialBuild", "Debug build.\0" -#endif - VALUE "LegalCopyright", "http://farplug.googlecode.com/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 0x0000 - END -END diff --git a/UnInstall.sln b/UnInstall.sln deleted file mode 100644 index 7f7711a..0000000 --- a/UnInstall.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnInstall", "UnInstall.vcproj", "{F44C0102-6977-419D-AC2B-B682E90D55B4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F44C0102-6977-419D-AC2B-B682E90D55B4}.Debug|Win32.ActiveCfg = Debug|Win32 - {F44C0102-6977-419D-AC2B-B682E90D55B4}.Debug|Win32.Build.0 = Debug|Win32 - {F44C0102-6977-419D-AC2B-B682E90D55B4}.Release|Win32.ActiveCfg = Release|Win32 - {F44C0102-6977-419D-AC2B-B682E90D55B4}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/UnInstall.vcproj b/UnInstall.vcproj deleted file mode 100644 index bd4250f..0000000 --- a/UnInstall.vcproj +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/UnInstallW.def b/UnInstallW.def deleted file mode 100644 index 6456f41..0000000 --- a/UnInstallW.def +++ /dev/null @@ -1,7 +0,0 @@ -EXPORTS - GetMinFarVersion - GetMinFarVersionW - SetStartupInfoW - GetPluginInfoW - OpenPluginW - ConfigureW diff --git a/WhatsNew.Rus.txt b/WhatsNew.Rus.txt index 749435d..aa45ab0 100644 --- a/WhatsNew.Rus.txt +++ b/WhatsNew.Rus.txt @@ -1,12 +1,15 @@ -v1.10.17 +v1.10.18 + - адаптация под актуальный Far3 + +v1.10.17 - поправлен запуск на Far3 b5262 (https://forum.farmanager.com/viewtopic.php?p=150733#p150733) -v1.10.16 - - при закрытии окна плагина сбрасывалась позиция курсора на файловой панели - -v1.10.15 - - совместимость с Far3 3192 - +v1.10.16 + - при закрытии окна плагина сбрасывалась позиция курсора на файловой панели + +v1.10.15 + - совместимость с Far3 3192 + v1.10.14 - не запускалась деинсталляция, если путь к *.exe был указан без кавычек и содержал пробелы. - уточнения определения 'скрытых' элементов diff --git a/common/error.hpp b/common/error.hpp deleted file mode 100644 index b7734a3..0000000 --- a/common/error.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#define FACILITY_INTERNAL 0xFFF -#define E_MESSAGE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_INTERNAL, 0) - -struct Error { - HRESULT code; - list messages; - const char* file; - int line; - Error(): code(NO_ERROR), file(__FILE__), line(__LINE__) { - } - Error(HRESULT code, const char* file, int line): code(code), file(file), line(line) { - } - Error(const wstring& message, const char* file, int line): code(E_MESSAGE), messages(1, message), file(file), line(line) { - } - Error(const std::exception& e): code(E_MESSAGE), file(__FILE__), line(__LINE__) { - string message(string(typeid(e).name()) + ": " + e.what()); - messages.push_back(wstring(message.begin(), message.end())); - } - operator bool() const { - return code != NO_ERROR; - } -}; - -#define FAIL(code) throw Error(code, __FILE__, __LINE__) -#define FAIL_MSG(message) throw Error(message, __FILE__, __LINE__) - -#define CHECK_SYS(code) { if (!(code)) FAIL(HRESULT_FROM_WIN32(GetLastError())); } -#define CHECK_ADVSYS(code) { DWORD __ret = (code); if (__ret != ERROR_SUCCESS) FAIL(HRESULT_FROM_WIN32(__ret)); } -#define CHECK_COM(code) { HRESULT __ret = (code); if (FAILED(__ret)) FAIL(__ret); } -#define CHECK(code) { if (!(code)) FAIL_MSG(L#code); } - -#define IGNORE_ERRORS(code) { try { code; } catch (...) { } } - -#define ERROR_MESSAGE_BEGIN try { -#define ERROR_MESSAGE_END(message) \ - } \ - catch (Error& e) { \ - e.messages.push_back(message); \ - throw e; \ - } diff --git a/common/farutils.cpp b/common/farutils.cpp deleted file mode 100644 index 55e392a..0000000 --- a/common/farutils.cpp +++ /dev/null @@ -1,686 +0,0 @@ -#include "utils.hpp" -#include "sysutils.hpp" -#include "farutils.hpp" - -namespace Far { - -PluginStartupInfo g_far; -FarStandardFunctions g_fsf; - -void init(const PluginStartupInfo* psi) { - g_far = *psi; - g_fsf = *psi->FSF; -} - -wstring get_plugin_module_path() { - return extract_file_path(g_far.ModuleName); -} - -wstring get_root_key_name() { - return g_far.RootKey; -} - -unsigned get_version() { - DWORD version; - g_far.AdvControl(g_far.ModuleNumber, ACTL_GETFARVERSION, &version); - return (LOWORD(version) << 16) | HIWORD(version); -} - -const wchar_t* msg_ptr(int id) { - return g_far.GetMsg(g_far.ModuleNumber, id); -} - -wstring get_msg(int id) { - return g_far.GetMsg(g_far.ModuleNumber, id); -} - -unsigned get_optimal_msg_width() { - HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); - if (con != INVALID_HANDLE_VALUE) { - CONSOLE_SCREEN_BUFFER_INFO con_info; - if (GetConsoleScreenBufferInfo(con, &con_info)) { - unsigned con_width = con_info.srWindow.Right - con_info.srWindow.Left + 1; - if (con_width >= 80) - return con_width - 20; - } - } - return 60; -} - -int message(const wstring& msg, int button_cnt, DWORD flags) { - return g_far.Message(g_far.ModuleNumber, flags | FMSG_ALLINONE, NULL, reinterpret_cast(msg.c_str()), 0, button_cnt); -} - -int menu(const wstring& title, const vector& items, const wchar_t* help) { - vector menu_items; - menu_items.reserve(items.size()); - FarMenuItem mi; - for (unsigned i = 0; i < items.size(); i++) { - memset(&mi, 0, sizeof(mi)); - mi.Text = items[i].c_str(); - menu_items.push_back(mi); - } - return g_far.Menu(g_far.ModuleNumber, -1, -1, 0, FMENU_WRAPMODE, title.c_str(), NULL, help, NULL, NULL, menu_items.data(), static_cast(menu_items.size())); -} - -wstring get_progress_bar_str(unsigned width, unsigned __int64 completed, unsigned __int64 total) { - const wchar_t c_pb_black = 9608; - const wchar_t c_pb_white = 9617; - unsigned len1; - if (total == 0) - len1 = 0; - else - len1 = static_cast(static_cast(completed) * width / total); - if (len1 > width) - len1 = width; - unsigned len2 = width - len1; - wstring result; - result.append(len1, c_pb_black); - result.append(len2, c_pb_white); - return result; -} - -void set_progress_state(TBPFLAG state) { - g_far.AdvControl(g_far.ModuleNumber, ACTL_SETPROGRESSSTATE, reinterpret_cast(state)); -} - -void set_progress_value(unsigned __int64 completed, unsigned __int64 total) { - PROGRESSVALUE pv; - pv.Completed = completed; - pv.Total = total; - g_far.AdvControl(g_far.ModuleNumber, ACTL_SETPROGRESSVALUE, &pv); -} - -void progress_notify() { - g_far.AdvControl(g_far.ModuleNumber, ACTL_PROGRESSNOTIFY, nullptr); -} - -void call_user_apc(void* param) { - g_far.AdvControl(g_far.ModuleNumber, ACTL_SYNCHRO, param); -} - -void post_keys(const vector& keys, DWORD flags) { - KeySequence ks = { flags, static_cast(keys.size()), keys.data() }; - g_far.AdvControl(g_far.ModuleNumber, ACTL_POSTKEYSEQUENCE, &ks); -} - -void quit() { - g_far.AdvControl(g_far.ModuleNumber, ACTL_QUIT, 0); -} - -HANDLE save_screen() { - return g_far.SaveScreen(0, 0, -1, -1); -} - -void restore_screen(HANDLE h_scr) { - g_far.RestoreScreen(h_scr); -} - -void flush_screen() { - g_far.Text(0, 0, 0, NULL); // flush buffer hack - g_far.AdvControl(g_far.ModuleNumber, ACTL_REDRAWALL, 0); -} - -int viewer(const wstring& file_name, const wstring& title) { - return g_far.Viewer(file_name.c_str(), title.c_str(), 0, 0, -1, -1, VF_DISABLEHISTORY | VF_ENABLE_F6, CP_UNICODE); -} - -void update_panel(HANDLE h_panel, bool keep_selection) { - g_far.Control(h_panel, FCTL_UPDATEPANEL, keep_selection ? 1 : 0, 0); - g_far.Control(h_panel, FCTL_REDRAWPANEL, 0, 0); -} - -void set_view_mode(HANDLE h_panel, unsigned view_mode) { - g_far.Control(h_panel, FCTL_SETVIEWMODE, view_mode, 0); -} - -void set_sort_mode(HANDLE h_panel, unsigned sort_mode) { - g_far.Control(h_panel, FCTL_SETSORTMODE, sort_mode, 0); -} - -void set_reverse_sort(HANDLE h_panel, bool reverse_sort) { - g_far.Control(h_panel, FCTL_SETSORTORDER, reverse_sort ? 1 : 0, 0); -} - -void set_numeric_sort(HANDLE h_panel, bool numeric_sort) { - g_far.Control(h_panel, FCTL_SETNUMERICSORT, numeric_sort ? 1 : 0, 0); -} - -void set_directories_first(HANDLE h_panel, bool first) { - g_far.Control(h_panel, FCTL_SETDIRECTORIESFIRST, first ? 1 : 0, 0); -} - -bool get_panel_info(HANDLE h_panel, PanelInfo& panel_info) { - return g_far.Control(h_panel, FCTL_GETPANELINFO, 0, reinterpret_cast(&panel_info)) == TRUE; -} - -bool is_real_file_panel(const PanelInfo& panel_info) { - return panel_info.PanelType == PTYPE_FILEPANEL && (panel_info.Flags & PFLAGS_REALNAMES); -} - -wstring get_panel_dir(HANDLE h_panel) { - Buffer buf(MAX_PATH); - unsigned size = g_far.Control(h_panel, FCTL_GETPANELDIR, static_cast(buf.size()), reinterpret_cast(buf.data())); - if (size > buf.size()) { - buf.resize(size); - size = g_far.Control(h_panel, FCTL_GETPANELDIR, static_cast(buf.size()), reinterpret_cast(buf.data())); - } - CHECK(size) - return wstring(buf.data(), size - 1); -} - -PanelItem get_current_panel_item(HANDLE h_panel) { - Buffer buf(0x1000); - unsigned size = g_far.Control(h_panel, FCTL_GETCURRENTPANELITEM, static_cast(buf.size()), reinterpret_cast(buf.data())); - if (size > buf.size()) { - buf.resize(size); - size = g_far.Control(h_panel, FCTL_GETCURRENTPANELITEM, static_cast(buf.size()), reinterpret_cast(buf.data())); - } - CHECK(size) - const PluginPanelItem* panel_item = reinterpret_cast(buf.data()); - PanelItem pi; - pi.file_attributes = panel_item->FindData.dwFileAttributes; - pi.creation_time = panel_item->FindData.ftCreationTime; - pi.last_access_time = panel_item->FindData.ftLastAccessTime; - pi.last_write_time = panel_item->FindData.ftLastWriteTime; - pi.file_size = panel_item->FindData.nFileSize; - pi.pack_size = panel_item->FindData.nPackSize; - pi.file_name = panel_item->FindData.lpwszFileName; - pi.alt_file_name = panel_item->FindData.lpwszAlternateFileName; - pi.user_data = panel_item->UserData; - return pi; -} - -void error_dlg(const wstring& title, const Error& e) { - wostringstream st; - st << title << L'\n'; - if (e.code != E_MESSAGE) { - wstring sys_msg = get_system_message(e.code, get_lang_id()); - if (!sys_msg.empty()) - st << word_wrap(sys_msg, get_optimal_msg_width()) << L'\n'; - } - for (list::const_iterator msg = e.messages.begin(); msg != e.messages.end(); msg++) { - st << word_wrap(*msg, get_optimal_msg_width()) << L'\n'; - } - st << extract_file_name(widen(e.file)) << L':' << e.line; - message(st.str(), 0, FMSG_WARNING | FMSG_MB_OK); -} - -void info_dlg(const wstring& title, const wstring& msg) { - message(title + L'\n' + msg, 0, FMSG_MB_OK); -} - -unsigned Dialog::get_label_len(const wstring& str) { - unsigned cnt = 0; - for (unsigned i = 0; i < str.size(); i++) { - if (str[i] != '&') cnt++; - } - return cnt; -} - -unsigned Dialog::new_value(const wstring& text) { - values.push_back(text); - return static_cast(values.size()); -} - -const wchar_t* Dialog::get_value(unsigned idx) const { - return values[idx - 1].c_str(); -} - -void Dialog::frame(const wstring& text) { - DialogItem di; - di.type = DI_DOUBLEBOX; - di.x1 = c_x_frame - 2; - di.y1 = c_y_frame - 1; - di.x2 = c_x_frame + client_xs + 1; - di.y2 = c_y_frame + client_ys; - di.text_idx = new_value(text); - new_item(di); -} - -void Dialog::calc_frame_size() { - client_ys = y - c_y_frame; - DialogItem& di = items.front(); // dialog frame - di.x2 = c_x_frame + client_xs + 1; - di.y2 = c_y_frame + client_ys; -} - -unsigned Dialog::new_item(const DialogItem& di) { - items.push_back(di); - return static_cast(items.size()) - 1; -} - -LONG_PTR WINAPI Dialog::internal_dialog_proc(HANDLE h_dlg, int msg, int param1, LONG_PTR param2) { - Dialog* dlg = reinterpret_cast(g_far.SendDlgMessage(h_dlg, DM_GETDLGDATA, 0, 0)); - dlg->h_dlg = h_dlg; - FAR_ERROR_HANDLER_BEGIN - return dlg->dialog_proc(msg, param1, param2); - FAR_ERROR_HANDLER_END(return 0, return 0, false) -} - -LONG_PTR Dialog::default_dialog_proc(int msg, int param1, LONG_PTR param2) { - return g_far.DefDlgProc(h_dlg, msg, param1, param2); -} - -LONG_PTR Dialog::send_message(int msg, int param1, LONG_PTR param2) { - return g_far.SendDlgMessage(h_dlg, msg, param1, param2); -} - -Dialog::Dialog(const wstring& title, unsigned width, const wchar_t* help): client_xs(width), x(c_x_frame), y(c_y_frame), help(help) { - frame(title); -} - -void Dialog::new_line() { - x = c_x_frame; - y++; -} - -void Dialog::reset_line() { - x = c_x_frame; -} - -void Dialog::spacer(unsigned size) { - x += size; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; -} - -void Dialog::pad(unsigned pos) { - if (pos > x - c_x_frame) spacer(pos - (x - c_x_frame)); -} - -unsigned Dialog::separator() { - DialogItem di; - di.type = DI_TEXT; - di.y1 = y; - di.y2 = y; - di.flags = DIF_SEPARATOR; - return new_item(di); -} - -unsigned Dialog::label(const wstring& text, unsigned boxsize, DWORD flags) { - DialogItem di; - di.type = DI_TEXT; - di.x1 = x; - di.y1 = y; - if (boxsize == AUTO_SIZE) - x += get_label_len(text); - else - x += boxsize; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.x2 = x - 1; - di.y2 = y; - di.flags = flags; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::edit_box(const wstring& text, unsigned boxsize, DWORD flags) { - DialogItem di; - di.type = DI_EDIT; - di.x1 = x; - di.y1 = y; - if (boxsize == AUTO_SIZE) - x = c_x_frame + client_xs; - else - x += boxsize; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.x2 = x - 1 - (flags & DIF_HISTORY ? 1 : 0); - di.y2 = y; - di.flags = flags; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::history_edit_box(const wstring& text, const wstring& history_name, unsigned boxsize, DWORD flags) { - unsigned idx = edit_box(text, boxsize, flags | DIF_HISTORY); - items[idx].history_idx = new_value(history_name); - return idx; -} - -unsigned Dialog::mask_edit_box(const wstring& text, const wstring& mask, unsigned boxsize, DWORD flags) { - unsigned idx = fix_edit_box(text, boxsize, flags | DIF_MASKEDIT); - items[idx].mask_idx = new_value(mask); - return idx; -} - -unsigned Dialog::fix_edit_box(const wstring& text, unsigned boxsize, DWORD flags) { - DialogItem di; - di.type = DI_FIXEDIT; - di.x1 = x; - di.y1 = y; - if (boxsize == AUTO_SIZE) - x += static_cast(text.size()); - else - x += boxsize; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.x2 = x - 1; - di.y2 = y; - di.flags = flags; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::pwd_edit_box(const wstring& text, unsigned boxsize, DWORD flags) { - DialogItem di; - di.type = DI_PSWEDIT; - di.x1 = x; - di.y1 = y; - if (boxsize == AUTO_SIZE) - x = c_x_frame + client_xs; - else - x += boxsize; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.x2 = x - 1; - di.y2 = y; - di.flags = flags; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::button(const wstring& text, DWORD flags, bool def) { - DialogItem di; - di.type = DI_BUTTON; - di.x1 = x; - di.y1 = y; - x += get_label_len(text) + 4; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.y2 = y; - di.flags = flags; - di.default_button = def ? 1 : 0; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::check_box(const wstring& text, int value, DWORD flags) { - DialogItem di; - di.type = DI_CHECKBOX; - di.x1 = x; - di.y1 = y; - x += get_label_len(text) + 4; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.y2 = y; - di.flags = flags; - di.selected = value; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::radio_button(const wstring& text, bool value, DWORD flags) { - DialogItem di; - di.type = DI_RADIOBUTTON; - di.x1 = x; - di.y1 = y; - x += get_label_len(text) + 4; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.y2 = y; - di.flags = flags; - di.selected = value ? 1 : 0; - di.text_idx = new_value(text); - return new_item(di); -} - -unsigned Dialog::combo_box(const vector& list_items, unsigned sel_idx, unsigned boxsize, DWORD flags) { - DialogItem di; - di.type = DI_COMBOBOX; - di.x1 = x; - di.y1 = y; - if (boxsize == AUTO_SIZE) { - if (flags & DIF_DROPDOWNLIST) { - unsigned max_len = 1; - for (unsigned i = 0; i < list_items.size(); i++) { - if (max_len < list_items[i].size()) - max_len = static_cast(list_items[i].size()); - } - x += max_len + 5; - } - else - x = c_x_frame + client_xs; - } - else - x += boxsize; - if (x - c_x_frame > client_xs) - client_xs = x - c_x_frame; - di.x2 = x - 1 - 1; // -1 for down arrow - di.y2 = y; - di.flags = flags; - for (unsigned i = 0; i < list_items.size(); i++) { - if (di.list_idx) - new_value(list_items[i]); - else - di.list_idx = new_value(list_items[i]); - } - di.list_size = static_cast(list_items.size()); - di.list_pos = sel_idx; - return new_item(di); -} - -int Dialog::show() { - calc_frame_size(); - - unsigned list_cnt = 0; - unsigned list_item_cnt = 0; - for (unsigned i = 0; i < items.size(); i++) { - if (items[i].list_idx) { - list_cnt++; - list_item_cnt += items[i].list_size; - } - } - Buffer far_lists(list_cnt); - far_lists.clear(); - Buffer far_list_items(list_item_cnt); - far_list_items.clear(); - - Buffer dlg_items(items.size()); - dlg_items.clear(); - unsigned fl_idx = 0; - unsigned fli_idx = 0; - for (unsigned i = 0; i < items.size(); i++) { - FarDialogItem* dlg_item = dlg_items.data() + i; - dlg_item->Type = items[i].type; - dlg_item->X1 = items[i].x1; - dlg_item->Y1 = items[i].y1; - dlg_item->X2 = items[i].x2; - dlg_item->Y2 = items[i].y2; - dlg_item->Focus = items[i].focus; - dlg_item->Flags = items[i].flags; - dlg_item->DefaultButton = items[i].default_button; - dlg_item->Selected = items[i].selected; - if (items[i].history_idx) - dlg_item->History = get_value(items[i].history_idx); - if (items[i].mask_idx) - dlg_item->Mask = get_value(items[i].mask_idx); - if (items[i].text_idx) - dlg_item->PtrData = get_value(items[i].text_idx); - if (items[i].list_idx) { - FarList* fl = far_lists.data() + fl_idx; - fl->Items = far_list_items.data() + fli_idx; - fl->ItemsNumber = items[i].list_size; - for (unsigned j = 0; j < items[i].list_size; j++) { - FarListItem* fli = far_list_items.data() + fli_idx; - if (j == items[i].list_pos) - fli->Flags = LIF_SELECTED; - fli->Text = get_value(items[i].list_idx + j); - fli_idx++; - } - fl_idx++; - dlg_item->ListItems = fl; - } - } - - int res = -1; - HANDLE h_dlg = g_far.DialogInit(g_far.ModuleNumber, -1, -1, client_xs + 2 * c_x_frame, client_ys + 2 * c_y_frame, help, dlg_items.data(), static_cast(dlg_items.size()), 0, 0, internal_dialog_proc, reinterpret_cast(this)); - if (h_dlg != INVALID_HANDLE_VALUE) { - res = g_far.DialogRun(h_dlg); - g_far.DialogFree(h_dlg); - } - return res; -} - -wstring Dialog::get_text(unsigned ctrl_id) const { - size_t len = g_far.SendDlgMessage(h_dlg, DM_GETTEXTLENGTH, ctrl_id, 0); - Buffer buf(len + 1); - g_far.SendDlgMessage(h_dlg, DM_GETTEXTPTR, ctrl_id, reinterpret_cast(buf.data())); - return wstring(buf.data(), len); -} - -void Dialog::set_text(unsigned ctrl_id, const wstring& text) { - g_far.SendDlgMessage(h_dlg, DM_SETTEXTPTR, ctrl_id, reinterpret_cast(text.c_str())); -} - -bool Dialog::get_check(unsigned ctrl_id) const { - return DlgItem_GetCheck(g_far, h_dlg, ctrl_id) == BSTATE_CHECKED; -} - -bool Dialog::is_check_defined(unsigned ctrl_id) const { - return DlgItem_GetCheck(g_far, h_dlg, ctrl_id) != BSTATE_3STATE; -} - -void Dialog::set_check(unsigned ctrl_id, bool check) { - g_far.SendDlgMessage(h_dlg, DM_SETCHECK, ctrl_id, check ? BSTATE_CHECKED : BSTATE_UNCHECKED); -} - -unsigned Dialog::get_list_pos(unsigned ctrl_id) const { - return static_cast(g_far.SendDlgMessage(h_dlg, DM_LISTGETCURPOS, ctrl_id, 0)); -} - -void Dialog::set_color(unsigned ctrl_id, unsigned char color) { - size_t size = g_far.SendDlgMessage(h_dlg, DM_GETDLGITEM, ctrl_id, NULL); - Buffer buf(size); - FarDialogItem* dlg_item = reinterpret_cast(buf.data()); - g_far.SendDlgMessage(h_dlg, DM_GETDLGITEM, ctrl_id, reinterpret_cast(dlg_item)); - dlg_item->Flags &= ~DIF_COLORMASK; - dlg_item->Flags |= DIF_SETCOLOR | color; - g_far.SendDlgMessage(h_dlg, DM_SETDLGITEM, ctrl_id, reinterpret_cast(dlg_item)); -} - -void Dialog::set_focus(unsigned ctrl_id) { - g_far.SendDlgMessage(h_dlg, DM_SETFOCUS, ctrl_id, 0); -} - -void Dialog::enable(unsigned ctrl_id, bool enable) { - g_far.SendDlgMessage(h_dlg, DM_ENABLE, ctrl_id, enable ? TRUE : FALSE); -} - -void Dialog::set_visible(unsigned ctrl_id, bool visible) { - g_far.SendDlgMessage(h_dlg, DM_SHOWITEM, ctrl_id, visible ? 1 : 0); -} - -Regex::Regex(): h_regex(INVALID_HANDLE_VALUE) { - CHECK(g_far.RegExpControl(0, RECTL_CREATE, reinterpret_cast(&h_regex))); -} - -Regex::~Regex() { - if (h_regex != INVALID_HANDLE_VALUE) - CHECK(g_far.RegExpControl(h_regex, RECTL_FREE, 0)); -} - -size_t Regex::search(const wstring& expr, const wstring& text) { - CHECK(g_far.RegExpControl(h_regex, RECTL_COMPILE, reinterpret_cast((L"/" + expr + L"/").c_str()))); - CHECK(g_far.RegExpControl(h_regex, RECTL_OPTIMIZE, 0)); - RegExpSearch regex_search; - memset(®ex_search, 0, sizeof(regex_search)); - regex_search.Text = text.c_str(); - regex_search.Position = 0; - regex_search.Length = static_cast(text.size()); - RegExpMatch regex_match; - regex_search.Match = ®ex_match; - regex_search.Count = 1; - if (g_far.RegExpControl(h_regex, RECTL_SEARCHEX, reinterpret_cast(®ex_search))) - return regex_search.Match[0].start; - else - return -1; -} - -Selection::Selection(HANDLE h_plugin): h_plugin(h_plugin) { - g_far.Control(h_plugin, FCTL_BEGINSELECTION, 0, 0); -} - -Selection::~Selection() { - g_far.Control(h_plugin, FCTL_ENDSELECTION, 0, 0); -} - -void Selection::select(unsigned idx, bool value) { - g_far.Control(h_plugin, FCTL_SETSELECTION, idx, value ? TRUE : FALSE); -} - -wstring get_absolute_path(const wstring& rel_path) { - Buffer buf(MAX_PATH); - unsigned len = g_fsf.ConvertPath(CPM_FULL, rel_path.c_str(), buf.data(), static_cast(buf.size())); - if (len > buf.size()) { - buf.resize(len); - len = g_fsf.ConvertPath(CPM_FULL, rel_path.c_str(), buf.data(), static_cast(buf.size())); - } - return buf.data(); -} - -INT_PTR adv_control(int command, void* param) { - return g_far.AdvControl(g_far.ModuleNumber, command, param); -} - -bool match_masks(const wstring& file_name, const wstring& masks) { - return g_fsf.ProcessName(masks.c_str(), const_cast(file_name.c_str()), 0, PN_CMPNAMELIST) != 0; -} - -unsigned char get_colors(PaletteColors color_id) { - return static_cast(g_far.AdvControl(g_far.ModuleNumber, ACTL_GETCOLOR, reinterpret_cast(color_id))); -} - -// set current file on panel to file_path -bool panel_go_to_file(HANDLE h_panel, const wstring& file_path) { - wstring dir = extract_file_path(file_path); - if (!g_far.Control(h_panel, FCTL_SETPANELDIR, 0, reinterpret_cast(dir.c_str()))) - return false; - PanelInfo panel_info; - if (!g_far.Control(h_panel, FCTL_GETPANELINFO, 0, reinterpret_cast(&panel_info))) - return false; - wstring file_name = upcase(extract_file_name(file_path)); - PanelRedrawInfo panel_ri = { 0 }; - Buffer buf(0x1000); - int i; - for (i = 0; i < panel_info.ItemsNumber; i++) { - unsigned size = g_far.Control(h_panel, FCTL_GETPANELITEM, i, NULL); - if (size > buf.size()) - buf.resize(size); - size = g_far.Control(h_panel, FCTL_GETPANELITEM, i, reinterpret_cast(buf.data())); - assert(size); - const PluginPanelItem* panel_item = reinterpret_cast(buf.data()); - if (file_name == upcase(panel_item->FindData.lpwszFileName)) { - panel_ri.CurrentItem = i; - break; - } - } - if (i == panel_info.ItemsNumber) - return false; - if (!g_far.Control(h_panel, FCTL_REDRAWPANEL, 0, reinterpret_cast(&panel_ri))) - return false; - return true; -} - -DWORD get_lang_id() { - DWORD lang_id = 0; - wstring lang_key_path = add_trailing_slash(extract_file_path(g_far.RootKey)) + L"Language"; - Key lang_key; - if (!lang_key.open_nt(HKEY_CURRENT_USER, lang_key_path.c_str(), KEY_QUERY_VALUE, false)) - return lang_id; - wstring lang_name; - if (!lang_key.query_str_nt(lang_name, L"Main")) - return lang_id; - if (lang_name == L"English") lang_id = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT); - else if (lang_name == L"Russian") lang_id = MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT); - else if (lang_name == L"Czech") lang_id = MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT); - else if (lang_name == L"German") lang_id = MAKELANGID(LANG_GERMAN, SUBLANG_DEFAULT); - else if (lang_name == L"Hungarian") lang_id = MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT); - else if (lang_name == L"Polish") lang_id = MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT); - else if (lang_name == L"Spanish") lang_id = MAKELANGID(LANG_SPANISH, SUBLANG_DEFAULT); - return lang_id; -} - -}; diff --git a/common/farutils.hpp b/common/farutils.hpp deleted file mode 100644 index f7b38fc..0000000 --- a/common/farutils.hpp +++ /dev/null @@ -1,210 +0,0 @@ -#pragma once - -extern wstring get_error_dlg_title(); - -#define FAR_ERROR_HANDLER_BEGIN \ - try { \ - try { - -#define FAR_ERROR_HANDLER_END(return_error, return_cancel, silent) \ - } \ - catch (const Error& e) { \ - if (e.code == E_ABORT) { \ - return_cancel; \ - } \ - else { \ - if (!silent) \ - Far::error_dlg(get_error_dlg_title(), e); \ - return_error; \ - } \ - } \ - catch (const std::exception& e) { \ - if (!silent) \ - Far::error_dlg(get_error_dlg_title(), e); \ - return_error; \ - } \ - } \ - catch (...) { \ - return_error; \ - } - -namespace Far { - -void init(const PluginStartupInfo* psi); -wstring get_plugin_module_path(); -wstring get_root_key_name(); - -#define MAKE_VERSION(major, minor, build) (((major) << 24) | ((minor) << 16) | (build)) -#define VER_MAJOR(version) HIBYTE(HIWORD(version)) -#define VER_MINOR(version) LOBYTE(HIWORD(version)) -#define VER_BUILD(version) LOWORD(version) -unsigned get_version(); - -const wchar_t* msg_ptr(int id); -wstring get_msg(int id); - -unsigned get_optimal_msg_width(); -int message(const wstring& msg, int button_cnt, DWORD flags = 0); -int menu(const wstring& title, const vector& items, const wchar_t* help = NULL); - -wstring get_progress_bar_str(unsigned width, unsigned __int64 completed, unsigned __int64 total); -void set_progress_state(TBPFLAG state); -void set_progress_value(unsigned __int64 completed, unsigned __int64 total); -void progress_notify(); - -void call_user_apc(void* param); -void post_keys(const vector& keys, DWORD flags = 0); -void quit(); - -HANDLE save_screen(); -void restore_screen(HANDLE h_scr); -void flush_screen(); - -int viewer(const wstring& file_name, const wstring& title); - -void update_panel(HANDLE h_panel, bool keep_selection); -void set_view_mode(HANDLE h_panel, unsigned view_mode); -void set_sort_mode(HANDLE h_panel, unsigned sort_mode); -void set_reverse_sort(HANDLE h_panel, bool reverse_sort); -void set_numeric_sort(HANDLE h_panel, bool numeric_sort); -void set_directories_first(HANDLE h_panel, bool first); - -bool get_panel_info(HANDLE h_panel, PanelInfo& panel_info); -bool is_real_file_panel(const PanelInfo& panel_info); -wstring get_panel_dir(HANDLE h_panel); - -struct PanelItem { - DWORD file_attributes; - FILETIME creation_time; - FILETIME last_access_time; - FILETIME last_write_time; - unsigned __int64 file_size; - unsigned __int64 pack_size; - wstring file_name; - wstring alt_file_name; - DWORD_PTR user_data; -}; -PanelItem get_current_panel_item(HANDLE h_panel); - -void error_dlg(const wstring& title, const Error& e); -void info_dlg(const wstring& title, const wstring& msg); - -#define AUTO_SIZE (-1) -const unsigned c_x_frame = 5; -const unsigned c_y_frame = 2; - -struct DialogItem { - DialogItemTypes type; - unsigned x1; - unsigned y1; - unsigned x2; - unsigned y2; - DWORD flags; - bool focus; - bool default_button; - int selected; - unsigned history_idx; - unsigned mask_idx; - unsigned text_idx; - unsigned list_idx; - unsigned list_size; - unsigned list_pos; - DialogItem() { - memset(this, 0, sizeof(*this)); - } -}; - -class Dialog { -private: - unsigned client_xs; - unsigned client_ys; - unsigned x; - unsigned y; - const wchar_t* help; - vector values; - vector items; - HANDLE h_dlg; - unsigned new_value(const wstring& text); - const wchar_t* get_value(unsigned idx) const; - void frame(const wstring& text); - void calc_frame_size(); - unsigned new_item(const DialogItem& di); - static LONG_PTR WINAPI internal_dialog_proc(HANDLE h_dlg, int msg, int param1, LONG_PTR param2); -protected: - unsigned get_label_len(const wstring& str); - virtual LONG_PTR default_dialog_proc(int msg, int param1, LONG_PTR param2); - virtual LONG_PTR dialog_proc(int msg, int param1, LONG_PTR param2) { - return default_dialog_proc(msg, param1, param2); - } - void set_width(unsigned width) { - client_xs = width; - } - LONG_PTR send_message(int msg, int param1, LONG_PTR param2); -public: - Dialog(const wstring& title, unsigned width = 60, const wchar_t* help = NULL); - // create different controls - void new_line(); - void reset_line(); - void spacer(unsigned size); - void pad(unsigned pos); - unsigned separator(); - unsigned label(const wstring& text, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned edit_box(const wstring& text, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned mask_edit_box(const wstring& text, const wstring& mask, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned history_edit_box(const wstring& text, const wstring& history_name, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned fix_edit_box(const wstring& text, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned pwd_edit_box(const wstring& text, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - unsigned button(const wstring& text, DWORD flags = 0, bool def = false); - unsigned def_button(const wstring& text, DWORD flags = 0) { - return button(text, flags, true); - } - unsigned check_box(const wstring& text, int value, DWORD flags = 0); - unsigned check_box(const wstring& text, bool value, DWORD flags = 0) { - return check_box(text, value ? BSTATE_CHECKED : BSTATE_UNCHECKED, flags); - } - unsigned check_box3(const wstring& text, bool value, bool value_defined, DWORD flags = 0) { - return check_box(text, value_defined ? (value ? BSTATE_CHECKED : BSTATE_UNCHECKED) : BSTATE_3STATE, flags | DIF_3STATE); - } - unsigned radio_button(const wstring& text, bool value, DWORD flags = 0); - unsigned combo_box(const vector& items, unsigned sel_idx, unsigned boxsize = AUTO_SIZE, DWORD flags = 0); - // display dialog - int show(); - // utilities to set/get control values - wstring get_text(unsigned ctrl_id) const; - void set_text(unsigned ctrl_id, const wstring& text); - bool get_check(unsigned ctrl_id) const; - bool is_check_defined(unsigned ctrl_id) const; - void set_check(unsigned ctrl_id, bool check); - unsigned get_list_pos(unsigned ctrl_id) const; - void set_color(unsigned ctrl_id, unsigned char color); - void set_focus(unsigned ctrl_id); - void enable(unsigned ctrl_id, bool enable); - void set_visible(unsigned ctrl_id, bool visible); -}; - -class Regex: private NonCopyable { -private: - HANDLE h_regex; -public: - Regex(); - ~Regex(); - size_t search(const wstring& expr, const wstring& text); -}; - -class Selection { -private: - HANDLE h_plugin; -public: - Selection(HANDLE h_plugin); - ~Selection(); - void select(unsigned idx, bool value); -}; - -wstring get_absolute_path(const wstring& rel_path); -INT_PTR adv_control(int command, void* param = nullptr); -bool match_masks(const wstring& file_name, const wstring& masks); -unsigned char get_colors(PaletteColors color_id); -bool panel_go_to_file(HANDLE h_panel, const wstring& file_path); -DWORD get_lang_id(); - -}; diff --git a/common/iniparse.cpp b/common/iniparse.cpp deleted file mode 100644 index fc2f113..0000000 --- a/common/iniparse.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "utils.hpp" -#include "iniparse.hpp" - -namespace Ini { - -wstring File::get(const wstring& section_name, const wstring& key_name) { - const_iterator section_pos = find(section_name); - CHECK(section_pos != end()); - const Section& section = section_pos->second; - Section::const_iterator key_pos = section.find(key_name); - CHECK(key_pos != section.end()); - return key_pos->second; -} - -void File::parse(const wstring& text) { - clear(); - wstring section_name; - Section section; - size_t begin_pos = 0; - while (begin_pos < text.size()) { - size_t end_pos = text.find(L'\n', begin_pos); - if (end_pos == wstring::npos) - end_pos = text.size(); - else - end_pos++; - wstring line = strip(text.substr(begin_pos, end_pos - begin_pos)); - if ((line.size() > 2) && (line[0] == L'[') && (line[line.size() - 1] == L']')) { - // section header - if (!section.empty()) { - (*this)[section_name] = section; - section.clear(); - } - section_name = strip(line.substr(1, line.size() - 2)); - } - if ((line.size() > 0) && (line[0] == L';')) { - // comment - } - else { - size_t delim_pos = line.find(L'='); - if (delim_pos != wstring::npos) { - // name = value pair - wstring name = strip(line.substr(0, delim_pos)); - wstring value = strip(line.substr(delim_pos + 1, line.size() - delim_pos - 1)); - // remove quotes if needed - if ((value.size() >= 2) && (value[0] == L'"') && (value[value.size() - 1] == L'"')) - value = value.substr(1, value.size() - 2); - if (!name.empty() && !value.empty()) - section[name] = value; - } - } - begin_pos = end_pos; - } - if (!section.empty()) { - (*this)[section_name] = section; - } -} - -} diff --git a/common/iniparse.hpp b/common/iniparse.hpp deleted file mode 100644 index 5696918..0000000 --- a/common/iniparse.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -namespace Ini { - -typedef map Section; -class File: public map { -public: - wstring get(const wstring& section_name, const wstring& key_name); - void parse(const wstring& text); -}; - -} diff --git a/common/numutils.cpp b/common/numutils.cpp deleted file mode 100644 index 8c26c7a..0000000 --- a/common/numutils.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "utils.hpp" - -int round(double d) { - double a = fabs(d); - int res = static_cast(a); - double frac = a - res; - if (frac >= 0.5) - res++; - if (d >= 0) - return res; - else - return -res; -} diff --git a/common/pathutils.cpp b/common/pathutils.cpp deleted file mode 100644 index bf1e4d9..0000000 --- a/common/pathutils.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "utils.hpp" - -wstring long_path(const wstring& path) { - if (substr_match(path, 0, L"\\\\")) { - if (substr_match(path, 2, L"?\\") || substr_match(path, 2, L".\\")) { - return path; - } - else { - return wstring(path).replace(0, 1, L"\\\\?\\UNC"); - } - } - else { - return wstring(path).insert(0, L"\\\\?\\"); - } -} - -wstring add_trailing_slash(const wstring& path) { - if ((path.size() == 0) || (path[path.size() - 1] == L'\\')) { - return path; - } - else { - return path + L'\\'; - } -} - -wstring del_trailing_slash(const wstring& path) { - if ((path.size() < 2) || (path[path.size() - 1] != L'\\')) { - return path; - } - else { - return path.substr(0, path.size() - 1); - } -} - -void locate_path_root(const wstring& path, size_t& path_root_len, bool& is_unc_path) { - unsigned prefix_len = 0; - is_unc_path = false; - if (substr_match(path, 0, L"\\\\")) { - if (substr_match(path, 2, L"?\\UNC\\")) { - prefix_len = 8; - is_unc_path = true; - } - else if (substr_match(path, 2, L"?\\") || substr_match(path, 2, L".\\")) { - prefix_len = 4; - } - else { - prefix_len = 2; - is_unc_path = true; - } - } - if ((prefix_len == 0) && !substr_match(path, 1, L":")) { - path_root_len = 0; - } - else { - wstring::size_type p = path.find(L'\\', prefix_len); - if (p == wstring::npos) { - p = path.size(); - } - if (is_unc_path) { - p = path.find(L'\\', p + 1); - if (p == wstring::npos) { - p = path.size(); - } - } - path_root_len = p; - } -} - -wstring extract_path_root(const wstring& path) { - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - if (path_root_len) - return path.substr(0, path_root_len).append(1, L'\\'); - else - return wstring(); -} - -wstring extract_file_name(const wstring& path) { - size_t pos = path.rfind(L'\\'); - if (pos == wstring::npos) { - pos = 0; - } - else { - pos++; - } - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - if ((pos <= path_root_len) && (path_root_len != 0)) - return wstring(); - else - return path.substr(pos); -} - -wstring extract_file_path(const wstring& path) { - size_t pos = path.rfind(L'\\'); - if (pos == wstring::npos) { - pos = 0; - } - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - if ((pos <= path_root_len) && (path_root_len != 0)) - return path.substr(0, path_root_len).append(1, L'\\'); - else - return path.substr(0, pos); -} - -wstring extract_file_ext(const wstring& path) { - size_t ext_pos = path.rfind(L'.'); - if (ext_pos == wstring::npos) { - return wstring(); - } - size_t name_pos = path.rfind(L'\\'); - if (name_pos == wstring::npos) { - name_pos = 0; - } - else { - name_pos++; - } - if (ext_pos <= name_pos) - return wstring(); - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - if ((ext_pos <= path_root_len) && (path_root_len != 0)) - return wstring(); - else - return path.substr(ext_pos); -} - -bool is_root_path(const wstring& path) { - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - return (path.size() == path_root_len) || ((path.size() == path_root_len + 1) && (path[path.size() - 1] == L'\\')); -} - -bool is_unc_path(const wstring& path) { - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - return is_unc_path; -} - -bool is_absolute_path(const wstring& path) { - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - return path_root_len != 0; -} - -wstring remove_path_root(const wstring& path) { - size_t path_root_len; - bool is_unc_path; - locate_path_root(path, path_root_len, is_unc_path); - if ((path_root_len < path.size()) && (path[path_root_len] == L'\\')) - path_root_len++; - return path.substr(path_root_len); -} diff --git a/common/strutils.cpp b/common/strutils.cpp deleted file mode 100644 index 64b7dc5..0000000 --- a/common/strutils.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include "utils.hpp" - -bool substr_match(const wstring& str, wstring::size_type pos, wstring::const_pointer mstr) { - size_t mstr_len = wcslen(mstr); - if ((pos > str.length()) || (pos + mstr_len > str.length())) { - return false; - } - return wmemcmp(str.data() + pos, mstr, mstr_len) == 0; -} - -wstring word_wrap(const wstring& str, wstring::size_type wrap_bound) { - wstring result; - wstring::size_type begin_pos = 0; - while (begin_pos < str.size()) { - wstring::size_type end_pos = begin_pos + wrap_bound; - if (end_pos < str.size()) { - for (wstring::size_type i = end_pos; i > begin_pos; i--) { - if (str[i - 1] == L' ') { - end_pos = i; - break; - } - } - } - else { - end_pos = str.size(); - } - wstring::size_type trim_pos = end_pos; - while (trim_pos > begin_pos && str[trim_pos - 1] == L' ') trim_pos--; - if (trim_pos > begin_pos) { - if (!result.empty()) - result.append(1, L'\n'); - result.append(str.data() + begin_pos, trim_pos - begin_pos); - } - begin_pos = end_pos; - } - return result; -} - -wstring fit_str(const wstring& str, wstring::size_type size) { - if (str.size() <= size) - return str; - if (size <= 3) - return str.substr(0, size); - size -= 3; // place for ... - return wstring(str).replace(size / 2, str.size() - size, L"..."); -} - -wstring center(const wstring& str, unsigned width) { - if (str.size() >= width) - return str; - size_t lpad = (width - str.size()) / 2; - size_t rpad = width - str.size() - lpad; - wstring result(lpad, L' '); - result.append(str); - result.append(rpad, L' '); - return result; -} - -template basic_string strip(const basic_string& str) { - basic_string::size_type hp = 0; - basic_string::size_type tp = str.size(); - while ((hp < str.size()) && ((static_cast(str[hp]) <= 0x20) || (str[hp] == 0x7F))) - hp++; - if (hp < str.size()) - while ((static_cast(str[tp - 1]) <= 0x20) || (str[tp - 1] == 0x7F)) - tp--; - return str.substr(hp, tp - hp); -} - -string strip(const string& str) { - return strip(str); -} - -wstring strip(const wstring& str) { - return strip(str); -} - -int str_to_int(const string& str) { - return atoi(str.c_str()); -} - -int str_to_int(const wstring& str) { - return _wtoi(str.c_str()); -} - -wstring int_to_str(int val) { - wchar_t str[64]; - return _itow(val, str, 10); -} - -unsigned __int64 str_to_uint(const wstring& str) { - unsigned __int64 val = 0; - for (unsigned i = 0; i < str.size() && str[i] >= L'0' && str[i] <= L'9'; i++) { - val = val * 10 + (str[i] - L'0'); - } - return val; -} - -wstring uint_to_str(unsigned __int64 val) { - if (val == 0) - return L"0"; - wchar_t str[32]; - unsigned pos = ARRAYSIZE(str); - while (val) { - pos--; - str[pos] = val % 10 + L'0'; - val /= 10; - } - return wstring(str + pos, ARRAYSIZE(str) - pos); -} - -wstring widen(const string& str) { - return wstring(str.begin(), str.end()); -} - -list split(const wstring& str, wchar_t sep) { - list result; - size_t begin = 0; - while (begin < str.size()) { - size_t end = str.find(sep, begin); - if (end == wstring::npos) - end = str.size(); - wstring sub_str = str.substr(begin, end - begin); - result.push_back(sub_str); - begin = end + 1; - } - return result; -} - -wstring combine(const list& lst, wchar_t sep) { - size_t size = 0; - for (list::const_iterator str = lst.begin(); str != lst.end(); str++) { - if (size) - size++; - size += str->size(); - } - wstring result; - result.reserve(size); - for (list::const_iterator str = lst.begin(); str != lst.end(); str++) { - if (!result.empty()) - result.append(1, sep); - result.append(*str); - } - return result; -} - -wstring format_data_size(unsigned __int64 value, const wchar_t* suffixes[5]) { - unsigned f = 0; - unsigned __int64 div = 1; - while ((value / div >= 1000) && (f < 4)) { - f++; - div *= 1024; - } - unsigned __int64 v1 = value / div; - - unsigned __int64 mul; - if (v1 < 10) mul = 100; - else if (v1 < 100) mul = 10; - else mul = 1; - - unsigned __int64 v2 = value % div; - unsigned __int64 d = v2 * mul * 10 / div % 10; - v2 = v2 * mul / div; - if (d >= 5) { - if (v2 + 1 == mul) { - v2 = 0; - if ((v1 == 999) && (f < 4)) { - v1 = 0; - v2 = 98; - f += 1; - } - else v1 += 1; - } - else v2 += 1; - } - - wstring result; - wchar_t buf[30]; - _ui64tow_s(v1, buf, ARRAYSIZE(buf), 10); - result += buf; - if (v2 != 0) { - result += L'.'; - if ((v1 < 10) && (v2 < 10)) result += L'0'; - _ui64tow_s(v2, buf, ARRAYSIZE(buf), 10); - result += buf; - } - if (*suffixes[f]) { - result += L' '; - result += suffixes[f]; - } - return result; -} - -bool is_slash(wchar_t c) { - return c == L'\\' || c == L'/'; -} - -wstring unquote(const wstring& str) { - if (str.size() >= 2 && str[0] == L'"' && str[str.size() - 1] == L'"') - return str.substr(1, str.size() - 2); - else - return str; -} diff --git a/common/sysutils.cpp b/common/sysutils.cpp deleted file mode 100644 index ee21351..0000000 --- a/common/sysutils.cpp +++ /dev/null @@ -1,582 +0,0 @@ -#include "utils.hpp" -#include "sysutils.hpp" - -HINSTANCE g_h_instance = nullptr; - -wstring get_system_message(HRESULT hr, DWORD lang_id) { - wostringstream st; - wchar_t* sys_msg; - DWORD len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, hr, lang_id, reinterpret_cast(&sys_msg), 0, nullptr); - if (!len && lang_id && GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND) - len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, hr, 0, reinterpret_cast(&sys_msg), 0, nullptr); - if (!len) { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) { - HMODULE h_winhttp = GetModuleHandle("winhttp"); - if (h_winhttp) { - len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS, h_winhttp, HRESULT_CODE(hr), lang_id, reinterpret_cast(&sys_msg), 0, nullptr); - if (!len && lang_id && GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND) - len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS, h_winhttp, HRESULT_CODE(hr), 0, reinterpret_cast(&sys_msg), 0, nullptr); - } - } - } - if (len) { - wstring message; - try { - message = sys_msg; - } - catch (...) { - LocalFree(static_cast(sys_msg)); - throw; - } - LocalFree(static_cast(sys_msg)); - st << strip(message) << L" (0x" << hex << uppercase << setw(8) << setfill(L'0') << hr << L")"; - } - else { - st << L"HRESULT: 0x" << hex << uppercase << setw(8) << setfill(L'0') << hr; - } - return st.str(); -} - -wstring get_console_title() { - Buffer buf(10000); - DWORD size = GetConsoleTitleW(buf.data(), static_cast(buf.size())); - return wstring(buf.data(), size); -} - -bool wait_for_single_object(HANDLE handle, DWORD timeout) { - DWORD res = WaitForSingleObject(handle, timeout); - CHECK_SYS(res != WAIT_FAILED); - if (res == WAIT_OBJECT_0) - return true; - else if (res == WAIT_TIMEOUT) - return false; - else - FAIL(E_FAIL); -} - -wstring ansi_to_unicode(const string& str, unsigned code_page) { - unsigned str_size = static_cast(str.size()); - if (str_size == 0) - return wstring(); - int size = MultiByteToWideChar(code_page, 0, str.data(), str_size, nullptr, 0); - Buffer out(size); - size = MultiByteToWideChar(code_page, 0, str.data(), str_size, out.data(), size); - CHECK_SYS(size); - return wstring(out.data(), size); -} - -string unicode_to_ansi(const wstring& str, unsigned code_page) { - unsigned str_size = static_cast(str.size()); - if (str_size == 0) - return string(); - int size = WideCharToMultiByte(code_page, 0, str.data(), str_size, nullptr, 0, nullptr, nullptr); - Buffer out(size); - size = WideCharToMultiByte(code_page, 0, str.data(), str_size, out.data(), size, nullptr, nullptr); - CHECK_SYS(size); - return string(out.data(), size); -} - -wstring expand_env_vars(const wstring& str) { - Buffer buf(MAX_PATH); - unsigned size = ExpandEnvironmentStringsW(str.c_str(), buf.data(), static_cast(buf.size())); - if (size > buf.size()) { - buf.resize(size); - size = ExpandEnvironmentStringsW(str.c_str(), buf.data(), static_cast(buf.size())); - } - CHECK_SYS(size); - return wstring(buf.data(), size - 1); -} - -wstring get_full_path_name(const wstring& path) { - Buffer buf(MAX_PATH); - DWORD size = GetFullPathNameW(path.c_str(), static_cast(buf.size()), buf.data(), nullptr); - if (size > buf.size()) { - buf.resize(size); - size = GetFullPathNameW(path.c_str(), static_cast(buf.size()), buf.data(), nullptr); - } - CHECK_SYS(size); - return wstring(buf.data(), size); -} - -wstring get_current_directory() { - Buffer buf(MAX_PATH); - DWORD size = GetCurrentDirectoryW(static_cast(buf.size()), buf.data()); - if (size > buf.size()) { - buf.resize(size); - size = GetCurrentDirectoryW(static_cast(buf.size()), buf.data()); - } - CHECK_SYS(size); - return wstring(buf.data(), size); -} - -File::File(): h_file(INVALID_HANDLE_VALUE) { -} - -File::~File() { - close(); -} - -File::File(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD dlags_and_attributes): h_file(INVALID_HANDLE_VALUE) { - open(file_path, desired_access, share_mode, creation_disposition, dlags_and_attributes); -} - -void File::open(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD dlags_and_attributes) { - CHECK_SYS(open_nt(file_path, desired_access, share_mode, creation_disposition, dlags_and_attributes)); -} - -bool File::open_nt(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD flags_and_attributes) { - close(); - h_file = CreateFileW(long_path(file_path).c_str(), desired_access, share_mode, nullptr, creation_disposition, flags_and_attributes, nullptr); - return h_file != INVALID_HANDLE_VALUE; -} - -void File::close() { - if (h_file != INVALID_HANDLE_VALUE) { - CloseHandle(h_file); - h_file = INVALID_HANDLE_VALUE; - } -} - -HANDLE File::handle() const { - return h_file; -} - -unsigned __int64 File::size() { - unsigned __int64 file_size; - CHECK_SYS(size_nt(file_size)); - return file_size; -} - -bool File::size_nt(unsigned __int64& file_size) { - LARGE_INTEGER fs; - if (GetFileSizeEx(h_file, &fs)) { - file_size = fs.QuadPart; - return true; - } - else - return false; -} - -unsigned File::read(void* data, unsigned size) { - unsigned size_read; - CHECK_SYS(read_nt(data, size, size_read)); - return size_read; -} - -bool File::read_nt(void* data, unsigned size, unsigned& size_read) { - DWORD sz; - if (ReadFile(h_file, data, size, &sz, nullptr)) { - size_read = sz; - return true; - } - else - return false; -} - -unsigned File::write(const void* data, unsigned size) { - unsigned size_written; - CHECK_SYS(write_nt(data, size, size_written)); - return size_written; -} - -bool File::write_nt(const void* data, unsigned size, unsigned& size_written) { - DWORD sz; - if (WriteFile(h_file, data, size, &sz, nullptr)) { - size_written = sz; - return true; - } - else - return false; -} - -void File::set_time(const FILETIME& ctime, const FILETIME& atime, const FILETIME& mtime) { - CHECK_SYS(set_time_nt(ctime, atime, mtime)); -}; - -bool File::set_time_nt(const FILETIME& ctime, const FILETIME& atime, const FILETIME& mtime) { - return SetFileTime(h_file, &ctime, &atime, &mtime) != 0; -}; - -unsigned __int64 File::set_pos(__int64 offset, DWORD method) { - unsigned __int64 new_pos; - CHECK_SYS(set_pos_nt(offset, method, &new_pos)); - return new_pos; -} - -bool File::set_pos_nt(__int64 offset, DWORD method, unsigned __int64* new_pos) { - LARGE_INTEGER distance_to_move, new_file_pointer; - distance_to_move.QuadPart = offset; - if (!SetFilePointerEx(h_file, distance_to_move, &new_file_pointer, method)) - return false; - if (new_pos) - *new_pos = new_file_pointer.QuadPart; - return true; -} - -void File::set_end() { - CHECK_SYS(set_end_nt()); -} - -bool File::set_end_nt() { - return SetEndOfFile(h_file) != 0; -} - -void Key::close() { - if (h_key) { - RegCloseKey(h_key); - h_key = nullptr; - } -} - -Key::Key(): h_key(nullptr) { -} - -Key::~Key() { - close(); -} - -Key::Key(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create) { - open(h_parent, sub_key, sam_desired, create); -} - -Key& Key::open(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create) { - close(); - CHECK_SYS(open_nt(h_parent, sub_key, sam_desired, create)); - return *this; -} - -bool Key::open_nt(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create) { - close(); - LONG res; - if (create) - res = RegCreateKeyExW(h_parent, sub_key, 0, nullptr, REG_OPTION_NON_VOLATILE, sam_desired, nullptr, &h_key, nullptr); - else - res = RegOpenKeyExW(h_parent, sub_key, 0, sam_desired, &h_key); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - return true; -} - -bool Key::query_bool(const wchar_t* name) { - bool value; - CHECK_SYS(query_bool_nt(value, name)); - return value; -} - -bool Key::query_bool_nt(bool& value, const wchar_t* name) { - DWORD type = REG_DWORD; - DWORD data; - DWORD data_size = sizeof(data); - LONG res = RegQueryValueExW(h_key, name, nullptr, &type, reinterpret_cast(&data), &data_size); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - value = data != 0; - return true; -} - -unsigned Key::query_int(const wchar_t* name) { - unsigned value; - CHECK_SYS(query_int_nt(value, name)); - return value; -} - -bool Key::query_int_nt(unsigned& value, const wchar_t* name) { - DWORD type = REG_DWORD; - DWORD data; - DWORD data_size = sizeof(data); - LONG res = RegQueryValueExW(h_key, name, nullptr, &type, reinterpret_cast(&data), &data_size); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - value = data; - return true; -} - -wstring Key::query_str(const wchar_t* name) { - wstring value; - CHECK_SYS(query_str_nt(value, name)); - return value; -} - -bool Key::query_str_nt(wstring& value, const wchar_t* name) { - DWORD type = REG_SZ; - DWORD data_size; - LONG res = RegQueryValueExW(h_key, name, nullptr, &type, nullptr, &data_size); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - Buffer buf(data_size / sizeof(wchar_t)); - res = RegQueryValueExW(h_key, name, nullptr, &type, reinterpret_cast(buf.data()), &data_size); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - value.assign(buf.data(), buf.size() - 1); - return true; -} - -void Key::set_bool(const wchar_t* name, bool value) { - CHECK_SYS(set_bool_nt(name, value)); -} - -bool Key::set_bool_nt(const wchar_t* name, bool value) { - DWORD data = value ? 1 : 0; - LONG res = RegSetValueExW(h_key, name, 0, REG_DWORD, reinterpret_cast(&data), sizeof(data)); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - return true; -} - -void Key::set_int(const wchar_t* name, unsigned value) { - CHECK_SYS(set_int_nt(name, value)); -} - -bool Key::set_int_nt(const wchar_t* name, unsigned value) { - DWORD data = value; - LONG res = RegSetValueExW(h_key, name, 0, REG_DWORD, reinterpret_cast(&data), sizeof(data)); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - return true; -} - -void Key::set_str(const wchar_t* name, const wstring& value) { - CHECK_SYS(set_str_nt(name, value)); -} - -bool Key::set_str_nt(const wchar_t* name, const wstring& value) { - LONG res = RegSetValueExW(h_key, name, 0, REG_SZ, reinterpret_cast(const_cast(value.c_str())), (static_cast(value.size()) + 1) * sizeof(wchar_t)); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - return true; -} - -void Key::delete_value(const wchar_t* name) { - CHECK_SYS(delete_value_nt(name)); -} - -bool Key::delete_value_nt(const wchar_t* name) { - LONG res = RegDeleteValueW(h_key, name); - if (res != ERROR_SUCCESS) { - SetLastError(res); - return false; - } - return true; -} - -FileEnum::FileEnum(const wstring& dir_path): dir_path(dir_path), h_find(INVALID_HANDLE_VALUE) { -} - -FileEnum::~FileEnum() { - if (h_find != INVALID_HANDLE_VALUE) - FindClose(h_find); -} - -bool FileEnum::next() { - bool more; - CHECK_SYS(next_nt(more)); - return more; -} - -bool FileEnum::next_nt(bool& more) { - while (true) { - if (h_find == INVALID_HANDLE_VALUE) { - h_find = FindFirstFileW(long_path(add_trailing_slash(dir_path) + L'*').c_str(), &find_data); - if (h_find == INVALID_HANDLE_VALUE) - return false; - } - else { - if (!FindNextFileW(h_find, &find_data)) { - if (GetLastError() == ERROR_NO_MORE_FILES) { - more = false; - return true; - } - return false; - } - } - if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - if ((find_data.cFileName[0] == L'.') && ((find_data.cFileName[1] == 0) || ((find_data.cFileName[1] == L'.') && (find_data.cFileName[2] == 0)))) - continue; - } - more = true; - return true; - } -} - -FindData get_find_data(const wstring& path) { - FindData find_data; - HANDLE h_find = FindFirstFileW(long_path(path).c_str(), &find_data); - CHECK_SYS(h_find != INVALID_HANDLE_VALUE); - FindClose(h_find); - return find_data; -} - -TempFile::TempFile() { - Buffer buf(MAX_PATH); - DWORD len = GetTempPathW(static_cast(buf.size()), buf.data()); - CHECK(len <= buf.size()); - CHECK_SYS(len); - wstring temp_path = wstring(buf.data(), len); - CHECK_SYS(GetTempFileNameW(temp_path.c_str(), L"", 0, buf.data())); - path.assign(buf.data()); -} - -TempFile::~TempFile() { - DeleteFileW(path.c_str()); -} - -unsigned __stdcall Thread::thread_proc(void* arg) { - Thread* thread = reinterpret_cast(arg); - try { - try { - thread->run(); - return TRUE; - } - catch (const Error& e) { - thread->error = e; - } - catch (const std::exception& e) { - thread->error = e; - } - } - catch (...) { - thread->error.code = E_FAIL; - } - return FALSE; -} - -Thread::Thread(): h_thread(nullptr) { -} - -Thread::~Thread() { - if (h_thread) { - wait(INFINITE); - CloseHandle(h_thread); - } -} - -void Thread::start() { - unsigned th_id; - h_thread = reinterpret_cast(_beginthreadex(nullptr, 0, thread_proc, this, 0, &th_id)); - CHECK_SYS(h_thread); -} - -bool Thread::wait(unsigned wait_time) { - return wait_for_single_object(h_thread, wait_time); -} - -bool Thread::get_result() { - DWORD exit_code; - CHECK_SYS(GetExitCodeThread(h_thread, &exit_code)); - return exit_code == TRUE ? true : false; -} - -Event::Event(bool manual_reset, bool initial_state) { - h_event = CreateEvent(nullptr, manual_reset, initial_state, nullptr); - CHECK_SYS(h_event); -} - -Event::~Event() { - CloseHandle(h_event); -} - -void Event::set() { - CHECK_SYS(SetEvent(h_event)); -} - -WindowClass::WindowClass(const wstring& name, WindowProc window_proc): name(name) { - WNDCLASSW wndclass; - memset(&wndclass, 0, sizeof(wndclass)); - wndclass.lpfnWndProc = window_proc; - wndclass.cbWndExtra = sizeof(this); - wndclass.hInstance = g_h_instance; - wndclass.lpszClassName = name.c_str(); - CHECK_SYS(RegisterClassW(&wndclass)); -} - -WindowClass::~WindowClass() { - UnregisterClassW(name.c_str(), nullptr); -} - -LRESULT CALLBACK MessageWindow::message_window_proc(HWND h_wnd, UINT msg, WPARAM w_param, LPARAM l_param) { - try { - MessageWindow* message_window = reinterpret_cast(GetWindowLongPtrW(h_wnd, 0)); - if (message_window) return message_window->window_proc(msg, w_param, l_param); - } - catch (...) { - } - return DefWindowProcW(h_wnd, msg, w_param, l_param); -} - -MessageWindow::MessageWindow(const wstring& name): WindowClass(name, message_window_proc) { - h_wnd = CreateWindowW(name.c_str(), name.c_str(), 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, g_h_instance, this); - CHECK_SYS(h_wnd); - SetWindowLongPtrW(h_wnd, 0, reinterpret_cast(this)); -} - -MessageWindow::~MessageWindow() { - SetWindowLongPtrW(h_wnd, 0, 0); - DestroyWindow(h_wnd); -} - -unsigned MessageWindow::message_loop(HANDLE h_abort) { - while (true) { - DWORD res = MsgWaitForMultipleObjects(1, &h_abort, FALSE, INFINITE, QS_POSTMESSAGE | QS_SENDMESSAGE); - CHECK_SYS(res != WAIT_FAILED); - if (res == WAIT_OBJECT_0) { - FAIL(E_ABORT); - } - else if (res == WAIT_OBJECT_0 + 1) { - MSG msg; - while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { - if (msg.message == WM_QUIT) - return static_cast(msg.wParam); - } - } - else FAIL(E_FAIL); - } -} - -void MessageWindow::end_message_loop(unsigned result) { - PostQuitMessage(result); -} - -Icon::Icon(HMODULE h_module, WORD icon_id, int width, int height) { - h_icon = static_cast(LoadImage(h_module, MAKEINTRESOURCE(icon_id), IMAGE_ICON, width, height, LR_DEFAULTCOLOR)); - CHECK_SYS(h_icon); -} - -Icon::~Icon() { - DestroyIcon(h_icon); -} - -wstring format_file_time(const FILETIME& file_time) { - FILETIME local_ft; - CHECK_SYS(FileTimeToLocalFileTime(&file_time, &local_ft)); - SYSTEMTIME st; - CHECK_SYS(FileTimeToSystemTime(&local_ft, &st)); - Buffer buf(1024); - CHECK_SYS(GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, buf.data(), static_cast(buf.size()))); - wstring date_str = buf.data(); - CHECK_SYS(GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, nullptr, buf.data(), static_cast(buf.size()))); - wstring time_str = buf.data(); - return date_str + L' ' + time_str; -} - -wstring upcase(const wstring& str) { - Buffer up_str(str.size()); - wmemcpy(up_str.data(), str.data(), str.size()); - CharUpperBuffW(up_str.data(), static_cast(up_str.size())); - return wstring(up_str.data(), up_str.size()); -} diff --git a/common/sysutils.hpp b/common/sysutils.hpp deleted file mode 100644 index 68cc386..0000000 --- a/common/sysutils.hpp +++ /dev/null @@ -1,193 +0,0 @@ -#pragma once - -#define nullptr NULL - -#ifdef DEBUG - #define DEBUG_OUTPUT(msg) OutputDebugStringW(((msg) + L"\n").c_str()) -#else - #define DEBUG_OUTPUT(msg) -#endif - -extern HINSTANCE g_h_instance; - -wstring get_system_message(HRESULT hr, DWORD lang_id = 0); -wstring get_console_title(); -bool wait_for_single_object(HANDLE handle, DWORD timeout); -wstring ansi_to_unicode(const string& str, unsigned code_page); -string unicode_to_ansi(const wstring& str, unsigned code_page); -wstring expand_env_vars(const wstring& str); -wstring get_full_path_name(const wstring& path); -wstring get_current_directory(); - -class CriticalSection: private NonCopyable, private CRITICAL_SECTION { -public: - CriticalSection() { - InitializeCriticalSection(this); - } - virtual ~CriticalSection() { - DeleteCriticalSection(this); - } - friend class CriticalSectionLock; -}; - -class CriticalSectionLock: private NonCopyable { -private: - CriticalSection& cs; -public: - CriticalSectionLock(CriticalSection& cs): cs(cs) { - EnterCriticalSection(&cs); - } - ~CriticalSectionLock() { - LeaveCriticalSection(&cs); - } -}; - -class File: private NonCopyable { -protected: - HANDLE h_file; -public: - File() throw(); - ~File() throw(); - File(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD flags_and_attributes); - void open(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD flags_and_attributes); - bool open_nt(const wstring& file_path, DWORD desired_access, DWORD share_mode, DWORD creation_disposition, DWORD flags_and_attributes) throw(); - void close() throw(); - HANDLE handle() const throw(); - unsigned __int64 size(); - bool size_nt(unsigned __int64& file_size) throw(); - unsigned read(void* data, unsigned size); - bool read_nt(void* data, unsigned size, unsigned& size_read) throw(); - unsigned write(const void* data, unsigned size); - bool write_nt(const void* data, unsigned size, unsigned& size_written) throw(); - void set_time(const FILETIME& ctime, const FILETIME& atime, const FILETIME& mtime); - bool set_time_nt(const FILETIME& ctime, const FILETIME& atime, const FILETIME& mtime) throw(); - unsigned __int64 set_pos(__int64 offset, DWORD method = FILE_BEGIN); - bool set_pos_nt(__int64 offset, DWORD method = FILE_BEGIN, unsigned __int64* new_pos = nullptr); - void set_end(); - bool set_end_nt(); -}; - -class Key: private NonCopyable { -protected: - HKEY h_key; -public: - Key() throw(); - ~Key() throw(); - Key(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create); - Key& open(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create); - bool open_nt(HKEY h_parent, LPCWSTR sub_key, REGSAM sam_desired, bool create) throw(); - void close() throw(); - HKEY handle() const throw(); - bool query_bool(const wchar_t* name); - bool query_bool_nt(bool& value, const wchar_t* name) throw(); - unsigned query_int(const wchar_t* name); - bool query_int_nt(unsigned& value, const wchar_t* name) throw(); - wstring query_str(const wchar_t* name); - bool query_str_nt(wstring& value, const wchar_t* name) throw(); - void set_bool(const wchar_t* name, bool value); - bool set_bool_nt(const wchar_t* name, bool value) throw(); - void set_int(const wchar_t* name, unsigned value); - bool set_int_nt(const wchar_t* name, unsigned value) throw(); - void set_str(const wchar_t* name, const wstring& value); - bool set_str_nt(const wchar_t* name, const wstring& value) throw(); - void delete_value(const wchar_t* name); - bool delete_value_nt(const wchar_t* name) throw(); -}; - -struct FindData: public WIN32_FIND_DATAW { - bool is_dir() const { - return (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; - } - unsigned __int64 size() const { - return (static_cast(nFileSizeHigh) << 32) | nFileSizeLow; - } -}; - -class FileEnum: private NonCopyable { -protected: - wstring dir_path; - HANDLE h_find; - FindData find_data; -public: - FileEnum(const wstring& dir_path) throw(); - ~FileEnum() throw(); - bool next(); - bool next_nt(bool& more) throw(); - const FindData& data() const { - return find_data; - } -}; - -FindData get_find_data(const wstring& path); - -class TempFile: private NonCopyable { -private: - wstring path; -public: - TempFile(); - ~TempFile(); - wstring get_path() const { - return path; - } -}; - -class Thread: private NonCopyable { -private: - Error error; - static unsigned __stdcall thread_proc(void* arg); -protected: - HANDLE h_thread; - virtual void run() = 0; -public: - Thread(); - virtual ~Thread(); - void start(); - bool wait(unsigned wait_time); - bool get_result(); - Error get_error() { - return error; - } -}; - -class Event: private NonCopyable { -protected: - HANDLE h_event; -public: - Event(bool manual_reset, bool initial_state); - ~Event(); - void set(); -}; - -typedef LRESULT (CALLBACK *WindowProc)(HWND h_wnd, UINT msg, WPARAM w_param, LPARAM l_param); - -class WindowClass: private NonCopyable { -protected: - wstring name; -public: - WindowClass(const wstring& name, WindowProc window_proc); - virtual ~WindowClass(); -}; - -class MessageWindow: public WindowClass { -private: - static LRESULT CALLBACK message_window_proc(HWND h_wnd, UINT msg, WPARAM w_param, LPARAM l_param); -protected: - HWND h_wnd; - virtual LRESULT window_proc(UINT msg, WPARAM w_param, LPARAM l_param) = 0; - void end_message_loop(unsigned result); -public: - MessageWindow(const wstring& name); - virtual ~MessageWindow(); - unsigned message_loop(HANDLE h_abort); -}; - -class Icon: private NonCopyable { -protected: - HICON h_icon; -public: - Icon(HMODULE h_module, WORD icon_id, int width, int height); - ~Icon(); -}; - -wstring format_file_time(const FILETIME& file_time); -wstring upcase(const wstring& str); diff --git a/common/utils.hpp b/common/utils.hpp deleted file mode 100644 index 5a672b4..0000000 --- a/common/utils.hpp +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include "error.hpp" - -bool substr_match(const wstring& str, wstring::size_type pos, wstring::const_pointer mstr); -wstring word_wrap(const wstring& str, wstring::size_type wrap_bound); -wstring fit_str(const wstring& str, wstring::size_type size); -wstring center(const wstring& str, unsigned width); -string strip(const string& str); -wstring strip(const wstring& str); -int str_to_int(const string& str); -int str_to_int(const wstring& str); -wstring int_to_str(int val); -unsigned __int64 str_to_uint(const wstring& str); -wstring uint_to_str(unsigned __int64 val); -wstring widen(const string& str); -list split(const wstring& str, wchar_t sep); -wstring combine(const list& lst, wchar_t sep); -wstring format_data_size(unsigned __int64 value, const wchar_t* suffixes[5]); -bool is_slash(wchar_t c); -wstring unquote(const wstring& str); - -wstring long_path(const wstring& path); - -wstring add_trailing_slash(const wstring& path); -wstring del_trailing_slash(const wstring& path); - -wstring extract_path_root(const wstring& path); -wstring extract_file_name(const wstring& path); -wstring extract_file_path(const wstring& path); -wstring extract_file_ext(const wstring& path); -bool is_root_path(const wstring& path); -bool is_unc_path(const wstring& path); -bool is_absolute_path(const wstring& path); -wstring remove_path_root(const wstring& path); - -int round(double d); - -class NonCopyable { -protected: - NonCopyable() {} - ~NonCopyable() {} -private: - NonCopyable(const NonCopyable&); - NonCopyable& operator=(const NonCopyable&); -}; - -template class Buffer: private NonCopyable { -private: - Type* buffer; - size_t buf_size; -public: - Buffer(): buffer(nullptr), buf_size(0) { - } - Buffer(size_t size) { - buffer = new Type[size]; - buf_size = size; - } - ~Buffer() { - delete[] buffer; - } - void resize(size_t size) { - delete[] buffer; - buffer = new Type[size]; - buf_size = size; - } - Type* data() { - return buffer; - } - size_t size() const { - return buf_size; - } - void clear() { - memset(buffer, 0, buf_size * sizeof(Type)); - } -}; diff --git a/farsdk/ansi/farcolor.hpp b/farsdk/ansi/farcolor.hpp deleted file mode 100644 index eedfbe7..0000000 --- a/farsdk/ansi/farcolor.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef __COLORS_HPP__ -#define __COLORS_HPP__ -/* - farcolor.hpp - - Colors Index for FAR Manager 1.75 build 2631 - HKCU\Software\Far\Colors\CurrentPalette - - Copyright (c) 1996-2000 Eugene Roshal - Copyrigth (c) 2000-2010 FAR group -*/ - - -enum PaletteColors -{ - COL_MENUTEXT, - COL_MENUSELECTEDTEXT, - COL_MENUHIGHLIGHT, - COL_MENUSELECTEDHIGHLIGHT, - COL_MENUBOX, - COL_MENUTITLE, - - COL_HMENUTEXT, - COL_HMENUSELECTEDTEXT, - COL_HMENUHIGHLIGHT, - COL_HMENUSELECTEDHIGHLIGHT, - - COL_PANELTEXT, - COL_PANELSELECTEDTEXT, - COL_PANELHIGHLIGHTTEXT, - COL_PANELINFOTEXT, - COL_PANELCURSOR, - COL_PANELSELECTEDCURSOR, - COL_PANELTITLE, - COL_PANELSELECTEDTITLE, - COL_PANELCOLUMNTITLE, - COL_PANELTOTALINFO, - COL_PANELSELECTEDINFO, - - COL_DIALOGTEXT, - COL_DIALOGHIGHLIGHTTEXT, - COL_DIALOGBOX, - COL_DIALOGBOXTITLE, - COL_DIALOGHIGHLIGHTBOXTITLE, - COL_DIALOGEDIT, - COL_DIALOGBUTTON, - COL_DIALOGSELECTEDBUTTON, - COL_DIALOGHIGHLIGHTBUTTON, - COL_DIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_DIALOGLISTTEXT, - COL_DIALOGLISTSELECTEDTEXT, - COL_DIALOGLISTHIGHLIGHT, - COL_DIALOGLISTSELECTEDHIGHLIGHT, - - COL_WARNDIALOGTEXT, - COL_WARNDIALOGHIGHLIGHTTEXT, - COL_WARNDIALOGBOX, - COL_WARNDIALOGBOXTITLE, - COL_WARNDIALOGHIGHLIGHTBOXTITLE, - COL_WARNDIALOGEDIT, - COL_WARNDIALOGBUTTON, - COL_WARNDIALOGSELECTEDBUTTON, - COL_WARNDIALOGHIGHLIGHTBUTTON, - COL_WARNDIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_KEYBARNUM, - COL_KEYBARTEXT, - COL_KEYBARBACKGROUND, - - COL_COMMANDLINE, - - COL_CLOCK, - - COL_VIEWERTEXT, - COL_VIEWERSELECTEDTEXT, - COL_VIEWERSTATUS, - - COL_EDITORTEXT, - COL_EDITORSELECTEDTEXT, - COL_EDITORSTATUS, - - COL_HELPTEXT, - COL_HELPHIGHLIGHTTEXT, - COL_HELPTOPIC, - COL_HELPSELECTEDTOPIC, - COL_HELPBOX, - COL_HELPBOXTITLE, - - COL_PANELDRAGTEXT, - COL_DIALOGEDITUNCHANGED, - COL_PANELSCROLLBAR, - COL_HELPSCROLLBAR, - COL_PANELBOX, - COL_PANELSCREENSNUMBER, - COL_DIALOGEDITSELECTED, - COL_COMMANDLINESELECTED, - COL_VIEWERARROWS, - - COL_RESERVED0, - - COL_DIALOGLISTSCROLLBAR, - COL_MENUSCROLLBAR, - COL_VIEWERSCROLLBAR, - COL_COMMANDLINEPREFIX, - COL_DIALOGDISABLED, - COL_DIALOGEDITDISABLED, - COL_DIALOGLISTDISABLED, - COL_WARNDIALOGDISABLED, - COL_WARNDIALOGEDITDISABLED, - COL_WARNDIALOGLISTDISABLED, - - COL_MENUDISABLEDTEXT, - - COL_EDITORCLOCK, - COL_VIEWERCLOCK, - - COL_DIALOGLISTTITLE, - COL_DIALOGLISTBOX, - - COL_WARNDIALOGEDITSELECTED, - COL_WARNDIALOGEDITUNCHANGED, - - COL_DIALOGCOMBOTEXT, - COL_DIALOGCOMBOSELECTEDTEXT, - COL_DIALOGCOMBOHIGHLIGHT, - COL_DIALOGCOMBOSELECTEDHIGHLIGHT, - COL_DIALOGCOMBOBOX, - COL_DIALOGCOMBOTITLE, - COL_DIALOGCOMBODISABLED, - COL_DIALOGCOMBOSCROLLBAR, - - COL_WARNDIALOGLISTTEXT, - COL_WARNDIALOGLISTSELECTEDTEXT, - COL_WARNDIALOGLISTHIGHLIGHT, - COL_WARNDIALOGLISTSELECTEDHIGHLIGHT, - COL_WARNDIALOGLISTBOX, - COL_WARNDIALOGLISTTITLE, - COL_WARNDIALOGLISTSCROLLBAR, - - COL_WARNDIALOGCOMBOTEXT, - COL_WARNDIALOGCOMBOSELECTEDTEXT, - COL_WARNDIALOGCOMBOHIGHLIGHT, - COL_WARNDIALOGCOMBOSELECTEDHIGHLIGHT, - COL_WARNDIALOGCOMBOBOX, - COL_WARNDIALOGCOMBOTITLE, - COL_WARNDIALOGCOMBODISABLED, - COL_WARNDIALOGCOMBOSCROLLBAR, - - COL_DIALOGLISTARROWS, - COL_DIALOGLISTARROWSDISABLED, - COL_DIALOGLISTARROWSSELECTED, - COL_DIALOGCOMBOARROWS, - COL_DIALOGCOMBOARROWSDISABLED, - COL_DIALOGCOMBOARROWSSELECTED, - COL_WARNDIALOGLISTARROWS, - COL_WARNDIALOGLISTARROWSDISABLED, - COL_WARNDIALOGLISTARROWSSELECTED, - COL_WARNDIALOGCOMBOARROWS, - COL_WARNDIALOGCOMBOARROWSDISABLED, - COL_WARNDIALOGCOMBOARROWSSELECTED, - COL_MENUARROWS, - COL_MENUARROWSDISABLED, - COL_MENUARROWSSELECTED, - COL_COMMANDLINEUSERSCREEN, - COL_EDITORSCROLLBAR, - - COL_MENUGRAYTEXT, - COL_MENUSELECTEDGRAYTEXT, - COL_DIALOGCOMBOGRAY, - COL_DIALOGCOMBOSELECTEDGRAYTEXT, - COL_DIALOGLISTGRAY, - COL_DIALOGLISTSELECTEDGRAYTEXT, - COL_WARNDIALOGCOMBOGRAY, - COL_WARNDIALOGCOMBOSELECTEDGRAYTEXT, - COL_WARNDIALOGLISTGRAY, - COL_WARNDIALOGLISTSELECTEDGRAYTEXT, - - COL_LASTPALETTECOLOR -}; - -#endif // __COLORS_HPP__ diff --git a/farsdk/ansi/farkeys.hpp b/farsdk/ansi/farkeys.hpp deleted file mode 100644 index bf82a3d..0000000 --- a/farsdk/ansi/farkeys.hpp +++ /dev/null @@ -1,661 +0,0 @@ -#ifndef __FARKEYS_HPP__ -#define __FARKEYS_HPP__ -/* - farkeys.hpp - - Inside KeyName for FAR Manager 1.75 build 2631 - - Copyright (c) 1996-2000 Eugene Roshal - Copyrigth (c) 2000-2010 FAR group -*/ - - -enum BaseDefKeyboard -{ - KEY_CTRL =0x01000000, - KEY_ALT =0x02000000, - KEY_SHIFT =0x04000000, - KEY_RCTRL =0x10000000, - KEY_RALT =0x20000000, - KEY_CTRLMASK =0xFF000000, - - KEY_BRACKET ='[', - KEY_BACKBRACKET =']', - KEY_COMMA =',', - KEY_QUOTE ='"', - KEY_DOT ='.', - KEY_SLASH ='/', - KEY_COLON =':', - KEY_SEMICOLON =';', - KEY_BACKSLASH ='\\', - - KEY_BS =0x00000008, - KEY_TAB =0x00000009, - KEY_ENTER =0x0000000D, - KEY_ESC =0x0000001B, - KEY_SPACE =0x00000020, - - KEY_MASKF =0x00000FFF, - - KEY_FKEY_BEGIN =0x00000100, - - KEY_BREAK =0x00000103, - - KEY_PAUSE =0x00000113, - KEY_CAPSLOCK =0x00000114, - - KEY_PGUP =0x00000121, - KEY_PGDN =0x00000122, - KEY_END =0x00000123, - KEY_HOME =0x00000124, - KEY_LEFT =0x00000125, - KEY_UP =0x00000126, - KEY_RIGHT =0x00000127, - KEY_DOWN =0x00000128, - KEY_PRNTSCRN =0x0000012C, - KEY_INS =0x0000012D, - KEY_DEL =0x0000012E, - - KEY_LWIN =0x0000015B, - KEY_RWIN =0x0000015C, - KEY_APPS =0x0000015D, - KEY_STANDBY =0x0000015F, - - KEY_NUMPAD0 =0x00000160, - KEY_NUMPAD1 =0x00000161, - KEY_NUMPAD2 =0x00000162, - KEY_NUMPAD3 =0x00000163, - KEY_NUMPAD4 =0x00000164, - KEY_NUMPAD5 =0x00000165, - KEY_CLEAR =KEY_NUMPAD5, - KEY_NUMPAD6 =0x00000166, - KEY_NUMPAD7 =0x00000167, - KEY_NUMPAD8 =0x00000168, - KEY_NUMPAD9 =0x00000169, - - KEY_MULTIPLY =0x0000016A, - KEY_ADD =0x0000016B, - KEY_SUBTRACT =0x0000016D, - KEY_DECIMAL =0x0000016E, - KEY_DIVIDE =0x0000016F, - - KEY_F1 =0x00000170, - KEY_F2 =0x00000171, - KEY_F3 =0x00000172, - KEY_F4 =0x00000173, - KEY_F5 =0x00000174, - KEY_F6 =0x00000175, - KEY_F7 =0x00000176, - KEY_F8 =0x00000177, - KEY_F9 =0x00000178, - KEY_F10 =0x00000179, - KEY_F11 =0x0000017A, - KEY_F12 =0x0000017B, - - KEY_F13 =0x0000017C, - KEY_F14 =0x0000017D, - KEY_F15 =0x0000017E, - KEY_F16 =0x0000017F, - KEY_F17 =0x00000180, - KEY_F18 =0x00000181, - KEY_F19 =0x00000182, - KEY_F20 =0x00000183, - KEY_F21 =0x00000184, - KEY_F22 =0x00000185, - KEY_F23 =0x00000186, - KEY_F24 =0x00000187, - - KEY_NUMLOCK =0x00000190, - KEY_SCROLLLOCK =0x00000191, - - KEY_BROWSER_BACK =0x000001A6, - KEY_BROWSER_FORWARD =0x000001A7, - KEY_BROWSER_REFRESH =0x000001A8, - KEY_BROWSER_STOP =0x000001A9, - KEY_BROWSER_SEARCH =0x000001AA, - KEY_BROWSER_FAVORITES =0x000001AB, - KEY_BROWSER_HOME =0x000001AC, - KEY_VOLUME_MUTE =0x000001AD, - KEY_VOLUME_DOWN =0x000001AE, - KEY_VOLUME_UP =0x000001AF, - KEY_MEDIA_NEXT_TRACK =0x000001B0, - KEY_MEDIA_PREV_TRACK =0x000001B1, - KEY_MEDIA_STOP =0x000001B2, - KEY_MEDIA_PLAY_PAUSE =0x000001B3, - KEY_LAUNCH_MAIL =0x000001B4, - KEY_LAUNCH_MEDIA_SELECT =0x000001B5, - KEY_LAUNCH_APP1 =0x000001B6, - KEY_LAUNCH_APP2 =0x000001B7, - - KEY_CTRLALTSHIFTPRESS =0x00000201, - KEY_CTRLALTSHIFTRELEASE =0x00000202, - - KEY_MSWHEEL_UP =0x00000203, - KEY_MSWHEEL_DOWN =0x00000204, - - KEY_NUMDEL =0x00000209, - KEY_NUMENTER =0x0000020B, - - KEY_MSWHEEL_LEFT =0x0000020C, - KEY_MSWHEEL_RIGHT =0x0000020D, - - KEY_MSLCLICK =0x0000020F, - KEY_MSRCLICK =0x00000210, - - KEY_MSM1CLICK =0x00000211, - KEY_MSM2CLICK =0x00000212, - KEY_MSM3CLICK =0x00000213, - KEY_VK_0xFF_BEGIN =0x00000300, - KEY_VK_0xFF_END =0x000003FF, - - KEY_END_FKEY =0x00000FFF, - - KEY_NONE =0x00001001, - KEY_IDLE =0x00001002, - KEY_END_SKEY =0x0000FFFF, - KEY_LAST_BASE =KEY_END_SKEY, - -}; - -enum AddDefKeyboard -{ - KEY_CTRLSHIFT =KEY_CTRL|KEY_SHIFT, - KEY_ALTSHIFT =KEY_ALT|KEY_SHIFT, - KEY_CTRLALT =KEY_CTRL|KEY_ALT, - - KEY_CTRL0 =KEY_CTRL+'0', - KEY_CTRL1 =KEY_CTRL+'1', - KEY_CTRL2 =KEY_CTRL+'2', - KEY_CTRL3 =KEY_CTRL+'3', - KEY_CTRL4 =KEY_CTRL+'4', - KEY_CTRL5 =KEY_CTRL+'5', - KEY_CTRL6 =KEY_CTRL+'6', - KEY_CTRL7 =KEY_CTRL+'7', - KEY_CTRL8 =KEY_CTRL+'8', - KEY_CTRL9 =KEY_CTRL+'9', - - KEY_RCTRL0 =KEY_RCTRL+'0', - KEY_RCTRL1 =KEY_RCTRL+'1', - KEY_RCTRL2 =KEY_RCTRL+'2', - KEY_RCTRL3 =KEY_RCTRL+'3', - KEY_RCTRL4 =KEY_RCTRL+'4', - KEY_RCTRL5 =KEY_RCTRL+'5', - KEY_RCTRL6 =KEY_RCTRL+'6', - KEY_RCTRL7 =KEY_RCTRL+'7', - KEY_RCTRL8 =KEY_RCTRL+'8', - KEY_RCTRL9 =KEY_RCTRL+'9', - - KEY_CTRLA =KEY_CTRL+'A', - KEY_CTRLB =KEY_CTRL+'B', - KEY_CTRLC =KEY_CTRL+'C', - KEY_CTRLD =KEY_CTRL+'D', - KEY_CTRLE =KEY_CTRL+'E', - KEY_CTRLF =KEY_CTRL+'F', - KEY_CTRLG =KEY_CTRL+'G', - KEY_CTRLH =KEY_CTRL+'H', - KEY_CTRLI =KEY_CTRL+'I', - KEY_CTRLJ =KEY_CTRL+'J', - KEY_CTRLK =KEY_CTRL+'K', - KEY_CTRLL =KEY_CTRL+'L', - KEY_CTRLM =KEY_CTRL+'M', - KEY_CTRLN =KEY_CTRL+'N', - KEY_CTRLO =KEY_CTRL+'O', - KEY_CTRLP =KEY_CTRL+'P', - KEY_CTRLQ =KEY_CTRL+'Q', - KEY_CTRLR =KEY_CTRL+'R', - KEY_CTRLS =KEY_CTRL+'S', - KEY_CTRLT =KEY_CTRL+'T', - KEY_CTRLU =KEY_CTRL+'U', - KEY_CTRLV =KEY_CTRL+'V', - KEY_CTRLW =KEY_CTRL+'W', - KEY_CTRLX =KEY_CTRL+'X', - KEY_CTRLY =KEY_CTRL+'Y', - KEY_CTRLZ =KEY_CTRL+'Z', - - KEY_CTRLBRACKET =KEY_CTRL|KEY_BRACKET, - KEY_CTRLBACKBRACKET =KEY_CTRL|KEY_BACKBRACKET, - KEY_CTRLCOMMA =KEY_CTRL|KEY_COMMA, - KEY_CTRLQUOTE =KEY_CTRL|KEY_QUOTE, - KEY_CTRLDOT =KEY_CTRL|KEY_DOT, - - KEY_ALT0 =KEY_ALT+'0', - KEY_ALT1 =KEY_ALT+'1', - KEY_ALT2 =KEY_ALT+'2', - KEY_ALT3 =KEY_ALT+'3', - KEY_ALT4 =KEY_ALT+'4', - KEY_ALT5 =KEY_ALT+'5', - KEY_ALT6 =KEY_ALT+'6', - KEY_ALT7 =KEY_ALT+'7', - KEY_ALT8 =KEY_ALT+'8', - KEY_ALT9 =KEY_ALT+'9', - - KEY_ALTADD =KEY_ALT|KEY_ADD, - KEY_ALTDOT =KEY_ALT|KEY_DOT, - KEY_ALTCOMMA =KEY_ALT|KEY_COMMA, - KEY_ALTMULTIPLY =KEY_ALT|KEY_MULTIPLY, - - KEY_ALTA =KEY_ALT+'A', - KEY_ALTB =KEY_ALT+'B', - KEY_ALTC =KEY_ALT+'C', - KEY_ALTD =KEY_ALT+'D', - KEY_ALTE =KEY_ALT+'E', - KEY_ALTF =KEY_ALT+'F', - KEY_ALTG =KEY_ALT+'G', - KEY_ALTH =KEY_ALT+'H', - KEY_ALTI =KEY_ALT+'I', - KEY_ALTJ =KEY_ALT+'J', - KEY_ALTK =KEY_ALT+'K', - KEY_ALTL =KEY_ALT+'L', - KEY_ALTM =KEY_ALT+'M', - KEY_ALTN =KEY_ALT+'N', - KEY_ALTO =KEY_ALT+'O', - KEY_ALTP =KEY_ALT+'P', - KEY_ALTQ =KEY_ALT+'Q', - KEY_ALTR =KEY_ALT+'R', - KEY_ALTS =KEY_ALT+'S', - KEY_ALTT =KEY_ALT+'T', - KEY_ALTU =KEY_ALT+'U', - KEY_ALTV =KEY_ALT+'V', - KEY_ALTW =KEY_ALT+'W', - KEY_ALTX =KEY_ALT+'X', - KEY_ALTY =KEY_ALT+'Y', - KEY_ALTZ =KEY_ALT+'Z', - - KEY_CTRLSHIFTADD =KEY_CTRL|KEY_SHIFT|KEY_ADD, - KEY_CTRLSHIFTSUBTRACT =KEY_CTRL|KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLSHIFTDOT =KEY_CTRL|KEY_SHIFT|KEY_DOT, - KEY_CTRLSHIFTSLASH =KEY_CTRL|KEY_SHIFT|KEY_SLASH, - - KEY_CTRLSHIFT0 =(KEY_CTRL|KEY_SHIFT)+'0', - KEY_CTRLSHIFT1 =(KEY_CTRL|KEY_SHIFT)+'1', - KEY_CTRLSHIFT2 =(KEY_CTRL|KEY_SHIFT)+'2', - KEY_CTRLSHIFT3 =(KEY_CTRL|KEY_SHIFT)+'3', - KEY_CTRLSHIFT4 =(KEY_CTRL|KEY_SHIFT)+'4', - KEY_CTRLSHIFT5 =(KEY_CTRL|KEY_SHIFT)+'5', - KEY_CTRLSHIFT6 =(KEY_CTRL|KEY_SHIFT)+'6', - KEY_CTRLSHIFT7 =(KEY_CTRL|KEY_SHIFT)+'7', - KEY_CTRLSHIFT8 =(KEY_CTRL|KEY_SHIFT)+'8', - KEY_CTRLSHIFT9 =(KEY_CTRL|KEY_SHIFT)+'9', - - KEY_RCTRLSHIFT0 =(KEY_RCTRL+KEY_SHIFT)+'0', - KEY_RCTRLSHIFT1 =(KEY_RCTRL+KEY_SHIFT)+'1', - KEY_RCTRLSHIFT2 =(KEY_RCTRL+KEY_SHIFT)+'2', - KEY_RCTRLSHIFT3 =(KEY_RCTRL+KEY_SHIFT)+'3', - KEY_RCTRLSHIFT4 =(KEY_RCTRL+KEY_SHIFT)+'4', - KEY_RCTRLSHIFT5 =(KEY_RCTRL+KEY_SHIFT)+'5', - KEY_RCTRLSHIFT6 =(KEY_RCTRL+KEY_SHIFT)+'6', - KEY_RCTRLSHIFT7 =(KEY_RCTRL+KEY_SHIFT)+'7', - KEY_RCTRLSHIFT8 =(KEY_RCTRL+KEY_SHIFT)+'8', - KEY_RCTRLSHIFT9 =(KEY_RCTRL+KEY_SHIFT)+'9', - - KEY_CTRLSHIFTA =(KEY_CTRL|KEY_SHIFT)+'A', - KEY_CTRLSHIFTB =(KEY_CTRL|KEY_SHIFT)+'B', - KEY_CTRLSHIFTC =(KEY_CTRL|KEY_SHIFT)+'C', - KEY_CTRLSHIFTD =(KEY_CTRL|KEY_SHIFT)+'D', - KEY_CTRLSHIFTE =(KEY_CTRL|KEY_SHIFT)+'E', - KEY_CTRLSHIFTF =(KEY_CTRL|KEY_SHIFT)+'F', - KEY_CTRLSHIFTG =(KEY_CTRL|KEY_SHIFT)+'G', - KEY_CTRLSHIFTH =(KEY_CTRL|KEY_SHIFT)+'H', - KEY_CTRLSHIFTI =(KEY_CTRL|KEY_SHIFT)+'I', - KEY_CTRLSHIFTJ =(KEY_CTRL|KEY_SHIFT)+'J', - KEY_CTRLSHIFTK =(KEY_CTRL|KEY_SHIFT)+'K', - KEY_CTRLSHIFTL =(KEY_CTRL|KEY_SHIFT)+'L', - KEY_CTRLSHIFTM =(KEY_CTRL|KEY_SHIFT)+'M', - KEY_CTRLSHIFTN =(KEY_CTRL|KEY_SHIFT)+'N', - KEY_CTRLSHIFTO =(KEY_CTRL|KEY_SHIFT)+'O', - KEY_CTRLSHIFTP =(KEY_CTRL|KEY_SHIFT)+'P', - KEY_CTRLSHIFTQ =(KEY_CTRL|KEY_SHIFT)+'Q', - KEY_CTRLSHIFTR =(KEY_CTRL|KEY_SHIFT)+'R', - KEY_CTRLSHIFTS =(KEY_CTRL|KEY_SHIFT)+'S', - KEY_CTRLSHIFTT =(KEY_CTRL|KEY_SHIFT)+'T', - KEY_CTRLSHIFTU =(KEY_CTRL|KEY_SHIFT)+'U', - KEY_CTRLSHIFTV =(KEY_CTRL|KEY_SHIFT)+'V', - KEY_CTRLSHIFTW =(KEY_CTRL|KEY_SHIFT)+'W', - KEY_CTRLSHIFTX =(KEY_CTRL|KEY_SHIFT)+'X', - KEY_CTRLSHIFTY =(KEY_CTRL|KEY_SHIFT)+'Y', - KEY_CTRLSHIFTZ =(KEY_CTRL|KEY_SHIFT)+'Z', - - KEY_CTRLSHIFTBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BRACKET, - KEY_CTRLSHIFTBACKSLASH =KEY_CTRL|KEY_SHIFT|KEY_BACKSLASH, - KEY_CTRLSHIFTBACKBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_ALTSHIFT0 =(KEY_ALT|KEY_SHIFT)+'0', - KEY_ALTSHIFT1 =(KEY_ALT|KEY_SHIFT)+'1', - KEY_ALTSHIFT2 =(KEY_ALT|KEY_SHIFT)+'2', - KEY_ALTSHIFT3 =(KEY_ALT|KEY_SHIFT)+'3', - KEY_ALTSHIFT4 =(KEY_ALT|KEY_SHIFT)+'4', - KEY_ALTSHIFT5 =(KEY_ALT|KEY_SHIFT)+'5', - KEY_ALTSHIFT6 =(KEY_ALT|KEY_SHIFT)+'6', - KEY_ALTSHIFT7 =(KEY_ALT|KEY_SHIFT)+'7', - KEY_ALTSHIFT8 =(KEY_ALT|KEY_SHIFT)+'8', - KEY_ALTSHIFT9 =(KEY_ALT|KEY_SHIFT)+'9', - - KEY_ALTSHIFTA =(KEY_ALT|KEY_SHIFT)+'A', - KEY_ALTSHIFTB =(KEY_ALT|KEY_SHIFT)+'B', - KEY_ALTSHIFTC =(KEY_ALT|KEY_SHIFT)+'C', - KEY_ALTSHIFTD =(KEY_ALT|KEY_SHIFT)+'D', - KEY_ALTSHIFTE =(KEY_ALT|KEY_SHIFT)+'E', - KEY_ALTSHIFTF =(KEY_ALT|KEY_SHIFT)+'F', - KEY_ALTSHIFTG =(KEY_ALT|KEY_SHIFT)+'G', - KEY_ALTSHIFTH =(KEY_ALT|KEY_SHIFT)+'H', - KEY_ALTSHIFTI =(KEY_ALT|KEY_SHIFT)+'I', - KEY_ALTSHIFTJ =(KEY_ALT|KEY_SHIFT)+'J', - KEY_ALTSHIFTK =(KEY_ALT|KEY_SHIFT)+'K', - KEY_ALTSHIFTL =(KEY_ALT|KEY_SHIFT)+'L', - KEY_ALTSHIFTM =(KEY_ALT|KEY_SHIFT)+'M', - KEY_ALTSHIFTN =(KEY_ALT|KEY_SHIFT)+'N', - KEY_ALTSHIFTO =(KEY_ALT|KEY_SHIFT)+'O', - KEY_ALTSHIFTP =(KEY_ALT|KEY_SHIFT)+'P', - KEY_ALTSHIFTQ =(KEY_ALT|KEY_SHIFT)+'Q', - KEY_ALTSHIFTR =(KEY_ALT|KEY_SHIFT)+'R', - KEY_ALTSHIFTS =(KEY_ALT|KEY_SHIFT)+'S', - KEY_ALTSHIFTT =(KEY_ALT|KEY_SHIFT)+'T', - KEY_ALTSHIFTU =(KEY_ALT|KEY_SHIFT)+'U', - KEY_ALTSHIFTV =(KEY_ALT|KEY_SHIFT)+'V', - KEY_ALTSHIFTW =(KEY_ALT|KEY_SHIFT)+'W', - KEY_ALTSHIFTX =(KEY_ALT|KEY_SHIFT)+'X', - KEY_ALTSHIFTY =(KEY_ALT|KEY_SHIFT)+'Y', - KEY_ALTSHIFTZ =(KEY_ALT|KEY_SHIFT)+'Z', - - KEY_ALTSHIFTBRACKET =KEY_ALT|KEY_SHIFT|KEY_BRACKET, - KEY_ALTSHIFTBACKBRACKET =KEY_ALT|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_CTRLALT0 =(KEY_CTRL|KEY_ALT)+'0', - KEY_CTRLALT1 =(KEY_CTRL|KEY_ALT)+'1', - KEY_CTRLALT2 =(KEY_CTRL|KEY_ALT)+'2', - KEY_CTRLALT3 =(KEY_CTRL|KEY_ALT)+'3', - KEY_CTRLALT4 =(KEY_CTRL|KEY_ALT)+'4', - KEY_CTRLALT5 =(KEY_CTRL|KEY_ALT)+'5', - KEY_CTRLALT6 =(KEY_CTRL|KEY_ALT)+'6', - KEY_CTRLALT7 =(KEY_CTRL|KEY_ALT)+'7', - KEY_CTRLALT8 =(KEY_CTRL|KEY_ALT)+'8', - KEY_CTRLALT9 =(KEY_CTRL|KEY_ALT)+'9', - - KEY_CTRLALTA =(KEY_CTRL|KEY_ALT)+'A', - KEY_CTRLALTB =(KEY_CTRL|KEY_ALT)+'B', - KEY_CTRLALTC =(KEY_CTRL|KEY_ALT)+'C', - KEY_CTRLALTD =(KEY_CTRL|KEY_ALT)+'D', - KEY_CTRLALTE =(KEY_CTRL|KEY_ALT)+'E', - KEY_CTRLALTF =(KEY_CTRL|KEY_ALT)+'F', - KEY_CTRLALTG =(KEY_CTRL|KEY_ALT)+'G', - KEY_CTRLALTH =(KEY_CTRL|KEY_ALT)+'H', - KEY_CTRLALTI =(KEY_CTRL|KEY_ALT)+'I', - KEY_CTRLALTJ =(KEY_CTRL|KEY_ALT)+'J', - KEY_CTRLALTK =(KEY_CTRL|KEY_ALT)+'K', - KEY_CTRLALTL =(KEY_CTRL|KEY_ALT)+'L', - KEY_CTRLALTM =(KEY_CTRL|KEY_ALT)+'M', - KEY_CTRLALTN =(KEY_CTRL|KEY_ALT)+'N', - KEY_CTRLALTO =(KEY_CTRL|KEY_ALT)+'O', - KEY_CTRLALTP =(KEY_CTRL|KEY_ALT)+'P', - KEY_CTRLALTQ =(KEY_CTRL|KEY_ALT)+'Q', - KEY_CTRLALTR =(KEY_CTRL|KEY_ALT)+'R', - KEY_CTRLALTS =(KEY_CTRL|KEY_ALT)+'S', - KEY_CTRLALTT =(KEY_CTRL|KEY_ALT)+'T', - KEY_CTRLALTU =(KEY_CTRL|KEY_ALT)+'U', - KEY_CTRLALTV =(KEY_CTRL|KEY_ALT)+'V', - KEY_CTRLALTW =(KEY_CTRL|KEY_ALT)+'W', - KEY_CTRLALTX =(KEY_CTRL|KEY_ALT)+'X', - KEY_CTRLALTY =(KEY_CTRL|KEY_ALT)+'Y', - KEY_CTRLALTZ =(KEY_CTRL|KEY_ALT)+'Z', - - KEY_CTRLALTBRACKET =KEY_CTRL|KEY_ALT|KEY_BRACKET, - KEY_CTRLALTBACKBRACKET =KEY_CTRL|KEY_ALT|KEY_BACKBRACKET, - - KEY_CTRLF1 =KEY_CTRL|KEY_F1, - KEY_CTRLF2 =KEY_CTRL|KEY_F2, - KEY_CTRLF3 =KEY_CTRL|KEY_F3, - KEY_CTRLF4 =KEY_CTRL|KEY_F4, - KEY_CTRLF5 =KEY_CTRL|KEY_F5, - KEY_CTRLF6 =KEY_CTRL|KEY_F6, - KEY_CTRLF7 =KEY_CTRL|KEY_F7, - KEY_CTRLF8 =KEY_CTRL|KEY_F8, - KEY_CTRLF9 =KEY_CTRL|KEY_F9, - KEY_CTRLF10 =KEY_CTRL|KEY_F10, - KEY_CTRLF11 =KEY_CTRL|KEY_F11, - KEY_CTRLF12 =KEY_CTRL|KEY_F12, - - KEY_SHIFTF1 =KEY_SHIFT|KEY_F1, - KEY_SHIFTF2 =KEY_SHIFT|KEY_F2, - KEY_SHIFTF3 =KEY_SHIFT|KEY_F3, - KEY_SHIFTF4 =KEY_SHIFT|KEY_F4, - KEY_SHIFTF5 =KEY_SHIFT|KEY_F5, - KEY_SHIFTF6 =KEY_SHIFT|KEY_F6, - KEY_SHIFTF7 =KEY_SHIFT|KEY_F7, - KEY_SHIFTF8 =KEY_SHIFT|KEY_F8, - KEY_SHIFTF9 =KEY_SHIFT|KEY_F9, - KEY_SHIFTF10 =KEY_SHIFT|KEY_F10, - KEY_SHIFTF11 =KEY_SHIFT|KEY_F11, - KEY_SHIFTF12 =KEY_SHIFT|KEY_F12, - - KEY_ALTF1 =KEY_ALT|KEY_F1, - KEY_ALTF2 =KEY_ALT|KEY_F2, - KEY_ALTF3 =KEY_ALT|KEY_F3, - KEY_ALTF4 =KEY_ALT|KEY_F4, - KEY_ALTF5 =KEY_ALT|KEY_F5, - KEY_ALTF6 =KEY_ALT|KEY_F6, - KEY_ALTF7 =KEY_ALT|KEY_F7, - KEY_ALTF8 =KEY_ALT|KEY_F8, - KEY_ALTF9 =KEY_ALT|KEY_F9, - KEY_ALTF10 =KEY_ALT|KEY_F10, - KEY_ALTF11 =KEY_ALT|KEY_F11, - KEY_ALTF12 =KEY_ALT|KEY_F12, - - KEY_CTRLSHIFTF1 =KEY_CTRL|KEY_SHIFT|KEY_F1, - KEY_CTRLSHIFTF2 =KEY_CTRL|KEY_SHIFT|KEY_F2, - KEY_CTRLSHIFTF3 =KEY_CTRL|KEY_SHIFT|KEY_F3, - KEY_CTRLSHIFTF4 =KEY_CTRL|KEY_SHIFT|KEY_F4, - KEY_CTRLSHIFTF5 =KEY_CTRL|KEY_SHIFT|KEY_F5, - KEY_CTRLSHIFTF6 =KEY_CTRL|KEY_SHIFT|KEY_F6, - KEY_CTRLSHIFTF7 =KEY_CTRL|KEY_SHIFT|KEY_F7, - KEY_CTRLSHIFTF8 =KEY_CTRL|KEY_SHIFT|KEY_F8, - KEY_CTRLSHIFTF9 =KEY_CTRL|KEY_SHIFT|KEY_F9, - KEY_CTRLSHIFTF10 =KEY_CTRL|KEY_SHIFT|KEY_F10, - KEY_CTRLSHIFTF11 =KEY_CTRL|KEY_SHIFT|KEY_F11, - KEY_CTRLSHIFTF12 =KEY_CTRL|KEY_SHIFT|KEY_F12, - - KEY_ALTSHIFTF1 =KEY_ALT|KEY_SHIFT|KEY_F1, - KEY_ALTSHIFTF2 =KEY_ALT|KEY_SHIFT|KEY_F2, - KEY_ALTSHIFTF3 =KEY_ALT|KEY_SHIFT|KEY_F3, - KEY_ALTSHIFTF4 =KEY_ALT|KEY_SHIFT|KEY_F4, - KEY_ALTSHIFTF5 =KEY_ALT|KEY_SHIFT|KEY_F5, - KEY_ALTSHIFTF6 =KEY_ALT|KEY_SHIFT|KEY_F6, - KEY_ALTSHIFTF7 =KEY_ALT|KEY_SHIFT|KEY_F7, - KEY_ALTSHIFTF8 =KEY_ALT|KEY_SHIFT|KEY_F8, - KEY_ALTSHIFTF9 =KEY_ALT|KEY_SHIFT|KEY_F9, - KEY_ALTSHIFTF10 =KEY_ALT|KEY_SHIFT|KEY_F10, - KEY_ALTSHIFTF11 =KEY_ALT|KEY_SHIFT|KEY_F11, - KEY_ALTSHIFTF12 =KEY_ALT|KEY_SHIFT|KEY_F12, - - KEY_CTRLALTF1 =KEY_CTRL|KEY_ALT|KEY_F1, - KEY_CTRLALTF2 =KEY_CTRL|KEY_ALT|KEY_F2, - KEY_CTRLALTF3 =KEY_CTRL|KEY_ALT|KEY_F3, - KEY_CTRLALTF4 =KEY_CTRL|KEY_ALT|KEY_F4, - KEY_CTRLALTF5 =KEY_CTRL|KEY_ALT|KEY_F5, - KEY_CTRLALTF6 =KEY_CTRL|KEY_ALT|KEY_F6, - KEY_CTRLALTF7 =KEY_CTRL|KEY_ALT|KEY_F7, - KEY_CTRLALTF8 =KEY_CTRL|KEY_ALT|KEY_F8, - KEY_CTRLALTF9 =KEY_CTRL|KEY_ALT|KEY_F9, - KEY_CTRLALTF10 =KEY_CTRL|KEY_ALT|KEY_F10, - KEY_CTRLALTF11 =KEY_CTRL|KEY_ALT|KEY_F11, - KEY_CTRLALTF12 =KEY_CTRL|KEY_ALT|KEY_F12, - - KEY_CTRLHOME =KEY_CTRL|KEY_HOME, - KEY_CTRLUP =KEY_CTRL|KEY_UP, - KEY_CTRLPGUP =KEY_CTRL|KEY_PGUP, - KEY_CTRLLEFT =KEY_CTRL|KEY_LEFT, - KEY_CTRLRIGHT =KEY_CTRL|KEY_RIGHT, - KEY_CTRLEND =KEY_CTRL|KEY_END, - KEY_CTRLDOWN =KEY_CTRL|KEY_DOWN, - KEY_CTRLPGDN =KEY_CTRL|KEY_PGDN, - KEY_CTRLINS =KEY_CTRL|KEY_INS, - KEY_CTRLDEL =KEY_CTRL|KEY_DEL, - KEY_CTRLNUMDEL =KEY_CTRL|KEY_NUMDEL, - KEY_CTRLDECIMAL =KEY_CTRL|KEY_DECIMAL, - - KEY_SHIFTHOME =KEY_SHIFT|KEY_HOME, - KEY_SHIFTUP =KEY_SHIFT|KEY_UP, - KEY_SHIFTPGUP =KEY_SHIFT|KEY_PGUP, - KEY_SHIFTLEFT =KEY_SHIFT|KEY_LEFT, - KEY_SHIFTRIGHT =KEY_SHIFT|KEY_RIGHT, - KEY_SHIFTEND =KEY_SHIFT|KEY_END, - KEY_SHIFTDOWN =KEY_SHIFT|KEY_DOWN, - KEY_SHIFTPGDN =KEY_SHIFT|KEY_PGDN, - KEY_SHIFTINS =KEY_SHIFT|KEY_INS, - KEY_SHIFTDEL =KEY_SHIFT|KEY_DEL, - KEY_SHIFTNUMDEL =KEY_SHIFT|KEY_NUMDEL, - KEY_SHIFTDECIMAL =KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTHOME =KEY_ALT|KEY_HOME, - KEY_ALTUP =KEY_ALT|KEY_UP, - KEY_ALTPGUP =KEY_ALT|KEY_PGUP, - KEY_ALTLEFT =KEY_ALT|KEY_LEFT, - KEY_ALTRIGHT =KEY_ALT|KEY_RIGHT, - KEY_ALTEND =KEY_ALT|KEY_END, - KEY_ALTDOWN =KEY_ALT|KEY_DOWN, - KEY_ALTPGDN =KEY_ALT|KEY_PGDN, - KEY_ALTINS =KEY_ALT|KEY_INS, - KEY_ALTDEL =KEY_ALT|KEY_DEL, - KEY_ALTNUMDEL =KEY_ALT|KEY_NUMDEL, - KEY_ALTDECIMAL =KEY_ALT|KEY_DECIMAL, - - KEY_CTRLSHIFTHOME =KEY_CTRL|KEY_SHIFT|KEY_HOME, - KEY_CTRLSHIFTUP =KEY_CTRL|KEY_SHIFT|KEY_UP, - KEY_CTRLSHIFTPGUP =KEY_CTRL|KEY_SHIFT|KEY_PGUP, - KEY_CTRLSHIFTLEFT =KEY_CTRL|KEY_SHIFT|KEY_LEFT, - KEY_CTRLSHIFTRIGHT =KEY_CTRL|KEY_SHIFT|KEY_RIGHT, - KEY_CTRLSHIFTEND =KEY_CTRL|KEY_SHIFT|KEY_END, - KEY_CTRLSHIFTDOWN =KEY_CTRL|KEY_SHIFT|KEY_DOWN, - KEY_CTRLSHIFTPGDN =KEY_CTRL|KEY_SHIFT|KEY_PGDN, - KEY_CTRLSHIFTINS =KEY_CTRL|KEY_SHIFT|KEY_INS, - KEY_CTRLSHIFTDEL =KEY_CTRL|KEY_SHIFT|KEY_DEL, - KEY_CTRLSHIFTNUMDEL =KEY_CTRL|KEY_SHIFT|KEY_NUMDEL, - KEY_CTRLSHIFTDECIMAL =KEY_CTRL|KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTSHIFTHOME =KEY_ALT|KEY_SHIFT|KEY_HOME, - KEY_ALTSHIFTUP =KEY_ALT|KEY_SHIFT|KEY_UP, - KEY_ALTSHIFTPGUP =KEY_ALT|KEY_SHIFT|KEY_PGUP, - KEY_ALTSHIFTLEFT =KEY_ALT|KEY_SHIFT|KEY_LEFT, - KEY_ALTSHIFTRIGHT =KEY_ALT|KEY_SHIFT|KEY_RIGHT, - KEY_ALTSHIFTEND =KEY_ALT|KEY_SHIFT|KEY_END, - KEY_ALTSHIFTDOWN =KEY_ALT|KEY_SHIFT|KEY_DOWN, - KEY_ALTSHIFTPGDN =KEY_ALT|KEY_SHIFT|KEY_PGDN, - KEY_ALTSHIFTINS =KEY_ALT|KEY_SHIFT|KEY_INS, - KEY_ALTSHIFTDEL =KEY_ALT|KEY_SHIFT|KEY_DEL, - KEY_ALTSHIFTNUMDEL =KEY_ALT|KEY_SHIFT|KEY_NUMDEL, - KEY_ALTSHIFTDECIMAL =KEY_ALT|KEY_SHIFT|KEY_DECIMAL, - - KEY_CTRLALTHOME =KEY_CTRL|KEY_ALT|KEY_HOME, - KEY_CTRLALTUP =KEY_CTRL|KEY_ALT|KEY_UP, - KEY_CTRLALTPGUP =KEY_CTRL|KEY_ALT|KEY_PGUP, - KEY_CTRLALTLEFT =KEY_CTRL|KEY_ALT|KEY_LEFT, - KEY_CTRLALTRIGHT =KEY_CTRL|KEY_ALT|KEY_RIGHT, - KEY_CTRLALTEND =KEY_CTRL|KEY_ALT|KEY_END, - KEY_CTRLALTDOWN =KEY_CTRL|KEY_ALT|KEY_DOWN, - KEY_CTRLALTPGDN =KEY_CTRL|KEY_ALT|KEY_PGDN, - KEY_CTRLALTINS =KEY_CTRL|KEY_ALT|KEY_INS, - - KEY_CTRLNUMPAD0 =KEY_CTRL|KEY_NUMPAD0, - KEY_CTRLNUMPAD1 =KEY_CTRL|KEY_NUMPAD1, - KEY_CTRLNUMPAD2 =KEY_CTRL|KEY_NUMPAD2, - KEY_CTRLNUMPAD3 =KEY_CTRL|KEY_NUMPAD3, - KEY_CTRLNUMPAD4 =KEY_CTRL|KEY_NUMPAD4, - KEY_CTRLNUMPAD5 =KEY_CTRL|KEY_NUMPAD5, - KEY_CTRLNUMPAD6 =KEY_CTRL|KEY_NUMPAD6, - KEY_CTRLNUMPAD7 =KEY_CTRL|KEY_NUMPAD7, - KEY_CTRLNUMPAD8 =KEY_CTRL|KEY_NUMPAD8, - KEY_CTRLNUMPAD9 =KEY_CTRL|KEY_NUMPAD9, - - KEY_SHIFTNUMPAD0 =KEY_SHIFT|KEY_NUMPAD0, - KEY_SHIFTNUMPAD1 =KEY_SHIFT|KEY_NUMPAD1, - KEY_SHIFTNUMPAD2 =KEY_SHIFT|KEY_NUMPAD2, - KEY_SHIFTNUMPAD3 =KEY_SHIFT|KEY_NUMPAD3, - KEY_SHIFTNUMPAD4 =KEY_SHIFT|KEY_NUMPAD4, - KEY_SHIFTNUMPAD5 =KEY_SHIFT|KEY_NUMPAD5, - KEY_SHIFTNUMPAD6 =KEY_SHIFT|KEY_NUMPAD6, - KEY_SHIFTNUMPAD7 =KEY_SHIFT|KEY_NUMPAD7, - KEY_SHIFTNUMPAD8 =KEY_SHIFT|KEY_NUMPAD8, - KEY_SHIFTNUMPAD9 =KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSHIFTNUMPAD0 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD0, - KEY_CTRLSHIFTNUMPAD1 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD1, - KEY_CTRLSHIFTNUMPAD2 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD2, - KEY_CTRLSHIFTNUMPAD3 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD3, - KEY_CTRLSHIFTNUMPAD4 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD4, - KEY_CTRLSHIFTNUMPAD5 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD5, - KEY_CTRLSHIFTNUMPAD6 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD6, - KEY_CTRLSHIFTNUMPAD7 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD7, - KEY_CTRLSHIFTNUMPAD8 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD8, - KEY_CTRLSHIFTNUMPAD9 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLALTNUMPAD0 =KEY_CTRL|KEY_ALT|KEY_NUMPAD0, - KEY_CTRLALTNUMPAD1 =KEY_CTRL|KEY_ALT|KEY_NUMPAD1, - KEY_CTRLALTNUMPAD2 =KEY_CTRL|KEY_ALT|KEY_NUMPAD2, - KEY_CTRLALTNUMPAD3 =KEY_CTRL|KEY_ALT|KEY_NUMPAD3, - KEY_CTRLALTNUMPAD4 =KEY_CTRL|KEY_ALT|KEY_NUMPAD4, - KEY_CTRLALTNUMPAD5 =KEY_CTRL|KEY_ALT|KEY_NUMPAD5, - KEY_CTRLALTNUMPAD6 =KEY_CTRL|KEY_ALT|KEY_NUMPAD6, - KEY_CTRLALTNUMPAD7 =KEY_CTRL|KEY_ALT|KEY_NUMPAD7, - KEY_CTRLALTNUMPAD8 =KEY_CTRL|KEY_ALT|KEY_NUMPAD8, - KEY_CTRLALTNUMPAD9 =KEY_CTRL|KEY_ALT|KEY_NUMPAD9, - - KEY_ALTSHIFTNUMPAD0 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD0, - KEY_ALTSHIFTNUMPAD1 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD1, - KEY_ALTSHIFTNUMPAD2 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD2, - KEY_ALTSHIFTNUMPAD3 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD3, - KEY_ALTSHIFTNUMPAD4 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD4, - KEY_ALTSHIFTNUMPAD5 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD5, - KEY_ALTSHIFTNUMPAD6 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD6, - KEY_ALTSHIFTNUMPAD7 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD7, - KEY_ALTSHIFTNUMPAD8 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD8, - KEY_ALTSHIFTNUMPAD9 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSLASH =KEY_CTRL|KEY_SLASH, - KEY_CTRLBACKSLASH =KEY_CTRL|KEY_BACKSLASH, - KEY_CTRLCLEAR =KEY_CTRL|KEY_CLEAR, - KEY_CTRLSHIFTCLEAR =KEY_CTRL|KEY_SHIFT|KEY_CLEAR, - KEY_CTRLADD =KEY_CTRL|KEY_ADD, - KEY_SHIFTADD =KEY_SHIFT|KEY_ADD, - - KEY_CTRLSUBTRACT =KEY_CTRL|KEY_SUBTRACT, - KEY_ALTSUBTRACT =KEY_ALT|KEY_SUBTRACT, - KEY_SHIFTSUBTRACT =KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLMULTIPLY =KEY_CTRL|KEY_MULTIPLY, - - KEY_CTRLBS =KEY_CTRL|KEY_BS, - KEY_ALTBS =KEY_ALT|KEY_BS, - KEY_CTRLSHIFTBS =KEY_CTRL|KEY_SHIFT|KEY_BS, - KEY_SHIFTBS =KEY_SHIFT|KEY_BS, - - KEY_CTRLSHIFTTAB =KEY_CTRL|KEY_SHIFT|KEY_TAB, - KEY_CTRLTAB =KEY_CTRL|KEY_TAB, - KEY_SHIFTTAB =KEY_SHIFT|KEY_TAB, - - KEY_CTRLENTER =KEY_CTRL|KEY_ENTER, - KEY_SHIFTENTER =KEY_SHIFT|KEY_ENTER, - KEY_ALTSHIFTENTER =KEY_ALT|KEY_SHIFT|KEY_ENTER, - KEY_CTRLALTENTER =KEY_CTRL|KEY_ALT|KEY_ENTER, - KEY_CTRLSHIFTENTER =KEY_CTRL|KEY_SHIFT|KEY_ENTER, - - KEY_CTRLNUMENTER =KEY_CTRL|KEY_NUMENTER, - KEY_SHIFTNUMENTER =KEY_SHIFT|KEY_NUMENTER, - KEY_ALTSHIFTNUMENTER =KEY_ALT|KEY_SHIFT|KEY_NUMENTER, - KEY_CTRLALTNUMENTER =KEY_CTRL|KEY_ALT|KEY_NUMENTER, - KEY_CTRLSHIFTNUMENTER =KEY_CTRL|KEY_SHIFT|KEY_NUMENTER, - - KEY_CTRLAPPS =KEY_CTRL|KEY_APPS, - KEY_ALTAPPS =KEY_ALT|KEY_APPS, - KEY_SHIFTAPPS =KEY_SHIFT|KEY_APPS, - KEY_CTRLSHIFTAPPS =KEY_CTRL|KEY_SHIFT|KEY_APPS, - KEY_ALTSHIFTAPPS =KEY_ALT|KEY_SHIFT|KEY_APPS, - KEY_CTRLALTAPPS =KEY_CTRL|KEY_ALT|KEY_APPS, - - KEY_CTRLSPACE =KEY_CTRL|KEY_SPACE, - KEY_SHIFTSPACE =KEY_SHIFT|KEY_SPACE, - KEY_CTRLSHIFTSPACE =KEY_CTRL|KEY_SHIFT|KEY_SPACE, - - KEY_ALT_BASE =KEY_ALT, - KEY_ALTSHIFT_BASE =KEY_ALTSHIFT, -}; - - -#endif // __FARKEYS_HPP__ diff --git a/farsdk/ansi/plugin.hpp b/farsdk/ansi/plugin.hpp deleted file mode 100644 index 9bb4f91..0000000 --- a/farsdk/ansi/plugin.hpp +++ /dev/null @@ -1,1928 +0,0 @@ -#ifndef __PLUGIN_HPP__ -#define __PLUGIN_HPP__ - -/* - plugin.hpp - - Plugin API for FAR Manager 1.75 build 2631 - - Copyright (c) 1996-2000 Eugene Roshal - Copyright (c) 2000-2010 FAR group -*/ - -#define FARMANAGERVERSION_MAJOR 1 -#define FARMANAGERVERSION_MINOR 75 -#define FARMANAGERVERSION_BUILD 2631 - -#ifndef RC_INVOKED - -#define MAKEFARVERSION(major,minor,build) ( ((major)<<8) | (minor) | ((build)<<16)) - -#define FARMANAGERVERSION MAKEFARVERSION(FARMANAGERVERSION_MAJOR,FARMANAGERVERSION_MINOR,FARMANAGERVERSION_BUILD) - -#if !defined(_INC_WINDOWS) && !defined(_WINDOWS_) -#if (defined(__GNUC__) || defined(_MSC_VER)) && !defined(_WIN64) -#if !defined(_WINCON_H) && !defined(_WINCON_) -#define _WINCON_H -#define _WINCON_ // to prevent including wincon.h -#if defined(_MSC_VER) -#pragma pack(push,2) -#else -#pragma pack(2) -#endif -#include -#if defined(_MSC_VER) -#pragma pack(pop) -#else -#pragma pack() -#endif -#undef _WINCON_ -#undef _WINCON_H - -#if defined(_MSC_VER) -#pragma pack(push,8) -#else -#pragma pack(8) -#endif -#include -#if defined(_MSC_VER) -#pragma pack(pop) -#else -#pragma pack() -#endif -#endif -#define _WINCON_ -#else -#include -#endif -#endif - -#if defined(__BORLANDC__) -#ifndef _WIN64 -#pragma option -a2 -#endif -#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100)) || defined(__LCC__) -#ifndef _WIN64 -#pragma pack(2) -#endif -#if defined(__LCC__) -#define _export __declspec(dllexport) -#endif -#else -#ifndef _WIN64 -#pragma pack(push,2) -#endif -#if _MSC_VER -#ifdef _export -#undef _export -#endif -#define _export -#endif -#endif - -#define NM 260 - -#undef DefDlgProc - -#define FARMACRO_KEY_EVENT (KEY_EVENT|0x8000) - -// To ensure compatibility of plugin.hpp with compilers not supporting C++, -// you can #define _FAR_NO_NAMELESS_UNIONS. In this case, to access, -// for example, the Data field of the FarDialogItem structure -// you will need to use Data.Data, and the Selected field - Param.Selected -//#define _FAR_NO_NAMELESS_UNIONS - -// To ensure correct structure packing the member PluginPanelItem.FindData -// has the type FAR_FIND_DATA, not WIN32_FIND_DATA (since version 1.71 -// build 2250). The structure FAR_FIND_DATA has the same layout as -// WIN32_FIND_DATA, but since it is declared in this file, it is -// generated with correct 2-byte alignment. -// This #define is necessary to compile plugins that expect -// PluginPanelItem.FindData to be of WIN32_FIND_DATA type. -//#define _FAR_USE_WIN32_FIND_DATA - -#ifndef _WINCON_ -typedef struct _INPUT_RECORD INPUT_RECORD; -typedef struct _CHAR_INFO CHAR_INFO; -#endif - -enum FARMESSAGEFLAGS -{ - FMSG_WARNING = 0x00000001, - FMSG_ERRORTYPE = 0x00000002, - FMSG_KEEPBACKGROUND = 0x00000004, - FMSG_DOWN = 0x00000008, - FMSG_LEFTALIGN = 0x00000010, - - FMSG_ALLINONE = 0x00000020, - - FMSG_MB_OK = 0x00010000, - FMSG_MB_OKCANCEL = 0x00020000, - FMSG_MB_ABORTRETRYIGNORE = 0x00030000, - FMSG_MB_YESNO = 0x00040000, - FMSG_MB_YESNOCANCEL = 0x00050000, - FMSG_MB_RETRYCANCEL = 0x00060000, -}; - -typedef int (WINAPI *FARAPIMESSAGE)( - INT_PTR PluginNumber, - DWORD Flags, - const char *HelpTopic, - const char * const *Items, - int ItemsNumber, - int ButtonsNumber -); - - -enum DialogItemTypes -{ - DI_TEXT, - DI_VTEXT, - DI_SINGLEBOX, - DI_DOUBLEBOX, - DI_EDIT, - DI_PSWEDIT, - DI_FIXEDIT, - DI_BUTTON, - DI_CHECKBOX, - DI_RADIOBUTTON, - DI_COMBOBOX, - DI_LISTBOX, - - DI_USERCONTROL=255, -}; - -enum FarDialogItemFlags -{ - DIF_COLORMASK = 0x000000ffUL, - DIF_SETCOLOR = 0x00000100UL, - DIF_BOXCOLOR = 0x00000200UL, - DIF_GROUP = 0x00000400UL, - DIF_LEFTTEXT = 0x00000800UL, - DIF_MOVESELECT = 0x00001000UL, - DIF_SHOWAMPERSAND = 0x00002000UL, - DIF_CENTERGROUP = 0x00004000UL, - DIF_NOBRACKETS = 0x00008000UL, - DIF_MANUALADDHISTORY = 0x00008000UL, - DIF_SEPARATOR = 0x00010000UL, - DIF_VAREDIT = 0x00010000UL, - DIF_SEPARATOR2 = 0x00020000UL, - DIF_EDITOR = 0x00020000UL, - DIF_LISTNOAMPERSAND = 0x00020000UL, - DIF_LISTNOBOX = 0x00040000UL, - DIF_HISTORY = 0x00040000UL, - DIF_BTNNOCLOSE = 0x00040000UL, - DIF_CENTERTEXT = 0x00040000UL, - DIF_NOTCVTUSERCONTROL = 0x00040000UL, - DIF_EDITEXPAND = 0x00080000UL, - DIF_DROPDOWNLIST = 0x00100000UL, - DIF_USELASTHISTORY = 0x00200000UL, - DIF_MASKEDIT = 0x00400000UL, - DIF_SELECTONENTRY = 0x00800000UL, - DIF_3STATE = 0x00800000UL, - DIF_LISTWRAPMODE = 0x01000000UL, - DIF_NOAUTOCOMPLETE = 0x02000000UL, - DIF_LISTAUTOHIGHLIGHT = 0x02000000UL, - DIF_LISTNOCLOSE = 0x04000000UL, - DIF_HIDDEN = 0x10000000UL, - DIF_READONLY = 0x20000000UL, - DIF_NOFOCUS = 0x40000000UL, - DIF_DISABLE = 0x80000000UL, -}; - -enum FarMessagesProc -{ - DM_FIRST=0, - DM_CLOSE, - DM_ENABLE, - DM_ENABLEREDRAW, - DM_GETDLGDATA, - DM_GETDLGITEM, - DM_GETDLGRECT, - DM_GETTEXT, - DM_GETTEXTLENGTH, - DM_KEY, - DM_MOVEDIALOG, - DM_SETDLGDATA, - DM_SETDLGITEM, - DM_SETFOCUS, - DM_REDRAW, - DM_SETREDRAW=DM_REDRAW, - DM_SETTEXT, - DM_SETMAXTEXTLENGTH, - DM_SETTEXTLENGTH=DM_SETMAXTEXTLENGTH, - DM_SHOWDIALOG, - DM_GETFOCUS, - DM_GETCURSORPOS, - DM_SETCURSORPOS, - DM_GETTEXTPTR, - DM_SETTEXTPTR, - DM_SHOWITEM, - DM_ADDHISTORY, - - DM_GETCHECK, - DM_SETCHECK, - DM_SET3STATE, - - DM_LISTSORT, - DM_LISTGETITEM, - DM_LISTGETCURPOS, - DM_LISTSETCURPOS, - DM_LISTDELETE, - DM_LISTADD, - DM_LISTADDSTR, - DM_LISTUPDATE, - DM_LISTINSERT, - DM_LISTFINDSTRING, - DM_LISTINFO, - DM_LISTGETDATA, - DM_LISTSETDATA, - DM_LISTSETTITLES, - DM_LISTGETTITLES, - - DM_RESIZEDIALOG, - DM_SETITEMPOSITION, - - DM_GETDROPDOWNOPENED, - DM_SETDROPDOWNOPENED, - - DM_SETHISTORY, - - DM_GETITEMPOSITION, - DM_SETMOUSEEVENTNOTIFY, - - DM_EDITUNCHANGEDFLAG, - - DM_GETITEMDATA, - DM_SETITEMDATA, - - DM_LISTSET, - DM_LISTSETMOUSEREACTION, - - DM_GETCURSORSIZE, - DM_SETCURSORSIZE, - - DM_LISTGETDATASIZE, - - DM_GETSELECTION, - DM_SETSELECTION, - - DN_LISTHOTKEY, - - DM_GETEDITPOSITION, - DM_SETEDITPOSITION, - - DM_SETCOMBOBOXEVENT, - DM_GETCOMBOBOXEVENT, - - DN_FIRST=0x1000, - DN_BTNCLICK, - DN_CTLCOLORDIALOG, - DN_CTLCOLORDLGITEM, - DN_CTLCOLORDLGLIST, - DN_DRAWDIALOG, - DN_DRAWDLGITEM, - DN_EDITCHANGE, - DN_ENTERIDLE, - DN_GOTFOCUS, - DN_HELP, - DN_HOTKEY, - DN_INITDIALOG, - DN_KILLFOCUS, - DN_LISTCHANGE, - DN_MOUSECLICK, - DN_DRAGGED, - DN_RESIZECONSOLE, - DN_MOUSEEVENT, - DN_DRAWDIALOGDONE, - - DN_CLOSE=DM_CLOSE, - DN_KEY=DM_KEY, - - DM_USER=0x4000, - -}; - -enum FARCHECKEDSTATE -{ - BSTATE_UNCHECKED = 0, - BSTATE_CHECKED = 1, - BSTATE_3STATE = 2, - BSTATE_TOGGLE = 3, -}; - -enum FARLISTMOUSEREACTIONTYPE -{ - LMRT_ONLYFOCUS = 0, - LMRT_ALWAYS = 1, - LMRT_NEVER = 2, -}; - -enum FARCOMBOBOXEVENTTYPE -{ - CBET_KEY = 0x00000001, - CBET_MOUSE = 0x00000002, -}; - -enum LISTITEMFLAGS -{ - LIF_SELECTED = 0x00010000UL, - LIF_CHECKED = 0x00020000UL, - LIF_SEPARATOR = 0x00040000UL, - LIF_DISABLE = 0x00080000UL, - LIF_GRAYED = 0x00100000UL, - LIF_HIDDEN = 0x00200000UL, - LIF_DELETEUSERDATA = 0x80000000UL, -}; - -struct FarListItem -{ - DWORD Flags; - char Text[128]; - DWORD Reserved[3]; -}; - -struct FarListUpdate -{ - int Index; - struct FarListItem Item; -}; - -struct FarListInsert -{ - int Index; - struct FarListItem Item; -}; - -struct FarListGetItem -{ - int ItemIndex; - struct FarListItem Item; -}; - -struct FarListPos -{ - int SelectPos; - int TopPos; -}; - -enum FARLISTFINDFLAGS -{ - LIFIND_EXACTMATCH = 0x00000001, -}; - -struct FarListFind -{ - int StartIndex; - const char *Pattern; - DWORD Flags; - DWORD Reserved; -}; - -struct FarListDelete -{ - int StartIndex; - int Count; -}; - -enum FARLISTINFOFLAGS -{ - LINFO_SHOWNOBOX = 0x00000400, - LINFO_AUTOHIGHLIGHT = 0x00000800, - LINFO_REVERSEHIGHLIGHT = 0x00001000, - LINFO_WRAPMODE = 0x00008000, - LINFO_SHOWAMPERSAND = 0x00010000, -}; - -struct FarListInfo -{ - DWORD Flags; - int ItemsNumber; - int SelectPos; - int TopPos; - int MaxHeight; - int MaxLength; - DWORD Reserved[6]; -}; - -struct FarListItemData -{ - int Index; - int DataSize; - void *Data; - DWORD Reserved; -}; - -struct FarList -{ - int ItemsNumber; - struct FarListItem *Items; -}; - -struct FarListTitles -{ - int TitleLen; - char *Title; - int BottomLen; - char *Bottom; -}; - -struct FarListColors -{ - DWORD Flags; - DWORD Reserved; - int ColorCount; - LPBYTE Colors; -}; - -struct FarDialogItem -{ - int Type; - int X1,Y1,X2,Y2; - int Focus; - union - { - DWORD_PTR Reserved; - int Selected; - const char *History; - const char *Mask; - struct FarList *ListItems; - int ListPos; - CHAR_INFO *VBuf; - } -#ifdef _FAR_NO_NAMELESS_UNIONS - Param -#endif - ; - DWORD Flags; - int DefaultButton; - union - { - char Data[512]; - struct - { - DWORD PtrFlags; - int PtrLength; - char *PtrData; - char PtrTail[1]; - } Ptr; - } -#ifdef _FAR_NO_NAMELESS_UNIONS - Data -#endif - ; -}; - -struct FarDialogItemData -{ - int PtrLength; - char *PtrData; -}; - -struct FarDialogEvent -{ - HANDLE hDlg; - int Msg; - int Param1; - LONG_PTR Param2; - LONG_PTR Result; -}; - -struct OpenDlgPluginData -{ - int ItemNumber; - HANDLE hDlg; -}; - -#define Dlg_RedrawDialog(Info,hDlg) Info.SendDlgMessage(hDlg,DM_REDRAW,0,0) - -#define Dlg_GetDlgData(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETDLGDATA,0,0) -#define Dlg_SetDlgData(Info,hDlg,Data) Info.SendDlgMessage(hDlg,DM_SETDLGDATA,0,(LONG_PTR)Data) - -#define Dlg_GetDlgItemData(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETITEMDATA,0,0) -#define Dlg_SetDlgItemData(Info,hDlg,ID,Data) Info.SendDlgMessage(hDlg,DM_SETITEMDATA,0,(LONG_PTR)Data) - -#define DlgItem_GetFocus(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETFOCUS,0,0) -#define DlgItem_SetFocus(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_SETFOCUS,ID,0) -#define DlgItem_Enable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,TRUE) -#define DlgItem_Disable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,FALSE) -#define DlgItem_IsEnable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,-1) -#define DlgItem_SetText(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,ID,(LONG_PTR)Str) - -#define DlgItem_GetCheck(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETCHECK,ID,0) -#define DlgItem_SetCheck(Info,hDlg,ID,State) Info.SendDlgMessage(hDlg,DM_SETCHECK,ID,State) - -#define DlgEdit_AddHistory(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_ADDHISTORY,ID,(LONG_PTR)Str) - -#define DlgList_AddString(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_LISTADDSTR,ID,(LONG_PTR)Str) -#define DlgList_GetCurPos(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,ID,0) -#define DlgList_SetCurPos(Info,hDlg,ID,NewPos) {struct FarListPos LPos={NewPos,-1};Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,ID,(LONG_PTR)&LPos);} -#define DlgList_ClearList(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,0) -#define DlgList_DeleteItem(Info,hDlg,ID,Index) {struct FarListDelete FLDItem={Index,1}; Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,(LONG_PTR)&FLDItem);} -#define DlgList_SortUp(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,0) -#define DlgList_SortDown(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,1) -#define DlgList_GetItemData(Info,hDlg,ID,Index) Info.SendDlgMessage(hDlg,DM_LISTGETDATA,ID,Index) -#define DlgList_SetItemStrAsData(Info,hDlg,ID,Index,Str) {struct FarListItemData FLID{Index,0,Str,0}; Info.SendDlgMessage(hDlg,DM_LISTSETDATA,ID,(LONG_PTR)&FLID);} - -enum FARDIALOGFLAGS -{ - FDLG_WARNING = 0x00000001, - FDLG_SMALLDIALOG = 0x00000002, - FDLG_NODRAWSHADOW = 0x00000004, - FDLG_NODRAWPANEL = 0x00000008, -}; - -typedef LONG_PTR(WINAPI *FARWINDOWPROC)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef LONG_PTR(WINAPI *FARAPISENDDLGMESSAGE)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef LONG_PTR(WINAPI *FARAPIDEFDLGPROC)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef int (WINAPI *FARAPIDIALOG)( - INT_PTR PluginNumber, - int X1, - int Y1, - int X2, - int Y2, - const char *HelpTopic, - struct FarDialogItem *Item, - int ItemsNumber -); - -typedef int (WINAPI *FARAPIDIALOGEX)( - INT_PTR PluginNumber, - int X1, - int Y1, - int X2, - int Y2, - const char *HelpTopic, - struct FarDialogItem *Item, - int ItemsNumber, - DWORD Reserved, - DWORD Flags, - FARWINDOWPROC DlgProc, - LONG_PTR Param -); - - -struct FarMenuItem -{ - char Text[128]; - int Selected; - int Checked; - int Separator; -}; - -enum MENUITEMFLAGS -{ - MIF_SELECTED = 0x00010000UL, - MIF_CHECKED = 0x00020000UL, - MIF_SEPARATOR = 0x00040000UL, - MIF_DISABLE = 0x00080000UL, - MIF_GRAYED = 0x00100000UL, - MIF_HIDDEN = 0x00200000UL, - MIF_USETEXTPTR = 0x80000000UL, -}; - -struct FarMenuItemEx -{ - DWORD Flags; - union - { - char Text[128]; - const char *TextPtr; - } Text; - DWORD AccelKey; - DWORD Reserved; - DWORD_PTR UserData; -}; - -enum FARMENUFLAGS -{ - FMENU_SHOWAMPERSAND = 0x00000001, - FMENU_WRAPMODE = 0x00000002, - FMENU_AUTOHIGHLIGHT = 0x00000004, - FMENU_REVERSEAUTOHIGHLIGHT = 0x00000008, - FMENU_USEEXT = 0x00000020, - FMENU_CHANGECONSOLETITLE = 0x00000040, -}; - -typedef int (WINAPI *FARAPIMENU)( - INT_PTR PluginNumber, - int X, - int Y, - int MaxHeight, - DWORD Flags, - const char *Title, - const char *Bottom, - const char *HelpTopic, - const int *BreakKeys, - int *BreakCode, - const struct FarMenuItem *Item, - int ItemsNumber -); - - -enum PLUGINPANELITEMFLAGS -{ - PPIF_PROCESSDESCR = 0x80000000, - PPIF_SELECTED = 0x40000000, - PPIF_USERDATA = 0x20000000, -}; - -#ifndef _FAR_USE_WIN32_FIND_DATA - -struct FAR_FIND_DATA -{ - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD dwReserved0; - DWORD dwReserved1; - CHAR cFileName[MAX_PATH]; - CHAR cAlternateFileName[14]; -}; - -#endif - -struct PluginPanelItem -{ -#ifndef _FAR_USE_WIN32_FIND_DATA - struct FAR_FIND_DATA FindData; -#else - WIN32_FIND_DATA FindData; -#endif - DWORD PackSizeHigh; - DWORD PackSize; - DWORD Flags; - DWORD NumberOfLinks; - char *Description; - char *Owner; - char **CustomColumnData; - int CustomColumnNumber; - DWORD_PTR UserData; - DWORD CRC32; - DWORD_PTR Reserved[2]; -}; - -#if defined(__BORLANDC__) -#if sizeof(struct PluginPanelItem) != 366 -#if defined(STRICT) -#error Incorrect alignment: sizeof(PluginPanelItem)!=366 -#else -#pragma message Incorrect alignment: sizeof(PluginPanelItem)!=366 -#endif -#endif -#endif - -enum PANELINFOFLAGS -{ - PFLAGS_SHOWHIDDEN = 0x00000001, - PFLAGS_HIGHLIGHT = 0x00000002, - PFLAGS_REVERSESORTORDER = 0x00000004, - PFLAGS_USESORTGROUPS = 0x00000008, - PFLAGS_SELECTEDFIRST = 0x00000010, - PFLAGS_REALNAMES = 0x00000020, - PFLAGS_NUMERICSORT = 0x00000040, - PFLAGS_PANELLEFT = 0x00000080, -}; - -enum PANELINFOTYPE -{ - PTYPE_FILEPANEL, - PTYPE_TREEPANEL, - PTYPE_QVIEWPANEL, - PTYPE_INFOPANEL -}; - -struct PanelInfo -{ - int PanelType; - int Plugin; - RECT PanelRect; - struct PluginPanelItem *PanelItems; - int ItemsNumber; - struct PluginPanelItem *SelectedItems; - int SelectedItemsNumber; - int CurrentItem; - int TopPanelItem; - int Visible; - int Focus; - int ViewMode; - char ColumnTypes[80]; - char ColumnWidths[80]; - char CurDir[NM]; - int ShortNames; - int SortMode; - DWORD Flags; - DWORD Reserved; -}; - - -struct PanelRedrawInfo -{ - int CurrentItem; - int TopPanelItem; -}; - -struct CmdLineSelect -{ - int SelStart; - int SelEnd; -}; - -enum FILE_CONTROL_COMMANDS -{ - FCTL_CLOSEPLUGIN, - FCTL_GETPANELINFO, - FCTL_GETANOTHERPANELINFO, - FCTL_UPDATEPANEL, - FCTL_UPDATEANOTHERPANEL, - FCTL_REDRAWPANEL, - FCTL_REDRAWANOTHERPANEL, - FCTL_SETANOTHERPANELDIR, - FCTL_GETCMDLINE, - FCTL_SETCMDLINE, - FCTL_SETSELECTION, - FCTL_SETANOTHERSELECTION, - FCTL_SETVIEWMODE, - FCTL_SETANOTHERVIEWMODE, - FCTL_INSERTCMDLINE, - FCTL_SETUSERSCREEN, - FCTL_SETPANELDIR, - FCTL_SETCMDLINEPOS, - FCTL_GETCMDLINEPOS, - FCTL_SETSORTMODE, - FCTL_SETANOTHERSORTMODE, - FCTL_SETSORTORDER, - FCTL_SETANOTHERSORTORDER, - FCTL_GETCMDLINESELECTEDTEXT, - FCTL_SETCMDLINESELECTION, - FCTL_GETCMDLINESELECTION, - FCTL_GETPANELSHORTINFO, - FCTL_GETANOTHERPANELSHORTINFO, - FCTL_CHECKPANELSEXIST, - FCTL_SETNUMERICSORT, - FCTL_SETANOTHERNUMERICSORT, - FCTL_GETUSERSCREEN, -}; - -typedef int (WINAPI *FARAPICONTROL)( - HANDLE hPlugin, - int Command, - void *Param -); - -typedef void (WINAPI *FARAPITEXT)( - int X, - int Y, - int Color, - const char *Str -); - -typedef HANDLE(WINAPI *FARAPISAVESCREEN)(int X1, int Y1, int X2, int Y2); - -typedef void (WINAPI *FARAPIRESTORESCREEN)(HANDLE hScreen); - - -typedef int (WINAPI *FARAPIGETDIRLIST)( - const char *Dir, - struct PluginPanelItem **pPanelItem, - int *pItemsNumber -); - -typedef int (WINAPI *FARAPIGETPLUGINDIRLIST)( - INT_PTR PluginNumber, - HANDLE hPlugin, - const char *Dir, - struct PluginPanelItem **pPanelItem, - int *pItemsNumber -); - -typedef void (WINAPI *FARAPIFREEDIRLIST)(const struct PluginPanelItem *PanelItem); - -enum VIEWER_FLAGS -{ - VF_NONMODAL = 0x00000001, - VF_DELETEONCLOSE = 0x00000002, - VF_ENABLE_F6 = 0x00000004, - VF_DISABLEHISTORY = 0x00000008, - VF_IMMEDIATERETURN = 0x00000100, - VF_DELETEONLYFILEONCLOSE = 0x00000200, -}; - -typedef int (WINAPI *FARAPIVIEWER)( - const char *FileName, - const char *Title, - int X1, - int Y1, - int X2, - int Y2, - DWORD Flags -); - -enum EDITOR_FLAGS -{ - EF_NONMODAL = 0x00000001, - EF_CREATENEW = 0x00000002, - EF_ENABLE_F6 = 0x00000004, - EF_DISABLEHISTORY = 0x00000008, - EF_DELETEONCLOSE = 0x00000010, - EF_IMMEDIATERETURN = 0x00000100, - EF_DELETEONLYFILEONCLOSE = 0x00000200, -}; - -enum EDITOR_EXITCODE -{ - EEC_OPEN_ERROR = 0, - EEC_MODIFIED = 1, - EEC_NOT_MODIFIED = 2, - EEC_LOADING_INTERRUPTED = 3, -}; - -typedef int (WINAPI *FARAPIEDITOR)( - const char *FileName, - const char *Title, - int X1, - int Y1, - int X2, - int Y2, - DWORD Flags, - int StartLine, - int StartChar -); - -typedef int (WINAPI *FARAPICMPNAME)( - const char *Pattern, - const char *String, - int SkipPath -); - - -enum FARCHARTABLE_COMMAND -{ - FCT_DETECT=0x40000000, -}; - -struct CharTableSet -{ - unsigned char DecodeTable[256]; - unsigned char EncodeTable[256]; - unsigned char UpperTable[256]; - unsigned char LowerTable[256]; - char TableName[128]; -}; - -typedef int (WINAPI *FARAPICHARTABLE)( - int Command, - char *Buffer, - int BufferSize -); - -typedef const char*(WINAPI *FARAPIGETMSG)( - INT_PTR PluginNumber, - int MsgId -); - - -enum FarHelpFlags -{ - FHELP_NOSHOWERROR = 0x80000000, - FHELP_SELFHELP = 0x00000000, - FHELP_FARHELP = 0x00000001, - FHELP_CUSTOMFILE = 0x00000002, - FHELP_CUSTOMPATH = 0x00000004, - FHELP_USECONTENTS = 0x40000000, -}; - -typedef BOOL (WINAPI *FARAPISHOWHELP)( - const char *ModuleName, - const char *Topic, - DWORD Flags -); - -enum ADVANCED_CONTROL_COMMANDS -{ - ACTL_GETFARVERSION = 0, - ACTL_CONSOLEMODE = 1, - ACTL_GETSYSWORDDIV = 2, - ACTL_WAITKEY = 3, - ACTL_GETCOLOR = 4, - ACTL_GETARRAYCOLOR = 5, - ACTL_EJECTMEDIA = 6, - ACTL_KEYMACRO = 7, - ACTL_POSTKEYSEQUENCE = 8, - ACTL_GETWINDOWINFO = 9, - ACTL_GETWINDOWCOUNT = 10, - ACTL_SETCURRENTWINDOW = 11, - ACTL_COMMIT = 12, - ACTL_GETFARHWND = 13, - ACTL_GETSYSTEMSETTINGS = 14, - ACTL_GETPANELSETTINGS = 15, - ACTL_GETINTERFACESETTINGS = 16, - ACTL_GETCONFIRMATIONS = 17, - ACTL_GETDESCSETTINGS = 18, - ACTL_SETARRAYCOLOR = 19, - ACTL_GETWCHARMODE = 20, - ACTL_GETPLUGINMAXREADDATA = 21, - ACTL_GETDIALOGSETTINGS = 22, - ACTL_GETSHORTWINDOWINFO = 23, - ACTL_REDRAWALL = 27, -}; - - -enum FarSystemSettings -{ - FSS_CLEARROATTRIBUTE = 0x00000001, - FSS_DELETETORECYCLEBIN = 0x00000002, - FSS_USESYSTEMCOPYROUTINE = 0x00000004, - FSS_COPYFILESOPENEDFORWRITING = 0x00000008, - FSS_CREATEFOLDERSINUPPERCASE = 0x00000010, - FSS_SAVECOMMANDSHISTORY = 0x00000020, - FSS_SAVEFOLDERSHISTORY = 0x00000040, - FSS_SAVEVIEWANDEDITHISTORY = 0x00000080, - FSS_USEWINDOWSREGISTEREDTYPES = 0x00000100, - FSS_AUTOSAVESETUP = 0x00000200, - FSS_SCANSYMLINK = 0x00000400, -}; - -enum FarPanelSettings -{ - FPS_SHOWHIDDENANDSYSTEMFILES = 0x00000001, - FPS_HIGHLIGHTFILES = 0x00000002, - FPS_AUTOCHANGEFOLDER = 0x00000004, - FPS_SELECTFOLDERS = 0x00000008, - FPS_ALLOWREVERSESORTMODES = 0x00000010, - FPS_SHOWCOLUMNTITLES = 0x00000020, - FPS_SHOWSTATUSLINE = 0x00000040, - FPS_SHOWFILESTOTALINFORMATION = 0x00000080, - FPS_SHOWFREESIZE = 0x00000100, - FPS_SHOWSCROLLBAR = 0x00000200, - FPS_SHOWBACKGROUNDSCREENSNUMBER = 0x00000400, - FPS_SHOWSORTMODELETTER = 0x00000800, -}; - -enum FarDialogSettings -{ - FDIS_HISTORYINDIALOGEDITCONTROLS = 0x00000001, - FDIS_PERSISTENTBLOCKSINEDITCONTROLS = 0x00000002, - FDIS_AUTOCOMPLETEININPUTLINES = 0x00000004, - FDIS_BSDELETEUNCHANGEDTEXT = 0x00000008, - FDIS_DELREMOVESBLOCKS = 0x00000010, - FDIS_MOUSECLICKOUTSIDECLOSESDIALOG = 0x00000020, -}; - -enum FarInterfaceSettings -{ - FIS_CLOCKINPANELS = 0x00000001, - FIS_CLOCKINVIEWERANDEDITOR = 0x00000002, - FIS_MOUSE = 0x00000004, - FIS_SHOWKEYBAR = 0x00000008, - FIS_ALWAYSSHOWMENUBAR = 0x00000010, - FIS_USERIGHTALTASALTGR = 0x00000080, - FIS_SHOWTOTALCOPYPROGRESSINDICATOR = 0x00000100, - FIS_SHOWCOPYINGTIMEINFO = 0x00000200, - FIS_USECTRLPGUPTOCHANGEDRIVE = 0x00000800, -}; - -enum FarConfirmationsSettings -{ - FCS_COPYOVERWRITE = 0x00000001, - FCS_MOVEOVERWRITE = 0x00000002, - FCS_DRAGANDDROP = 0x00000004, - FCS_DELETE = 0x00000008, - FCS_DELETENONEMPTYFOLDERS = 0x00000010, - FCS_INTERRUPTOPERATION = 0x00000020, - FCS_DISCONNECTNETWORKDRIVE = 0x00000040, - FCS_RELOADEDITEDFILE = 0x00000080, - FCS_CLEARHISTORYLIST = 0x00000100, - FCS_EXIT = 0x00000200, -}; - -enum FarDescriptionSettings -{ - FDS_UPDATEALWAYS = 0x00000001, - FDS_UPDATEIFDISPLAYED = 0x00000002, - FDS_SETHIDDEN = 0x00000004, - FDS_UPDATEREADONLY = 0x00000008, -}; - -#define FAR_CONSOLE_GET_MODE (-2) -#define FAR_CONSOLE_TRIGGER (-1) -#define FAR_CONSOLE_SET_WINDOWED (0) -#define FAR_CONSOLE_SET_FULLSCREEN (1) -#define FAR_CONSOLE_WINDOWED (0) -#define FAR_CONSOLE_FULLSCREEN (1) - -enum FAREJECTMEDIAFLAGS -{ - EJECT_NO_MESSAGE = 0x00000001, - EJECT_LOAD_MEDIA = 0x00000002, -}; - -struct ActlEjectMedia -{ - DWORD Letter; - DWORD Flags; -}; - - -enum FARKEYSEQUENCEFLAGS -{ - KSFLAGS_DISABLEOUTPUT = 0x00000001, - KSFLAGS_NOSENDKEYSTOPLUGINS = 0x00000002, - KSFLAGS_REG_MULTI_SZ = 0x00100000, -}; - -struct KeySequence -{ - DWORD Flags; - int Count; - DWORD *Sequence; -}; - -enum FARMACROCOMMAND -{ - MCMD_LOADALL = 0, - MCMD_SAVEALL = 1, - MCMD_POSTMACROSTRING = 2, - MCMD_GETSTATE = 5, -}; - -enum FARMACROSTATE -{ - MACROSTATE_NOMACRO =0, - MACROSTATE_EXECUTING =1, - MACROSTATE_EXECUTING_COMMON =2, - MACROSTATE_RECORDING =3, - MACROSTATE_RECORDING_COMMON =4, -}; - -struct ActlKeyMacro -{ - int Command; - union - { - struct - { - char *SequenceText; - DWORD Flags; - } PlainText; - DWORD_PTR Reserved[3]; - } Param; -}; - -enum FARCOLORFLAGS -{ - FCLR_REDRAW = 0x00000001, -}; - -struct FarSetColors -{ - DWORD Flags; - int StartIndex; - int ColorCount; - LPBYTE Colors; -}; - -enum WINDOWINFO_TYPE -{ - WTYPE_PANELS=1, - WTYPE_VIEWER, - WTYPE_EDITOR, - WTYPE_DIALOG, - WTYPE_VMENU, - WTYPE_HELP, -}; - -struct WindowInfo -{ - int Pos; - int Type; - int Modified; - int Current; - char TypeName[64]; - char Name[NM]; -}; - -typedef INT_PTR(WINAPI *FARAPIADVCONTROL)( - INT_PTR ModuleNumber, - int Command, - void *Param -); - - -enum VIEWER_CONTROL_COMMANDS -{ - VCTL_GETINFO, - VCTL_QUIT, - VCTL_REDRAW, - VCTL_SETKEYBAR, - VCTL_SETPOSITION, - VCTL_SELECT, - VCTL_SETMODE, -}; - -enum VIEWER_OPTIONS -{ - VOPT_SAVEFILEPOSITION=1, - VOPT_AUTODETECTTABLE=2, -}; - -enum VIEWER_SETMODE_TYPES -{ - VSMT_HEX, - VSMT_WRAP, - VSMT_WORDWRAP, -}; - -enum VIEWER_SETMODEFLAGS_TYPES -{ - VSMFL_REDRAW = 0x00000001, -}; - -struct ViewerSetMode -{ - int Type; - union - { - int iParam; - char *cParam; - } Param; - DWORD Flags; - DWORD Reserved; -}; - -typedef union -{ - __int64 i64; - struct - { - DWORD LowPart; - LONG HighPart; - } Part; -} FARINT64; - -struct ViewerSelect -{ - FARINT64 BlockStartPos; - int BlockLen; -}; - -enum VIEWER_SETPOS_FLAGS -{ - VSP_NOREDRAW = 0x0001, - VSP_PERCENT = 0x0002, - VSP_RELATIVE = 0x0004, - VSP_NORETNEWPOS = 0x0008, -}; - -struct ViewerSetPosition -{ - DWORD Flags; - FARINT64 StartPos; - int LeftPos; -}; - -struct ViewerMode -{ - int UseDecodeTable; - int TableNum; - int AnsiMode; - int Unicode; - int Wrap; - int WordWrap; - int Hex; - DWORD Reserved[4]; -}; - -struct ViewerInfo -{ - int StructSize; - int ViewerID; - const char *FileName; - FARINT64 FileSize; - FARINT64 FilePos; - int WindowSizeX; - int WindowSizeY; - DWORD Options; - int TabSize; - struct ViewerMode CurMode; - int LeftPos; - DWORD Reserved3; -}; - -typedef int (WINAPI *FARAPIVIEWERCONTROL)( - int Command, - void *Param -); - -enum VIEWER_EVENTS -{ - VE_READ =0, - VE_CLOSE =1, - - VE_GOTFOCUS =6, - VE_KILLFOCUS =7, -}; - - -enum EDITOR_EVENTS -{ - EE_READ =0, - EE_SAVE =1, - EE_REDRAW =2, - EE_CLOSE =3, - - EE_GOTFOCUS =6, - EE_KILLFOCUS =7, -}; - -enum DIALOG_EVENTS -{ - DE_DLGPROCINIT =0, - DE_DEFDLGPROCINIT =1, - DE_DLGPROCEND =2, -}; - -#define EEREDRAW_ALL (void*)0 -#define EEREDRAW_CHANGE (void*)1 -#define EEREDRAW_LINE (void*)2 - -enum EDITOR_CONTROL_COMMANDS -{ - ECTL_GETSTRING, - ECTL_SETSTRING, - ECTL_INSERTSTRING, - ECTL_DELETESTRING, - ECTL_DELETECHAR, - ECTL_INSERTTEXT, - ECTL_GETINFO, - ECTL_SETPOSITION, - ECTL_SELECT, - ECTL_REDRAW, - ECTL_EDITORTOOEM, - ECTL_OEMTOEDITOR, - ECTL_TABTOREAL, - ECTL_REALTOTAB, - ECTL_EXPANDTABS, - ECTL_SETTITLE, - ECTL_READINPUT, - ECTL_PROCESSINPUT, - ECTL_ADDCOLOR, - ECTL_GETCOLOR, - ECTL_SAVEFILE, - ECTL_QUIT, - ECTL_SETKEYBAR, - ECTL_PROCESSKEY, - ECTL_SETPARAM, - ECTL_GETBOOKMARKS, - ECTL_TURNOFFMARKINGBLOCK, - ECTL_DELETEBLOCK, - ECTL_ADDSTACKBOOKMARK, - ECTL_PREVSTACKBOOKMARK, - ECTL_NEXTSTACKBOOKMARK, - ECTL_CLEARSTACKBOOKMARKS, - ECTL_DELETESTACKBOOKMARK, - ECTL_GETSTACKBOOKMARKS, -}; - -enum EDITOR_SETPARAMETER_TYPES -{ - ESPT_TABSIZE, - ESPT_EXPANDTABS, - ESPT_AUTOINDENT, - ESPT_CURSORBEYONDEOL, - ESPT_CHARCODEBASE, - ESPT_CHARTABLE, - ESPT_SAVEFILEPOSITION, - ESPT_LOCKMODE, - ESPT_SETWORDDIV, - ESPT_GETWORDDIV, -}; - - - -struct EditorSetParameter -{ - int Type; - union - { - int iParam; - char *cParam; - DWORD Reserved1; - } Param; - DWORD Flags; - DWORD Reserved2; -}; - -struct EditorGetString -{ - int StringNumber; - const char *StringText; - const char *StringEOL; - int StringLength; - int SelStart; - int SelEnd; -}; - - -struct EditorSetString -{ - int StringNumber; - char *StringText; - char *StringEOL; - int StringLength; -}; - -enum EXPAND_TABS -{ - EXPAND_NOTABS, - EXPAND_ALLTABS, - EXPAND_NEWTABS -}; - - -enum EDITOR_OPTIONS -{ - EOPT_EXPANDALLTABS = 0x00000001, - EOPT_PERSISTENTBLOCKS = 0x00000002, - EOPT_DELREMOVESBLOCKS = 0x00000004, - EOPT_AUTOINDENT = 0x00000008, - EOPT_SAVEFILEPOSITION = 0x00000010, - EOPT_AUTODETECTTABLE = 0x00000020, - EOPT_CURSORBEYONDEOL = 0x00000040, - EOPT_EXPANDONLYNEWTABS = 0x00000080, -}; - - -enum EDITOR_BLOCK_TYPES -{ - BTYPE_NONE, - BTYPE_STREAM, - BTYPE_COLUMN -}; - -enum EDITOR_CURRENTSTATE -{ - ECSTATE_MODIFIED = 0x00000001, - ECSTATE_SAVED = 0x00000002, - ECSTATE_LOCKED = 0x00000004, -}; - - -struct EditorInfo -{ - int EditorID; - const char *FileName; - int WindowSizeX; - int WindowSizeY; - int TotalLines; - int CurLine; - int CurPos; - int CurTabPos; - int TopScreenLine; - int LeftPos; - int Overtype; - int BlockType; - int BlockStartLine; - int AnsiMode; - int TableNum; - DWORD Options; - int TabSize; - int BookMarkCount; - DWORD CurState; - DWORD Reserved[6]; -}; - -struct EditorBookMarks -{ - long *Line; - long *Cursor; - long *ScreenLine; - long *LeftPos; - DWORD Reserved[4]; -}; - -struct EditorSetPosition -{ - int CurLine; - int CurPos; - int CurTabPos; - int TopScreenLine; - int LeftPos; - int Overtype; -}; - - -struct EditorSelect -{ - int BlockType; - int BlockStartLine; - int BlockStartPos; - int BlockWidth; - int BlockHeight; -}; - - -struct EditorConvertText -{ - char *Text; - int TextLength; -}; - - -struct EditorConvertPos -{ - int StringNumber; - int SrcPos; - int DestPos; -}; - - -enum EDITORCOLORFLAGS -{ - ECF_TAB1 = 0x10000, -}; - -struct EditorColor -{ - int StringNumber; - int ColorItem; - int StartPos; - int EndPos; - int Color; -}; - -struct EditorSaveFile -{ - char FileName[NM]; - char *FileEOL; -}; - -typedef int (WINAPI *FARAPIEDITORCONTROL)( - int Command, - void *Param -); - -enum INPUTBOXFLAGS -{ - FIB_ENABLEEMPTY = 0x00000001, - FIB_PASSWORD = 0x00000002, - FIB_EXPANDENV = 0x00000004, - FIB_NOUSELASTHISTORY = 0x00000008, - FIB_BUTTONS = 0x00000010, - FIB_NOAMPERSAND = 0x00000020, -}; - -typedef int (WINAPI *FARAPIINPUTBOX)( - const char *Title, - const char *SubTitle, - const char *HistoryName, - const char *SrcText, - char *DestText, - int DestLength, - const char *HelpTopic, - DWORD Flags -); - -// -typedef int (WINAPIV *FARSTDSPRINTF)(char *Buffer,const char *Format,...); -typedef int (WINAPIV *FARSTDSNPRINTF)(char *Buffer,size_t Sizebuf,const char *Format,...); -typedef int (WINAPIV *FARSTDSSCANF)(const char *Buffer, const char *Format,...); -// -typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *)); -typedef void (WINAPI *FARSTDQSORTEX)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *,void *userparam),void *userparam); -typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *)); -typedef int (WINAPI *FARSTDGETFILEOWNER)(const char *Computer,const char *Name,char *Owner); -typedef int (WINAPI *FARSTDGETNUMBEROFLINKS)(const char *Name); -typedef int (WINAPI *FARSTDATOI)(const char *s); -typedef __int64(WINAPI *FARSTDATOI64)(const char *s); -typedef char *(WINAPI *FARSTDITOA64)(__int64 value, char *string, int radix); -typedef char *(WINAPI *FARSTDITOA)(int value, char *string, int radix); -typedef char *(WINAPI *FARSTDLTRIM)(char *Str); -typedef char *(WINAPI *FARSTDRTRIM)(char *Str); -typedef char *(WINAPI *FARSTDTRIM)(char *Str); -typedef char *(WINAPI *FARSTDTRUNCSTR)(char *Str,int MaxLength); -typedef char *(WINAPI *FARSTDTRUNCPATHSTR)(char *Str,int MaxLength); -typedef char *(WINAPI *FARSTDQUOTESPACEONLY)(char *Str); -typedef char*(WINAPI *FARSTDPOINTTONAME)(const char *Path); -typedef void (WINAPI *FARSTDGETPATHROOT)(const char *Path,char *Root); -typedef BOOL (WINAPI *FARSTDADDENDSLASH)(char *Path); -typedef int (WINAPI *FARSTDCOPYTOCLIPBOARD)(const char *Data); -typedef char *(WINAPI *FARSTDPASTEFROMCLIPBOARD)(void); -typedef int (WINAPI *FARSTDINPUTRECORDTOKEY)(const INPUT_RECORD *r); -typedef int (WINAPI *FARSTDLOCALISLOWER)(unsigned Ch); -typedef int (WINAPI *FARSTDLOCALISUPPER)(unsigned Ch); -typedef int (WINAPI *FARSTDLOCALISALPHA)(unsigned Ch); -typedef int (WINAPI *FARSTDLOCALISALPHANUM)(unsigned Ch); -typedef unsigned(WINAPI *FARSTDLOCALUPPER)(unsigned LowerChar); -typedef unsigned(WINAPI *FARSTDLOCALLOWER)(unsigned UpperChar); -typedef void (WINAPI *FARSTDLOCALUPPERBUF)(char *Buf,int Length); -typedef void (WINAPI *FARSTDLOCALLOWERBUF)(char *Buf,int Length); -typedef void (WINAPI *FARSTDLOCALSTRUPR)(char *s1); -typedef void (WINAPI *FARSTDLOCALSTRLWR)(char *s1); -typedef int (WINAPI *FARSTDLOCALSTRICMP)(const char *s1,const char *s2); -typedef int (WINAPI *FARSTDLOCALSTRNICMP)(const char *s1,const char *s2,int n); - -enum PROCESSNAME_FLAGS -{ - PN_CMPNAME = 0x00000000UL, - PN_CMPNAMELIST = 0x00001000UL, - PN_GENERATENAME = 0x00002000UL, - PN_SKIPPATH = 0x00100000UL, -}; - -typedef int (WINAPI *FARSTDPROCESSNAME)(const char *param1, char *param2, DWORD flags); - -typedef void (WINAPI *FARSTDUNQUOTE)(char *Str); - -typedef DWORD (WINAPI *FARSTDEXPANDENVIRONMENTSTR)( - const char *src, - char *dst, - size_t size -); - -enum XLATMODE -{ - XLAT_SWITCHKEYBLAYOUT = 0x00000001UL, - XLAT_SWITCHKEYBBEEP = 0x00000002UL, -}; - -typedef char*(WINAPI *FARSTDXLAT)(char *Line,int StartPos,int EndPos,const struct CharTableSet *TableSet,DWORD Flags); -typedef BOOL (WINAPI *FARSTDKEYTOKEYNAME)(int Key,char *KeyText,int Size); -typedef int (WINAPI *FARSTDKEYNAMETOKEY)(const char *Name); - -typedef int (WINAPI *FRSUSERFUNC)( - const WIN32_FIND_DATA *FData, - const char *FullName, - void *Param -); - -enum FRSMODE -{ - FRS_RETUPDIR = 0x01, - FRS_RECUR = 0x02, - FRS_SCANSYMLINK = 0x04, -}; - -typedef void (WINAPI *FARSTDRECURSIVESEARCH)(const char *InitDir,const char *Mask,FRSUSERFUNC Func,DWORD Flags,void *Param); -typedef char*(WINAPI *FARSTDMKTEMP)(char *Dest,const char *Prefix); -typedef void (WINAPI *FARSTDDELETEBUFFER)(void *Buffer); - -enum MKLINKOP -{ - FLINK_HARDLINK = 1, - FLINK_JUNCTION = 2, - FLINK_SYMLINK = FLINK_JUNCTION, - FLINK_VOLMOUNT = 3, - FLINK_SYMLINKFILE = 4, - FLINK_SYMLINKDIR = 5, - - FLINK_SHOWERRMSG = 0x10000, - FLINK_DONOTUPDATEPANEL = 0x20000, -}; -typedef int (WINAPI *FARSTDMKLINK)(const char *Src,const char *Dest,DWORD Flags); -typedef int (WINAPI *FARCONVERTNAMETOREAL)(const char *Src,char *Dest, int DestSize); -typedef int (WINAPI *FARGETREPARSEPOINTINFO)(const char *Src,char *Dest,int DestSize); - -typedef struct FarStandardFunctions -{ - int StructSize; - - FARSTDATOI atoi; - FARSTDATOI64 atoi64; - FARSTDITOA itoa; - FARSTDITOA64 itoa64; - // - FARSTDSPRINTF sprintf_; - FARSTDSSCANF sscanf; - // - FARSTDQSORT qsort; - FARSTDBSEARCH bsearch; - FARSTDQSORTEX qsortex; - - // - FARSTDSNPRINTF snprintf; - // - - DWORD_PTR Reserved[8]; - - FARSTDLOCALISLOWER LIsLower; - FARSTDLOCALISUPPER LIsUpper; - FARSTDLOCALISALPHA LIsAlpha; - FARSTDLOCALISALPHANUM LIsAlphanum; - FARSTDLOCALUPPER LUpper; - FARSTDLOCALLOWER LLower; - FARSTDLOCALUPPERBUF LUpperBuf; - FARSTDLOCALLOWERBUF LLowerBuf; - FARSTDLOCALSTRUPR LStrupr; - FARSTDLOCALSTRLWR LStrlwr; - FARSTDLOCALSTRICMP LStricmp; - FARSTDLOCALSTRNICMP LStrnicmp; - - FARSTDUNQUOTE Unquote; - FARSTDEXPANDENVIRONMENTSTR ExpandEnvironmentStr; - FARSTDLTRIM LTrim; - FARSTDRTRIM RTrim; - FARSTDTRIM Trim; - FARSTDTRUNCSTR TruncStr; - FARSTDTRUNCPATHSTR TruncPathStr; - FARSTDQUOTESPACEONLY QuoteSpaceOnly; - FARSTDPOINTTONAME PointToName; - FARSTDGETPATHROOT GetPathRoot; - FARSTDADDENDSLASH AddEndSlash; - FARSTDCOPYTOCLIPBOARD CopyToClipboard; - FARSTDPASTEFROMCLIPBOARD PasteFromClipboard; - FARSTDKEYTOKEYNAME FarKeyToName; - FARSTDKEYNAMETOKEY FarNameToKey; - FARSTDINPUTRECORDTOKEY FarInputRecordToKey; - FARSTDXLAT XLat; - FARSTDGETFILEOWNER GetFileOwner; - FARSTDGETNUMBEROFLINKS GetNumberOfLinks; - FARSTDRECURSIVESEARCH FarRecursiveSearch; - FARSTDMKTEMP MkTemp; - FARSTDDELETEBUFFER DeleteBuffer; - FARSTDPROCESSNAME ProcessName; - FARSTDMKLINK MkLink; - FARCONVERTNAMETOREAL ConvertNameToReal; - FARGETREPARSEPOINTINFO GetReparsePointInfo; -} FARSTANDARDFUNCTIONS; - -struct PluginStartupInfo -{ - int StructSize; - char ModuleName[NM]; - INT_PTR ModuleNumber; - const char *RootKey; - - FARAPIMENU Menu; - FARAPIDIALOG Dialog; - FARAPIMESSAGE Message; - FARAPIGETMSG GetMsg; - FARAPICONTROL Control; - FARAPISAVESCREEN SaveScreen; - FARAPIRESTORESCREEN RestoreScreen; - FARAPIGETDIRLIST GetDirList; - FARAPIGETPLUGINDIRLIST GetPluginDirList; - FARAPIFREEDIRLIST FreeDirList; - FARAPIVIEWER Viewer; - FARAPIEDITOR Editor; - FARAPICMPNAME CmpName; - FARAPICHARTABLE CharTable; - FARAPITEXT Text; - FARAPIEDITORCONTROL EditorControl; - - FARSTANDARDFUNCTIONS *FSF; - - FARAPISHOWHELP ShowHelp; - FARAPIADVCONTROL AdvControl; - FARAPIINPUTBOX InputBox; - FARAPIDIALOGEX DialogEx; - FARAPISENDDLGMESSAGE SendDlgMessage; - FARAPIDEFDLGPROC DefDlgProc; - DWORD_PTR Reserved; - FARAPIVIEWERCONTROL ViewerControl; -}; - - -enum PLUGIN_FLAGS -{ - PF_PRELOAD = 0x0001, - PF_DISABLEPANELS = 0x0002, - PF_EDITOR = 0x0004, - PF_VIEWER = 0x0008, - PF_FULLCMDLINE = 0x0010, - PF_DIALOG = 0x0020, -}; - - -struct PluginInfo -{ - int StructSize; - DWORD Flags; - const char * const *DiskMenuStrings; - int *DiskMenuNumbers; - int DiskMenuStringsNumber; - const char * const *PluginMenuStrings; - int PluginMenuStringsNumber; - const char * const *PluginConfigStrings; - int PluginConfigStringsNumber; - const char *CommandPrefix; - DWORD Reserved; -}; - - -struct InfoPanelLine -{ - char Text[80]; - char Data[80]; - int Separator; -}; - -struct PanelMode -{ - char *ColumnTypes; - char *ColumnWidths; - char **ColumnTitles; - int FullScreen; - int DetailedStatus; - int AlignExtensions; - int CaseConversion; - char *StatusColumnTypes; - char *StatusColumnWidths; - DWORD Reserved[2]; -}; - - -enum OPENPLUGININFO_FLAGS -{ - OPIF_USEFILTER = 0x00000001, - OPIF_USESORTGROUPS = 0x00000002, - OPIF_USEHIGHLIGHTING = 0x00000004, - OPIF_ADDDOTS = 0x00000008, - OPIF_RAWSELECTION = 0x00000010, - OPIF_REALNAMES = 0x00000020, - OPIF_SHOWNAMESONLY = 0x00000040, - OPIF_SHOWRIGHTALIGNNAMES = 0x00000080, - OPIF_SHOWPRESERVECASE = 0x00000100, - OPIF_FINDFOLDERS = 0x00000200, - OPIF_COMPAREFATTIME = 0x00000400, - OPIF_EXTERNALGET = 0x00000800, - OPIF_EXTERNALPUT = 0x00001000, - OPIF_EXTERNALDELETE = 0x00002000, - OPIF_EXTERNALMKDIR = 0x00004000, - OPIF_USEATTRHIGHLIGHTING = 0x00008000, -}; - - -enum OPENPLUGININFO_SORTMODES -{ - SM_DEFAULT, - SM_UNSORTED, - SM_NAME, - SM_EXT, - SM_MTIME, - SM_CTIME, - SM_ATIME, - SM_SIZE, - SM_DESCR, - SM_OWNER, - SM_COMPRESSEDSIZE, - SM_NUMLINKS -}; - - -struct KeyBarTitles -{ - char *Titles[12]; - char *CtrlTitles[12]; - char *AltTitles[12]; - char *ShiftTitles[12]; - - char *CtrlShiftTitles[12]; - char *AltShiftTitles[12]; - char *CtrlAltTitles[12]; -}; - - -enum OPERATION_MODES -{ - OPM_SILENT =0x0001, - OPM_FIND =0x0002, - OPM_VIEW =0x0004, - OPM_EDIT =0x0008, - OPM_TOPLEVEL =0x0010, - OPM_DESCR =0x0020, - OPM_QUICKVIEW =0x0040, -}; - -#define MAXSIZE_SHORTCUTDATA 8192 - -struct OpenPluginInfo -{ - int StructSize; - DWORD Flags; - const char *HostFile; - const char *CurDir; - const char *Format; - const char *PanelTitle; - const struct InfoPanelLine *InfoLines; - int InfoLinesNumber; - const char * const *DescrFiles; - int DescrFilesNumber; - const struct PanelMode *PanelModesArray; - int PanelModesNumber; - int StartPanelMode; - int StartSortMode; - int StartSortOrder; - const struct KeyBarTitles *KeyBar; - const char *ShortcutData; - long Reserved; -}; - -enum OPENPLUGIN_OPENFROM -{ - OPEN_DISKMENU = 0, - OPEN_PLUGINSMENU = 1, - OPEN_FINDLIST = 2, - OPEN_SHORTCUT = 3, - OPEN_COMMANDLINE = 4, - OPEN_EDITOR = 5, - OPEN_VIEWER = 6, - OPEN_DIALOG = 8, -}; - -enum FAR_PKF_FLAGS -{ - PKF_CONTROL = 0x00000001, - PKF_ALT = 0x00000002, - PKF_SHIFT = 0x00000004, - PKF_PREPROCESS = 0x00080000, // for "Key", function ProcessKey() -}; - -enum FAR_EVENTS -{ - FE_CHANGEVIEWMODE =0, - FE_REDRAW =1, - FE_IDLE =2, - FE_CLOSE =3, - FE_BREAK =4, - FE_COMMAND =5, - - FE_GOTFOCUS =6, - FE_KILLFOCUS =7, -}; - - -#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__GNUC__) || defined(__WATCOMC__) -#ifdef __cplusplus -extern "C" -{ -#endif -// Exported Functions - - void WINAPI _export ClosePlugin(HANDLE hPlugin); - int WINAPI _export Compare(HANDLE hPlugin,const struct PluginPanelItem *Item1,const struct PluginPanelItem *Item2,unsigned int Mode); - int WINAPI _export Configure(int ItemNumber); - int WINAPI _export DeleteFiles(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode); - void WINAPI _export ExitFAR(void); - void WINAPI _export FreeFindData(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber); - void WINAPI _export FreeVirtualFindData(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber); - int WINAPI _export GetFiles(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,char *DestPath,int OpMode); - int WINAPI _export GetFindData(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,int OpMode); - int WINAPI _export GetMinFarVersion(void); - void WINAPI _export GetOpenPluginInfo(HANDLE hPlugin,struct OpenPluginInfo *Info); - void WINAPI _export GetPluginInfo(struct PluginInfo *Info); - int WINAPI _export GetVirtualFindData(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,const char *Path); - int WINAPI _export MakeDirectory(HANDLE hPlugin,char *Name,int OpMode); - HANDLE WINAPI _export OpenFilePlugin(char *Name,const unsigned char *Data,int DataSize); - HANDLE WINAPI _export OpenPlugin(int OpenFrom,INT_PTR Item); - int WINAPI _export ProcessDialogEvent(int Event,void *Param); - int WINAPI _export ProcessEditorEvent(int Event,void *Param); - int WINAPI _export ProcessEditorInput(const INPUT_RECORD *Rec); - int WINAPI _export ProcessEvent(HANDLE hPlugin,int Event,void *Param); - int WINAPI _export ProcessHostFile(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode); - int WINAPI _export ProcessKey(HANDLE hPlugin,int Key,unsigned int ControlState); - int WINAPI _export ProcessViewerEvent(int Event,void *Param); - int WINAPI _export PutFiles(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,int OpMode); - int WINAPI _export SetDirectory(HANDLE hPlugin,const char *Dir,int OpMode); - int WINAPI _export SetFindList(HANDLE hPlugin,const struct PluginPanelItem *PanelItem,int ItemsNumber); - void WINAPI _export SetStartupInfo(const struct PluginStartupInfo *Info); - -#ifdef __cplusplus -}; -#endif -#endif - -#ifndef _WIN64 -#if defined(__BORLANDC__) -#pragma option -a. -#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100)) || defined(__LCC__) -#pragma pack() -#else -#pragma pack(pop) -#endif -#endif - -#endif /* RC_INVOKED */ - -#endif /* __PLUGIN_HPP__ */ diff --git a/farsdk/unicode3/PluginSettings.hpp b/farsdk/unicode/PluginSettings.hpp similarity index 99% rename from farsdk/unicode3/PluginSettings.hpp rename to farsdk/unicode/PluginSettings.hpp index b77eb92..3bdda34 100644 --- a/farsdk/unicode3/PluginSettings.hpp +++ b/farsdk/unicode/PluginSettings.hpp @@ -1,4 +1,4 @@ -#ifndef __PLUGINSETTINGS_HPP__ +#ifndef __PLUGINSETTINGS_HPP__ #define __PLUGINSETTINGS_HPP__ #include "plugin.hpp" diff --git a/farsdk/unicode/farcolor.hpp b/farsdk/unicode/farcolor.hpp index ca7d44d..5752d6c 100644 --- a/farsdk/unicode/farcolor.hpp +++ b/farsdk/unicode/farcolor.hpp @@ -1,212 +1,219 @@ -#pragma once -#ifndef __COLORS_HPP__ -#define __COLORS_HPP__ -/* - farcolor.hpp - - Colors Index for FAR Manager 2.0 build 1420 - HKCU\Software\Far\Colors\CurrentPalette -*/ - -/* -Copyright (c) 1996 Eugene Roshal -Copyright (c) 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - - -enum PaletteColors -{ - COL_MENUTEXT, - COL_MENUSELECTEDTEXT, - COL_MENUHIGHLIGHT, - COL_MENUSELECTEDHIGHLIGHT, - COL_MENUBOX, - COL_MENUTITLE, - - COL_HMENUTEXT, - COL_HMENUSELECTEDTEXT, - COL_HMENUHIGHLIGHT, - COL_HMENUSELECTEDHIGHLIGHT, - - COL_PANELTEXT, - COL_PANELSELECTEDTEXT, - COL_PANELHIGHLIGHTTEXT, - COL_PANELINFOTEXT, - COL_PANELCURSOR, - COL_PANELSELECTEDCURSOR, - COL_PANELTITLE, - COL_PANELSELECTEDTITLE, - COL_PANELCOLUMNTITLE, - COL_PANELTOTALINFO, - COL_PANELSELECTEDINFO, - - COL_DIALOGTEXT, - COL_DIALOGHIGHLIGHTTEXT, - COL_DIALOGBOX, - COL_DIALOGBOXTITLE, - COL_DIALOGHIGHLIGHTBOXTITLE, - COL_DIALOGEDIT, - COL_DIALOGBUTTON, - COL_DIALOGSELECTEDBUTTON, - COL_DIALOGHIGHLIGHTBUTTON, - COL_DIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_DIALOGLISTTEXT, - COL_DIALOGLISTSELECTEDTEXT, - COL_DIALOGLISTHIGHLIGHT, - COL_DIALOGLISTSELECTEDHIGHLIGHT, - - COL_WARNDIALOGTEXT, - COL_WARNDIALOGHIGHLIGHTTEXT, - COL_WARNDIALOGBOX, - COL_WARNDIALOGBOXTITLE, - COL_WARNDIALOGHIGHLIGHTBOXTITLE, - COL_WARNDIALOGEDIT, - COL_WARNDIALOGBUTTON, - COL_WARNDIALOGSELECTEDBUTTON, - COL_WARNDIALOGHIGHLIGHTBUTTON, - COL_WARNDIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_KEYBARNUM, - COL_KEYBARTEXT, - COL_KEYBARBACKGROUND, - - COL_COMMANDLINE, - - COL_CLOCK, - - COL_VIEWERTEXT, - COL_VIEWERSELECTEDTEXT, - COL_VIEWERSTATUS, - - COL_EDITORTEXT, - COL_EDITORSELECTEDTEXT, - COL_EDITORSTATUS, - - COL_HELPTEXT, - COL_HELPHIGHLIGHTTEXT, - COL_HELPTOPIC, - COL_HELPSELECTEDTOPIC, - COL_HELPBOX, - COL_HELPBOXTITLE, - - COL_PANELDRAGTEXT, - COL_DIALOGEDITUNCHANGED, - COL_PANELSCROLLBAR, - COL_HELPSCROLLBAR, - COL_PANELBOX, - COL_PANELSCREENSNUMBER, - COL_DIALOGEDITSELECTED, - COL_COMMANDLINESELECTED, - COL_VIEWERARROWS, - - COL_RESERVED0, - - COL_DIALOGLISTSCROLLBAR, - COL_MENUSCROLLBAR, - COL_VIEWERSCROLLBAR, - COL_COMMANDLINEPREFIX, - COL_DIALOGDISABLED, - COL_DIALOGEDITDISABLED, - COL_DIALOGLISTDISABLED, - COL_WARNDIALOGDISABLED, - COL_WARNDIALOGEDITDISABLED, - COL_WARNDIALOGLISTDISABLED, - - COL_MENUDISABLEDTEXT, - - COL_EDITORCLOCK, - COL_VIEWERCLOCK, - - COL_DIALOGLISTTITLE, - COL_DIALOGLISTBOX, - - COL_WARNDIALOGEDITSELECTED, - COL_WARNDIALOGEDITUNCHANGED, - - COL_DIALOGCOMBOTEXT, - COL_DIALOGCOMBOSELECTEDTEXT, - COL_DIALOGCOMBOHIGHLIGHT, - COL_DIALOGCOMBOSELECTEDHIGHLIGHT, - COL_DIALOGCOMBOBOX, - COL_DIALOGCOMBOTITLE, - COL_DIALOGCOMBODISABLED, - COL_DIALOGCOMBOSCROLLBAR, - - COL_WARNDIALOGLISTTEXT, - COL_WARNDIALOGLISTSELECTEDTEXT, - COL_WARNDIALOGLISTHIGHLIGHT, - COL_WARNDIALOGLISTSELECTEDHIGHLIGHT, - COL_WARNDIALOGLISTBOX, - COL_WARNDIALOGLISTTITLE, - COL_WARNDIALOGLISTSCROLLBAR, - - COL_WARNDIALOGCOMBOTEXT, - COL_WARNDIALOGCOMBOSELECTEDTEXT, - COL_WARNDIALOGCOMBOHIGHLIGHT, - COL_WARNDIALOGCOMBOSELECTEDHIGHLIGHT, - COL_WARNDIALOGCOMBOBOX, - COL_WARNDIALOGCOMBOTITLE, - COL_WARNDIALOGCOMBODISABLED, - COL_WARNDIALOGCOMBOSCROLLBAR, - - COL_DIALOGLISTARROWS, - COL_DIALOGLISTARROWSDISABLED, - COL_DIALOGLISTARROWSSELECTED, - COL_DIALOGCOMBOARROWS, - COL_DIALOGCOMBOARROWSDISABLED, - COL_DIALOGCOMBOARROWSSELECTED, - COL_WARNDIALOGLISTARROWS, - COL_WARNDIALOGLISTARROWSDISABLED, - COL_WARNDIALOGLISTARROWSSELECTED, - COL_WARNDIALOGCOMBOARROWS, - COL_WARNDIALOGCOMBOARROWSDISABLED, - COL_WARNDIALOGCOMBOARROWSSELECTED, - COL_MENUARROWS, - COL_MENUARROWSDISABLED, - COL_MENUARROWSSELECTED, - COL_COMMANDLINEUSERSCREEN, - COL_EDITORSCROLLBAR, - - COL_MENUGRAYTEXT, - COL_MENUSELECTEDGRAYTEXT, - COL_DIALOGCOMBOGRAY, - COL_DIALOGCOMBOSELECTEDGRAYTEXT, - COL_DIALOGLISTGRAY, - COL_DIALOGLISTSELECTEDGRAYTEXT, - COL_WARNDIALOGCOMBOGRAY, - COL_WARNDIALOGCOMBOSELECTEDGRAYTEXT, - COL_WARNDIALOGLISTGRAY, - COL_WARNDIALOGLISTSELECTEDGRAYTEXT, - - COL_LASTPALETTECOLOR -}; - -#endif // __COLORS_HPP__ +#ifndef FARCOLOR_HPP_57151931_4591_44A5_92CF_8E51D1FBC57E +#define FARCOLOR_HPP_57151931_4591_44A5_92CF_8E51D1FBC57E +#pragma once + +/* +farcolor.hpp + +Colors Index for FAR Manager 3.0 build 5655 +*/ +/* +Copyright © 1996 Eugene Roshal +Copyright © 2000 Far Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +EXCEPTION: +Far Manager plugins that use this header file can be distributed under any +other possible license with no implications from the above license on them. +*/ + + + +enum PaletteColors +{ + COL_MENUTEXT, + COL_MENUSELECTEDTEXT, + COL_MENUHIGHLIGHT, + COL_MENUSELECTEDHIGHLIGHT, + COL_MENUBOX, + COL_MENUTITLE, + + COL_HMENUTEXT, + COL_HMENUSELECTEDTEXT, + COL_HMENUHIGHLIGHT, + COL_HMENUSELECTEDHIGHLIGHT, + + COL_PANELTEXT, + COL_PANELSELECTEDTEXT, + COL_PANELHIGHLIGHTTEXT, + COL_PANELINFOTEXT, + COL_PANELCURSOR, + COL_PANELSELECTEDCURSOR, + COL_PANELTITLE, + COL_PANELSELECTEDTITLE, + COL_PANELCOLUMNTITLE, + COL_PANELTOTALINFO, + COL_PANELSELECTEDINFO, + + COL_DIALOGTEXT, + COL_DIALOGHIGHLIGHTTEXT, + COL_DIALOGBOX, + COL_DIALOGBOXTITLE, + COL_DIALOGHIGHLIGHTBOXTITLE, + COL_DIALOGEDIT, + COL_DIALOGBUTTON, + COL_DIALOGSELECTEDBUTTON, + COL_DIALOGHIGHLIGHTBUTTON, + COL_DIALOGHIGHLIGHTSELECTEDBUTTON, + + COL_DIALOGLISTTEXT, + COL_DIALOGLISTSELECTEDTEXT, + COL_DIALOGLISTHIGHLIGHT, + COL_DIALOGLISTSELECTEDHIGHLIGHT, + + COL_WARNDIALOGTEXT, + COL_WARNDIALOGHIGHLIGHTTEXT, + COL_WARNDIALOGBOX, + COL_WARNDIALOGBOXTITLE, + COL_WARNDIALOGHIGHLIGHTBOXTITLE, + COL_WARNDIALOGEDIT, + COL_WARNDIALOGBUTTON, + COL_WARNDIALOGSELECTEDBUTTON, + COL_WARNDIALOGHIGHLIGHTBUTTON, + COL_WARNDIALOGHIGHLIGHTSELECTEDBUTTON, + + COL_KEYBARNUM, + COL_KEYBARTEXT, + COL_KEYBARBACKGROUND, + + COL_COMMANDLINE, + + COL_CLOCK, + + COL_VIEWERTEXT, + COL_VIEWERSELECTEDTEXT, + COL_VIEWERSTATUS, + + COL_EDITORTEXT, + COL_EDITORSELECTEDTEXT, + COL_EDITORSTATUS, + + COL_HELPTEXT, + COL_HELPHIGHLIGHTTEXT, + COL_HELPTOPIC, + COL_HELPSELECTEDTOPIC, + COL_HELPBOX, + COL_HELPBOXTITLE, + + COL_PANELDRAGTEXT, + COL_DIALOGEDITUNCHANGED, + COL_PANELSCROLLBAR, + COL_HELPSCROLLBAR, + COL_PANELBOX, + COL_PANELSCREENSNUMBER, + COL_DIALOGEDITSELECTED, + COL_COMMANDLINESELECTED, + COL_VIEWERARROWS, + + COL_DIALOGLISTSCROLLBAR, + COL_MENUSCROLLBAR, + COL_VIEWERSCROLLBAR, + COL_COMMANDLINEPREFIX, + COL_DIALOGDISABLED, + COL_DIALOGEDITDISABLED, + COL_DIALOGLISTDISABLED, + COL_WARNDIALOGDISABLED, + COL_WARNDIALOGEDITDISABLED, + COL_WARNDIALOGLISTDISABLED, + + COL_MENUDISABLEDTEXT, + + COL_EDITORCLOCK, + COL_VIEWERCLOCK, + + COL_DIALOGLISTTITLE, + COL_DIALOGLISTBOX, + + COL_WARNDIALOGEDITSELECTED, + COL_WARNDIALOGEDITUNCHANGED, + + COL_DIALOGCOMBOTEXT, + COL_DIALOGCOMBOSELECTEDTEXT, + COL_DIALOGCOMBOHIGHLIGHT, + COL_DIALOGCOMBOSELECTEDHIGHLIGHT, + COL_DIALOGCOMBOBOX, + COL_DIALOGCOMBOTITLE, + COL_DIALOGCOMBODISABLED, + COL_DIALOGCOMBOSCROLLBAR, + + COL_WARNDIALOGLISTTEXT, + COL_WARNDIALOGLISTSELECTEDTEXT, + COL_WARNDIALOGLISTHIGHLIGHT, + COL_WARNDIALOGLISTSELECTEDHIGHLIGHT, + COL_WARNDIALOGLISTBOX, + COL_WARNDIALOGLISTTITLE, + COL_WARNDIALOGLISTSCROLLBAR, + + COL_WARNDIALOGCOMBOTEXT, + COL_WARNDIALOGCOMBOSELECTEDTEXT, + COL_WARNDIALOGCOMBOHIGHLIGHT, + COL_WARNDIALOGCOMBOSELECTEDHIGHLIGHT, + COL_WARNDIALOGCOMBOBOX, + COL_WARNDIALOGCOMBOTITLE, + COL_WARNDIALOGCOMBODISABLED, + COL_WARNDIALOGCOMBOSCROLLBAR, + + COL_DIALOGLISTARROWS, + COL_DIALOGLISTARROWSDISABLED, + COL_DIALOGLISTARROWSSELECTED, + COL_DIALOGCOMBOARROWS, + COL_DIALOGCOMBOARROWSDISABLED, + COL_DIALOGCOMBOARROWSSELECTED, + COL_WARNDIALOGLISTARROWS, + COL_WARNDIALOGLISTARROWSDISABLED, + COL_WARNDIALOGLISTARROWSSELECTED, + COL_WARNDIALOGCOMBOARROWS, + COL_WARNDIALOGCOMBOARROWSDISABLED, + COL_WARNDIALOGCOMBOARROWSSELECTED, + COL_MENUARROWS, + COL_MENUARROWSDISABLED, + COL_MENUARROWSSELECTED, + COL_COMMANDLINEUSERSCREEN, + COL_EDITORSCROLLBAR, + + COL_MENUGRAYTEXT, + COL_MENUSELECTEDGRAYTEXT, + COL_DIALOGCOMBOGRAY, + COL_DIALOGCOMBOSELECTEDGRAYTEXT, + COL_DIALOGLISTGRAY, + COL_DIALOGLISTSELECTEDGRAYTEXT, + COL_WARNDIALOGCOMBOGRAY, + COL_WARNDIALOGCOMBOSELECTEDGRAYTEXT, + COL_WARNDIALOGLISTGRAY, + COL_WARNDIALOGLISTSELECTEDGRAYTEXT, + + COL_DIALOGDEFAULTBUTTON, + COL_DIALOGSELECTEDDEFAULTBUTTON, + COL_DIALOGHIGHLIGHTDEFAULTBUTTON, + COL_DIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON, + COL_WARNDIALOGDEFAULTBUTTON, + COL_WARNDIALOGSELECTEDDEFAULTBUTTON, + COL_WARNDIALOGHIGHLIGHTDEFAULTBUTTON, + COL_WARNDIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON, + + COL_LASTPALETTECOLOR +}; + +#endif // FARCOLOR_HPP_57151931_4591_44A5_92CF_8E51D1FBC57E diff --git a/farsdk/unicode/farkeys.hpp b/farsdk/unicode/farkeys.hpp index 3a15074..b8d895c 100644 --- a/farsdk/unicode/farkeys.hpp +++ b/farsdk/unicode/farkeys.hpp @@ -1,700 +1,700 @@ -#pragma once -#ifndef __FARKEYS_HPP__ -#define __FARKEYS_HPP__ -/* - farkeys.hpp - - Inside KeyName for FAR Manager 2.0 build 1420 -*/ - -/* -Copyright (c) 1996 Eugene Roshal -Copyright (c) 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - - -#define EXTENDED_KEY_BASE 0x00010000 -#define INTERNAL_KEY_BASE 0x00020000 -#define INTERNAL_KEY_BASE_2 0x00030000 - -enum BaseDefKeyboard -{ - KEY_CTRL =0x01000000, - KEY_ALT =0x02000000, - KEY_SHIFT =0x04000000, - KEY_RCTRL =0x10000000, - KEY_RALT =0x20000000, - KEY_CTRLMASK =0xFF000000, - - KEY_BRACKET ='[', - KEY_BACKBRACKET =']', - KEY_COMMA =',', - KEY_QUOTE ='"', - KEY_DOT ='.', - KEY_SLASH ='/', - KEY_COLON =':', - KEY_SEMICOLON =';', - KEY_BACKSLASH ='\\', - - KEY_BS =0x00000008, - KEY_TAB =0x00000009, - KEY_ENTER =0x0000000D, - KEY_ESC =0x0000001B, - KEY_SPACE =0x00000020, - - KEY_MASKF =0x0001FFFF, - - KEY_FKEY_BEGIN =EXTENDED_KEY_BASE, - - KEY_BREAK =EXTENDED_KEY_BASE+VK_CANCEL, - - KEY_PAUSE =EXTENDED_KEY_BASE+VK_PAUSE, - KEY_CAPSLOCK =EXTENDED_KEY_BASE+VK_CAPITAL, - - KEY_PGUP =EXTENDED_KEY_BASE+VK_PRIOR, - KEY_PGDN =EXTENDED_KEY_BASE+VK_NEXT, - KEY_END =EXTENDED_KEY_BASE+VK_END, - KEY_HOME =EXTENDED_KEY_BASE+VK_HOME, - KEY_LEFT =EXTENDED_KEY_BASE+VK_LEFT, - KEY_UP =EXTENDED_KEY_BASE+VK_UP, - KEY_RIGHT =EXTENDED_KEY_BASE+VK_RIGHT, - KEY_DOWN =EXTENDED_KEY_BASE+VK_DOWN, - KEY_PRNTSCRN =EXTENDED_KEY_BASE+VK_SNAPSHOT, - KEY_INS =EXTENDED_KEY_BASE+VK_INSERT, - KEY_DEL =EXTENDED_KEY_BASE+VK_DELETE, - - KEY_LWIN =EXTENDED_KEY_BASE+VK_LWIN, - KEY_RWIN =EXTENDED_KEY_BASE+VK_RWIN, - KEY_APPS =EXTENDED_KEY_BASE+VK_APPS, - KEY_STANDBY =EXTENDED_KEY_BASE+VK_SLEEP, - - KEY_NUMPAD0 =EXTENDED_KEY_BASE+VK_NUMPAD0, - KEY_NUMPAD1 =EXTENDED_KEY_BASE+VK_NUMPAD1, - KEY_NUMPAD2 =EXTENDED_KEY_BASE+VK_NUMPAD2, - KEY_NUMPAD3 =EXTENDED_KEY_BASE+VK_NUMPAD3, - KEY_NUMPAD4 =EXTENDED_KEY_BASE+VK_NUMPAD4, - KEY_NUMPAD5 =EXTENDED_KEY_BASE+VK_NUMPAD5, - KEY_CLEAR =KEY_NUMPAD5, - KEY_NUMPAD6 =EXTENDED_KEY_BASE+VK_NUMPAD6, - KEY_NUMPAD7 =EXTENDED_KEY_BASE+VK_NUMPAD7, - KEY_NUMPAD8 =EXTENDED_KEY_BASE+VK_NUMPAD8, - KEY_NUMPAD9 =EXTENDED_KEY_BASE+VK_NUMPAD9, - - KEY_MULTIPLY =EXTENDED_KEY_BASE+VK_MULTIPLY, - KEY_ADD =EXTENDED_KEY_BASE+VK_ADD, - KEY_SUBTRACT =EXTENDED_KEY_BASE+VK_SUBTRACT, - KEY_DECIMAL =EXTENDED_KEY_BASE+VK_DECIMAL, - KEY_DIVIDE =EXTENDED_KEY_BASE+VK_DIVIDE, - - KEY_F1 =EXTENDED_KEY_BASE+VK_F1, - KEY_F2 =EXTENDED_KEY_BASE+VK_F2, - KEY_F3 =EXTENDED_KEY_BASE+VK_F3, - KEY_F4 =EXTENDED_KEY_BASE+VK_F4, - KEY_F5 =EXTENDED_KEY_BASE+VK_F5, - KEY_F6 =EXTENDED_KEY_BASE+VK_F6, - KEY_F7 =EXTENDED_KEY_BASE+VK_F7, - KEY_F8 =EXTENDED_KEY_BASE+VK_F8, - KEY_F9 =EXTENDED_KEY_BASE+VK_F9, - KEY_F10 =EXTENDED_KEY_BASE+VK_F10, - KEY_F11 =EXTENDED_KEY_BASE+VK_F11, - KEY_F12 =EXTENDED_KEY_BASE+VK_F12, - - KEY_F13 =EXTENDED_KEY_BASE+VK_F13, - KEY_F14 =EXTENDED_KEY_BASE+VK_F14, - KEY_F15 =EXTENDED_KEY_BASE+VK_F15, - KEY_F16 =EXTENDED_KEY_BASE+VK_F16, - KEY_F17 =EXTENDED_KEY_BASE+VK_F17, - KEY_F18 =EXTENDED_KEY_BASE+VK_F18, - KEY_F19 =EXTENDED_KEY_BASE+VK_F19, - KEY_F20 =EXTENDED_KEY_BASE+VK_F20, - KEY_F21 =EXTENDED_KEY_BASE+VK_F21, - KEY_F22 =EXTENDED_KEY_BASE+VK_F22, - KEY_F23 =EXTENDED_KEY_BASE+VK_F23, - KEY_F24 =EXTENDED_KEY_BASE+VK_F24, - - KEY_NUMLOCK =EXTENDED_KEY_BASE+VK_NUMLOCK, - KEY_SCROLLLOCK =EXTENDED_KEY_BASE+VK_SCROLL, - -#if (_WIN32_WINNT >= 0x0500) - KEY_BROWSER_BACK =EXTENDED_KEY_BASE+VK_BROWSER_BACK, - KEY_BROWSER_FORWARD =EXTENDED_KEY_BASE+VK_BROWSER_FORWARD, - KEY_BROWSER_REFRESH =EXTENDED_KEY_BASE+VK_BROWSER_REFRESH, - KEY_BROWSER_STOP =EXTENDED_KEY_BASE+VK_BROWSER_STOP, - KEY_BROWSER_SEARCH =EXTENDED_KEY_BASE+VK_BROWSER_SEARCH, - KEY_BROWSER_FAVORITES =EXTENDED_KEY_BASE+VK_BROWSER_FAVORITES, - KEY_BROWSER_HOME =EXTENDED_KEY_BASE+VK_BROWSER_HOME, - KEY_VOLUME_MUTE =EXTENDED_KEY_BASE+VK_VOLUME_MUTE, - KEY_VOLUME_DOWN =EXTENDED_KEY_BASE+VK_VOLUME_DOWN, - KEY_VOLUME_UP =EXTENDED_KEY_BASE+VK_VOLUME_UP, - KEY_MEDIA_NEXT_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_NEXT_TRACK, - KEY_MEDIA_PREV_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_PREV_TRACK, - KEY_MEDIA_STOP =EXTENDED_KEY_BASE+VK_MEDIA_STOP, - KEY_MEDIA_PLAY_PAUSE =EXTENDED_KEY_BASE+VK_MEDIA_PLAY_PAUSE, - KEY_LAUNCH_MAIL =EXTENDED_KEY_BASE+VK_LAUNCH_MAIL, - KEY_LAUNCH_MEDIA_SELECT =EXTENDED_KEY_BASE+VK_LAUNCH_MEDIA_SELECT, - KEY_LAUNCH_APP1 =EXTENDED_KEY_BASE+VK_LAUNCH_APP1, - KEY_LAUNCH_APP2 =EXTENDED_KEY_BASE+VK_LAUNCH_APP2, -#endif - - KEY_CTRLALTSHIFTPRESS =INTERNAL_KEY_BASE+1, - KEY_CTRLALTSHIFTRELEASE =INTERNAL_KEY_BASE+2, - - KEY_MSWHEEL_UP =INTERNAL_KEY_BASE+3, - KEY_MSWHEEL_DOWN =INTERNAL_KEY_BASE+4, - KEY_NUMDEL =INTERNAL_KEY_BASE+9, - KEY_NUMENTER =INTERNAL_KEY_BASE+0xB, - - KEY_MSWHEEL_LEFT =INTERNAL_KEY_BASE+0xC, - KEY_MSWHEEL_RIGHT =INTERNAL_KEY_BASE+0xD, - - KEY_MSLCLICK =INTERNAL_KEY_BASE+0xF, - KEY_MSRCLICK =INTERNAL_KEY_BASE+0x10, - - KEY_MSM1CLICK =INTERNAL_KEY_BASE+0x11, - KEY_MSM2CLICK =INTERNAL_KEY_BASE+0x12, - KEY_MSM3CLICK =INTERNAL_KEY_BASE+0x13, - - - - KEY_VK_0xFF_BEGIN =EXTENDED_KEY_BASE+0x00000100, - KEY_VK_0xFF_END =EXTENDED_KEY_BASE+0x000001FF, - - KEY_END_FKEY =0x0001FFFF, - - KEY_NONE =INTERNAL_KEY_BASE_2+1, - KEY_IDLE =INTERNAL_KEY_BASE_2+2, - - KEY_END_SKEY =0x0003FFFF, - KEY_LAST_BASE =KEY_END_SKEY, - -}; - -enum AddDefKeyboard -{ - KEY_CTRLSHIFT =KEY_CTRL|KEY_SHIFT, - KEY_ALTSHIFT =KEY_ALT|KEY_SHIFT, - KEY_CTRLALT =KEY_CTRL|KEY_ALT, - - KEY_CTRL0 =KEY_CTRL+'0', - KEY_CTRL1 =KEY_CTRL+'1', - KEY_CTRL2 =KEY_CTRL+'2', - KEY_CTRL3 =KEY_CTRL+'3', - KEY_CTRL4 =KEY_CTRL+'4', - KEY_CTRL5 =KEY_CTRL+'5', - KEY_CTRL6 =KEY_CTRL+'6', - KEY_CTRL7 =KEY_CTRL+'7', - KEY_CTRL8 =KEY_CTRL+'8', - KEY_CTRL9 =KEY_CTRL+'9', - - KEY_RCTRL0 =KEY_RCTRL+'0', - KEY_RCTRL1 =KEY_RCTRL+'1', - KEY_RCTRL2 =KEY_RCTRL+'2', - KEY_RCTRL3 =KEY_RCTRL+'3', - KEY_RCTRL4 =KEY_RCTRL+'4', - KEY_RCTRL5 =KEY_RCTRL+'5', - KEY_RCTRL6 =KEY_RCTRL+'6', - KEY_RCTRL7 =KEY_RCTRL+'7', - KEY_RCTRL8 =KEY_RCTRL+'8', - KEY_RCTRL9 =KEY_RCTRL+'9', - - KEY_CTRLA =KEY_CTRL+'A', - KEY_CTRLB =KEY_CTRL+'B', - KEY_CTRLC =KEY_CTRL+'C', - KEY_CTRLD =KEY_CTRL+'D', - KEY_CTRLE =KEY_CTRL+'E', - KEY_CTRLF =KEY_CTRL+'F', - KEY_CTRLG =KEY_CTRL+'G', - KEY_CTRLH =KEY_CTRL+'H', - KEY_CTRLI =KEY_CTRL+'I', - KEY_CTRLJ =KEY_CTRL+'J', - KEY_CTRLK =KEY_CTRL+'K', - KEY_CTRLL =KEY_CTRL+'L', - KEY_CTRLM =KEY_CTRL+'M', - KEY_CTRLN =KEY_CTRL+'N', - KEY_CTRLO =KEY_CTRL+'O', - KEY_CTRLP =KEY_CTRL+'P', - KEY_CTRLQ =KEY_CTRL+'Q', - KEY_CTRLR =KEY_CTRL+'R', - KEY_CTRLS =KEY_CTRL+'S', - KEY_CTRLT =KEY_CTRL+'T', - KEY_CTRLU =KEY_CTRL+'U', - KEY_CTRLV =KEY_CTRL+'V', - KEY_CTRLW =KEY_CTRL+'W', - KEY_CTRLX =KEY_CTRL+'X', - KEY_CTRLY =KEY_CTRL+'Y', - KEY_CTRLZ =KEY_CTRL+'Z', - - KEY_CTRLBRACKET =KEY_CTRL|KEY_BRACKET, - KEY_CTRLBACKBRACKET =KEY_CTRL|KEY_BACKBRACKET, - KEY_CTRLCOMMA =KEY_CTRL|KEY_COMMA, - KEY_CTRLQUOTE =KEY_CTRL|KEY_QUOTE, - KEY_CTRLDOT =KEY_CTRL|KEY_DOT, - - KEY_ALT0 =KEY_ALT+'0', - KEY_ALT1 =KEY_ALT+'1', - KEY_ALT2 =KEY_ALT+'2', - KEY_ALT3 =KEY_ALT+'3', - KEY_ALT4 =KEY_ALT+'4', - KEY_ALT5 =KEY_ALT+'5', - KEY_ALT6 =KEY_ALT+'6', - KEY_ALT7 =KEY_ALT+'7', - KEY_ALT8 =KEY_ALT+'8', - KEY_ALT9 =KEY_ALT+'9', - - KEY_ALTADD =KEY_ALT|KEY_ADD, - KEY_ALTDOT =KEY_ALT|KEY_DOT, - KEY_ALTCOMMA =KEY_ALT|KEY_COMMA, - KEY_ALTMULTIPLY =KEY_ALT|KEY_MULTIPLY, - - KEY_ALTA =KEY_ALT+'A', - KEY_ALTB =KEY_ALT+'B', - KEY_ALTC =KEY_ALT+'C', - KEY_ALTD =KEY_ALT+'D', - KEY_ALTE =KEY_ALT+'E', - KEY_ALTF =KEY_ALT+'F', - KEY_ALTG =KEY_ALT+'G', - KEY_ALTH =KEY_ALT+'H', - KEY_ALTI =KEY_ALT+'I', - KEY_ALTJ =KEY_ALT+'J', - KEY_ALTK =KEY_ALT+'K', - KEY_ALTL =KEY_ALT+'L', - KEY_ALTM =KEY_ALT+'M', - KEY_ALTN =KEY_ALT+'N', - KEY_ALTO =KEY_ALT+'O', - KEY_ALTP =KEY_ALT+'P', - KEY_ALTQ =KEY_ALT+'Q', - KEY_ALTR =KEY_ALT+'R', - KEY_ALTS =KEY_ALT+'S', - KEY_ALTT =KEY_ALT+'T', - KEY_ALTU =KEY_ALT+'U', - KEY_ALTV =KEY_ALT+'V', - KEY_ALTW =KEY_ALT+'W', - KEY_ALTX =KEY_ALT+'X', - KEY_ALTY =KEY_ALT+'Y', - KEY_ALTZ =KEY_ALT+'Z', - - KEY_CTRLSHIFTADD =KEY_CTRL|KEY_SHIFT|KEY_ADD, - KEY_CTRLSHIFTSUBTRACT =KEY_CTRL|KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLSHIFTDOT =KEY_CTRL|KEY_SHIFT|KEY_DOT, - KEY_CTRLSHIFTSLASH =KEY_CTRL|KEY_SHIFT|KEY_SLASH, - - KEY_CTRLSHIFT0 =(KEY_CTRL|KEY_SHIFT)+'0', - KEY_CTRLSHIFT1 =(KEY_CTRL|KEY_SHIFT)+'1', - KEY_CTRLSHIFT2 =(KEY_CTRL|KEY_SHIFT)+'2', - KEY_CTRLSHIFT3 =(KEY_CTRL|KEY_SHIFT)+'3', - KEY_CTRLSHIFT4 =(KEY_CTRL|KEY_SHIFT)+'4', - KEY_CTRLSHIFT5 =(KEY_CTRL|KEY_SHIFT)+'5', - KEY_CTRLSHIFT6 =(KEY_CTRL|KEY_SHIFT)+'6', - KEY_CTRLSHIFT7 =(KEY_CTRL|KEY_SHIFT)+'7', - KEY_CTRLSHIFT8 =(KEY_CTRL|KEY_SHIFT)+'8', - KEY_CTRLSHIFT9 =(KEY_CTRL|KEY_SHIFT)+'9', - - KEY_RCTRLSHIFT0 =KEY_RCTRL+KEY_SHIFT+'0', - KEY_RCTRLSHIFT1 =KEY_RCTRL+KEY_SHIFT+'1', - KEY_RCTRLSHIFT2 =KEY_RCTRL+KEY_SHIFT+'2', - KEY_RCTRLSHIFT3 =KEY_RCTRL+KEY_SHIFT+'3', - KEY_RCTRLSHIFT4 =KEY_RCTRL+KEY_SHIFT+'4', - KEY_RCTRLSHIFT5 =KEY_RCTRL+KEY_SHIFT+'5', - KEY_RCTRLSHIFT6 =KEY_RCTRL+KEY_SHIFT+'6', - KEY_RCTRLSHIFT7 =KEY_RCTRL+KEY_SHIFT+'7', - KEY_RCTRLSHIFT8 =KEY_RCTRL+KEY_SHIFT+'8', - KEY_RCTRLSHIFT9 =KEY_RCTRL+KEY_SHIFT+'9', - - KEY_CTRLSHIFTA =(KEY_CTRL|KEY_SHIFT)+'A', - KEY_CTRLSHIFTB =(KEY_CTRL|KEY_SHIFT)+'B', - KEY_CTRLSHIFTC =(KEY_CTRL|KEY_SHIFT)+'C', - KEY_CTRLSHIFTD =(KEY_CTRL|KEY_SHIFT)+'D', - KEY_CTRLSHIFTE =(KEY_CTRL|KEY_SHIFT)+'E', - KEY_CTRLSHIFTF =(KEY_CTRL|KEY_SHIFT)+'F', - KEY_CTRLSHIFTG =(KEY_CTRL|KEY_SHIFT)+'G', - KEY_CTRLSHIFTH =(KEY_CTRL|KEY_SHIFT)+'H', - KEY_CTRLSHIFTI =(KEY_CTRL|KEY_SHIFT)+'I', - KEY_CTRLSHIFTJ =(KEY_CTRL|KEY_SHIFT)+'J', - KEY_CTRLSHIFTK =(KEY_CTRL|KEY_SHIFT)+'K', - KEY_CTRLSHIFTL =(KEY_CTRL|KEY_SHIFT)+'L', - KEY_CTRLSHIFTM =(KEY_CTRL|KEY_SHIFT)+'M', - KEY_CTRLSHIFTN =(KEY_CTRL|KEY_SHIFT)+'N', - KEY_CTRLSHIFTO =(KEY_CTRL|KEY_SHIFT)+'O', - KEY_CTRLSHIFTP =(KEY_CTRL|KEY_SHIFT)+'P', - KEY_CTRLSHIFTQ =(KEY_CTRL|KEY_SHIFT)+'Q', - KEY_CTRLSHIFTR =(KEY_CTRL|KEY_SHIFT)+'R', - KEY_CTRLSHIFTS =(KEY_CTRL|KEY_SHIFT)+'S', - KEY_CTRLSHIFTT =(KEY_CTRL|KEY_SHIFT)+'T', - KEY_CTRLSHIFTU =(KEY_CTRL|KEY_SHIFT)+'U', - KEY_CTRLSHIFTV =(KEY_CTRL|KEY_SHIFT)+'V', - KEY_CTRLSHIFTW =(KEY_CTRL|KEY_SHIFT)+'W', - KEY_CTRLSHIFTX =(KEY_CTRL|KEY_SHIFT)+'X', - KEY_CTRLSHIFTY =(KEY_CTRL|KEY_SHIFT)+'Y', - KEY_CTRLSHIFTZ =(KEY_CTRL|KEY_SHIFT)+'Z', - - KEY_CTRLSHIFTBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BRACKET, - KEY_CTRLSHIFTBACKSLASH =KEY_CTRL|KEY_SHIFT|KEY_BACKSLASH, - KEY_CTRLSHIFTBACKBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_ALTSHIFT0 =(KEY_ALT|KEY_SHIFT)+'0', - KEY_ALTSHIFT1 =(KEY_ALT|KEY_SHIFT)+'1', - KEY_ALTSHIFT2 =(KEY_ALT|KEY_SHIFT)+'2', - KEY_ALTSHIFT3 =(KEY_ALT|KEY_SHIFT)+'3', - KEY_ALTSHIFT4 =(KEY_ALT|KEY_SHIFT)+'4', - KEY_ALTSHIFT5 =(KEY_ALT|KEY_SHIFT)+'5', - KEY_ALTSHIFT6 =(KEY_ALT|KEY_SHIFT)+'6', - KEY_ALTSHIFT7 =(KEY_ALT|KEY_SHIFT)+'7', - KEY_ALTSHIFT8 =(KEY_ALT|KEY_SHIFT)+'8', - KEY_ALTSHIFT9 =(KEY_ALT|KEY_SHIFT)+'9', - - KEY_ALTSHIFTA =(KEY_ALT|KEY_SHIFT)+'A', - KEY_ALTSHIFTB =(KEY_ALT|KEY_SHIFT)+'B', - KEY_ALTSHIFTC =(KEY_ALT|KEY_SHIFT)+'C', - KEY_ALTSHIFTD =(KEY_ALT|KEY_SHIFT)+'D', - KEY_ALTSHIFTE =(KEY_ALT|KEY_SHIFT)+'E', - KEY_ALTSHIFTF =(KEY_ALT|KEY_SHIFT)+'F', - KEY_ALTSHIFTG =(KEY_ALT|KEY_SHIFT)+'G', - KEY_ALTSHIFTH =(KEY_ALT|KEY_SHIFT)+'H', - KEY_ALTSHIFTI =(KEY_ALT|KEY_SHIFT)+'I', - KEY_ALTSHIFTJ =(KEY_ALT|KEY_SHIFT)+'J', - KEY_ALTSHIFTK =(KEY_ALT|KEY_SHIFT)+'K', - KEY_ALTSHIFTL =(KEY_ALT|KEY_SHIFT)+'L', - KEY_ALTSHIFTM =(KEY_ALT|KEY_SHIFT)+'M', - KEY_ALTSHIFTN =(KEY_ALT|KEY_SHIFT)+'N', - KEY_ALTSHIFTO =(KEY_ALT|KEY_SHIFT)+'O', - KEY_ALTSHIFTP =(KEY_ALT|KEY_SHIFT)+'P', - KEY_ALTSHIFTQ =(KEY_ALT|KEY_SHIFT)+'Q', - KEY_ALTSHIFTR =(KEY_ALT|KEY_SHIFT)+'R', - KEY_ALTSHIFTS =(KEY_ALT|KEY_SHIFT)+'S', - KEY_ALTSHIFTT =(KEY_ALT|KEY_SHIFT)+'T', - KEY_ALTSHIFTU =(KEY_ALT|KEY_SHIFT)+'U', - KEY_ALTSHIFTV =(KEY_ALT|KEY_SHIFT)+'V', - KEY_ALTSHIFTW =(KEY_ALT|KEY_SHIFT)+'W', - KEY_ALTSHIFTX =(KEY_ALT|KEY_SHIFT)+'X', - KEY_ALTSHIFTY =(KEY_ALT|KEY_SHIFT)+'Y', - KEY_ALTSHIFTZ =(KEY_ALT|KEY_SHIFT)+'Z', - - KEY_ALTSHIFTBRACKET =KEY_ALT|KEY_SHIFT|KEY_BRACKET, - KEY_ALTSHIFTBACKBRACKET =KEY_ALT|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_CTRLALT0 =(KEY_CTRL|KEY_ALT)+'0', - KEY_CTRLALT1 =(KEY_CTRL|KEY_ALT)+'1', - KEY_CTRLALT2 =(KEY_CTRL|KEY_ALT)+'2', - KEY_CTRLALT3 =(KEY_CTRL|KEY_ALT)+'3', - KEY_CTRLALT4 =(KEY_CTRL|KEY_ALT)+'4', - KEY_CTRLALT5 =(KEY_CTRL|KEY_ALT)+'5', - KEY_CTRLALT6 =(KEY_CTRL|KEY_ALT)+'6', - KEY_CTRLALT7 =(KEY_CTRL|KEY_ALT)+'7', - KEY_CTRLALT8 =(KEY_CTRL|KEY_ALT)+'8', - KEY_CTRLALT9 =(KEY_CTRL|KEY_ALT)+'9', - - KEY_CTRLALTA =(KEY_CTRL|KEY_ALT)+'A', - KEY_CTRLALTB =(KEY_CTRL|KEY_ALT)+'B', - KEY_CTRLALTC =(KEY_CTRL|KEY_ALT)+'C', - KEY_CTRLALTD =(KEY_CTRL|KEY_ALT)+'D', - KEY_CTRLALTE =(KEY_CTRL|KEY_ALT)+'E', - KEY_CTRLALTF =(KEY_CTRL|KEY_ALT)+'F', - KEY_CTRLALTG =(KEY_CTRL|KEY_ALT)+'G', - KEY_CTRLALTH =(KEY_CTRL|KEY_ALT)+'H', - KEY_CTRLALTI =(KEY_CTRL|KEY_ALT)+'I', - KEY_CTRLALTJ =(KEY_CTRL|KEY_ALT)+'J', - KEY_CTRLALTK =(KEY_CTRL|KEY_ALT)+'K', - KEY_CTRLALTL =(KEY_CTRL|KEY_ALT)+'L', - KEY_CTRLALTM =(KEY_CTRL|KEY_ALT)+'M', - KEY_CTRLALTN =(KEY_CTRL|KEY_ALT)+'N', - KEY_CTRLALTO =(KEY_CTRL|KEY_ALT)+'O', - KEY_CTRLALTP =(KEY_CTRL|KEY_ALT)+'P', - KEY_CTRLALTQ =(KEY_CTRL|KEY_ALT)+'Q', - KEY_CTRLALTR =(KEY_CTRL|KEY_ALT)+'R', - KEY_CTRLALTS =(KEY_CTRL|KEY_ALT)+'S', - KEY_CTRLALTT =(KEY_CTRL|KEY_ALT)+'T', - KEY_CTRLALTU =(KEY_CTRL|KEY_ALT)+'U', - KEY_CTRLALTV =(KEY_CTRL|KEY_ALT)+'V', - KEY_CTRLALTW =(KEY_CTRL|KEY_ALT)+'W', - KEY_CTRLALTX =(KEY_CTRL|KEY_ALT)+'X', - KEY_CTRLALTY =(KEY_CTRL|KEY_ALT)+'Y', - KEY_CTRLALTZ =(KEY_CTRL|KEY_ALT)+'Z', - - KEY_CTRLALTBRACKET =KEY_CTRL|KEY_ALT|KEY_BRACKET, - KEY_CTRLALTBACKBRACKET =KEY_CTRL|KEY_ALT|KEY_BACKBRACKET, - - KEY_CTRLF1 =KEY_CTRL|KEY_F1, - KEY_CTRLF2 =KEY_CTRL|KEY_F2, - KEY_CTRLF3 =KEY_CTRL|KEY_F3, - KEY_CTRLF4 =KEY_CTRL|KEY_F4, - KEY_CTRLF5 =KEY_CTRL|KEY_F5, - KEY_CTRLF6 =KEY_CTRL|KEY_F6, - KEY_CTRLF7 =KEY_CTRL|KEY_F7, - KEY_CTRLF8 =KEY_CTRL|KEY_F8, - KEY_CTRLF9 =KEY_CTRL|KEY_F9, - KEY_CTRLF10 =KEY_CTRL|KEY_F10, - KEY_CTRLF11 =KEY_CTRL|KEY_F11, - KEY_CTRLF12 =KEY_CTRL|KEY_F12, - - KEY_SHIFTF1 =KEY_SHIFT|KEY_F1, - KEY_SHIFTF2 =KEY_SHIFT|KEY_F2, - KEY_SHIFTF3 =KEY_SHIFT|KEY_F3, - KEY_SHIFTF4 =KEY_SHIFT|KEY_F4, - KEY_SHIFTF5 =KEY_SHIFT|KEY_F5, - KEY_SHIFTF6 =KEY_SHIFT|KEY_F6, - KEY_SHIFTF7 =KEY_SHIFT|KEY_F7, - KEY_SHIFTF8 =KEY_SHIFT|KEY_F8, - KEY_SHIFTF9 =KEY_SHIFT|KEY_F9, - KEY_SHIFTF10 =KEY_SHIFT|KEY_F10, - KEY_SHIFTF11 =KEY_SHIFT|KEY_F11, - KEY_SHIFTF12 =KEY_SHIFT|KEY_F12, - - KEY_ALTF1 =KEY_ALT|KEY_F1, - KEY_ALTF2 =KEY_ALT|KEY_F2, - KEY_ALTF3 =KEY_ALT|KEY_F3, - KEY_ALTF4 =KEY_ALT|KEY_F4, - KEY_ALTF5 =KEY_ALT|KEY_F5, - KEY_ALTF6 =KEY_ALT|KEY_F6, - KEY_ALTF7 =KEY_ALT|KEY_F7, - KEY_ALTF8 =KEY_ALT|KEY_F8, - KEY_ALTF9 =KEY_ALT|KEY_F9, - KEY_ALTF10 =KEY_ALT|KEY_F10, - KEY_ALTF11 =KEY_ALT|KEY_F11, - KEY_ALTF12 =KEY_ALT|KEY_F12, - - KEY_CTRLSHIFTF1 =KEY_CTRL|KEY_SHIFT|KEY_F1, - KEY_CTRLSHIFTF2 =KEY_CTRL|KEY_SHIFT|KEY_F2, - KEY_CTRLSHIFTF3 =KEY_CTRL|KEY_SHIFT|KEY_F3, - KEY_CTRLSHIFTF4 =KEY_CTRL|KEY_SHIFT|KEY_F4, - KEY_CTRLSHIFTF5 =KEY_CTRL|KEY_SHIFT|KEY_F5, - KEY_CTRLSHIFTF6 =KEY_CTRL|KEY_SHIFT|KEY_F6, - KEY_CTRLSHIFTF7 =KEY_CTRL|KEY_SHIFT|KEY_F7, - KEY_CTRLSHIFTF8 =KEY_CTRL|KEY_SHIFT|KEY_F8, - KEY_CTRLSHIFTF9 =KEY_CTRL|KEY_SHIFT|KEY_F9, - KEY_CTRLSHIFTF10 =KEY_CTRL|KEY_SHIFT|KEY_F10, - KEY_CTRLSHIFTF11 =KEY_CTRL|KEY_SHIFT|KEY_F11, - KEY_CTRLSHIFTF12 =KEY_CTRL|KEY_SHIFT|KEY_F12, - - KEY_ALTSHIFTF1 =KEY_ALT|KEY_SHIFT|KEY_F1, - KEY_ALTSHIFTF2 =KEY_ALT|KEY_SHIFT|KEY_F2, - KEY_ALTSHIFTF3 =KEY_ALT|KEY_SHIFT|KEY_F3, - KEY_ALTSHIFTF4 =KEY_ALT|KEY_SHIFT|KEY_F4, - KEY_ALTSHIFTF5 =KEY_ALT|KEY_SHIFT|KEY_F5, - KEY_ALTSHIFTF6 =KEY_ALT|KEY_SHIFT|KEY_F6, - KEY_ALTSHIFTF7 =KEY_ALT|KEY_SHIFT|KEY_F7, - KEY_ALTSHIFTF8 =KEY_ALT|KEY_SHIFT|KEY_F8, - KEY_ALTSHIFTF9 =KEY_ALT|KEY_SHIFT|KEY_F9, - KEY_ALTSHIFTF10 =KEY_ALT|KEY_SHIFT|KEY_F10, - KEY_ALTSHIFTF11 =KEY_ALT|KEY_SHIFT|KEY_F11, - KEY_ALTSHIFTF12 =KEY_ALT|KEY_SHIFT|KEY_F12, - - KEY_CTRLALTF1 =KEY_CTRL|KEY_ALT|KEY_F1, - KEY_CTRLALTF2 =KEY_CTRL|KEY_ALT|KEY_F2, - KEY_CTRLALTF3 =KEY_CTRL|KEY_ALT|KEY_F3, - KEY_CTRLALTF4 =KEY_CTRL|KEY_ALT|KEY_F4, - KEY_CTRLALTF5 =KEY_CTRL|KEY_ALT|KEY_F5, - KEY_CTRLALTF6 =KEY_CTRL|KEY_ALT|KEY_F6, - KEY_CTRLALTF7 =KEY_CTRL|KEY_ALT|KEY_F7, - KEY_CTRLALTF8 =KEY_CTRL|KEY_ALT|KEY_F8, - KEY_CTRLALTF9 =KEY_CTRL|KEY_ALT|KEY_F9, - KEY_CTRLALTF10 =KEY_CTRL|KEY_ALT|KEY_F10, - KEY_CTRLALTF11 =KEY_CTRL|KEY_ALT|KEY_F11, - KEY_CTRLALTF12 =KEY_CTRL|KEY_ALT|KEY_F12, - - KEY_CTRLHOME =KEY_CTRL|KEY_HOME, - KEY_CTRLUP =KEY_CTRL|KEY_UP, - KEY_CTRLPGUP =KEY_CTRL|KEY_PGUP, - KEY_CTRLLEFT =KEY_CTRL|KEY_LEFT, - KEY_CTRLRIGHT =KEY_CTRL|KEY_RIGHT, - KEY_CTRLEND =KEY_CTRL|KEY_END, - KEY_CTRLDOWN =KEY_CTRL|KEY_DOWN, - KEY_CTRLPGDN =KEY_CTRL|KEY_PGDN, - KEY_CTRLINS =KEY_CTRL|KEY_INS, - KEY_CTRLDEL =KEY_CTRL|KEY_DEL, - KEY_CTRLNUMDEL =KEY_CTRL|KEY_NUMDEL, - KEY_CTRLDECIMAL =KEY_CTRL|KEY_DECIMAL, - - KEY_SHIFTHOME =KEY_SHIFT|KEY_HOME, - KEY_SHIFTUP =KEY_SHIFT|KEY_UP, - KEY_SHIFTPGUP =KEY_SHIFT|KEY_PGUP, - KEY_SHIFTLEFT =KEY_SHIFT|KEY_LEFT, - KEY_SHIFTRIGHT =KEY_SHIFT|KEY_RIGHT, - KEY_SHIFTEND =KEY_SHIFT|KEY_END, - KEY_SHIFTDOWN =KEY_SHIFT|KEY_DOWN, - KEY_SHIFTPGDN =KEY_SHIFT|KEY_PGDN, - KEY_SHIFTINS =KEY_SHIFT|KEY_INS, - KEY_SHIFTDEL =KEY_SHIFT|KEY_DEL, - KEY_SHIFTNUMDEL =KEY_SHIFT|KEY_NUMDEL, - KEY_SHIFTDECIMAL =KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTHOME =KEY_ALT|KEY_HOME, - KEY_ALTUP =KEY_ALT|KEY_UP, - KEY_ALTPGUP =KEY_ALT|KEY_PGUP, - KEY_ALTLEFT =KEY_ALT|KEY_LEFT, - KEY_ALTRIGHT =KEY_ALT|KEY_RIGHT, - KEY_ALTEND =KEY_ALT|KEY_END, - KEY_ALTDOWN =KEY_ALT|KEY_DOWN, - KEY_ALTPGDN =KEY_ALT|KEY_PGDN, - KEY_ALTINS =KEY_ALT|KEY_INS, - KEY_ALTDEL =KEY_ALT|KEY_DEL, - KEY_ALTNUMDEL =KEY_ALT|KEY_NUMDEL, - KEY_ALTDECIMAL =KEY_ALT|KEY_DECIMAL, - - KEY_CTRLSHIFTHOME =KEY_CTRL|KEY_SHIFT|KEY_HOME, - KEY_CTRLSHIFTUP =KEY_CTRL|KEY_SHIFT|KEY_UP, - KEY_CTRLSHIFTPGUP =KEY_CTRL|KEY_SHIFT|KEY_PGUP, - KEY_CTRLSHIFTLEFT =KEY_CTRL|KEY_SHIFT|KEY_LEFT, - KEY_CTRLSHIFTRIGHT =KEY_CTRL|KEY_SHIFT|KEY_RIGHT, - KEY_CTRLSHIFTEND =KEY_CTRL|KEY_SHIFT|KEY_END, - KEY_CTRLSHIFTDOWN =KEY_CTRL|KEY_SHIFT|KEY_DOWN, - KEY_CTRLSHIFTPGDN =KEY_CTRL|KEY_SHIFT|KEY_PGDN, - KEY_CTRLSHIFTINS =KEY_CTRL|KEY_SHIFT|KEY_INS, - KEY_CTRLSHIFTDEL =KEY_CTRL|KEY_SHIFT|KEY_DEL, - KEY_CTRLSHIFTNUMDEL =KEY_CTRL|KEY_SHIFT|KEY_NUMDEL, - KEY_CTRLSHIFTDECIMAL =KEY_CTRL|KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTSHIFTHOME =KEY_ALT|KEY_SHIFT|KEY_HOME, - KEY_ALTSHIFTUP =KEY_ALT|KEY_SHIFT|KEY_UP, - KEY_ALTSHIFTPGUP =KEY_ALT|KEY_SHIFT|KEY_PGUP, - KEY_ALTSHIFTLEFT =KEY_ALT|KEY_SHIFT|KEY_LEFT, - KEY_ALTSHIFTRIGHT =KEY_ALT|KEY_SHIFT|KEY_RIGHT, - KEY_ALTSHIFTEND =KEY_ALT|KEY_SHIFT|KEY_END, - KEY_ALTSHIFTDOWN =KEY_ALT|KEY_SHIFT|KEY_DOWN, - KEY_ALTSHIFTPGDN =KEY_ALT|KEY_SHIFT|KEY_PGDN, - KEY_ALTSHIFTINS =KEY_ALT|KEY_SHIFT|KEY_INS, - KEY_ALTSHIFTDEL =KEY_ALT|KEY_SHIFT|KEY_DEL, - KEY_ALTSHIFTNUMDEL =KEY_ALT|KEY_SHIFT|KEY_NUMDEL, - KEY_ALTSHIFTDECIMAL =KEY_ALT|KEY_SHIFT|KEY_DECIMAL, - - KEY_CTRLALTHOME =KEY_CTRL|KEY_ALT|KEY_HOME, - KEY_CTRLALTUP =KEY_CTRL|KEY_ALT|KEY_UP, - KEY_CTRLALTPGUP =KEY_CTRL|KEY_ALT|KEY_PGUP, - KEY_CTRLALTLEFT =KEY_CTRL|KEY_ALT|KEY_LEFT, - KEY_CTRLALTRIGHT =KEY_CTRL|KEY_ALT|KEY_RIGHT, - KEY_CTRLALTEND =KEY_CTRL|KEY_ALT|KEY_END, - KEY_CTRLALTDOWN =KEY_CTRL|KEY_ALT|KEY_DOWN, - KEY_CTRLALTPGDN =KEY_CTRL|KEY_ALT|KEY_PGDN, - KEY_CTRLALTINS =KEY_CTRL|KEY_ALT|KEY_INS, - - KEY_CTRLNUMPAD0 =KEY_CTRL|KEY_NUMPAD0, - KEY_CTRLNUMPAD1 =KEY_CTRL|KEY_NUMPAD1, - KEY_CTRLNUMPAD2 =KEY_CTRL|KEY_NUMPAD2, - KEY_CTRLNUMPAD3 =KEY_CTRL|KEY_NUMPAD3, - KEY_CTRLNUMPAD4 =KEY_CTRL|KEY_NUMPAD4, - KEY_CTRLNUMPAD5 =KEY_CTRL|KEY_NUMPAD5, - KEY_CTRLNUMPAD6 =KEY_CTRL|KEY_NUMPAD6, - KEY_CTRLNUMPAD7 =KEY_CTRL|KEY_NUMPAD7, - KEY_CTRLNUMPAD8 =KEY_CTRL|KEY_NUMPAD8, - KEY_CTRLNUMPAD9 =KEY_CTRL|KEY_NUMPAD9, - - KEY_SHIFTNUMPAD0 =KEY_SHIFT|KEY_NUMPAD0, - KEY_SHIFTNUMPAD1 =KEY_SHIFT|KEY_NUMPAD1, - KEY_SHIFTNUMPAD2 =KEY_SHIFT|KEY_NUMPAD2, - KEY_SHIFTNUMPAD3 =KEY_SHIFT|KEY_NUMPAD3, - KEY_SHIFTNUMPAD4 =KEY_SHIFT|KEY_NUMPAD4, - KEY_SHIFTNUMPAD5 =KEY_SHIFT|KEY_NUMPAD5, - KEY_SHIFTNUMPAD6 =KEY_SHIFT|KEY_NUMPAD6, - KEY_SHIFTNUMPAD7 =KEY_SHIFT|KEY_NUMPAD7, - KEY_SHIFTNUMPAD8 =KEY_SHIFT|KEY_NUMPAD8, - KEY_SHIFTNUMPAD9 =KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSHIFTNUMPAD0 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD0, - KEY_CTRLSHIFTNUMPAD1 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD1, - KEY_CTRLSHIFTNUMPAD2 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD2, - KEY_CTRLSHIFTNUMPAD3 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD3, - KEY_CTRLSHIFTNUMPAD4 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD4, - KEY_CTRLSHIFTNUMPAD5 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD5, - KEY_CTRLSHIFTNUMPAD6 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD6, - KEY_CTRLSHIFTNUMPAD7 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD7, - KEY_CTRLSHIFTNUMPAD8 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD8, - KEY_CTRLSHIFTNUMPAD9 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLALTNUMPAD0 =KEY_CTRL|KEY_ALT|KEY_NUMPAD0, - KEY_CTRLALTNUMPAD1 =KEY_CTRL|KEY_ALT|KEY_NUMPAD1, - KEY_CTRLALTNUMPAD2 =KEY_CTRL|KEY_ALT|KEY_NUMPAD2, - KEY_CTRLALTNUMPAD3 =KEY_CTRL|KEY_ALT|KEY_NUMPAD3, - KEY_CTRLALTNUMPAD4 =KEY_CTRL|KEY_ALT|KEY_NUMPAD4, - KEY_CTRLALTNUMPAD5 =KEY_CTRL|KEY_ALT|KEY_NUMPAD5, - KEY_CTRLALTNUMPAD6 =KEY_CTRL|KEY_ALT|KEY_NUMPAD6, - KEY_CTRLALTNUMPAD7 =KEY_CTRL|KEY_ALT|KEY_NUMPAD7, - KEY_CTRLALTNUMPAD8 =KEY_CTRL|KEY_ALT|KEY_NUMPAD8, - KEY_CTRLALTNUMPAD9 =KEY_CTRL|KEY_ALT|KEY_NUMPAD9, - - KEY_ALTSHIFTNUMPAD0 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD0, - KEY_ALTSHIFTNUMPAD1 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD1, - KEY_ALTSHIFTNUMPAD2 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD2, - KEY_ALTSHIFTNUMPAD3 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD3, - KEY_ALTSHIFTNUMPAD4 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD4, - KEY_ALTSHIFTNUMPAD5 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD5, - KEY_ALTSHIFTNUMPAD6 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD6, - KEY_ALTSHIFTNUMPAD7 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD7, - KEY_ALTSHIFTNUMPAD8 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD8, - KEY_ALTSHIFTNUMPAD9 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSLASH =KEY_CTRL|KEY_SLASH, - KEY_CTRLBACKSLASH =KEY_CTRL|KEY_BACKSLASH, - KEY_CTRLCLEAR =KEY_CTRL|KEY_CLEAR, - KEY_CTRLSHIFTCLEAR =KEY_CTRL|KEY_SHIFT|KEY_CLEAR, - KEY_CTRLADD =KEY_CTRL|KEY_ADD, - KEY_SHIFTADD =KEY_SHIFT|KEY_ADD, - - KEY_CTRLSUBTRACT =KEY_CTRL|KEY_SUBTRACT, - KEY_ALTSUBTRACT =KEY_ALT|KEY_SUBTRACT, - KEY_SHIFTSUBTRACT =KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLMULTIPLY =KEY_CTRL|KEY_MULTIPLY, - - KEY_CTRLBS =KEY_CTRL|KEY_BS, - KEY_ALTBS =KEY_ALT|KEY_BS, - KEY_CTRLSHIFTBS =KEY_CTRL|KEY_SHIFT|KEY_BS, - KEY_SHIFTBS =KEY_SHIFT|KEY_BS, - - KEY_CTRLSHIFTTAB =KEY_CTRL|KEY_SHIFT|KEY_TAB, - KEY_CTRLTAB =KEY_CTRL|KEY_TAB, - KEY_SHIFTTAB =KEY_SHIFT|KEY_TAB, - - KEY_CTRLENTER =KEY_CTRL|KEY_ENTER, - KEY_SHIFTENTER =KEY_SHIFT|KEY_ENTER, - KEY_ALTSHIFTENTER =KEY_ALT|KEY_SHIFT|KEY_ENTER, - KEY_CTRLALTENTER =KEY_CTRL|KEY_ALT|KEY_ENTER, - KEY_CTRLSHIFTENTER =KEY_CTRL|KEY_SHIFT|KEY_ENTER, - - KEY_CTRLNUMENTER =KEY_CTRL|KEY_NUMENTER, - KEY_SHIFTNUMENTER =KEY_SHIFT|KEY_NUMENTER, - KEY_ALTSHIFTNUMENTER =KEY_ALT|KEY_SHIFT|KEY_NUMENTER, - KEY_CTRLALTNUMENTER =KEY_CTRL|KEY_ALT|KEY_NUMENTER, - KEY_CTRLSHIFTNUMENTER =KEY_CTRL|KEY_SHIFT|KEY_NUMENTER, - - KEY_CTRLAPPS =KEY_CTRL|KEY_APPS, - KEY_ALTAPPS =KEY_ALT|KEY_APPS, - KEY_SHIFTAPPS =KEY_SHIFT|KEY_APPS, - KEY_CTRLSHIFTAPPS =KEY_CTRL|KEY_SHIFT|KEY_APPS, - KEY_ALTSHIFTAPPS =KEY_ALT|KEY_SHIFT|KEY_APPS, - KEY_CTRLALTAPPS =KEY_CTRL|KEY_ALT|KEY_APPS, - - KEY_CTRLSPACE =KEY_CTRL|KEY_SPACE, - KEY_SHIFTSPACE =KEY_SHIFT|KEY_SPACE, - KEY_CTRLSHIFTSPACE =KEY_CTRL|KEY_SHIFT|KEY_SPACE, - - KEY_ALT_BASE =KEY_ALT, - KEY_ALTSHIFT_BASE =KEY_ALTSHIFT, -}; - - -#endif // __FARKEYS_HPP__ +#pragma once +#ifndef __FARKEYS_HPP__ +#define __FARKEYS_HPP__ +/* + farkeys.hpp + + Inside KeyName for FAR Manager 2.0 build 1420 +*/ + +/* +Copyright (c) 1996 Eugene Roshal +Copyright (c) 2000 Far Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +EXCEPTION: +Far Manager plugins that use this header file can be distributed under any +other possible license with no implications from the above license on them. +*/ + + +#define EXTENDED_KEY_BASE 0x00010000 +#define INTERNAL_KEY_BASE 0x00020000 +#define INTERNAL_KEY_BASE_2 0x00030000 + +enum BaseDefKeyboard +{ + KEY_CTRL =0x01000000, + KEY_ALT =0x02000000, + KEY_SHIFT =0x04000000, + KEY_RCTRL =0x10000000, + KEY_RALT =0x20000000, + KEY_CTRLMASK =0xFF000000, + + KEY_BRACKET ='[', + KEY_BACKBRACKET =']', + KEY_COMMA =',', + KEY_QUOTE ='"', + KEY_DOT ='.', + KEY_SLASH ='/', + KEY_COLON =':', + KEY_SEMICOLON =';', + KEY_BACKSLASH ='\\', + + KEY_BS =0x00000008, + KEY_TAB =0x00000009, + KEY_ENTER =0x0000000D, + KEY_ESC =0x0000001B, + KEY_SPACE =0x00000020, + + KEY_MASKF =0x0001FFFF, + + KEY_FKEY_BEGIN =EXTENDED_KEY_BASE, + + KEY_BREAK =EXTENDED_KEY_BASE+VK_CANCEL, + + KEY_PAUSE =EXTENDED_KEY_BASE+VK_PAUSE, + KEY_CAPSLOCK =EXTENDED_KEY_BASE+VK_CAPITAL, + + KEY_PGUP =EXTENDED_KEY_BASE+VK_PRIOR, + KEY_PGDN =EXTENDED_KEY_BASE+VK_NEXT, + KEY_END =EXTENDED_KEY_BASE+VK_END, + KEY_HOME =EXTENDED_KEY_BASE+VK_HOME, + KEY_LEFT =EXTENDED_KEY_BASE+VK_LEFT, + KEY_UP =EXTENDED_KEY_BASE+VK_UP, + KEY_RIGHT =EXTENDED_KEY_BASE+VK_RIGHT, + KEY_DOWN =EXTENDED_KEY_BASE+VK_DOWN, + KEY_PRNTSCRN =EXTENDED_KEY_BASE+VK_SNAPSHOT, + KEY_INS =EXTENDED_KEY_BASE+VK_INSERT, + KEY_DEL =EXTENDED_KEY_BASE+VK_DELETE, + + KEY_LWIN =EXTENDED_KEY_BASE+VK_LWIN, + KEY_RWIN =EXTENDED_KEY_BASE+VK_RWIN, + KEY_APPS =EXTENDED_KEY_BASE+VK_APPS, + KEY_STANDBY =EXTENDED_KEY_BASE+VK_SLEEP, + + KEY_NUMPAD0 =EXTENDED_KEY_BASE+VK_NUMPAD0, + KEY_NUMPAD1 =EXTENDED_KEY_BASE+VK_NUMPAD1, + KEY_NUMPAD2 =EXTENDED_KEY_BASE+VK_NUMPAD2, + KEY_NUMPAD3 =EXTENDED_KEY_BASE+VK_NUMPAD3, + KEY_NUMPAD4 =EXTENDED_KEY_BASE+VK_NUMPAD4, + KEY_NUMPAD5 =EXTENDED_KEY_BASE+VK_NUMPAD5, + KEY_CLEAR =KEY_NUMPAD5, + KEY_NUMPAD6 =EXTENDED_KEY_BASE+VK_NUMPAD6, + KEY_NUMPAD7 =EXTENDED_KEY_BASE+VK_NUMPAD7, + KEY_NUMPAD8 =EXTENDED_KEY_BASE+VK_NUMPAD8, + KEY_NUMPAD9 =EXTENDED_KEY_BASE+VK_NUMPAD9, + + KEY_MULTIPLY =EXTENDED_KEY_BASE+VK_MULTIPLY, + KEY_ADD =EXTENDED_KEY_BASE+VK_ADD, + KEY_SUBTRACT =EXTENDED_KEY_BASE+VK_SUBTRACT, + KEY_DECIMAL =EXTENDED_KEY_BASE+VK_DECIMAL, + KEY_DIVIDE =EXTENDED_KEY_BASE+VK_DIVIDE, + + KEY_F1 =EXTENDED_KEY_BASE+VK_F1, + KEY_F2 =EXTENDED_KEY_BASE+VK_F2, + KEY_F3 =EXTENDED_KEY_BASE+VK_F3, + KEY_F4 =EXTENDED_KEY_BASE+VK_F4, + KEY_F5 =EXTENDED_KEY_BASE+VK_F5, + KEY_F6 =EXTENDED_KEY_BASE+VK_F6, + KEY_F7 =EXTENDED_KEY_BASE+VK_F7, + KEY_F8 =EXTENDED_KEY_BASE+VK_F8, + KEY_F9 =EXTENDED_KEY_BASE+VK_F9, + KEY_F10 =EXTENDED_KEY_BASE+VK_F10, + KEY_F11 =EXTENDED_KEY_BASE+VK_F11, + KEY_F12 =EXTENDED_KEY_BASE+VK_F12, + + KEY_F13 =EXTENDED_KEY_BASE+VK_F13, + KEY_F14 =EXTENDED_KEY_BASE+VK_F14, + KEY_F15 =EXTENDED_KEY_BASE+VK_F15, + KEY_F16 =EXTENDED_KEY_BASE+VK_F16, + KEY_F17 =EXTENDED_KEY_BASE+VK_F17, + KEY_F18 =EXTENDED_KEY_BASE+VK_F18, + KEY_F19 =EXTENDED_KEY_BASE+VK_F19, + KEY_F20 =EXTENDED_KEY_BASE+VK_F20, + KEY_F21 =EXTENDED_KEY_BASE+VK_F21, + KEY_F22 =EXTENDED_KEY_BASE+VK_F22, + KEY_F23 =EXTENDED_KEY_BASE+VK_F23, + KEY_F24 =EXTENDED_KEY_BASE+VK_F24, + + KEY_NUMLOCK =EXTENDED_KEY_BASE+VK_NUMLOCK, + KEY_SCROLLLOCK =EXTENDED_KEY_BASE+VK_SCROLL, + +#if (_WIN32_WINNT >= 0x0500) + KEY_BROWSER_BACK =EXTENDED_KEY_BASE+VK_BROWSER_BACK, + KEY_BROWSER_FORWARD =EXTENDED_KEY_BASE+VK_BROWSER_FORWARD, + KEY_BROWSER_REFRESH =EXTENDED_KEY_BASE+VK_BROWSER_REFRESH, + KEY_BROWSER_STOP =EXTENDED_KEY_BASE+VK_BROWSER_STOP, + KEY_BROWSER_SEARCH =EXTENDED_KEY_BASE+VK_BROWSER_SEARCH, + KEY_BROWSER_FAVORITES =EXTENDED_KEY_BASE+VK_BROWSER_FAVORITES, + KEY_BROWSER_HOME =EXTENDED_KEY_BASE+VK_BROWSER_HOME, + KEY_VOLUME_MUTE =EXTENDED_KEY_BASE+VK_VOLUME_MUTE, + KEY_VOLUME_DOWN =EXTENDED_KEY_BASE+VK_VOLUME_DOWN, + KEY_VOLUME_UP =EXTENDED_KEY_BASE+VK_VOLUME_UP, + KEY_MEDIA_NEXT_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_NEXT_TRACK, + KEY_MEDIA_PREV_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_PREV_TRACK, + KEY_MEDIA_STOP =EXTENDED_KEY_BASE+VK_MEDIA_STOP, + KEY_MEDIA_PLAY_PAUSE =EXTENDED_KEY_BASE+VK_MEDIA_PLAY_PAUSE, + KEY_LAUNCH_MAIL =EXTENDED_KEY_BASE+VK_LAUNCH_MAIL, + KEY_LAUNCH_MEDIA_SELECT =EXTENDED_KEY_BASE+VK_LAUNCH_MEDIA_SELECT, + KEY_LAUNCH_APP1 =EXTENDED_KEY_BASE+VK_LAUNCH_APP1, + KEY_LAUNCH_APP2 =EXTENDED_KEY_BASE+VK_LAUNCH_APP2, +#endif + + KEY_CTRLALTSHIFTPRESS =INTERNAL_KEY_BASE+1, + KEY_CTRLALTSHIFTRELEASE =INTERNAL_KEY_BASE+2, + + KEY_MSWHEEL_UP =INTERNAL_KEY_BASE+3, + KEY_MSWHEEL_DOWN =INTERNAL_KEY_BASE+4, + KEY_NUMDEL =INTERNAL_KEY_BASE+9, + KEY_NUMENTER =INTERNAL_KEY_BASE+0xB, + + KEY_MSWHEEL_LEFT =INTERNAL_KEY_BASE+0xC, + KEY_MSWHEEL_RIGHT =INTERNAL_KEY_BASE+0xD, + + KEY_MSLCLICK =INTERNAL_KEY_BASE+0xF, + KEY_MSRCLICK =INTERNAL_KEY_BASE+0x10, + + KEY_MSM1CLICK =INTERNAL_KEY_BASE+0x11, + KEY_MSM2CLICK =INTERNAL_KEY_BASE+0x12, + KEY_MSM3CLICK =INTERNAL_KEY_BASE+0x13, + + + + KEY_VK_0xFF_BEGIN =EXTENDED_KEY_BASE+0x00000100, + KEY_VK_0xFF_END =EXTENDED_KEY_BASE+0x000001FF, + + KEY_END_FKEY =0x0001FFFF, + + KEY_NONE =INTERNAL_KEY_BASE_2+1, + KEY_IDLE =INTERNAL_KEY_BASE_2+2, + + KEY_END_SKEY =0x0003FFFF, + KEY_LAST_BASE =KEY_END_SKEY, + +}; + +enum AddDefKeyboard +{ + KEY_CTRLSHIFT =KEY_CTRL|KEY_SHIFT, + KEY_ALTSHIFT =KEY_ALT|KEY_SHIFT, + KEY_CTRLALT =KEY_CTRL|KEY_ALT, + + KEY_CTRL0 =KEY_CTRL+'0', + KEY_CTRL1 =KEY_CTRL+'1', + KEY_CTRL2 =KEY_CTRL+'2', + KEY_CTRL3 =KEY_CTRL+'3', + KEY_CTRL4 =KEY_CTRL+'4', + KEY_CTRL5 =KEY_CTRL+'5', + KEY_CTRL6 =KEY_CTRL+'6', + KEY_CTRL7 =KEY_CTRL+'7', + KEY_CTRL8 =KEY_CTRL+'8', + KEY_CTRL9 =KEY_CTRL+'9', + + KEY_RCTRL0 =KEY_RCTRL+'0', + KEY_RCTRL1 =KEY_RCTRL+'1', + KEY_RCTRL2 =KEY_RCTRL+'2', + KEY_RCTRL3 =KEY_RCTRL+'3', + KEY_RCTRL4 =KEY_RCTRL+'4', + KEY_RCTRL5 =KEY_RCTRL+'5', + KEY_RCTRL6 =KEY_RCTRL+'6', + KEY_RCTRL7 =KEY_RCTRL+'7', + KEY_RCTRL8 =KEY_RCTRL+'8', + KEY_RCTRL9 =KEY_RCTRL+'9', + + KEY_CTRLA =KEY_CTRL+'A', + KEY_CTRLB =KEY_CTRL+'B', + KEY_CTRLC =KEY_CTRL+'C', + KEY_CTRLD =KEY_CTRL+'D', + KEY_CTRLE =KEY_CTRL+'E', + KEY_CTRLF =KEY_CTRL+'F', + KEY_CTRLG =KEY_CTRL+'G', + KEY_CTRLH =KEY_CTRL+'H', + KEY_CTRLI =KEY_CTRL+'I', + KEY_CTRLJ =KEY_CTRL+'J', + KEY_CTRLK =KEY_CTRL+'K', + KEY_CTRLL =KEY_CTRL+'L', + KEY_CTRLM =KEY_CTRL+'M', + KEY_CTRLN =KEY_CTRL+'N', + KEY_CTRLO =KEY_CTRL+'O', + KEY_CTRLP =KEY_CTRL+'P', + KEY_CTRLQ =KEY_CTRL+'Q', + KEY_CTRLR =KEY_CTRL+'R', + KEY_CTRLS =KEY_CTRL+'S', + KEY_CTRLT =KEY_CTRL+'T', + KEY_CTRLU =KEY_CTRL+'U', + KEY_CTRLV =KEY_CTRL+'V', + KEY_CTRLW =KEY_CTRL+'W', + KEY_CTRLX =KEY_CTRL+'X', + KEY_CTRLY =KEY_CTRL+'Y', + KEY_CTRLZ =KEY_CTRL+'Z', + + KEY_CTRLBRACKET =KEY_CTRL|KEY_BRACKET, + KEY_CTRLBACKBRACKET =KEY_CTRL|KEY_BACKBRACKET, + KEY_CTRLCOMMA =KEY_CTRL|KEY_COMMA, + KEY_CTRLQUOTE =KEY_CTRL|KEY_QUOTE, + KEY_CTRLDOT =KEY_CTRL|KEY_DOT, + + KEY_ALT0 =KEY_ALT+'0', + KEY_ALT1 =KEY_ALT+'1', + KEY_ALT2 =KEY_ALT+'2', + KEY_ALT3 =KEY_ALT+'3', + KEY_ALT4 =KEY_ALT+'4', + KEY_ALT5 =KEY_ALT+'5', + KEY_ALT6 =KEY_ALT+'6', + KEY_ALT7 =KEY_ALT+'7', + KEY_ALT8 =KEY_ALT+'8', + KEY_ALT9 =KEY_ALT+'9', + + KEY_ALTADD =KEY_ALT|KEY_ADD, + KEY_ALTDOT =KEY_ALT|KEY_DOT, + KEY_ALTCOMMA =KEY_ALT|KEY_COMMA, + KEY_ALTMULTIPLY =KEY_ALT|KEY_MULTIPLY, + + KEY_ALTA =KEY_ALT+'A', + KEY_ALTB =KEY_ALT+'B', + KEY_ALTC =KEY_ALT+'C', + KEY_ALTD =KEY_ALT+'D', + KEY_ALTE =KEY_ALT+'E', + KEY_ALTF =KEY_ALT+'F', + KEY_ALTG =KEY_ALT+'G', + KEY_ALTH =KEY_ALT+'H', + KEY_ALTI =KEY_ALT+'I', + KEY_ALTJ =KEY_ALT+'J', + KEY_ALTK =KEY_ALT+'K', + KEY_ALTL =KEY_ALT+'L', + KEY_ALTM =KEY_ALT+'M', + KEY_ALTN =KEY_ALT+'N', + KEY_ALTO =KEY_ALT+'O', + KEY_ALTP =KEY_ALT+'P', + KEY_ALTQ =KEY_ALT+'Q', + KEY_ALTR =KEY_ALT+'R', + KEY_ALTS =KEY_ALT+'S', + KEY_ALTT =KEY_ALT+'T', + KEY_ALTU =KEY_ALT+'U', + KEY_ALTV =KEY_ALT+'V', + KEY_ALTW =KEY_ALT+'W', + KEY_ALTX =KEY_ALT+'X', + KEY_ALTY =KEY_ALT+'Y', + KEY_ALTZ =KEY_ALT+'Z', + + KEY_CTRLSHIFTADD =KEY_CTRL|KEY_SHIFT|KEY_ADD, + KEY_CTRLSHIFTSUBTRACT =KEY_CTRL|KEY_SHIFT|KEY_SUBTRACT, + KEY_CTRLSHIFTDOT =KEY_CTRL|KEY_SHIFT|KEY_DOT, + KEY_CTRLSHIFTSLASH =KEY_CTRL|KEY_SHIFT|KEY_SLASH, + + KEY_CTRLSHIFT0 =(KEY_CTRL|KEY_SHIFT)+'0', + KEY_CTRLSHIFT1 =(KEY_CTRL|KEY_SHIFT)+'1', + KEY_CTRLSHIFT2 =(KEY_CTRL|KEY_SHIFT)+'2', + KEY_CTRLSHIFT3 =(KEY_CTRL|KEY_SHIFT)+'3', + KEY_CTRLSHIFT4 =(KEY_CTRL|KEY_SHIFT)+'4', + KEY_CTRLSHIFT5 =(KEY_CTRL|KEY_SHIFT)+'5', + KEY_CTRLSHIFT6 =(KEY_CTRL|KEY_SHIFT)+'6', + KEY_CTRLSHIFT7 =(KEY_CTRL|KEY_SHIFT)+'7', + KEY_CTRLSHIFT8 =(KEY_CTRL|KEY_SHIFT)+'8', + KEY_CTRLSHIFT9 =(KEY_CTRL|KEY_SHIFT)+'9', + + KEY_RCTRLSHIFT0 =KEY_RCTRL+KEY_SHIFT+'0', + KEY_RCTRLSHIFT1 =KEY_RCTRL+KEY_SHIFT+'1', + KEY_RCTRLSHIFT2 =KEY_RCTRL+KEY_SHIFT+'2', + KEY_RCTRLSHIFT3 =KEY_RCTRL+KEY_SHIFT+'3', + KEY_RCTRLSHIFT4 =KEY_RCTRL+KEY_SHIFT+'4', + KEY_RCTRLSHIFT5 =KEY_RCTRL+KEY_SHIFT+'5', + KEY_RCTRLSHIFT6 =KEY_RCTRL+KEY_SHIFT+'6', + KEY_RCTRLSHIFT7 =KEY_RCTRL+KEY_SHIFT+'7', + KEY_RCTRLSHIFT8 =KEY_RCTRL+KEY_SHIFT+'8', + KEY_RCTRLSHIFT9 =KEY_RCTRL+KEY_SHIFT+'9', + + KEY_CTRLSHIFTA =(KEY_CTRL|KEY_SHIFT)+'A', + KEY_CTRLSHIFTB =(KEY_CTRL|KEY_SHIFT)+'B', + KEY_CTRLSHIFTC =(KEY_CTRL|KEY_SHIFT)+'C', + KEY_CTRLSHIFTD =(KEY_CTRL|KEY_SHIFT)+'D', + KEY_CTRLSHIFTE =(KEY_CTRL|KEY_SHIFT)+'E', + KEY_CTRLSHIFTF =(KEY_CTRL|KEY_SHIFT)+'F', + KEY_CTRLSHIFTG =(KEY_CTRL|KEY_SHIFT)+'G', + KEY_CTRLSHIFTH =(KEY_CTRL|KEY_SHIFT)+'H', + KEY_CTRLSHIFTI =(KEY_CTRL|KEY_SHIFT)+'I', + KEY_CTRLSHIFTJ =(KEY_CTRL|KEY_SHIFT)+'J', + KEY_CTRLSHIFTK =(KEY_CTRL|KEY_SHIFT)+'K', + KEY_CTRLSHIFTL =(KEY_CTRL|KEY_SHIFT)+'L', + KEY_CTRLSHIFTM =(KEY_CTRL|KEY_SHIFT)+'M', + KEY_CTRLSHIFTN =(KEY_CTRL|KEY_SHIFT)+'N', + KEY_CTRLSHIFTO =(KEY_CTRL|KEY_SHIFT)+'O', + KEY_CTRLSHIFTP =(KEY_CTRL|KEY_SHIFT)+'P', + KEY_CTRLSHIFTQ =(KEY_CTRL|KEY_SHIFT)+'Q', + KEY_CTRLSHIFTR =(KEY_CTRL|KEY_SHIFT)+'R', + KEY_CTRLSHIFTS =(KEY_CTRL|KEY_SHIFT)+'S', + KEY_CTRLSHIFTT =(KEY_CTRL|KEY_SHIFT)+'T', + KEY_CTRLSHIFTU =(KEY_CTRL|KEY_SHIFT)+'U', + KEY_CTRLSHIFTV =(KEY_CTRL|KEY_SHIFT)+'V', + KEY_CTRLSHIFTW =(KEY_CTRL|KEY_SHIFT)+'W', + KEY_CTRLSHIFTX =(KEY_CTRL|KEY_SHIFT)+'X', + KEY_CTRLSHIFTY =(KEY_CTRL|KEY_SHIFT)+'Y', + KEY_CTRLSHIFTZ =(KEY_CTRL|KEY_SHIFT)+'Z', + + KEY_CTRLSHIFTBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BRACKET, + KEY_CTRLSHIFTBACKSLASH =KEY_CTRL|KEY_SHIFT|KEY_BACKSLASH, + KEY_CTRLSHIFTBACKBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BACKBRACKET, + + KEY_ALTSHIFT0 =(KEY_ALT|KEY_SHIFT)+'0', + KEY_ALTSHIFT1 =(KEY_ALT|KEY_SHIFT)+'1', + KEY_ALTSHIFT2 =(KEY_ALT|KEY_SHIFT)+'2', + KEY_ALTSHIFT3 =(KEY_ALT|KEY_SHIFT)+'3', + KEY_ALTSHIFT4 =(KEY_ALT|KEY_SHIFT)+'4', + KEY_ALTSHIFT5 =(KEY_ALT|KEY_SHIFT)+'5', + KEY_ALTSHIFT6 =(KEY_ALT|KEY_SHIFT)+'6', + KEY_ALTSHIFT7 =(KEY_ALT|KEY_SHIFT)+'7', + KEY_ALTSHIFT8 =(KEY_ALT|KEY_SHIFT)+'8', + KEY_ALTSHIFT9 =(KEY_ALT|KEY_SHIFT)+'9', + + KEY_ALTSHIFTA =(KEY_ALT|KEY_SHIFT)+'A', + KEY_ALTSHIFTB =(KEY_ALT|KEY_SHIFT)+'B', + KEY_ALTSHIFTC =(KEY_ALT|KEY_SHIFT)+'C', + KEY_ALTSHIFTD =(KEY_ALT|KEY_SHIFT)+'D', + KEY_ALTSHIFTE =(KEY_ALT|KEY_SHIFT)+'E', + KEY_ALTSHIFTF =(KEY_ALT|KEY_SHIFT)+'F', + KEY_ALTSHIFTG =(KEY_ALT|KEY_SHIFT)+'G', + KEY_ALTSHIFTH =(KEY_ALT|KEY_SHIFT)+'H', + KEY_ALTSHIFTI =(KEY_ALT|KEY_SHIFT)+'I', + KEY_ALTSHIFTJ =(KEY_ALT|KEY_SHIFT)+'J', + KEY_ALTSHIFTK =(KEY_ALT|KEY_SHIFT)+'K', + KEY_ALTSHIFTL =(KEY_ALT|KEY_SHIFT)+'L', + KEY_ALTSHIFTM =(KEY_ALT|KEY_SHIFT)+'M', + KEY_ALTSHIFTN =(KEY_ALT|KEY_SHIFT)+'N', + KEY_ALTSHIFTO =(KEY_ALT|KEY_SHIFT)+'O', + KEY_ALTSHIFTP =(KEY_ALT|KEY_SHIFT)+'P', + KEY_ALTSHIFTQ =(KEY_ALT|KEY_SHIFT)+'Q', + KEY_ALTSHIFTR =(KEY_ALT|KEY_SHIFT)+'R', + KEY_ALTSHIFTS =(KEY_ALT|KEY_SHIFT)+'S', + KEY_ALTSHIFTT =(KEY_ALT|KEY_SHIFT)+'T', + KEY_ALTSHIFTU =(KEY_ALT|KEY_SHIFT)+'U', + KEY_ALTSHIFTV =(KEY_ALT|KEY_SHIFT)+'V', + KEY_ALTSHIFTW =(KEY_ALT|KEY_SHIFT)+'W', + KEY_ALTSHIFTX =(KEY_ALT|KEY_SHIFT)+'X', + KEY_ALTSHIFTY =(KEY_ALT|KEY_SHIFT)+'Y', + KEY_ALTSHIFTZ =(KEY_ALT|KEY_SHIFT)+'Z', + + KEY_ALTSHIFTBRACKET =KEY_ALT|KEY_SHIFT|KEY_BRACKET, + KEY_ALTSHIFTBACKBRACKET =KEY_ALT|KEY_SHIFT|KEY_BACKBRACKET, + + KEY_CTRLALT0 =(KEY_CTRL|KEY_ALT)+'0', + KEY_CTRLALT1 =(KEY_CTRL|KEY_ALT)+'1', + KEY_CTRLALT2 =(KEY_CTRL|KEY_ALT)+'2', + KEY_CTRLALT3 =(KEY_CTRL|KEY_ALT)+'3', + KEY_CTRLALT4 =(KEY_CTRL|KEY_ALT)+'4', + KEY_CTRLALT5 =(KEY_CTRL|KEY_ALT)+'5', + KEY_CTRLALT6 =(KEY_CTRL|KEY_ALT)+'6', + KEY_CTRLALT7 =(KEY_CTRL|KEY_ALT)+'7', + KEY_CTRLALT8 =(KEY_CTRL|KEY_ALT)+'8', + KEY_CTRLALT9 =(KEY_CTRL|KEY_ALT)+'9', + + KEY_CTRLALTA =(KEY_CTRL|KEY_ALT)+'A', + KEY_CTRLALTB =(KEY_CTRL|KEY_ALT)+'B', + KEY_CTRLALTC =(KEY_CTRL|KEY_ALT)+'C', + KEY_CTRLALTD =(KEY_CTRL|KEY_ALT)+'D', + KEY_CTRLALTE =(KEY_CTRL|KEY_ALT)+'E', + KEY_CTRLALTF =(KEY_CTRL|KEY_ALT)+'F', + KEY_CTRLALTG =(KEY_CTRL|KEY_ALT)+'G', + KEY_CTRLALTH =(KEY_CTRL|KEY_ALT)+'H', + KEY_CTRLALTI =(KEY_CTRL|KEY_ALT)+'I', + KEY_CTRLALTJ =(KEY_CTRL|KEY_ALT)+'J', + KEY_CTRLALTK =(KEY_CTRL|KEY_ALT)+'K', + KEY_CTRLALTL =(KEY_CTRL|KEY_ALT)+'L', + KEY_CTRLALTM =(KEY_CTRL|KEY_ALT)+'M', + KEY_CTRLALTN =(KEY_CTRL|KEY_ALT)+'N', + KEY_CTRLALTO =(KEY_CTRL|KEY_ALT)+'O', + KEY_CTRLALTP =(KEY_CTRL|KEY_ALT)+'P', + KEY_CTRLALTQ =(KEY_CTRL|KEY_ALT)+'Q', + KEY_CTRLALTR =(KEY_CTRL|KEY_ALT)+'R', + KEY_CTRLALTS =(KEY_CTRL|KEY_ALT)+'S', + KEY_CTRLALTT =(KEY_CTRL|KEY_ALT)+'T', + KEY_CTRLALTU =(KEY_CTRL|KEY_ALT)+'U', + KEY_CTRLALTV =(KEY_CTRL|KEY_ALT)+'V', + KEY_CTRLALTW =(KEY_CTRL|KEY_ALT)+'W', + KEY_CTRLALTX =(KEY_CTRL|KEY_ALT)+'X', + KEY_CTRLALTY =(KEY_CTRL|KEY_ALT)+'Y', + KEY_CTRLALTZ =(KEY_CTRL|KEY_ALT)+'Z', + + KEY_CTRLALTBRACKET =KEY_CTRL|KEY_ALT|KEY_BRACKET, + KEY_CTRLALTBACKBRACKET =KEY_CTRL|KEY_ALT|KEY_BACKBRACKET, + + KEY_CTRLF1 =KEY_CTRL|KEY_F1, + KEY_CTRLF2 =KEY_CTRL|KEY_F2, + KEY_CTRLF3 =KEY_CTRL|KEY_F3, + KEY_CTRLF4 =KEY_CTRL|KEY_F4, + KEY_CTRLF5 =KEY_CTRL|KEY_F5, + KEY_CTRLF6 =KEY_CTRL|KEY_F6, + KEY_CTRLF7 =KEY_CTRL|KEY_F7, + KEY_CTRLF8 =KEY_CTRL|KEY_F8, + KEY_CTRLF9 =KEY_CTRL|KEY_F9, + KEY_CTRLF10 =KEY_CTRL|KEY_F10, + KEY_CTRLF11 =KEY_CTRL|KEY_F11, + KEY_CTRLF12 =KEY_CTRL|KEY_F12, + + KEY_SHIFTF1 =KEY_SHIFT|KEY_F1, + KEY_SHIFTF2 =KEY_SHIFT|KEY_F2, + KEY_SHIFTF3 =KEY_SHIFT|KEY_F3, + KEY_SHIFTF4 =KEY_SHIFT|KEY_F4, + KEY_SHIFTF5 =KEY_SHIFT|KEY_F5, + KEY_SHIFTF6 =KEY_SHIFT|KEY_F6, + KEY_SHIFTF7 =KEY_SHIFT|KEY_F7, + KEY_SHIFTF8 =KEY_SHIFT|KEY_F8, + KEY_SHIFTF9 =KEY_SHIFT|KEY_F9, + KEY_SHIFTF10 =KEY_SHIFT|KEY_F10, + KEY_SHIFTF11 =KEY_SHIFT|KEY_F11, + KEY_SHIFTF12 =KEY_SHIFT|KEY_F12, + + KEY_ALTF1 =KEY_ALT|KEY_F1, + KEY_ALTF2 =KEY_ALT|KEY_F2, + KEY_ALTF3 =KEY_ALT|KEY_F3, + KEY_ALTF4 =KEY_ALT|KEY_F4, + KEY_ALTF5 =KEY_ALT|KEY_F5, + KEY_ALTF6 =KEY_ALT|KEY_F6, + KEY_ALTF7 =KEY_ALT|KEY_F7, + KEY_ALTF8 =KEY_ALT|KEY_F8, + KEY_ALTF9 =KEY_ALT|KEY_F9, + KEY_ALTF10 =KEY_ALT|KEY_F10, + KEY_ALTF11 =KEY_ALT|KEY_F11, + KEY_ALTF12 =KEY_ALT|KEY_F12, + + KEY_CTRLSHIFTF1 =KEY_CTRL|KEY_SHIFT|KEY_F1, + KEY_CTRLSHIFTF2 =KEY_CTRL|KEY_SHIFT|KEY_F2, + KEY_CTRLSHIFTF3 =KEY_CTRL|KEY_SHIFT|KEY_F3, + KEY_CTRLSHIFTF4 =KEY_CTRL|KEY_SHIFT|KEY_F4, + KEY_CTRLSHIFTF5 =KEY_CTRL|KEY_SHIFT|KEY_F5, + KEY_CTRLSHIFTF6 =KEY_CTRL|KEY_SHIFT|KEY_F6, + KEY_CTRLSHIFTF7 =KEY_CTRL|KEY_SHIFT|KEY_F7, + KEY_CTRLSHIFTF8 =KEY_CTRL|KEY_SHIFT|KEY_F8, + KEY_CTRLSHIFTF9 =KEY_CTRL|KEY_SHIFT|KEY_F9, + KEY_CTRLSHIFTF10 =KEY_CTRL|KEY_SHIFT|KEY_F10, + KEY_CTRLSHIFTF11 =KEY_CTRL|KEY_SHIFT|KEY_F11, + KEY_CTRLSHIFTF12 =KEY_CTRL|KEY_SHIFT|KEY_F12, + + KEY_ALTSHIFTF1 =KEY_ALT|KEY_SHIFT|KEY_F1, + KEY_ALTSHIFTF2 =KEY_ALT|KEY_SHIFT|KEY_F2, + KEY_ALTSHIFTF3 =KEY_ALT|KEY_SHIFT|KEY_F3, + KEY_ALTSHIFTF4 =KEY_ALT|KEY_SHIFT|KEY_F4, + KEY_ALTSHIFTF5 =KEY_ALT|KEY_SHIFT|KEY_F5, + KEY_ALTSHIFTF6 =KEY_ALT|KEY_SHIFT|KEY_F6, + KEY_ALTSHIFTF7 =KEY_ALT|KEY_SHIFT|KEY_F7, + KEY_ALTSHIFTF8 =KEY_ALT|KEY_SHIFT|KEY_F8, + KEY_ALTSHIFTF9 =KEY_ALT|KEY_SHIFT|KEY_F9, + KEY_ALTSHIFTF10 =KEY_ALT|KEY_SHIFT|KEY_F10, + KEY_ALTSHIFTF11 =KEY_ALT|KEY_SHIFT|KEY_F11, + KEY_ALTSHIFTF12 =KEY_ALT|KEY_SHIFT|KEY_F12, + + KEY_CTRLALTF1 =KEY_CTRL|KEY_ALT|KEY_F1, + KEY_CTRLALTF2 =KEY_CTRL|KEY_ALT|KEY_F2, + KEY_CTRLALTF3 =KEY_CTRL|KEY_ALT|KEY_F3, + KEY_CTRLALTF4 =KEY_CTRL|KEY_ALT|KEY_F4, + KEY_CTRLALTF5 =KEY_CTRL|KEY_ALT|KEY_F5, + KEY_CTRLALTF6 =KEY_CTRL|KEY_ALT|KEY_F6, + KEY_CTRLALTF7 =KEY_CTRL|KEY_ALT|KEY_F7, + KEY_CTRLALTF8 =KEY_CTRL|KEY_ALT|KEY_F8, + KEY_CTRLALTF9 =KEY_CTRL|KEY_ALT|KEY_F9, + KEY_CTRLALTF10 =KEY_CTRL|KEY_ALT|KEY_F10, + KEY_CTRLALTF11 =KEY_CTRL|KEY_ALT|KEY_F11, + KEY_CTRLALTF12 =KEY_CTRL|KEY_ALT|KEY_F12, + + KEY_CTRLHOME =KEY_CTRL|KEY_HOME, + KEY_CTRLUP =KEY_CTRL|KEY_UP, + KEY_CTRLPGUP =KEY_CTRL|KEY_PGUP, + KEY_CTRLLEFT =KEY_CTRL|KEY_LEFT, + KEY_CTRLRIGHT =KEY_CTRL|KEY_RIGHT, + KEY_CTRLEND =KEY_CTRL|KEY_END, + KEY_CTRLDOWN =KEY_CTRL|KEY_DOWN, + KEY_CTRLPGDN =KEY_CTRL|KEY_PGDN, + KEY_CTRLINS =KEY_CTRL|KEY_INS, + KEY_CTRLDEL =KEY_CTRL|KEY_DEL, + KEY_CTRLNUMDEL =KEY_CTRL|KEY_NUMDEL, + KEY_CTRLDECIMAL =KEY_CTRL|KEY_DECIMAL, + + KEY_SHIFTHOME =KEY_SHIFT|KEY_HOME, + KEY_SHIFTUP =KEY_SHIFT|KEY_UP, + KEY_SHIFTPGUP =KEY_SHIFT|KEY_PGUP, + KEY_SHIFTLEFT =KEY_SHIFT|KEY_LEFT, + KEY_SHIFTRIGHT =KEY_SHIFT|KEY_RIGHT, + KEY_SHIFTEND =KEY_SHIFT|KEY_END, + KEY_SHIFTDOWN =KEY_SHIFT|KEY_DOWN, + KEY_SHIFTPGDN =KEY_SHIFT|KEY_PGDN, + KEY_SHIFTINS =KEY_SHIFT|KEY_INS, + KEY_SHIFTDEL =KEY_SHIFT|KEY_DEL, + KEY_SHIFTNUMDEL =KEY_SHIFT|KEY_NUMDEL, + KEY_SHIFTDECIMAL =KEY_SHIFT|KEY_DECIMAL, + + KEY_ALTHOME =KEY_ALT|KEY_HOME, + KEY_ALTUP =KEY_ALT|KEY_UP, + KEY_ALTPGUP =KEY_ALT|KEY_PGUP, + KEY_ALTLEFT =KEY_ALT|KEY_LEFT, + KEY_ALTRIGHT =KEY_ALT|KEY_RIGHT, + KEY_ALTEND =KEY_ALT|KEY_END, + KEY_ALTDOWN =KEY_ALT|KEY_DOWN, + KEY_ALTPGDN =KEY_ALT|KEY_PGDN, + KEY_ALTINS =KEY_ALT|KEY_INS, + KEY_ALTDEL =KEY_ALT|KEY_DEL, + KEY_ALTNUMDEL =KEY_ALT|KEY_NUMDEL, + KEY_ALTDECIMAL =KEY_ALT|KEY_DECIMAL, + + KEY_CTRLSHIFTHOME =KEY_CTRL|KEY_SHIFT|KEY_HOME, + KEY_CTRLSHIFTUP =KEY_CTRL|KEY_SHIFT|KEY_UP, + KEY_CTRLSHIFTPGUP =KEY_CTRL|KEY_SHIFT|KEY_PGUP, + KEY_CTRLSHIFTLEFT =KEY_CTRL|KEY_SHIFT|KEY_LEFT, + KEY_CTRLSHIFTRIGHT =KEY_CTRL|KEY_SHIFT|KEY_RIGHT, + KEY_CTRLSHIFTEND =KEY_CTRL|KEY_SHIFT|KEY_END, + KEY_CTRLSHIFTDOWN =KEY_CTRL|KEY_SHIFT|KEY_DOWN, + KEY_CTRLSHIFTPGDN =KEY_CTRL|KEY_SHIFT|KEY_PGDN, + KEY_CTRLSHIFTINS =KEY_CTRL|KEY_SHIFT|KEY_INS, + KEY_CTRLSHIFTDEL =KEY_CTRL|KEY_SHIFT|KEY_DEL, + KEY_CTRLSHIFTNUMDEL =KEY_CTRL|KEY_SHIFT|KEY_NUMDEL, + KEY_CTRLSHIFTDECIMAL =KEY_CTRL|KEY_SHIFT|KEY_DECIMAL, + + KEY_ALTSHIFTHOME =KEY_ALT|KEY_SHIFT|KEY_HOME, + KEY_ALTSHIFTUP =KEY_ALT|KEY_SHIFT|KEY_UP, + KEY_ALTSHIFTPGUP =KEY_ALT|KEY_SHIFT|KEY_PGUP, + KEY_ALTSHIFTLEFT =KEY_ALT|KEY_SHIFT|KEY_LEFT, + KEY_ALTSHIFTRIGHT =KEY_ALT|KEY_SHIFT|KEY_RIGHT, + KEY_ALTSHIFTEND =KEY_ALT|KEY_SHIFT|KEY_END, + KEY_ALTSHIFTDOWN =KEY_ALT|KEY_SHIFT|KEY_DOWN, + KEY_ALTSHIFTPGDN =KEY_ALT|KEY_SHIFT|KEY_PGDN, + KEY_ALTSHIFTINS =KEY_ALT|KEY_SHIFT|KEY_INS, + KEY_ALTSHIFTDEL =KEY_ALT|KEY_SHIFT|KEY_DEL, + KEY_ALTSHIFTNUMDEL =KEY_ALT|KEY_SHIFT|KEY_NUMDEL, + KEY_ALTSHIFTDECIMAL =KEY_ALT|KEY_SHIFT|KEY_DECIMAL, + + KEY_CTRLALTHOME =KEY_CTRL|KEY_ALT|KEY_HOME, + KEY_CTRLALTUP =KEY_CTRL|KEY_ALT|KEY_UP, + KEY_CTRLALTPGUP =KEY_CTRL|KEY_ALT|KEY_PGUP, + KEY_CTRLALTLEFT =KEY_CTRL|KEY_ALT|KEY_LEFT, + KEY_CTRLALTRIGHT =KEY_CTRL|KEY_ALT|KEY_RIGHT, + KEY_CTRLALTEND =KEY_CTRL|KEY_ALT|KEY_END, + KEY_CTRLALTDOWN =KEY_CTRL|KEY_ALT|KEY_DOWN, + KEY_CTRLALTPGDN =KEY_CTRL|KEY_ALT|KEY_PGDN, + KEY_CTRLALTINS =KEY_CTRL|KEY_ALT|KEY_INS, + + KEY_CTRLNUMPAD0 =KEY_CTRL|KEY_NUMPAD0, + KEY_CTRLNUMPAD1 =KEY_CTRL|KEY_NUMPAD1, + KEY_CTRLNUMPAD2 =KEY_CTRL|KEY_NUMPAD2, + KEY_CTRLNUMPAD3 =KEY_CTRL|KEY_NUMPAD3, + KEY_CTRLNUMPAD4 =KEY_CTRL|KEY_NUMPAD4, + KEY_CTRLNUMPAD5 =KEY_CTRL|KEY_NUMPAD5, + KEY_CTRLNUMPAD6 =KEY_CTRL|KEY_NUMPAD6, + KEY_CTRLNUMPAD7 =KEY_CTRL|KEY_NUMPAD7, + KEY_CTRLNUMPAD8 =KEY_CTRL|KEY_NUMPAD8, + KEY_CTRLNUMPAD9 =KEY_CTRL|KEY_NUMPAD9, + + KEY_SHIFTNUMPAD0 =KEY_SHIFT|KEY_NUMPAD0, + KEY_SHIFTNUMPAD1 =KEY_SHIFT|KEY_NUMPAD1, + KEY_SHIFTNUMPAD2 =KEY_SHIFT|KEY_NUMPAD2, + KEY_SHIFTNUMPAD3 =KEY_SHIFT|KEY_NUMPAD3, + KEY_SHIFTNUMPAD4 =KEY_SHIFT|KEY_NUMPAD4, + KEY_SHIFTNUMPAD5 =KEY_SHIFT|KEY_NUMPAD5, + KEY_SHIFTNUMPAD6 =KEY_SHIFT|KEY_NUMPAD6, + KEY_SHIFTNUMPAD7 =KEY_SHIFT|KEY_NUMPAD7, + KEY_SHIFTNUMPAD8 =KEY_SHIFT|KEY_NUMPAD8, + KEY_SHIFTNUMPAD9 =KEY_SHIFT|KEY_NUMPAD9, + + KEY_CTRLSHIFTNUMPAD0 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD0, + KEY_CTRLSHIFTNUMPAD1 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD1, + KEY_CTRLSHIFTNUMPAD2 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD2, + KEY_CTRLSHIFTNUMPAD3 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD3, + KEY_CTRLSHIFTNUMPAD4 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD4, + KEY_CTRLSHIFTNUMPAD5 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD5, + KEY_CTRLSHIFTNUMPAD6 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD6, + KEY_CTRLSHIFTNUMPAD7 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD7, + KEY_CTRLSHIFTNUMPAD8 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD8, + KEY_CTRLSHIFTNUMPAD9 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD9, + + KEY_CTRLALTNUMPAD0 =KEY_CTRL|KEY_ALT|KEY_NUMPAD0, + KEY_CTRLALTNUMPAD1 =KEY_CTRL|KEY_ALT|KEY_NUMPAD1, + KEY_CTRLALTNUMPAD2 =KEY_CTRL|KEY_ALT|KEY_NUMPAD2, + KEY_CTRLALTNUMPAD3 =KEY_CTRL|KEY_ALT|KEY_NUMPAD3, + KEY_CTRLALTNUMPAD4 =KEY_CTRL|KEY_ALT|KEY_NUMPAD4, + KEY_CTRLALTNUMPAD5 =KEY_CTRL|KEY_ALT|KEY_NUMPAD5, + KEY_CTRLALTNUMPAD6 =KEY_CTRL|KEY_ALT|KEY_NUMPAD6, + KEY_CTRLALTNUMPAD7 =KEY_CTRL|KEY_ALT|KEY_NUMPAD7, + KEY_CTRLALTNUMPAD8 =KEY_CTRL|KEY_ALT|KEY_NUMPAD8, + KEY_CTRLALTNUMPAD9 =KEY_CTRL|KEY_ALT|KEY_NUMPAD9, + + KEY_ALTSHIFTNUMPAD0 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD0, + KEY_ALTSHIFTNUMPAD1 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD1, + KEY_ALTSHIFTNUMPAD2 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD2, + KEY_ALTSHIFTNUMPAD3 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD3, + KEY_ALTSHIFTNUMPAD4 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD4, + KEY_ALTSHIFTNUMPAD5 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD5, + KEY_ALTSHIFTNUMPAD6 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD6, + KEY_ALTSHIFTNUMPAD7 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD7, + KEY_ALTSHIFTNUMPAD8 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD8, + KEY_ALTSHIFTNUMPAD9 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD9, + + KEY_CTRLSLASH =KEY_CTRL|KEY_SLASH, + KEY_CTRLBACKSLASH =KEY_CTRL|KEY_BACKSLASH, + KEY_CTRLCLEAR =KEY_CTRL|KEY_CLEAR, + KEY_CTRLSHIFTCLEAR =KEY_CTRL|KEY_SHIFT|KEY_CLEAR, + KEY_CTRLADD =KEY_CTRL|KEY_ADD, + KEY_SHIFTADD =KEY_SHIFT|KEY_ADD, + + KEY_CTRLSUBTRACT =KEY_CTRL|KEY_SUBTRACT, + KEY_ALTSUBTRACT =KEY_ALT|KEY_SUBTRACT, + KEY_SHIFTSUBTRACT =KEY_SHIFT|KEY_SUBTRACT, + KEY_CTRLMULTIPLY =KEY_CTRL|KEY_MULTIPLY, + + KEY_CTRLBS =KEY_CTRL|KEY_BS, + KEY_ALTBS =KEY_ALT|KEY_BS, + KEY_CTRLSHIFTBS =KEY_CTRL|KEY_SHIFT|KEY_BS, + KEY_SHIFTBS =KEY_SHIFT|KEY_BS, + + KEY_CTRLSHIFTTAB =KEY_CTRL|KEY_SHIFT|KEY_TAB, + KEY_CTRLTAB =KEY_CTRL|KEY_TAB, + KEY_SHIFTTAB =KEY_SHIFT|KEY_TAB, + + KEY_CTRLENTER =KEY_CTRL|KEY_ENTER, + KEY_SHIFTENTER =KEY_SHIFT|KEY_ENTER, + KEY_ALTSHIFTENTER =KEY_ALT|KEY_SHIFT|KEY_ENTER, + KEY_CTRLALTENTER =KEY_CTRL|KEY_ALT|KEY_ENTER, + KEY_CTRLSHIFTENTER =KEY_CTRL|KEY_SHIFT|KEY_ENTER, + + KEY_CTRLNUMENTER =KEY_CTRL|KEY_NUMENTER, + KEY_SHIFTNUMENTER =KEY_SHIFT|KEY_NUMENTER, + KEY_ALTSHIFTNUMENTER =KEY_ALT|KEY_SHIFT|KEY_NUMENTER, + KEY_CTRLALTNUMENTER =KEY_CTRL|KEY_ALT|KEY_NUMENTER, + KEY_CTRLSHIFTNUMENTER =KEY_CTRL|KEY_SHIFT|KEY_NUMENTER, + + KEY_CTRLAPPS =KEY_CTRL|KEY_APPS, + KEY_ALTAPPS =KEY_ALT|KEY_APPS, + KEY_SHIFTAPPS =KEY_SHIFT|KEY_APPS, + KEY_CTRLSHIFTAPPS =KEY_CTRL|KEY_SHIFT|KEY_APPS, + KEY_ALTSHIFTAPPS =KEY_ALT|KEY_SHIFT|KEY_APPS, + KEY_CTRLALTAPPS =KEY_CTRL|KEY_ALT|KEY_APPS, + + KEY_CTRLSPACE =KEY_CTRL|KEY_SPACE, + KEY_SHIFTSPACE =KEY_SHIFT|KEY_SPACE, + KEY_CTRLSHIFTSPACE =KEY_CTRL|KEY_SHIFT|KEY_SPACE, + + KEY_ALT_BASE =KEY_ALT, + KEY_ALTSHIFT_BASE =KEY_ALTSHIFT, +}; + + +#endif // __FARKEYS_HPP__ diff --git a/farsdk/unicode/plugin.hpp b/farsdk/unicode/plugin.hpp index 54424ba..6101828 100644 --- a/farsdk/unicode/plugin.hpp +++ b/farsdk/unicode/plugin.hpp @@ -1,2050 +1,2912 @@ -#pragma once -#ifndef __PLUGIN_HPP__ -#define __PLUGIN_HPP__ - -/* - plugin.hpp - - Plugin API for FAR Manager 2.0 build 1420 -*/ - -/* -Copyright (c) 1996 Eugene Roshal -Copyright (c) 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - -#define FARMANAGERVERSION_MAJOR 2 -#define FARMANAGERVERSION_MINOR 0 -#define FARMANAGERVERSION_BUILD 1420 - -#ifndef RC_INVOKED - -#define MAKEFARVERSION(major,minor,build) ( ((major)<<8) | (minor) | ((build)<<16)) - -#define FARMANAGERVERSION MAKEFARVERSION(FARMANAGERVERSION_MAJOR,FARMANAGERVERSION_MINOR,FARMANAGERVERSION_BUILD) - -#if !defined(_INC_WINDOWS) && !defined(_WINDOWS_) -#if (defined(__GNUC__) || defined(_MSC_VER)) && !defined(_WIN64) -#if !defined(_WINCON_H) && !defined(_WINCON_) -#define _WINCON_H -#define _WINCON_ // to prevent including wincon.h -#if defined(_MSC_VER) -#pragma pack(push,2) -#else -#pragma pack(2) -#endif -#include -#if defined(_MSC_VER) -#pragma pack(pop) -#else -#pragma pack() -#endif -#undef _WINCON_ -#undef _WINCON_H - -#if defined(_MSC_VER) -#pragma pack(push,8) -#else -#pragma pack(8) -#endif -#include -#if defined(_MSC_VER) -#pragma pack(pop) -#else -#pragma pack() -#endif -#endif -#define _WINCON_ -#else -#include -#endif -#endif - -#if defined(__BORLANDC__) -#ifndef _WIN64 -#pragma option -a2 -#endif -#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100)) || defined(__LCC__) -#ifndef _WIN64 -#pragma pack(2) -#endif -#if defined(__LCC__) -#define _export __declspec(dllexport) -#endif -#else -#ifndef _WIN64 -#pragma pack(push,2) -#endif -#if _MSC_VER -#ifdef _export -#undef _export -#endif -#define _export -#endif -#endif - -#undef DefDlgProc - -#define FARMACRO_KEY_EVENT (KEY_EVENT|0x8000) - -// To ensure compatibility of plugin.hpp with compilers not supporting C++, -// you can #define _FAR_NO_NAMELESS_UNIONS. In this case, to access, -// for example, the Data field of the FarDialogItem structure -// you will need to use Data.Data, and the Selected field - Param.Selected -//#define _FAR_NO_NAMELESS_UNIONS - -#ifndef _WINCON_ -typedef struct _INPUT_RECORD INPUT_RECORD; -typedef struct _CHAR_INFO CHAR_INFO; -#endif - -#define CP_UNICODE 1200 -#define CP_REVERSEBOM 1201 -#define CP_AUTODETECT ((UINT)-1) - -enum FARMESSAGEFLAGS -{ - FMSG_WARNING = 0x00000001, - FMSG_ERRORTYPE = 0x00000002, - FMSG_KEEPBACKGROUND = 0x00000004, - FMSG_DOWN = 0x00000008, - FMSG_LEFTALIGN = 0x00000010, - - FMSG_ALLINONE = 0x00000020, - - FMSG_MB_OK = 0x00010000, - FMSG_MB_OKCANCEL = 0x00020000, - FMSG_MB_ABORTRETRYIGNORE = 0x00030000, - FMSG_MB_YESNO = 0x00040000, - FMSG_MB_YESNOCANCEL = 0x00050000, - FMSG_MB_RETRYCANCEL = 0x00060000, -}; - -typedef int (WINAPI *FARAPIMESSAGE)( - INT_PTR PluginNumber, - DWORD Flags, - const wchar_t *HelpTopic, - const wchar_t * const *Items, - int ItemsNumber, - int ButtonsNumber -); - - -enum DialogItemTypes -{ - DI_TEXT, - DI_VTEXT, - DI_SINGLEBOX, - DI_DOUBLEBOX, - DI_EDIT, - DI_PSWEDIT, - DI_FIXEDIT, - DI_BUTTON, - DI_CHECKBOX, - DI_RADIOBUTTON, - DI_COMBOBOX, - DI_LISTBOX, - - DI_USERCONTROL=255, -}; - -/* - Check diagol element type has inputstring? - (DI_EDIT, DI_FIXEDIT, DI_PSWEDIT, etc) -*/ -static __inline BOOL IsEdit(int Type) -{ - switch (Type) - { - case DI_EDIT: - case DI_FIXEDIT: - case DI_PSWEDIT: - case DI_COMBOBOX: - return TRUE; - default: - return FALSE; - } -} - - -enum FarDialogItemFlags -{ - DIF_NONE = 0, - DIF_COLORMASK = 0x000000ffUL, - DIF_SETCOLOR = 0x00000100UL, - DIF_BOXCOLOR = 0x00000200UL, - DIF_GROUP = 0x00000400UL, - DIF_LEFTTEXT = 0x00000800UL, - DIF_MOVESELECT = 0x00001000UL, - DIF_SHOWAMPERSAND = 0x00002000UL, - DIF_CENTERGROUP = 0x00004000UL, - DIF_NOBRACKETS = 0x00008000UL, - DIF_MANUALADDHISTORY = 0x00008000UL, - DIF_SEPARATOR = 0x00010000UL, - DIF_SEPARATOR2 = 0x00020000UL, - DIF_EDITOR = 0x00020000UL, - DIF_LISTNOAMPERSAND = 0x00020000UL, - DIF_LISTNOBOX = 0x00040000UL, - DIF_HISTORY = 0x00040000UL, - DIF_BTNNOCLOSE = 0x00040000UL, - DIF_CENTERTEXT = 0x00040000UL, - DIF_EDITEXPAND = 0x00080000UL, - DIF_DROPDOWNLIST = 0x00100000UL, - DIF_USELASTHISTORY = 0x00200000UL, - DIF_MASKEDIT = 0x00400000UL, - DIF_SELECTONENTRY = 0x00800000UL, - DIF_3STATE = 0x00800000UL, - DIF_EDITPATH = 0x01000000UL, - DIF_LISTWRAPMODE = 0x01000000UL, - DIF_NOAUTOCOMPLETE = 0x02000000UL, - DIF_LISTAUTOHIGHLIGHT = 0x02000000UL, - DIF_LISTNOCLOSE = 0x04000000UL, - DIF_HIDDEN = 0x10000000UL, - DIF_READONLY = 0x20000000UL, - DIF_NOFOCUS = 0x40000000UL, - DIF_DISABLE = 0x80000000UL, -}; - -enum FarMessagesProc -{ - DM_FIRST=0, - DM_CLOSE, - DM_ENABLE, - DM_ENABLEREDRAW, - DM_GETDLGDATA, - DM_GETDLGITEM, - DM_GETDLGRECT, - DM_GETTEXT, - DM_GETTEXTLENGTH, - DM_KEY, - DM_MOVEDIALOG, - DM_SETDLGDATA, - DM_SETDLGITEM, - DM_SETFOCUS, - DM_REDRAW, - DM_SETREDRAW=DM_REDRAW, - DM_SETTEXT, - DM_SETMAXTEXTLENGTH, - DM_SETTEXTLENGTH=DM_SETMAXTEXTLENGTH, - DM_SHOWDIALOG, - DM_GETFOCUS, - DM_GETCURSORPOS, - DM_SETCURSORPOS, - DM_GETTEXTPTR, - DM_SETTEXTPTR, - DM_SHOWITEM, - DM_ADDHISTORY, - - DM_GETCHECK, - DM_SETCHECK, - DM_SET3STATE, - - DM_LISTSORT, - DM_LISTGETITEM, - DM_LISTGETCURPOS, - DM_LISTSETCURPOS, - DM_LISTDELETE, - DM_LISTADD, - DM_LISTADDSTR, - DM_LISTUPDATE, - DM_LISTINSERT, - DM_LISTFINDSTRING, - DM_LISTINFO, - DM_LISTGETDATA, - DM_LISTSETDATA, - DM_LISTSETTITLES, - DM_LISTGETTITLES, - - DM_RESIZEDIALOG, - DM_SETITEMPOSITION, - - DM_GETDROPDOWNOPENED, - DM_SETDROPDOWNOPENED, - - DM_SETHISTORY, - - DM_GETITEMPOSITION, - DM_SETMOUSEEVENTNOTIFY, - - DM_EDITUNCHANGEDFLAG, - - DM_GETITEMDATA, - DM_SETITEMDATA, - - DM_LISTSET, - DM_LISTSETMOUSEREACTION, - - DM_GETCURSORSIZE, - DM_SETCURSORSIZE, - - DM_LISTGETDATASIZE, - - DM_GETSELECTION, - DM_SETSELECTION, - - DM_GETEDITPOSITION, - DM_SETEDITPOSITION, - - DM_SETCOMBOBOXEVENT, - DM_GETCOMBOBOXEVENT, - - DM_GETCONSTTEXTPTR, - DM_GETDLGITEMSHORT, - DM_SETDLGITEMSHORT, - - DM_GETDIALOGINFO, - - DN_FIRST=0x1000, - DN_BTNCLICK, - DN_CTLCOLORDIALOG, - DN_CTLCOLORDLGITEM, - DN_CTLCOLORDLGLIST, - DN_DRAWDIALOG, - DN_DRAWDLGITEM, - DN_EDITCHANGE, - DN_ENTERIDLE, - DN_GOTFOCUS, - DN_HELP, - DN_HOTKEY, - DN_INITDIALOG, - DN_KILLFOCUS, - DN_LISTCHANGE, - DN_MOUSECLICK, - DN_DRAGGED, - DN_RESIZECONSOLE, - DN_MOUSEEVENT, - DN_DRAWDIALOGDONE, - DN_LISTHOTKEY, - - DN_GETDIALOGINFO=DM_GETDIALOGINFO, - - DN_CLOSE=DM_CLOSE, - DN_KEY=DM_KEY, - - - DM_USER=0x4000, - -}; - -enum FARCHECKEDSTATE -{ - BSTATE_UNCHECKED = 0, - BSTATE_CHECKED = 1, - BSTATE_3STATE = 2, - BSTATE_TOGGLE = 3, -}; - -enum FARLISTMOUSEREACTIONTYPE -{ - LMRT_ONLYFOCUS = 0, - LMRT_ALWAYS = 1, - LMRT_NEVER = 2, -}; - -enum FARCOMBOBOXEVENTTYPE -{ - CBET_KEY = 0x00000001, - CBET_MOUSE = 0x00000002, -}; - -enum LISTITEMFLAGS -{ - LIF_SELECTED = 0x00010000UL, - LIF_CHECKED = 0x00020000UL, - LIF_SEPARATOR = 0x00040000UL, - LIF_DISABLE = 0x00080000UL, - LIF_GRAYED = 0x00100000UL, - LIF_HIDDEN = 0x00200000UL, - LIF_DELETEUSERDATA = 0x80000000UL, -}; - -struct FarListItem -{ - DWORD Flags; - const wchar_t *Text; - DWORD Reserved[3]; -}; - -struct FarListUpdate -{ - int Index; - struct FarListItem Item; -}; - -struct FarListInsert -{ - int Index; - struct FarListItem Item; -}; - -struct FarListGetItem -{ - int ItemIndex; - struct FarListItem Item; -}; - -struct FarListPos -{ - int SelectPos; - int TopPos; -}; - -enum FARLISTFINDFLAGS -{ - LIFIND_EXACTMATCH = 0x00000001, -}; - -struct FarListFind -{ - int StartIndex; - const wchar_t *Pattern; - DWORD Flags; - DWORD Reserved; -}; - -struct FarListDelete -{ - int StartIndex; - int Count; -}; - -enum FARLISTINFOFLAGS -{ - LINFO_SHOWNOBOX = 0x00000400, - LINFO_AUTOHIGHLIGHT = 0x00000800, - LINFO_REVERSEHIGHLIGHT = 0x00001000, - LINFO_WRAPMODE = 0x00008000, - LINFO_SHOWAMPERSAND = 0x00010000, -}; - -struct FarListInfo -{ - DWORD Flags; - int ItemsNumber; - int SelectPos; - int TopPos; - int MaxHeight; - int MaxLength; - DWORD Reserved[6]; -}; - -struct FarListItemData -{ - int Index; - int DataSize; - void *Data; - DWORD Reserved; -}; - -struct FarList -{ - int ItemsNumber; - struct FarListItem *Items; -}; - -struct FarListTitles -{ - int TitleLen; - const wchar_t *Title; - int BottomLen; - const wchar_t *Bottom; -}; - -struct FarListColors -{ - DWORD Flags; - DWORD Reserved; - int ColorCount; - LPBYTE Colors; -}; - -struct FarDialogItem -{ - int Type; - int X1,Y1,X2,Y2; - int Focus; - union - { - DWORD_PTR Reserved; - int Selected; - const wchar_t *History; - const wchar_t *Mask; - struct FarList *ListItems; - int ListPos; - CHAR_INFO *VBuf; - } -#ifdef _FAR_NO_NAMELESS_UNIONS - Param -#endif - ; - DWORD Flags; - int DefaultButton; - - const wchar_t *PtrData; - size_t MaxLen; // terminate 0 not included (if == 0 string size is unlimited) -}; - -struct FarDialogItemData -{ - size_t PtrLength; - wchar_t *PtrData; -}; - -struct FarDialogEvent -{ - HANDLE hDlg; - int Msg; - int Param1; - LONG_PTR Param2; - LONG_PTR Result; -}; - -struct OpenDlgPluginData -{ - int ItemNumber; - HANDLE hDlg; -}; - -struct DialogInfo -{ - int StructSize; - GUID Id; -}; - -#define Dlg_RedrawDialog(Info,hDlg) Info.SendDlgMessage(hDlg,DM_REDRAW,0,0) - -#define Dlg_GetDlgData(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETDLGDATA,0,0) -#define Dlg_SetDlgData(Info,hDlg,Data) Info.SendDlgMessage(hDlg,DM_SETDLGDATA,0,(LONG_PTR)Data) - -#define Dlg_GetDlgItemData(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETITEMDATA,0,0) -#define Dlg_SetDlgItemData(Info,hDlg,ID,Data) Info.SendDlgMessage(hDlg,DM_SETITEMDATA,0,(LONG_PTR)Data) - -#define DlgItem_GetFocus(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETFOCUS,0,0) -#define DlgItem_SetFocus(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_SETFOCUS,ID,0) -#define DlgItem_Enable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,TRUE) -#define DlgItem_Disable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,FALSE) -#define DlgItem_IsEnable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,-1) -#define DlgItem_SetText(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,ID,(LONG_PTR)Str) - -#define DlgItem_GetCheck(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETCHECK,ID,0) -#define DlgItem_SetCheck(Info,hDlg,ID,State) Info.SendDlgMessage(hDlg,DM_SETCHECK,ID,State) - -#define DlgEdit_AddHistory(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_ADDHISTORY,ID,(LONG_PTR)Str) - -#define DlgList_AddString(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_LISTADDSTR,ID,(LONG_PTR)Str) -#define DlgList_GetCurPos(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,ID,0) -#define DlgList_SetCurPos(Info,hDlg,ID,NewPos) {struct FarListPos LPos={NewPos,-1};Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,ID,(LONG_PTR)&LPos);} -#define DlgList_ClearList(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,0) -#define DlgList_DeleteItem(Info,hDlg,ID,Index) {struct FarListDelete FLDItem={Index,1}; Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,(LONG_PTR)&FLDItem);} -#define DlgList_SortUp(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,0) -#define DlgList_SortDown(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,1) -#define DlgList_GetItemData(Info,hDlg,ID,Index) Info.SendDlgMessage(hDlg,DM_LISTGETDATA,ID,Index) -#define DlgList_SetItemStrAsData(Info,hDlg,ID,Index,Str) {struct FarListItemData FLID{Index,0,Str,0}; Info.SendDlgMessage(hDlg,DM_LISTSETDATA,ID,(LONG_PTR)&FLID);} - -enum FARDIALOGFLAGS -{ - FDLG_WARNING = 0x00000001, - FDLG_SMALLDIALOG = 0x00000002, - FDLG_NODRAWSHADOW = 0x00000004, - FDLG_NODRAWPANEL = 0x00000008, -}; - -typedef LONG_PTR(WINAPI *FARWINDOWPROC)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef LONG_PTR(WINAPI *FARAPISENDDLGMESSAGE)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef LONG_PTR(WINAPI *FARAPIDEFDLGPROC)( - HANDLE hDlg, - int Msg, - int Param1, - LONG_PTR Param2 -); - -typedef HANDLE(WINAPI *FARAPIDIALOGINIT)( - INT_PTR PluginNumber, - int X1, - int Y1, - int X2, - int Y2, - const wchar_t *HelpTopic, - struct FarDialogItem *Item, - unsigned int ItemsNumber, - DWORD Reserved, - DWORD Flags, - FARWINDOWPROC DlgProc, - LONG_PTR Param -); - -typedef int (WINAPI *FARAPIDIALOGRUN)( - HANDLE hDlg -); - -typedef void (WINAPI *FARAPIDIALOGFREE)( - HANDLE hDlg -); - -struct FarMenuItem -{ - const wchar_t *Text; - int Selected; - int Checked; - int Separator; -}; - -enum MENUITEMFLAGS -{ - MIF_SELECTED = 0x00010000UL, - MIF_CHECKED = 0x00020000UL, - MIF_SEPARATOR = 0x00040000UL, - MIF_DISABLE = 0x00080000UL, - MIF_GRAYED = 0x00100000UL, - MIF_HIDDEN = 0x00200000UL, -}; - -struct FarMenuItemEx -{ - DWORD Flags; - const wchar_t *Text; - DWORD AccelKey; - DWORD Reserved; - DWORD_PTR UserData; -}; - -enum FARMENUFLAGS -{ - FMENU_SHOWAMPERSAND = 0x00000001, - FMENU_WRAPMODE = 0x00000002, - FMENU_AUTOHIGHLIGHT = 0x00000004, - FMENU_REVERSEAUTOHIGHLIGHT = 0x00000008, - FMENU_USEEXT = 0x00000020, - FMENU_CHANGECONSOLETITLE = 0x00000040, -}; - -typedef int (WINAPI *FARAPIMENU)( - INT_PTR PluginNumber, - int X, - int Y, - int MaxHeight, - DWORD Flags, - const wchar_t *Title, - const wchar_t *Bottom, - const wchar_t *HelpTopic, - const int *BreakKeys, - int *BreakCode, - const struct FarMenuItem *Item, - int ItemsNumber -); - - -enum PLUGINPANELITEMFLAGS -{ - PPIF_PROCESSDESCR = 0x80000000, - PPIF_SELECTED = 0x40000000, - PPIF_USERDATA = 0x20000000, -}; - -struct FAR_FIND_DATA -{ - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - unsigned __int64 nFileSize; - unsigned __int64 nPackSize; - const wchar_t *lpwszFileName; - const wchar_t *lpwszAlternateFileName; -}; - -struct PluginPanelItem -{ - struct FAR_FIND_DATA FindData; - DWORD Flags; - DWORD NumberOfLinks; - const wchar_t *Description; - const wchar_t *Owner; - const wchar_t * const *CustomColumnData; - int CustomColumnNumber; - DWORD_PTR UserData; - DWORD CRC32; - DWORD_PTR Reserved[2]; -}; - -enum PANELINFOFLAGS -{ - PFLAGS_SHOWHIDDEN = 0x00000001, - PFLAGS_HIGHLIGHT = 0x00000002, - PFLAGS_REVERSESORTORDER = 0x00000004, - PFLAGS_USESORTGROUPS = 0x00000008, - PFLAGS_SELECTEDFIRST = 0x00000010, - PFLAGS_REALNAMES = 0x00000020, - PFLAGS_NUMERICSORT = 0x00000040, - PFLAGS_PANELLEFT = 0x00000080, -}; - -enum PANELINFOTYPE -{ - PTYPE_FILEPANEL, - PTYPE_TREEPANEL, - PTYPE_QVIEWPANEL, - PTYPE_INFOPANEL -}; - -struct PanelInfo -{ - int PanelType; - int Plugin; - RECT PanelRect; - int ItemsNumber; - int SelectedItemsNumber; - int CurrentItem; - int TopPanelItem; - int Visible; - int Focus; - int ViewMode; - int ShortNames; - int SortMode; - DWORD Flags; - DWORD Reserved; -}; - - -struct PanelRedrawInfo -{ - int CurrentItem; - int TopPanelItem; -}; - -struct CmdLineSelect -{ - int SelStart; - int SelEnd; -}; - -#define PANEL_NONE ((HANDLE)(-1)) -#define PANEL_ACTIVE ((HANDLE)(-1)) -#define PANEL_PASSIVE ((HANDLE)(-2)) - -enum FILE_CONTROL_COMMANDS -{ - FCTL_CLOSEPLUGIN, - FCTL_GETPANELINFO, - FCTL_UPDATEPANEL, - FCTL_REDRAWPANEL, - FCTL_GETCMDLINE, - FCTL_SETCMDLINE, - FCTL_SETSELECTION, - FCTL_SETVIEWMODE, - FCTL_INSERTCMDLINE, - FCTL_SETUSERSCREEN, - FCTL_SETPANELDIR, - FCTL_SETCMDLINEPOS, - FCTL_GETCMDLINEPOS, - FCTL_SETSORTMODE, - FCTL_SETSORTORDER, - FCTL_GETCMDLINESELECTEDTEXT, - FCTL_SETCMDLINESELECTION, - FCTL_GETCMDLINESELECTION, - FCTL_CHECKPANELSEXIST, - FCTL_SETNUMERICSORT, - FCTL_GETUSERSCREEN, - FCTL_ISACTIVEPANEL, - FCTL_GETPANELITEM, - FCTL_GETSELECTEDPANELITEM, - FCTL_GETCURRENTPANELITEM, - FCTL_GETPANELDIR, - FCTL_GETCOLUMNTYPES, - FCTL_GETCOLUMNWIDTHS, - FCTL_BEGINSELECTION, - FCTL_ENDSELECTION, - FCTL_CLEARSELECTION, -}; - -typedef int (WINAPI *FARAPICONTROL)( - HANDLE hPlugin, - int Command, - int Param1, - LONG_PTR Param2 -); - -typedef void (WINAPI *FARAPITEXT)( - int X, - int Y, - int Color, - const wchar_t *Str -); - -typedef HANDLE(WINAPI *FARAPISAVESCREEN)(int X1, int Y1, int X2, int Y2); - -typedef void (WINAPI *FARAPIRESTORESCREEN)(HANDLE hScreen); - - -typedef int (WINAPI *FARAPIGETDIRLIST)( - const wchar_t *Dir, - struct FAR_FIND_DATA **pPanelItem, - int *pItemsNumber -); - -typedef int (WINAPI *FARAPIGETPLUGINDIRLIST)( - INT_PTR PluginNumber, - HANDLE hPlugin, - const wchar_t *Dir, - struct PluginPanelItem **pPanelItem, - int *pItemsNumber -); - -typedef void (WINAPI *FARAPIFREEDIRLIST)(struct FAR_FIND_DATA *PanelItem, int nItemsNumber); -typedef void (WINAPI *FARAPIFREEPLUGINDIRLIST)(struct PluginPanelItem *PanelItem, int nItemsNumber); - -enum VIEWER_FLAGS -{ - VF_NONMODAL = 0x00000001, - VF_DELETEONCLOSE = 0x00000002, - VF_ENABLE_F6 = 0x00000004, - VF_DISABLEHISTORY = 0x00000008, - VF_IMMEDIATERETURN = 0x00000100, - VF_DELETEONLYFILEONCLOSE = 0x00000200, -}; - -typedef int (WINAPI *FARAPIVIEWER)( - const wchar_t *FileName, - const wchar_t *Title, - int X1, - int Y1, - int X2, - int Y2, - DWORD Flags, - UINT CodePage -); - -enum EDITOR_FLAGS -{ - EF_NONMODAL = 0x00000001, - EF_CREATENEW = 0x00000002, - EF_ENABLE_F6 = 0x00000004, - EF_DISABLEHISTORY = 0x00000008, - EF_DELETEONCLOSE = 0x00000010, - EF_IMMEDIATERETURN = 0x00000100, - EF_DELETEONLYFILEONCLOSE = 0x00000200, -}; - -enum EDITOR_EXITCODE -{ - EEC_OPEN_ERROR = 0, - EEC_MODIFIED = 1, - EEC_NOT_MODIFIED = 2, - EEC_LOADING_INTERRUPTED = 3, -}; - -typedef int (WINAPI *FARAPIEDITOR)( - const wchar_t *FileName, - const wchar_t *Title, - int X1, - int Y1, - int X2, - int Y2, - DWORD Flags, - int StartLine, - int StartChar, - UINT CodePage -); - -typedef int (WINAPI *FARAPICMPNAME)( - const wchar_t *Pattern, - const wchar_t *String, - int SkipPath -); - - -typedef const wchar_t*(WINAPI *FARAPIGETMSG)( - INT_PTR PluginNumber, - int MsgId -); - - -enum FarHelpFlags -{ - FHELP_NOSHOWERROR = 0x80000000, - FHELP_SELFHELP = 0x00000000, - FHELP_FARHELP = 0x00000001, - FHELP_CUSTOMFILE = 0x00000002, - FHELP_CUSTOMPATH = 0x00000004, - FHELP_USECONTENTS = 0x40000000, -}; - -typedef BOOL (WINAPI *FARAPISHOWHELP)( - const wchar_t *ModuleName, - const wchar_t *Topic, - DWORD Flags -); - -enum ADVANCED_CONTROL_COMMANDS -{ - ACTL_GETFARVERSION = 0, - ACTL_GETSYSWORDDIV = 2, - ACTL_WAITKEY = 3, - ACTL_GETCOLOR = 4, - ACTL_GETARRAYCOLOR = 5, - ACTL_EJECTMEDIA = 6, - ACTL_KEYMACRO = 7, - ACTL_POSTKEYSEQUENCE = 8, - ACTL_GETWINDOWINFO = 9, - ACTL_GETWINDOWCOUNT = 10, - ACTL_SETCURRENTWINDOW = 11, - ACTL_COMMIT = 12, - ACTL_GETFARHWND = 13, - ACTL_GETSYSTEMSETTINGS = 14, - ACTL_GETPANELSETTINGS = 15, - ACTL_GETINTERFACESETTINGS = 16, - ACTL_GETCONFIRMATIONS = 17, - ACTL_GETDESCSETTINGS = 18, - ACTL_SETARRAYCOLOR = 19, - ACTL_GETPLUGINMAXREADDATA = 21, - ACTL_GETDIALOGSETTINGS = 22, - ACTL_GETSHORTWINDOWINFO = 23, - ACTL_REDRAWALL = 27, - ACTL_SYNCHRO = 28, - ACTL_SETPROGRESSSTATE = 29, - ACTL_SETPROGRESSVALUE = 30, - ACTL_QUIT = 31, -}; - - -enum FarSystemSettings -{ - FSS_CLEARROATTRIBUTE = 0x00000001, - FSS_DELETETORECYCLEBIN = 0x00000002, - FSS_USESYSTEMCOPYROUTINE = 0x00000004, - FSS_COPYFILESOPENEDFORWRITING = 0x00000008, - FSS_CREATEFOLDERSINUPPERCASE = 0x00000010, - FSS_SAVECOMMANDSHISTORY = 0x00000020, - FSS_SAVEFOLDERSHISTORY = 0x00000040, - FSS_SAVEVIEWANDEDITHISTORY = 0x00000080, - FSS_USEWINDOWSREGISTEREDTYPES = 0x00000100, - FSS_AUTOSAVESETUP = 0x00000200, - FSS_SCANSYMLINK = 0x00000400, -}; - -enum FarPanelSettings -{ - FPS_SHOWHIDDENANDSYSTEMFILES = 0x00000001, - FPS_HIGHLIGHTFILES = 0x00000002, - FPS_AUTOCHANGEFOLDER = 0x00000004, - FPS_SELECTFOLDERS = 0x00000008, - FPS_ALLOWREVERSESORTMODES = 0x00000010, - FPS_SHOWCOLUMNTITLES = 0x00000020, - FPS_SHOWSTATUSLINE = 0x00000040, - FPS_SHOWFILESTOTALINFORMATION = 0x00000080, - FPS_SHOWFREESIZE = 0x00000100, - FPS_SHOWSCROLLBAR = 0x00000200, - FPS_SHOWBACKGROUNDSCREENSNUMBER = 0x00000400, - FPS_SHOWSORTMODELETTER = 0x00000800, -}; - -enum FarDialogSettings -{ - FDIS_HISTORYINDIALOGEDITCONTROLS = 0x00000001, - FDIS_PERSISTENTBLOCKSINEDITCONTROLS = 0x00000002, - FDIS_AUTOCOMPLETEININPUTLINES = 0x00000004, - FDIS_BSDELETEUNCHANGEDTEXT = 0x00000008, - FDIS_DELREMOVESBLOCKS = 0x00000010, - FDIS_MOUSECLICKOUTSIDECLOSESDIALOG = 0x00000020, -}; - -enum FarInterfaceSettings -{ - FIS_CLOCKINPANELS = 0x00000001, - FIS_CLOCKINVIEWERANDEDITOR = 0x00000002, - FIS_MOUSE = 0x00000004, - FIS_SHOWKEYBAR = 0x00000008, - FIS_ALWAYSSHOWMENUBAR = 0x00000010, - FIS_SHOWTOTALCOPYPROGRESSINDICATOR = 0x00000100, - FIS_SHOWCOPYINGTIMEINFO = 0x00000200, - FIS_USECTRLPGUPTOCHANGEDRIVE = 0x00000800, - FIS_SHOWTOTALDELPROGRESSINDICATOR = 0x00001000, -}; - -enum FarConfirmationsSettings -{ - FCS_COPYOVERWRITE = 0x00000001, - FCS_MOVEOVERWRITE = 0x00000002, - FCS_DRAGANDDROP = 0x00000004, - FCS_DELETE = 0x00000008, - FCS_DELETENONEMPTYFOLDERS = 0x00000010, - FCS_INTERRUPTOPERATION = 0x00000020, - FCS_DISCONNECTNETWORKDRIVE = 0x00000040, - FCS_RELOADEDITEDFILE = 0x00000080, - FCS_CLEARHISTORYLIST = 0x00000100, - FCS_EXIT = 0x00000200, - FCS_OVERWRITEDELETEROFILES = 0x00000400, -}; - -enum FarDescriptionSettings -{ - FDS_UPDATEALWAYS = 0x00000001, - FDS_UPDATEIFDISPLAYED = 0x00000002, - FDS_SETHIDDEN = 0x00000004, - FDS_UPDATEREADONLY = 0x00000008, -}; - -enum FAREJECTMEDIAFLAGS -{ - EJECT_NO_MESSAGE = 0x00000001, - EJECT_LOAD_MEDIA = 0x00000002, -}; - -struct ActlEjectMedia -{ - DWORD Letter; - DWORD Flags; -}; - - -enum FARKEYSEQUENCEFLAGS -{ - KSFLAGS_DISABLEOUTPUT = 0x00000001, - KSFLAGS_NOSENDKEYSTOPLUGINS = 0x00000002, - KSFLAGS_REG_MULTI_SZ = 0x00100000, - KSFLAGS_SILENTCHECK = 0x00000001, -}; - -struct KeySequence -{ - DWORD Flags; - int Count; - const DWORD *Sequence; -}; - -enum FARMACROCOMMAND -{ - MCMD_LOADALL = 0, - MCMD_SAVEALL = 1, - MCMD_POSTMACROSTRING = 2, - MCMD_CHECKMACRO = 4, - MCMD_GETSTATE = 5, -}; - -enum FARMACROSTATE -{ - MACROSTATE_NOMACRO =0, - MACROSTATE_EXECUTING =1, - MACROSTATE_EXECUTING_COMMON =2, - MACROSTATE_RECORDING =3, - MACROSTATE_RECORDING_COMMON =4, -}; - -enum FARMACROPARSEERRORCODE -{ - MPEC_SUCCESS = 0, - MPEC_UNRECOGNIZED_KEYWORD = 1, - MPEC_UNRECOGNIZED_FUNCTION = 2, - MPEC_FUNC_PARAM = 3, - MPEC_NOT_EXPECTED_ELSE = 4, - MPEC_NOT_EXPECTED_END = 5, - MPEC_UNEXPECTED_EOS = 6, - MPEC_EXPECTED_TOKEN = 7, - MPEC_BAD_HEX_CONTROL_CHAR = 8, - MPEC_BAD_CONTROL_CHAR = 9, - MPEC_VAR_EXPECTED =10, - MPEC_EXPR_EXPECTED =11, - MPEC_ZEROLENGTHMACRO =12, - MPEC_INTPARSERERROR =13, -}; - -struct MacroParseResult -{ - DWORD ErrCode; - COORD ErrPos; - const wchar_t *ErrSrc; -}; - -struct ActlKeyMacro -{ - int Command; - union - { - struct - { - const wchar_t *SequenceText; - DWORD Flags; - } PlainText; - struct MacroParseResult MacroResult; - DWORD_PTR Reserved[3]; - } Param; -}; - -enum FARCOLORFLAGS -{ - FCLR_REDRAW = 0x00000001, -}; - -struct FarSetColors -{ - DWORD Flags; - int StartIndex; - int ColorCount; - LPBYTE Colors; -}; - -enum WINDOWINFO_TYPE -{ - WTYPE_PANELS=1, - WTYPE_VIEWER, - WTYPE_EDITOR, - WTYPE_DIALOG, - WTYPE_VMENU, - WTYPE_HELP, -}; - -struct WindowInfo -{ - int Pos; - int Type; - int Modified; - int Current; - wchar_t *TypeName; - int TypeNameSize; - wchar_t *Name; - int NameSize; -}; - -enum PROGRESSTATE -{ - PS_NOPROGRESS =0x0, - PS_INDETERMINATE=0x1, - PS_NORMAL =0x2, - PS_ERROR =0x4, - PS_PAUSED =0x8, -}; - -struct PROGRESSVALUE -{ - unsigned __int64 Completed; - unsigned __int64 Total; -}; - -typedef INT_PTR(WINAPI *FARAPIADVCONTROL)( - INT_PTR ModuleNumber, - int Command, - void *Param -); - - -enum VIEWER_CONTROL_COMMANDS -{ - VCTL_GETINFO, - VCTL_QUIT, - VCTL_REDRAW, - VCTL_SETKEYBAR, - VCTL_SETPOSITION, - VCTL_SELECT, - VCTL_SETMODE, -}; - -enum VIEWER_OPTIONS -{ - VOPT_SAVEFILEPOSITION=1, - VOPT_AUTODETECTCODEPAGE=2, -}; - -enum VIEWER_SETMODE_TYPES -{ - VSMT_HEX, - VSMT_WRAP, - VSMT_WORDWRAP, -}; - -enum VIEWER_SETMODEFLAGS_TYPES -{ - VSMFL_REDRAW = 0x00000001, -}; - -struct ViewerSetMode -{ - int Type; - union - { - int iParam; - wchar_t *wszParam; - } Param; - DWORD Flags; - DWORD Reserved; -}; - -struct ViewerSelect -{ - __int64 BlockStartPos; - int BlockLen; -}; - -enum VIEWER_SETPOS_FLAGS -{ - VSP_NOREDRAW = 0x0001, - VSP_PERCENT = 0x0002, - VSP_RELATIVE = 0x0004, - VSP_NORETNEWPOS = 0x0008, -}; - -struct ViewerSetPosition -{ - DWORD Flags; - __int64 StartPos; - __int64 LeftPos; -}; - -struct ViewerMode -{ - UINT CodePage; - int Wrap; - int WordWrap; - int Hex; - DWORD Reserved[4]; -}; - -struct ViewerInfo -{ - int StructSize; - int ViewerID; - const wchar_t *FileName; - __int64 FileSize; - __int64 FilePos; - int WindowSizeX; - int WindowSizeY; - DWORD Options; - int TabSize; - struct ViewerMode CurMode; - __int64 LeftPos; -}; - -typedef int (WINAPI *FARAPIVIEWERCONTROL)( - int Command, - void *Param -); - -enum VIEWER_EVENTS -{ - VE_READ =0, - VE_CLOSE =1, - - VE_GOTFOCUS =6, - VE_KILLFOCUS =7, -}; - - -enum EDITOR_EVENTS -{ - EE_READ =0, - EE_SAVE =1, - EE_REDRAW =2, - EE_CLOSE =3, - - EE_GOTFOCUS =6, - EE_KILLFOCUS =7, -}; - -enum DIALOG_EVENTS -{ - DE_DLGPROCINIT =0, - DE_DEFDLGPROCINIT =1, - DE_DLGPROCEND =2, -}; - -enum SYNCHRO_EVENTS -{ - SE_COMMONSYNCHRO =0, -}; - -#define EEREDRAW_ALL (void*)0 -#define EEREDRAW_CHANGE (void*)1 -#define EEREDRAW_LINE (void*)2 - -enum EDITOR_CONTROL_COMMANDS -{ - ECTL_GETSTRING, - ECTL_SETSTRING, - ECTL_INSERTSTRING, - ECTL_DELETESTRING, - ECTL_DELETECHAR, - ECTL_INSERTTEXT, - ECTL_GETINFO, - ECTL_SETPOSITION, - ECTL_SELECT, - ECTL_REDRAW, - ECTL_TABTOREAL, - ECTL_REALTOTAB, - ECTL_EXPANDTABS, - ECTL_SETTITLE, - ECTL_READINPUT, - ECTL_PROCESSINPUT, - ECTL_ADDCOLOR, - ECTL_GETCOLOR, - ECTL_SAVEFILE, - ECTL_QUIT, - ECTL_SETKEYBAR, - ECTL_PROCESSKEY, - ECTL_SETPARAM, - ECTL_GETBOOKMARKS, - ECTL_TURNOFFMARKINGBLOCK, - ECTL_DELETEBLOCK, - ECTL_ADDSTACKBOOKMARK, - ECTL_PREVSTACKBOOKMARK, - ECTL_NEXTSTACKBOOKMARK, - ECTL_CLEARSTACKBOOKMARKS, - ECTL_DELETESTACKBOOKMARK, - ECTL_GETSTACKBOOKMARKS, - ECTL_UNDOREDO, - ECTL_GETFILENAME, -}; - -enum EDITOR_SETPARAMETER_TYPES -{ - ESPT_TABSIZE, - ESPT_EXPANDTABS, - ESPT_AUTOINDENT, - ESPT_CURSORBEYONDEOL, - ESPT_CHARCODEBASE, - ESPT_CODEPAGE, - ESPT_SAVEFILEPOSITION, - ESPT_LOCKMODE, - ESPT_SETWORDDIV, - ESPT_GETWORDDIV, - ESPT_SHOWWHITESPACE, - ESPT_SETBOM, -}; - - - -struct EditorSetParameter -{ - int Type; - union - { - int iParam; - wchar_t *wszParam; - DWORD Reserved1; - } Param; - DWORD Flags; - DWORD Size; -}; - - -enum EDITOR_UNDOREDO_COMMANDS -{ - EUR_BEGIN, - EUR_END, - EUR_UNDO, - EUR_REDO -}; - - -struct EditorUndoRedo -{ - int Command; - DWORD_PTR Reserved[3]; -}; - -struct EditorGetString -{ - int StringNumber; - const wchar_t *StringText; - const wchar_t *StringEOL; - int StringLength; - int SelStart; - int SelEnd; -}; - - -struct EditorSetString -{ - int StringNumber; - const wchar_t *StringText; - const wchar_t *StringEOL; - int StringLength; -}; - -enum EXPAND_TABS -{ - EXPAND_NOTABS, - EXPAND_ALLTABS, - EXPAND_NEWTABS -}; - - -enum EDITOR_OPTIONS -{ - EOPT_EXPANDALLTABS = 0x00000001, - EOPT_PERSISTENTBLOCKS = 0x00000002, - EOPT_DELREMOVESBLOCKS = 0x00000004, - EOPT_AUTOINDENT = 0x00000008, - EOPT_SAVEFILEPOSITION = 0x00000010, - EOPT_AUTODETECTCODEPAGE= 0x00000020, - EOPT_CURSORBEYONDEOL = 0x00000040, - EOPT_EXPANDONLYNEWTABS = 0x00000080, - EOPT_SHOWWHITESPACE = 0x00000100, - EOPT_BOM = 0x00000200, -}; - - -enum EDITOR_BLOCK_TYPES -{ - BTYPE_NONE, - BTYPE_STREAM, - BTYPE_COLUMN -}; - -enum EDITOR_CURRENTSTATE -{ - ECSTATE_MODIFIED = 0x00000001, - ECSTATE_SAVED = 0x00000002, - ECSTATE_LOCKED = 0x00000004, -}; - - -struct EditorInfo -{ - int EditorID; - int WindowSizeX; - int WindowSizeY; - int TotalLines; - int CurLine; - int CurPos; - int CurTabPos; - int TopScreenLine; - int LeftPos; - int Overtype; - int BlockType; - int BlockStartLine; - DWORD Options; - int TabSize; - int BookMarkCount; - DWORD CurState; - UINT CodePage; - DWORD Reserved[5]; -}; - -struct EditorBookMarks -{ - long *Line; - long *Cursor; - long *ScreenLine; - long *LeftPos; - DWORD Reserved[4]; -}; - -struct EditorSetPosition -{ - int CurLine; - int CurPos; - int CurTabPos; - int TopScreenLine; - int LeftPos; - int Overtype; -}; - - -struct EditorSelect -{ - int BlockType; - int BlockStartLine; - int BlockStartPos; - int BlockWidth; - int BlockHeight; -}; - - -struct EditorConvertPos -{ - int StringNumber; - int SrcPos; - int DestPos; -}; - - -enum EDITORCOLORFLAGS -{ - ECF_TAB1 = 0x10000, -}; - -struct EditorColor -{ - int StringNumber; - int ColorItem; - int StartPos; - int EndPos; - int Color; -}; - -struct EditorSaveFile -{ - const wchar_t *FileName; - const wchar_t *FileEOL; - UINT CodePage; -}; - -typedef int (WINAPI *FARAPIEDITORCONTROL)( - int Command, - void *Param -); - -enum INPUTBOXFLAGS -{ - FIB_ENABLEEMPTY = 0x00000001, - FIB_PASSWORD = 0x00000002, - FIB_EXPANDENV = 0x00000004, - FIB_NOUSELASTHISTORY = 0x00000008, - FIB_BUTTONS = 0x00000010, - FIB_NOAMPERSAND = 0x00000020, - FIB_EDITPATH = 0x01000000, -}; - -typedef int (WINAPI *FARAPIINPUTBOX)( - const wchar_t *Title, - const wchar_t *SubTitle, - const wchar_t *HistoryName, - const wchar_t *SrcText, - wchar_t *DestText, - int DestLength, - const wchar_t *HelpTopic, - DWORD Flags -); - -typedef int (WINAPI *FARAPIPLUGINSCONTROL)( - HANDLE hHandle, - int Command, - int Param1, - LONG_PTR Param2 -); - -typedef int (WINAPI *FARAPIFILEFILTERCONTROL)( - HANDLE hHandle, - int Command, - int Param1, - LONG_PTR Param2 -); - -typedef int (WINAPI *FARAPIREGEXPCONTROL)( - HANDLE hHandle, - int Command, - LONG_PTR Param -); - -// -typedef int (WINAPIV *FARSTDSPRINTF)(wchar_t *Buffer,const wchar_t *Format,...); -typedef int (WINAPIV *FARSTDSNPRINTF)(wchar_t *Buffer,size_t Sizebuf,const wchar_t *Format,...); -typedef int (WINAPIV *FARSTDSSCANF)(const wchar_t *Buffer, const wchar_t *Format,...); -// -typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *)); -typedef void (WINAPI *FARSTDQSORTEX)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *,void *userparam),void *userparam); -typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *)); -typedef int (WINAPI *FARSTDGETFILEOWNER)(const wchar_t *Computer,const wchar_t *Name,wchar_t *Owner,int Size); -typedef int (WINAPI *FARSTDGETNUMBEROFLINKS)(const wchar_t *Name); -typedef int (WINAPI *FARSTDATOI)(const wchar_t *s); -typedef __int64(WINAPI *FARSTDATOI64)(const wchar_t *s); -typedef wchar_t *(WINAPI *FARSTDITOA64)(__int64 value, wchar_t *string, int radix); -typedef wchar_t *(WINAPI *FARSTDITOA)(int value, wchar_t *string, int radix); -typedef wchar_t *(WINAPI *FARSTDLTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDRTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDTRUNCSTR)(wchar_t *Str,int MaxLength); -typedef wchar_t *(WINAPI *FARSTDTRUNCPATHSTR)(wchar_t *Str,int MaxLength); -typedef wchar_t *(WINAPI *FARSTDQUOTESPACEONLY)(wchar_t *Str); -typedef const wchar_t*(WINAPI *FARSTDPOINTTONAME)(const wchar_t *Path); -typedef int (WINAPI *FARSTDGETPATHROOT)(const wchar_t *Path,wchar_t *Root, int DestSize); -typedef BOOL (WINAPI *FARSTDADDENDSLASH)(wchar_t *Path); -typedef int (WINAPI *FARSTDCOPYTOCLIPBOARD)(const wchar_t *Data); -typedef wchar_t *(WINAPI *FARSTDPASTEFROMCLIPBOARD)(void); -typedef int (WINAPI *FARSTDINPUTRECORDTOKEY)(const INPUT_RECORD *r); -typedef int (WINAPI *FARSTDLOCALISLOWER)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISUPPER)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISALPHA)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISALPHANUM)(wchar_t Ch); -typedef wchar_t (WINAPI *FARSTDLOCALUPPER)(wchar_t LowerChar); -typedef wchar_t (WINAPI *FARSTDLOCALLOWER)(wchar_t UpperChar); -typedef void (WINAPI *FARSTDLOCALUPPERBUF)(wchar_t *Buf,int Length); -typedef void (WINAPI *FARSTDLOCALLOWERBUF)(wchar_t *Buf,int Length); -typedef void (WINAPI *FARSTDLOCALSTRUPR)(wchar_t *s1); -typedef void (WINAPI *FARSTDLOCALSTRLWR)(wchar_t *s1); -typedef int (WINAPI *FARSTDLOCALSTRICMP)(const wchar_t *s1,const wchar_t *s2); -typedef int (WINAPI *FARSTDLOCALSTRNICMP)(const wchar_t *s1,const wchar_t *s2,int n); - -enum PROCESSNAME_FLAGS -{ - PN_CMPNAME = 0x00000000UL, - PN_CMPNAMELIST = 0x00010000UL, - PN_GENERATENAME = 0x00020000UL, - PN_SKIPPATH = 0x01000000UL, -}; - -typedef int (WINAPI *FARSTDPROCESSNAME)(const wchar_t *param1, wchar_t *param2, DWORD size, DWORD flags); - -typedef void (WINAPI *FARSTDUNQUOTE)(wchar_t *Str); - -enum XLATMODE -{ - XLAT_SWITCHKEYBLAYOUT = 0x00000001UL, - XLAT_SWITCHKEYBBEEP = 0x00000002UL, -}; - -typedef size_t (WINAPI *FARSTDKEYTOKEYNAME)(int Key,wchar_t *KeyText,size_t Size); - -typedef wchar_t*(WINAPI *FARSTDXLAT)(wchar_t *Line,int StartPos,int EndPos,DWORD Flags); - -typedef int (WINAPI *FARSTDKEYNAMETOKEY)(const wchar_t *Name); - -typedef int (WINAPI *FRSUSERFUNC)( - const struct FAR_FIND_DATA *FData, - const wchar_t *FullName, - void *Param -); - -enum FRSMODE -{ - FRS_RETUPDIR = 0x01, - FRS_RECUR = 0x02, - FRS_SCANSYMLINK = 0x04, -}; - -typedef void (WINAPI *FARSTDRECURSIVESEARCH)(const wchar_t *InitDir,const wchar_t *Mask,FRSUSERFUNC Func,DWORD Flags,void *Param); -typedef int (WINAPI *FARSTDMKTEMP)(wchar_t *Dest, DWORD size, const wchar_t *Prefix); -typedef void (WINAPI *FARSTDDELETEBUFFER)(void *Buffer); - -enum MKLINKOP -{ - FLINK_HARDLINK = 1, - FLINK_JUNCTION = 2, - FLINK_VOLMOUNT = 3, - FLINK_SYMLINKFILE = 4, - FLINK_SYMLINKDIR = 5, - - FLINK_SHOWERRMSG = 0x10000, - FLINK_DONOTUPDATEPANEL = 0x20000, -}; -typedef int (WINAPI *FARSTDMKLINK)(const wchar_t *Src,const wchar_t *Dest,DWORD Flags); -typedef int (WINAPI *FARGETREPARSEPOINTINFO)(const wchar_t *Src, wchar_t *Dest,int DestSize); - -enum CONVERTPATHMODES -{ - CPM_FULL, - CPM_REAL, -}; - -typedef int (WINAPI *FARCONVERTPATH)(enum CONVERTPATHMODES Mode, const wchar_t *Src, wchar_t *Dest, int DestSize); - -typedef DWORD (WINAPI *FARGETCURRENTDIRECTORY)(DWORD Size,wchar_t* Buffer); - -typedef struct FarStandardFunctions -{ - int StructSize; - - FARSTDATOI atoi; - FARSTDATOI64 atoi64; - FARSTDITOA itoa; - FARSTDITOA64 itoa64; - // - FARSTDSPRINTF sprintf_; - FARSTDSSCANF sscanf; - // - FARSTDQSORT qsort; - FARSTDBSEARCH bsearch; - FARSTDQSORTEX qsortex; - // - FARSTDSNPRINTF snprintf; - // - - DWORD_PTR Reserved[8]; - - FARSTDLOCALISLOWER LIsLower; - FARSTDLOCALISUPPER LIsUpper; - FARSTDLOCALISALPHA LIsAlpha; - FARSTDLOCALISALPHANUM LIsAlphanum; - FARSTDLOCALUPPER LUpper; - FARSTDLOCALLOWER LLower; - FARSTDLOCALUPPERBUF LUpperBuf; - FARSTDLOCALLOWERBUF LLowerBuf; - FARSTDLOCALSTRUPR LStrupr; - FARSTDLOCALSTRLWR LStrlwr; - FARSTDLOCALSTRICMP LStricmp; - FARSTDLOCALSTRNICMP LStrnicmp; - - FARSTDUNQUOTE Unquote; - FARSTDLTRIM LTrim; - FARSTDRTRIM RTrim; - FARSTDTRIM Trim; - FARSTDTRUNCSTR TruncStr; - FARSTDTRUNCPATHSTR TruncPathStr; - FARSTDQUOTESPACEONLY QuoteSpaceOnly; - FARSTDPOINTTONAME PointToName; - FARSTDGETPATHROOT GetPathRoot; - FARSTDADDENDSLASH AddEndSlash; - FARSTDCOPYTOCLIPBOARD CopyToClipboard; - FARSTDPASTEFROMCLIPBOARD PasteFromClipboard; - FARSTDKEYTOKEYNAME FarKeyToName; - FARSTDKEYNAMETOKEY FarNameToKey; - FARSTDINPUTRECORDTOKEY FarInputRecordToKey; - FARSTDXLAT XLat; - FARSTDGETFILEOWNER GetFileOwner; - FARSTDGETNUMBEROFLINKS GetNumberOfLinks; - FARSTDRECURSIVESEARCH FarRecursiveSearch; - FARSTDMKTEMP MkTemp; - FARSTDDELETEBUFFER DeleteBuffer; - FARSTDPROCESSNAME ProcessName; - FARSTDMKLINK MkLink; - FARCONVERTPATH ConvertPath; - FARGETREPARSEPOINTINFO GetReparsePointInfo; - FARGETCURRENTDIRECTORY GetCurrentDirectory; -} FARSTANDARDFUNCTIONS; - -struct PluginStartupInfo -{ - int StructSize; - const wchar_t *ModuleName; - INT_PTR ModuleNumber; - const wchar_t *RootKey; - FARAPIMENU Menu; - FARAPIMESSAGE Message; - FARAPIGETMSG GetMsg; - FARAPICONTROL Control; - FARAPISAVESCREEN SaveScreen; - FARAPIRESTORESCREEN RestoreScreen; - FARAPIGETDIRLIST GetDirList; - FARAPIGETPLUGINDIRLIST GetPluginDirList; - FARAPIFREEDIRLIST FreeDirList; - FARAPIFREEPLUGINDIRLIST FreePluginDirList; - FARAPIVIEWER Viewer; - FARAPIEDITOR Editor; - FARAPICMPNAME CmpName; - FARAPITEXT Text; - FARAPIEDITORCONTROL EditorControl; - - FARSTANDARDFUNCTIONS *FSF; - - FARAPISHOWHELP ShowHelp; - FARAPIADVCONTROL AdvControl; - FARAPIINPUTBOX InputBox; - FARAPIDIALOGINIT DialogInit; - FARAPIDIALOGRUN DialogRun; - FARAPIDIALOGFREE DialogFree; - - FARAPISENDDLGMESSAGE SendDlgMessage; - FARAPIDEFDLGPROC DefDlgProc; - DWORD_PTR Reserved; - FARAPIVIEWERCONTROL ViewerControl; - FARAPIPLUGINSCONTROL PluginsControl; - FARAPIFILEFILTERCONTROL FileFilterControl; - FARAPIREGEXPCONTROL RegExpControl; -}; - - -enum PLUGIN_FLAGS -{ - PF_PRELOAD = 0x0001, - PF_DISABLEPANELS = 0x0002, - PF_EDITOR = 0x0004, - PF_VIEWER = 0x0008, - PF_FULLCMDLINE = 0x0010, - PF_DIALOG = 0x0020, -}; - -struct PluginInfo -{ - int StructSize; - DWORD Flags; - const wchar_t * const *DiskMenuStrings; - int *DiskMenuNumbers; - int DiskMenuStringsNumber; - const wchar_t * const *PluginMenuStrings; - int PluginMenuStringsNumber; - const wchar_t * const *PluginConfigStrings; - int PluginConfigStringsNumber; - const wchar_t *CommandPrefix; - DWORD Reserved; -}; - - - -struct InfoPanelLine -{ - const wchar_t *Text; - const wchar_t *Data; - int Separator; -}; - -struct PanelMode -{ - const wchar_t *ColumnTypes; - const wchar_t *ColumnWidths; - const wchar_t * const *ColumnTitles; - int FullScreen; - int DetailedStatus; - int AlignExtensions; - int CaseConversion; - const wchar_t *StatusColumnTypes; - const wchar_t *StatusColumnWidths; - DWORD Reserved[2]; -}; - - -enum OPENPLUGININFO_FLAGS -{ - OPIF_USEFILTER = 0x00000001, - OPIF_USESORTGROUPS = 0x00000002, - OPIF_USEHIGHLIGHTING = 0x00000004, - OPIF_ADDDOTS = 0x00000008, - OPIF_RAWSELECTION = 0x00000010, - OPIF_REALNAMES = 0x00000020, - OPIF_SHOWNAMESONLY = 0x00000040, - OPIF_SHOWRIGHTALIGNNAMES = 0x00000080, - OPIF_SHOWPRESERVECASE = 0x00000100, - OPIF_COMPAREFATTIME = 0x00000400, - OPIF_EXTERNALGET = 0x00000800, - OPIF_EXTERNALPUT = 0x00001000, - OPIF_EXTERNALDELETE = 0x00002000, - OPIF_EXTERNALMKDIR = 0x00004000, - OPIF_USEATTRHIGHLIGHTING = 0x00008000, -}; - - -enum OPENPLUGININFO_SORTMODES -{ - SM_DEFAULT, - SM_UNSORTED, - SM_NAME, - SM_EXT, - SM_MTIME, - SM_CTIME, - SM_ATIME, - SM_SIZE, - SM_DESCR, - SM_OWNER, - SM_COMPRESSEDSIZE, - SM_NUMLINKS -}; - - -struct KeyBarTitles -{ - wchar_t *Titles[12]; - wchar_t *CtrlTitles[12]; - wchar_t *AltTitles[12]; - wchar_t *ShiftTitles[12]; - - wchar_t *CtrlShiftTitles[12]; - wchar_t *AltShiftTitles[12]; - wchar_t *CtrlAltTitles[12]; -}; - - -enum OPERATION_MODES -{ - OPM_SILENT =0x0001, - OPM_FIND =0x0002, - OPM_VIEW =0x0004, - OPM_EDIT =0x0008, - OPM_TOPLEVEL =0x0010, - OPM_DESCR =0x0020, - OPM_QUICKVIEW =0x0040, -}; - -struct OpenPluginInfo -{ - int StructSize; - DWORD Flags; - const wchar_t *HostFile; - const wchar_t *CurDir; - const wchar_t *Format; - const wchar_t *PanelTitle; - const struct InfoPanelLine *InfoLines; - int InfoLinesNumber; - const wchar_t * const *DescrFiles; - int DescrFilesNumber; - const struct PanelMode *PanelModesArray; - int PanelModesNumber; - int StartPanelMode; - int StartSortMode; - int StartSortOrder; - const struct KeyBarTitles *KeyBar; - const wchar_t *ShortcutData; - long Reserved; -}; - -enum OPENPLUGIN_OPENFROM -{ - OPEN_DISKMENU = 0, - OPEN_PLUGINSMENU = 1, - OPEN_FINDLIST = 2, - OPEN_SHORTCUT = 3, - OPEN_COMMANDLINE = 4, - OPEN_EDITOR = 5, - OPEN_VIEWER = 6, - OPEN_FILEPANEL = 7, - OPEN_DIALOG = 8, - OPEN_ANALYSE = 9, - OPEN_FROMMACRO = 0x10000, -}; - -enum FAR_PKF_FLAGS -{ - PKF_CONTROL = 0x00000001, - PKF_ALT = 0x00000002, - PKF_SHIFT = 0x00000004, - PKF_PREPROCESS = 0x00080000, // for "Key", function ProcessKey() -}; - -enum FAR_EVENTS -{ - FE_CHANGEVIEWMODE =0, - FE_REDRAW =1, - FE_IDLE =2, - FE_CLOSE =3, - FE_BREAK =4, - FE_COMMAND =5, - - FE_GOTFOCUS =6, - FE_KILLFOCUS =7, -}; - -enum FAR_PLUGINS_CONTROL_COMMANDS -{ - PCTL_LOADPLUGIN = 0, - PCTL_UNLOADPLUGIN, -}; - -enum FAR_PLUGIN_LOAD_TYPE -{ - PLT_PATH = 0, -}; - -enum FAR_FILE_FILTER_CONTROL_COMMANDS -{ - FFCTL_CREATEFILEFILTER = 0, - FFCTL_FREEFILEFILTER, - FFCTL_OPENFILTERSMENU, - FFCTL_STARTINGTOFILTER, - FFCTL_ISFILEINFILTER, -}; - -enum FAR_FILE_FILTER_TYPE -{ - FFT_PANEL = 0, - FFT_FINDFILE, - FFT_COPY, - FFT_SELECT, -}; - -enum FAR_REGEXP_CONTROL_COMMANDS -{ - RECTL_CREATE=0, - RECTL_FREE, - RECTL_COMPILE, - RECTL_OPTIMIZE, - RECTL_MATCHEX, - RECTL_SEARCHEX, - RECTL_BRACKETSCOUNT -}; - -struct RegExpMatch -{ - int start,end; -}; - -struct RegExpSearch -{ - const wchar_t* Text; - int Position; - int Length; - struct RegExpMatch* Match; - int Count; - void* Reserved; -}; - - -#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__GNUC__) || defined(__WATCOMC__) -#ifdef __cplusplus -extern "C" -{ -#endif -// Exported Functions - - void WINAPI _export ClosePluginW(HANDLE hPlugin); - int WINAPI _export CompareW(HANDLE hPlugin,const struct PluginPanelItem *Item1,const struct PluginPanelItem *Item2,unsigned int Mode); - int WINAPI _export ConfigureW(int ItemNumber); - int WINAPI _export DeleteFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode); - void WINAPI _export ExitFARW(void); - void WINAPI _export FreeFindDataW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber); - void WINAPI _export FreeVirtualFindDataW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber); - int WINAPI _export GetFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,const wchar_t **DestPath,int OpMode); - int WINAPI _export GetFindDataW(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,int OpMode); - int WINAPI _export GetMinFarVersionW(void); - void WINAPI _export GetOpenPluginInfoW(HANDLE hPlugin,struct OpenPluginInfo *Info); - void WINAPI _export GetPluginInfoW(struct PluginInfo *Info); - int WINAPI _export GetVirtualFindDataW(HANDLE hPlugin,struct PluginPanelItem **pPanelItem,int *pItemsNumber,const wchar_t *Path); - int WINAPI _export MakeDirectoryW(HANDLE hPlugin,const wchar_t **Name,int OpMode); - HANDLE WINAPI _export OpenFilePluginW(const wchar_t *Name,const unsigned char *Data,int DataSize,int OpMode); - HANDLE WINAPI _export OpenPluginW(int OpenFrom,INT_PTR Item); - int WINAPI _export ProcessDialogEventW(int Event,void *Param); - int WINAPI _export ProcessEditorEventW(int Event,void *Param); - int WINAPI _export ProcessEditorInputW(const INPUT_RECORD *Rec); - int WINAPI _export ProcessEventW(HANDLE hPlugin,int Event,void *Param); - int WINAPI _export ProcessHostFileW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int OpMode); - int WINAPI _export ProcessKeyW(HANDLE hPlugin,int Key,unsigned int ControlState); - int WINAPI _export ProcessSynchroEventW(int Event,void *Param); - int WINAPI _export ProcessViewerEventW(int Event,void *Param); - int WINAPI _export PutFilesW(HANDLE hPlugin,struct PluginPanelItem *PanelItem,int ItemsNumber,int Move,const wchar_t *SrcPath,int OpMode); - int WINAPI _export SetDirectoryW(HANDLE hPlugin,const wchar_t *Dir,int OpMode); - int WINAPI _export SetFindListW(HANDLE hPlugin,const struct PluginPanelItem *PanelItem,int ItemsNumber); - void WINAPI _export SetStartupInfoW(const struct PluginStartupInfo *Info); - -#ifdef __cplusplus -}; -#endif -#endif - -#ifndef _WIN64 -#if defined(__BORLANDC__) -#pragma option -a. -#elif defined(__GNUC__) || (defined(__WATCOMC__) && (__WATCOMC__ < 1100)) || defined(__LCC__) -#pragma pack() -#else -#pragma pack(pop) -#endif -#endif - -#endif /* RC_INVOKED */ - -#endif /* __PLUGIN_HPP__ */ +// validator: no-bom +#ifndef PLUGIN_HPP_3FC978E9_63BE_4FC2_8F96_8188B0AF8363 +#define PLUGIN_HPP_3FC978E9_63BE_4FC2_8F96_8188B0AF8363 +#pragma once + +/* +plugin.hpp + +Plugin API for Far Manager 3.0 build 5655 +*/ +/* +Copyright © 1996 Eugene Roshal +Copyright © 2000 Far Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +EXCEPTION: +Far Manager plugins that use this header file can be distributed under any +other possible license with no implications from the above license on them. +*/ + + +#define FARMANAGERVERSION_MAJOR 3 +#define FARMANAGERVERSION_MINOR 0 +#define FARMANAGERVERSION_REVISION 0 +#define FARMANAGERVERSION_BUILD 5655 +#define FARMANAGERVERSION_STAGE VS_PRIVATE + +#ifndef RC_INVOKED + +#include +#include + +#undef DefDlgProc + + +#define CP_UNICODE ((uintptr_t)1200) +#define CP_REVERSEBOM ((uintptr_t)1201) +#define CP_DEFAULT ((uintptr_t)-1) +#define CP_REDETECT ((uintptr_t)-2) + +typedef unsigned long long FARCOLORFLAGS; +static const FARCOLORFLAGS + FCF_FG_4BIT = 0x0000000000000001ULL, + FCF_BG_4BIT = 0x0000000000000002ULL, + FCF_4BITMASK = 0x0000000000000003ULL, // FCF_FG_4BIT|FCF_BG_4BIT + + FCF_RAWATTR_MASK = 0x000000000000FF00ULL, // stored console attributes + + FCF_EXTENDEDFLAGS = 0xFFFFFFFFFFFFFFFCULL, // ~FCF_4BITMASK + + FCF_FG_BOLD = 0x1000000000000000ULL, + FCF_FG_ITALIC = 0x2000000000000000ULL, + FCF_FG_UNDERLINE = 0x4000000000000000ULL, + FCF_STYLEMASK = 0x7000000000000000ULL, // FCF_FG_BOLD|FCF_FG_ITALIC|FCF_FG_UNDERLINE + + FCF_NONE = 0; + +struct rgba { unsigned char r, g, b, a; }; + +struct FarColor +{ + FARCOLORFLAGS Flags; + union + { + COLORREF ForegroundColor; + struct rgba ForegroundRGBA; + } +#ifndef __cplusplus + Foreground +#endif + ; + union + { + COLORREF BackgroundColor; + struct rgba BackgroundRGBA; + } +#ifndef __cplusplus + Background +#endif + ; + DWORD Reserved[2]; + +#ifdef __cplusplus + bool operator ==(const FarColor& rhs) const + { + return Flags == rhs.Flags + && ForegroundColor == rhs.ForegroundColor + && BackgroundColor == rhs.BackgroundColor; + } + + bool operator !=(const FarColor& rhs) const + { + return !(*this == rhs); + } + + bool IsBg4Bit() const + { + return (Flags & FCF_BG_4BIT) != 0; + } + + bool IsFg4Bit() const + { + return (Flags & FCF_FG_4BIT) != 0; + } + + FarColor& SetBg4Bit(bool Value) + { + Value? Flags |= FCF_BG_4BIT : Flags &= ~FCF_BG_4BIT; + return *this; + } + + FarColor& SetFg4Bit(bool Value) + { + Value? Flags |= FCF_FG_4BIT : Flags &= ~FCF_FG_4BIT; + return *this; + } + +#endif +}; + + +#define INDEXMASK 0x0000000f +#define COLORMASK 0x00ffffff +#define ALPHAMASK 0xff000000 + +#define INDEXVALUE(x) ((x)&INDEXMASK) +#define COLORVALUE(x) ((x)&COLORMASK) +#define ALPHAVALUE(x) ((x)&ALPHAMASK) + +#define IS_OPAQUE(x) (ALPHAVALUE(x)==ALPHAMASK) +#define IS_TRANSPARENT(x) (!ALPHAVALUE(x)) +#define MAKE_OPAQUE(x) (x|=ALPHAMASK) +#define MAKE_TRANSPARENT(x) (x&=COLORMASK) + +typedef unsigned long long COLORDIALOGFLAGS; +static const COLORDIALOGFLAGS + CDF_NONE = 0; + +typedef BOOL (WINAPI *FARAPICOLORDIALOG)( + const GUID* PluginId, + COLORDIALOGFLAGS Flags, + struct FarColor *Color +); + +typedef unsigned long long FARMESSAGEFLAGS; +static const FARMESSAGEFLAGS + FMSG_WARNING = 0x0000000000000001ULL, + FMSG_ERRORTYPE = 0x0000000000000002ULL, + FMSG_KEEPBACKGROUND = 0x0000000000000004ULL, + FMSG_LEFTALIGN = 0x0000000000000008ULL, + FMSG_ALLINONE = 0x0000000000000010ULL, + FMSG_MB_OK = 0x0000000000010000ULL, + FMSG_MB_OKCANCEL = 0x0000000000020000ULL, + FMSG_MB_ABORTRETRYIGNORE = 0x0000000000030000ULL, + FMSG_MB_YESNO = 0x0000000000040000ULL, + FMSG_MB_YESNOCANCEL = 0x0000000000050000ULL, + FMSG_MB_RETRYCANCEL = 0x0000000000060000ULL, + FMSG_NONE = 0; + +typedef intptr_t (WINAPI *FARAPIMESSAGE)( + const GUID* PluginId, + const GUID* Id, + FARMESSAGEFLAGS Flags, + const wchar_t *HelpTopic, + const wchar_t * const *Items, + size_t ItemsNumber, + intptr_t ButtonsNumber +); + +enum FARDIALOGITEMTYPES +{ + DI_TEXT = 0, + DI_VTEXT = 1, + DI_SINGLEBOX = 2, + DI_DOUBLEBOX = 3, + DI_EDIT = 4, + DI_PSWEDIT = 5, + DI_FIXEDIT = 6, + DI_BUTTON = 7, + DI_CHECKBOX = 8, + DI_RADIOBUTTON = 9, + DI_COMBOBOX = 10, + DI_LISTBOX = 11, + + DI_USERCONTROL =255, +}; + +/* + Check diagol element type has inputstring? + (DI_EDIT, DI_FIXEDIT, DI_PSWEDIT, etc) +*/ +static __inline BOOL IsEdit(enum FARDIALOGITEMTYPES Type) +{ + switch (Type) + { + case DI_EDIT: + case DI_FIXEDIT: + case DI_PSWEDIT: + case DI_COMBOBOX: + return TRUE; + default: + return FALSE; + } +} + +typedef unsigned long long FARDIALOGITEMFLAGS; +static const FARDIALOGITEMFLAGS + DIF_BOXCOLOR = 0x0000000000000200ULL, + DIF_GROUP = 0x0000000000000400ULL, + DIF_LEFTTEXT = 0x0000000000000800ULL, + DIF_MOVESELECT = 0x0000000000001000ULL, + DIF_SHOWAMPERSAND = 0x0000000000002000ULL, + DIF_CENTERGROUP = 0x0000000000004000ULL, + DIF_NOBRACKETS = 0x0000000000008000ULL, + DIF_MANUALADDHISTORY = 0x0000000000008000ULL, + DIF_SEPARATOR = 0x0000000000010000ULL, + DIF_SEPARATOR2 = 0x0000000000020000ULL, + DIF_EDITOR = 0x0000000000020000ULL, + DIF_LISTNOAMPERSAND = 0x0000000000020000ULL, + DIF_LISTNOBOX = 0x0000000000040000ULL, + DIF_HISTORY = 0x0000000000040000ULL, + DIF_BTNNOCLOSE = 0x0000000000040000ULL, + DIF_CENTERTEXT = 0x0000000000040000ULL, + DIF_SEPARATORUSER = 0x0000000000080000ULL, + DIF_SETSHIELD = 0x0000000000080000ULL, + DIF_EDITEXPAND = 0x0000000000080000ULL, + DIF_DROPDOWNLIST = 0x0000000000100000ULL, + DIF_USELASTHISTORY = 0x0000000000200000ULL, + DIF_MASKEDIT = 0x0000000000400000ULL, + DIF_LISTTRACKMOUSE = 0x0000000000400000ULL, + DIF_LISTTRACKMOUSEINFOCUS = 0x0000000000800000ULL, + DIF_SELECTONENTRY = 0x0000000000800000ULL, + DIF_3STATE = 0x0000000000800000ULL, + DIF_EDITPATH = 0x0000000001000000ULL, + DIF_LISTWRAPMODE = 0x0000000001000000ULL, + DIF_NOAUTOCOMPLETE = 0x0000000002000000ULL, + DIF_LISTAUTOHIGHLIGHT = 0x0000000002000000ULL, + DIF_LISTNOCLOSE = 0x0000000004000000ULL, + DIF_EDITPATHEXEC = 0x0000000004000000ULL, + DIF_HIDDEN = 0x0000000010000000ULL, + DIF_READONLY = 0x0000000020000000ULL, + DIF_NOFOCUS = 0x0000000040000000ULL, + DIF_DISABLE = 0x0000000080000000ULL, + DIF_DEFAULTBUTTON = 0x0000000100000000ULL, + DIF_FOCUS = 0x0000000200000000ULL, + DIF_RIGHTTEXT = 0x0000000400000000ULL, + DIF_WORDWRAP = 0x0000000800000000ULL, + DIF_NONE = 0; + +enum FARMESSAGE +{ + DM_FIRST = 0, + DM_CLOSE = 1, + DM_ENABLE = 2, + DM_ENABLEREDRAW = 3, + DM_GETDLGDATA = 4, + DM_GETDLGITEM = 5, + DM_GETDLGRECT = 6, + DM_GETTEXT = 7, + DM_KEY = 9, + DM_MOVEDIALOG = 10, + DM_SETDLGDATA = 11, + DM_SETDLGITEM = 12, + DM_SETFOCUS = 13, + DM_REDRAW = 14, + DM_SETTEXT = 15, + DM_SETMAXTEXTLENGTH = 16, + DM_SHOWDIALOG = 17, + DM_GETFOCUS = 18, + DM_GETCURSORPOS = 19, + DM_SETCURSORPOS = 20, + DM_SETTEXTPTR = 22, + DM_SHOWITEM = 23, + DM_ADDHISTORY = 24, + + DM_GETCHECK = 25, + DM_SETCHECK = 26, + DM_SET3STATE = 27, + + DM_LISTSORT = 28, + DM_LISTGETITEM = 29, + DM_LISTGETCURPOS = 30, + DM_LISTSETCURPOS = 31, + DM_LISTDELETE = 32, + DM_LISTADD = 33, + DM_LISTADDSTR = 34, + DM_LISTUPDATE = 35, + DM_LISTINSERT = 36, + DM_LISTFINDSTRING = 37, + DM_LISTINFO = 38, + DM_LISTGETDATA = 39, + DM_LISTSETDATA = 40, + DM_LISTSETTITLES = 41, + DM_LISTGETTITLES = 42, + + DM_RESIZEDIALOG = 43, + DM_SETITEMPOSITION = 44, + + DM_GETDROPDOWNOPENED = 45, + DM_SETDROPDOWNOPENED = 46, + + DM_SETHISTORY = 47, + + DM_GETITEMPOSITION = 48, + DM_SETINPUTNOTIFY = 49, + DM_SETMOUSEEVENTNOTIFY = DM_SETINPUTNOTIFY, + + DM_EDITUNCHANGEDFLAG = 50, + + DM_GETITEMDATA = 51, + DM_SETITEMDATA = 52, + + DM_LISTSET = 53, + + DM_GETCURSORSIZE = 54, + DM_SETCURSORSIZE = 55, + + DM_LISTGETDATASIZE = 56, + + DM_GETSELECTION = 57, + DM_SETSELECTION = 58, + + DM_GETEDITPOSITION = 59, + DM_SETEDITPOSITION = 60, + + DM_SETCOMBOBOXEVENT = 61, + DM_GETCOMBOBOXEVENT = 62, + + DM_GETCONSTTEXTPTR = 63, + DM_GETDLGITEMSHORT = 64, + DM_SETDLGITEMSHORT = 65, + + DM_GETDIALOGINFO = 66, + + DM_GETDIALOGTITLE = 67, + + DN_FIRST = 4096, + DN_BTNCLICK = 4097, + DN_CTLCOLORDIALOG = 4098, + DN_CTLCOLORDLGITEM = 4099, + DN_CTLCOLORDLGLIST = 4100, + DN_DRAWDIALOG = 4101, + DN_DRAWDLGITEM = 4102, + DN_EDITCHANGE = 4103, + DN_ENTERIDLE = 4104, + DN_GOTFOCUS = 4105, + DN_HELP = 4106, + DN_HOTKEY = 4107, + DN_INITDIALOG = 4108, + DN_KILLFOCUS = 4109, + DN_LISTCHANGE = 4110, + DN_DRAGGED = 4111, + DN_RESIZECONSOLE = 4112, + DN_DRAWDIALOGDONE = 4113, + DN_LISTHOTKEY = 4114, + DN_INPUT = 4115, + DN_CONTROLINPUT = 4116, + DN_CLOSE = 4117, + DN_GETVALUE = 4118, + DN_DROPDOWNOPENED = 4119, + DN_DRAWDLGITEMDONE = 4120, + + DM_USER = 0x4000, + +}; + +enum FARCHECKEDSTATE +{ + BSTATE_UNCHECKED = 0, + BSTATE_CHECKED = 1, + BSTATE_3STATE = 2, + BSTATE_TOGGLE = 3, +}; + +enum FARCOMBOBOXEVENTTYPE +{ + CBET_KEY = 0x00000001, + CBET_MOUSE = 0x00000002, +}; + +typedef unsigned long long LISTITEMFLAGS; +static const LISTITEMFLAGS + LIF_SELECTED = 0x0000000000010000ULL, + LIF_CHECKED = 0x0000000000020000ULL, + LIF_SEPARATOR = 0x0000000000040000ULL, + LIF_DISABLE = 0x0000000000080000ULL, + LIF_GRAYED = 0x0000000000100000ULL, + LIF_HIDDEN = 0x0000000000200000ULL, + LIF_DELETEUSERDATA = 0x0000000080000000ULL, + LIF_NONE = 0; + + + +struct FarListItem +{ + LISTITEMFLAGS Flags; + const wchar_t *Text; + intptr_t UserData; + intptr_t Reserved; +}; + +struct FarListUpdate +{ + size_t StructSize; + intptr_t Index; + struct FarListItem Item; +}; + +struct FarListInsert +{ + size_t StructSize; + intptr_t Index; + struct FarListItem Item; +}; + +struct FarListGetItem +{ + size_t StructSize; + intptr_t ItemIndex; + struct FarListItem Item; +}; + +struct FarListPos +{ + size_t StructSize; + intptr_t SelectPos; + intptr_t TopPos; +}; + +typedef unsigned long long FARLISTFINDFLAGS; +static const FARLISTFINDFLAGS + LIFIND_EXACTMATCH = 0x0000000000000001ULL, + LIFIND_NONE = 0; + + +struct FarListFind +{ + size_t StructSize; + intptr_t StartIndex; + const wchar_t *Pattern; + FARLISTFINDFLAGS Flags; +}; + +struct FarListDelete +{ + size_t StructSize; + intptr_t StartIndex; + intptr_t Count; +}; + +typedef unsigned long long FARLISTINFOFLAGS; +static const FARLISTINFOFLAGS + LINFO_SHOWNOBOX = 0x0000000000000400ULL, + LINFO_AUTOHIGHLIGHT = 0x0000000000000800ULL, + LINFO_REVERSEHIGHLIGHT = 0x0000000000001000ULL, + LINFO_WRAPMODE = 0x0000000000008000ULL, + LINFO_SHOWAMPERSAND = 0x0000000000010000ULL, + LINFO_NONE = 0; + +struct FarListInfo +{ + size_t StructSize; + FARLISTINFOFLAGS Flags; + size_t ItemsNumber; + intptr_t SelectPos; + intptr_t TopPos; + intptr_t MaxHeight; + intptr_t MaxLength; +}; + +struct FarListItemData +{ + size_t StructSize; + intptr_t Index; + size_t DataSize; + void *Data; +}; + +struct FarList +{ + size_t StructSize; + size_t ItemsNumber; + struct FarListItem *Items; +}; + +struct FarListTitles +{ + size_t StructSize; + size_t TitleSize; + const wchar_t *Title; + size_t BottomSize; + const wchar_t *Bottom; +}; + +struct FarDialogItemColors +{ + size_t StructSize; + unsigned long long Flags; + size_t ColorsCount; + struct FarColor* Colors; +}; + +struct FAR_CHAR_INFO +{ + WCHAR Char; + struct FarColor Attributes; + +#ifdef __cplusplus + bool operator ==(const FAR_CHAR_INFO& rhs) const + { + return Char == rhs.Char && Attributes == rhs.Attributes; + } + + bool operator !=(const FAR_CHAR_INFO& rhs) const + { + return !(*this == rhs); + } +#endif +}; + +struct FarDialogItem +{ + enum FARDIALOGITEMTYPES Type; + intptr_t X1,Y1,X2,Y2; + union + { + intptr_t Selected; + struct FarList *ListItems; + struct FAR_CHAR_INFO *VBuf; + intptr_t Reserved0; + } +#ifndef __cplusplus + Param +#endif + ; + const wchar_t *History; + const wchar_t *Mask; + FARDIALOGITEMFLAGS Flags; + const wchar_t *Data; + size_t MaxLength; // terminate 0 not included (if == 0 string size is unlimited) + intptr_t UserData; + intptr_t Reserved[2]; +}; + +struct FarDialogItemData +{ + size_t StructSize; + size_t PtrLength; + wchar_t *PtrData; +}; + +struct FarDialogEvent +{ + size_t StructSize; + HANDLE hDlg; + intptr_t Msg; + intptr_t Param1; + void* Param2; + intptr_t Result; +}; + +struct OpenDlgPluginData +{ + size_t StructSize; + HANDLE hDlg; +}; + +struct DialogInfo +{ + size_t StructSize; + GUID Id; + GUID Owner; +}; + +struct FarGetDialogItem +{ + size_t StructSize; + size_t Size; + struct FarDialogItem* Item; +}; + +typedef unsigned long long FARDIALOGFLAGS; +static const FARDIALOGFLAGS + FDLG_WARNING = 0x0000000000000001ULL, + FDLG_SMALLDIALOG = 0x0000000000000002ULL, + FDLG_NODRAWSHADOW = 0x0000000000000004ULL, + FDLG_NODRAWPANEL = 0x0000000000000008ULL, + FDLG_KEEPCONSOLETITLE = 0x0000000000000010ULL, + FDLG_NONMODAL = 0x0000000000000020ULL, + FDLG_NONE = 0; + +typedef intptr_t(WINAPI *FARWINDOWPROC)( + HANDLE hDlg, + intptr_t Msg, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t(WINAPI *FARAPISENDDLGMESSAGE)( + HANDLE hDlg, + intptr_t Msg, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t(WINAPI *FARAPIDEFDLGPROC)( + HANDLE hDlg, + intptr_t Msg, + intptr_t Param1, + void* Param2 +); + +typedef HANDLE(WINAPI *FARAPIDIALOGINIT)( + const GUID* PluginId, + const GUID* Id, + intptr_t X1, + intptr_t Y1, + intptr_t X2, + intptr_t Y2, + const wchar_t *HelpTopic, + const struct FarDialogItem *Item, + size_t ItemsNumber, + intptr_t Reserved, + FARDIALOGFLAGS Flags, + FARWINDOWPROC DlgProc, + void* Param +); + +typedef intptr_t (WINAPI *FARAPIDIALOGRUN)( + HANDLE hDlg +); + +typedef void (WINAPI *FARAPIDIALOGFREE)( + HANDLE hDlg +); + +struct FarKey +{ + WORD VirtualKeyCode; + DWORD ControlKeyState; +}; + +typedef unsigned long long MENUITEMFLAGS; +static const MENUITEMFLAGS + MIF_SELECTED = 0x0000000000010000ULL, + MIF_CHECKED = 0x0000000000020000ULL, + MIF_SEPARATOR = 0x0000000000040000ULL, + MIF_DISABLE = 0x0000000000080000ULL, + MIF_GRAYED = 0x0000000000100000ULL, + MIF_HIDDEN = 0x0000000000200000ULL, + MIF_NONE = 0; + +struct FarMenuItem +{ + MENUITEMFLAGS Flags; + const wchar_t *Text; + struct FarKey AccelKey; + intptr_t UserData; + intptr_t Reserved[2]; +}; + +typedef unsigned long long FARMENUFLAGS; +static const FARMENUFLAGS + FMENU_SHOWAMPERSAND = 0x0000000000000001ULL, + FMENU_WRAPMODE = 0x0000000000000002ULL, + FMENU_AUTOHIGHLIGHT = 0x0000000000000004ULL, + FMENU_REVERSEAUTOHIGHLIGHT = 0x0000000000000008ULL, + FMENU_CHANGECONSOLETITLE = 0x0000000000000010ULL, + FMENU_SHOWNOBOX = 0x0000000000000020ULL, + FMENU_SHOWSHORTBOX = 0x0000000000000040ULL, + FMENU_SHOWSINGLEBOX = 0x0000000000000080ULL, + FMENU_NODRAWSHADOW = 0x0000000000000100ULL, + FMENU_NONE = 0; + +typedef intptr_t (WINAPI *FARAPIMENU)( + const GUID* PluginId, + const GUID* Id, + intptr_t X, + intptr_t Y, + intptr_t MaxHeight, + FARMENUFLAGS Flags, + const wchar_t *Title, + const wchar_t *Bottom, + const wchar_t *HelpTopic, + const struct FarKey *BreakKeys, + intptr_t *BreakCode, + const struct FarMenuItem *Item, + size_t ItemsNumber +); + + +typedef unsigned long long PLUGINPANELITEMFLAGS; +static const PLUGINPANELITEMFLAGS + // The low word is reserved for private flags + PPIF_SELECTED = 0x0000000040000000ULL, + PPIF_PROCESSDESCR = 0x0000000080000000ULL, + + PPIF_NONE = 0; + +struct FarPanelItemFreeInfo +{ + size_t StructSize; + HANDLE hPlugin; +}; + +typedef void (WINAPI *FARPANELITEMFREECALLBACK)(void* UserData, const struct FarPanelItemFreeInfo* Info); + +struct UserDataItem +{ + void* Data; + FARPANELITEMFREECALLBACK FreeData; +}; + + +struct PluginPanelItem +{ + FILETIME CreationTime; + FILETIME LastAccessTime; + FILETIME LastWriteTime; + FILETIME ChangeTime; + unsigned long long FileSize; + unsigned long long AllocationSize; + const wchar_t *FileName; + const wchar_t *AlternateFileName; + const wchar_t *Description; + const wchar_t *Owner; + const wchar_t * const *CustomColumnData; + size_t CustomColumnNumber; + PLUGINPANELITEMFLAGS Flags; + struct UserDataItem UserData; + uintptr_t FileAttributes; + uintptr_t NumberOfLinks; + uintptr_t CRC32; + intptr_t Reserved[2]; +}; + +struct FarGetPluginPanelItem +{ + size_t StructSize; + size_t Size; + struct PluginPanelItem* Item; +}; + +struct SortingPanelItem +{ + FILETIME CreationTime; + FILETIME LastAccessTime; + FILETIME LastWriteTime; + FILETIME ChangeTime; + unsigned long long FileSize; + unsigned long long AllocationSize; + const wchar_t *FileName; + const wchar_t *AlternateFileName; + const wchar_t *Description; + const wchar_t *Owner; + const wchar_t * const *CustomColumnData; + size_t CustomColumnNumber; + PLUGINPANELITEMFLAGS Flags; + struct UserDataItem UserData; + uintptr_t FileAttributes; + uintptr_t NumberOfLinks; + uintptr_t CRC32; + intptr_t Position; + intptr_t SortGroup; + uintptr_t NumberOfStreams; + unsigned long long StreamsSize; +}; + +typedef unsigned long long PANELINFOFLAGS; +static const PANELINFOFLAGS + PFLAGS_SHOWHIDDEN = 0x0000000000000001ULL, + PFLAGS_HIGHLIGHT = 0x0000000000000002ULL, + PFLAGS_REVERSESORTORDER = 0x0000000000000004ULL, + PFLAGS_USESORTGROUPS = 0x0000000000000008ULL, + PFLAGS_SELECTEDFIRST = 0x0000000000000010ULL, + PFLAGS_REALNAMES = 0x0000000000000020ULL, + PFLAGS_PANELLEFT = 0x0000000000000080ULL, + PFLAGS_DIRECTORIESFIRST = 0x0000000000000100ULL, + PFLAGS_USECRC32 = 0x0000000000000200ULL, + PFLAGS_PLUGIN = 0x0000000000000800ULL, + PFLAGS_VISIBLE = 0x0000000000001000ULL, + PFLAGS_FOCUS = 0x0000000000002000ULL, + PFLAGS_ALTERNATIVENAMES = 0x0000000000004000ULL, + PFLAGS_SHORTCUT = 0x0000000000008000ULL, + PFLAGS_NONE = 0; + +enum PANELINFOTYPE +{ + PTYPE_FILEPANEL = 0, + PTYPE_TREEPANEL = 1, + PTYPE_QVIEWPANEL = 2, + PTYPE_INFOPANEL = 3, +}; + +enum OPENPANELINFO_SORTMODES +{ + SM_DEFAULT = 0, + SM_UNSORTED = 1, + SM_NAME = 2, + SM_FULLNAME = SM_NAME, + SM_EXT = 3, + SM_MTIME = 4, + SM_CTIME = 5, + SM_ATIME = 6, + SM_SIZE = 7, + SM_DESCR = 8, + SM_OWNER = 9, + SM_COMPRESSEDSIZE = 10, + SM_NUMLINKS = 11, + SM_NUMSTREAMS = 12, + SM_STREAMSSIZE = 13, + SM_NAMEONLY = 14, + SM_CHTIME = 15, + + SM_COUNT, + + SM_USER = 100000 +}; + +struct PanelInfo +{ + size_t StructSize; + HANDLE PluginHandle; + GUID OwnerGuid; + PANELINFOFLAGS Flags; + size_t ItemsNumber; + size_t SelectedItemsNumber; + RECT PanelRect; + size_t CurrentItem; + size_t TopPanelItem; + intptr_t ViewMode; + enum PANELINFOTYPE PanelType; + enum OPENPANELINFO_SORTMODES SortMode; +}; + + +struct PanelRedrawInfo +{ + size_t StructSize; + size_t CurrentItem; + size_t TopPanelItem; +}; + +struct CmdLineSelect +{ + size_t StructSize; + intptr_t SelStart; + intptr_t SelEnd; +}; + +struct FarPanelDirectory +{ + size_t StructSize; + const wchar_t* Name; + const wchar_t* Param; + GUID PluginId; + const wchar_t* File; +}; + +#define PANEL_NONE ((HANDLE)(-1)) +#define PANEL_ACTIVE ((HANDLE)(-1)) +#define PANEL_PASSIVE ((HANDLE)(-2)) +#define PANEL_STOP ((HANDLE)(-1)) + +enum FILE_CONTROL_COMMANDS +{ + FCTL_CLOSEPANEL = 0, + FCTL_GETPANELINFO = 1, + FCTL_UPDATEPANEL = 2, + FCTL_REDRAWPANEL = 3, + FCTL_GETCMDLINE = 4, + FCTL_SETCMDLINE = 5, + FCTL_SETSELECTION = 6, + FCTL_SETVIEWMODE = 7, + FCTL_INSERTCMDLINE = 8, + FCTL_SETUSERSCREEN = 9, + FCTL_SETPANELDIRECTORY = 10, + FCTL_SETCMDLINEPOS = 11, + FCTL_GETCMDLINEPOS = 12, + FCTL_SETSORTMODE = 13, + FCTL_SETSORTORDER = 14, + FCTL_SETCMDLINESELECTION = 15, + FCTL_GETCMDLINESELECTION = 16, + FCTL_CHECKPANELSEXIST = 17, + FCTL_GETUSERSCREEN = 19, + FCTL_ISACTIVEPANEL = 20, + FCTL_GETPANELITEM = 21, + FCTL_GETSELECTEDPANELITEM = 22, + FCTL_GETCURRENTPANELITEM = 23, + FCTL_GETPANELDIRECTORY = 24, + FCTL_GETCOLUMNTYPES = 25, + FCTL_GETCOLUMNWIDTHS = 26, + FCTL_BEGINSELECTION = 27, + FCTL_ENDSELECTION = 28, + FCTL_CLEARSELECTION = 29, + FCTL_SETDIRECTORIESFIRST = 30, + FCTL_GETPANELFORMAT = 31, + FCTL_GETPANELHOSTFILE = 32, + FCTL_GETPANELPREFIX = 34, + FCTL_SETACTIVEPANEL = 35, +}; + +typedef void (WINAPI *FARAPITEXT)( + intptr_t X, + intptr_t Y, + const struct FarColor* Color, + const wchar_t *Str +); + +typedef HANDLE(WINAPI *FARAPISAVESCREEN)(intptr_t X1, intptr_t Y1, intptr_t X2, intptr_t Y2); + +typedef void (WINAPI *FARAPIRESTORESCREEN)(HANDLE hScreen); + +typedef void (WINAPI *FARAPIFREESCREEN)(HANDLE hScreen); + + +typedef intptr_t (WINAPI *FARAPIGETDIRLIST)( + const wchar_t *Dir, + struct PluginPanelItem **pPanelItem, + size_t *pItemsNumber +); + +typedef intptr_t (WINAPI *FARAPIGETPLUGINDIRLIST)( + const GUID* PluginId, + HANDLE hPanel, + const wchar_t *Dir, + struct PluginPanelItem **pPanelItem, + size_t *pItemsNumber +); + +typedef void (WINAPI *FARAPIFREEDIRLIST)(struct PluginPanelItem *PanelItem, size_t nItemsNumber); +typedef void (WINAPI *FARAPIFREEPLUGINDIRLIST)(HANDLE hPanel, struct PluginPanelItem *PanelItem, size_t nItemsNumber); + +typedef unsigned long long VIEWER_FLAGS; +static const VIEWER_FLAGS + VF_NONMODAL = 0x0000000000000001ULL, + VF_DELETEONCLOSE = 0x0000000000000002ULL, + VF_ENABLE_F6 = 0x0000000000000004ULL, + VF_DISABLEHISTORY = 0x0000000000000008ULL, + VF_IMMEDIATERETURN = 0x0000000000000100ULL, + VF_DELETEONLYFILEONCLOSE = 0x0000000000000200ULL, + VF_NONE = 0; + +typedef intptr_t (WINAPI *FARAPIVIEWER)( + const wchar_t *FileName, + const wchar_t *Title, + intptr_t X1, + intptr_t Y1, + intptr_t X2, + intptr_t Y2, + VIEWER_FLAGS Flags, + uintptr_t CodePage +); + +typedef unsigned long long EDITOR_FLAGS; +static const EDITOR_FLAGS + EF_NONMODAL = 0x0000000000000001ULL, + EF_CREATENEW = 0x0000000000000002ULL, + EF_ENABLE_F6 = 0x0000000000000004ULL, + EF_DISABLEHISTORY = 0x0000000000000008ULL, + EF_DELETEONCLOSE = 0x0000000000000010ULL, + EF_IMMEDIATERETURN = 0x0000000000000100ULL, + EF_DELETEONLYFILEONCLOSE = 0x0000000000000200ULL, + EF_LOCKED = 0x0000000000000400ULL, + EF_DISABLESAVEPOS = 0x0000000000000800ULL, + EF_OPENMODE_MASK = 0x00000000F0000000ULL, + EF_OPENMODE_QUERY = 0x0000000000000000ULL, + EF_OPENMODE_NEWIFOPEN = 0x0000000010000000ULL, + EF_OPENMODE_USEEXISTING = 0x0000000020000000ULL, + EF_OPENMODE_BREAKIFOPEN = 0x0000000030000000ULL, + EF_OPENMODE_RELOADIFOPEN = 0x0000000040000000ULL, + EN_NONE = 0; + +enum EDITOR_EXITCODE +{ + EEC_OPEN_ERROR = 0, + EEC_MODIFIED = 1, + EEC_NOT_MODIFIED = 2, + EEC_LOADING_INTERRUPTED = 3, +}; + +typedef intptr_t (WINAPI *FARAPIEDITOR)( + const wchar_t *FileName, + const wchar_t *Title, + intptr_t X1, + intptr_t Y1, + intptr_t X2, + intptr_t Y2, + EDITOR_FLAGS Flags, + intptr_t StartLine, + intptr_t StartChar, + uintptr_t CodePage +); + +typedef const wchar_t*(WINAPI *FARAPIGETMSG)( + const GUID* PluginId, + intptr_t MsgId +); + +typedef unsigned long long FARHELPFLAGS; +static const FARHELPFLAGS + FHELP_NOSHOWERROR = 0x0000000080000000ULL, + FHELP_SELFHELP = 0x0000000000000000ULL, + FHELP_FARHELP = 0x0000000000000001ULL, + FHELP_CUSTOMFILE = 0x0000000000000002ULL, + FHELP_CUSTOMPATH = 0x0000000000000004ULL, + FHELP_GUID = 0x0000000000000008ULL, + FHELP_USECONTENTS = 0x0000000040000000ULL, + FHELP_NONE = 0; + +typedef BOOL (WINAPI *FARAPISHOWHELP)( + const wchar_t *ModuleName, + const wchar_t *Topic, + FARHELPFLAGS Flags +); + +enum ADVANCED_CONTROL_COMMANDS +{ + ACTL_GETFARMANAGERVERSION = 0, + ACTL_WAITKEY = 2, + ACTL_GETCOLOR = 3, + ACTL_GETARRAYCOLOR = 4, + + ACTL_GETWINDOWINFO = 6, + ACTL_GETWINDOWCOUNT = 7, + ACTL_SETCURRENTWINDOW = 8, + ACTL_COMMIT = 9, + ACTL_GETFARHWND = 10, + ACTL_SETARRAYCOLOR = 16, + ACTL_REDRAWALL = 19, + ACTL_SYNCHRO = 20, + ACTL_SETPROGRESSSTATE = 21, + ACTL_SETPROGRESSVALUE = 22, + ACTL_QUIT = 23, + ACTL_GETFARRECT = 24, + ACTL_GETCURSORPOS = 25, + ACTL_SETCURSORPOS = 26, + ACTL_PROGRESSNOTIFY = 27, + ACTL_GETWINDOWTYPE = 28, +}; + +enum FAR_MACRO_CONTROL_COMMANDS +{ + MCTL_LOADALL = 0, + MCTL_SAVEALL = 1, + MCTL_SENDSTRING = 2, + MCTL_GETSTATE = 5, + MCTL_GETAREA = 6, + MCTL_ADDMACRO = 7, + MCTL_DELMACRO = 8, + MCTL_GETLASTERROR = 9, + MCTL_EXECSTRING = 10, +}; + +typedef unsigned long long FARKEYMACROFLAGS; +static const FARKEYMACROFLAGS + KMFLAGS_SILENTCHECK = 0x0000000000000001, + KMFLAGS_NOSENDKEYSTOPLUGINS = 0x0000000000000002, + KMFLAGS_ENABLEOUTPUT = 0x0000000000000004, + KMFLAGS_LANGMASK = 0x0000000000000070, // 3 bits reserved for 8 languages + KMFLAGS_LUA = 0x0000000000000000, + KMFLAGS_MOONSCRIPT = 0x0000000000000010, + KMFLAGS_NONE = 0; + +enum FARMACROSENDSTRINGCOMMAND +{ + MSSC_POST =0, + MSSC_CHECK =2, +}; + +enum FARMACROAREA +{ + MACROAREA_OTHER = 0, // Reserved + MACROAREA_SHELL = 1, // File panels + MACROAREA_VIEWER = 2, // Internal viewer program + MACROAREA_EDITOR = 3, // Editor + MACROAREA_DIALOG = 4, // Dialogs + MACROAREA_SEARCH = 5, // Quick search in panels + MACROAREA_DISKS = 6, // Menu of disk selection + MACROAREA_MAINMENU = 7, // Main menu + MACROAREA_MENU = 8, // Other menus + MACROAREA_HELP = 9, // Help system + MACROAREA_INFOPANEL = 10, // Info panel + MACROAREA_QVIEWPANEL = 11, // Quick view panel + MACROAREA_TREEPANEL = 12, // Folders tree panel + MACROAREA_FINDFOLDER = 13, // Find folder + MACROAREA_USERMENU = 14, // User menu + MACROAREA_SHELLAUTOCOMPLETION = 15, // Autocompletion list in command line + MACROAREA_DIALOGAUTOCOMPLETION = 16, // Autocompletion list in dialogs + MACROAREA_GRABBER = 17, // Mode of copying text from the screen + MACROAREA_DESKTOP = 18, // Desktop + + MACROAREA_COMMON = 255, +}; + +enum FARMACROSTATE +{ + MACROSTATE_NOMACRO = 0, + MACROSTATE_EXECUTING = 1, + MACROSTATE_EXECUTING_COMMON = 2, + MACROSTATE_RECORDING = 3, + MACROSTATE_RECORDING_COMMON = 4, +}; + +enum FARMACROPARSEERRORCODE +{ + MPEC_SUCCESS = 0, + MPEC_ERROR = 1, +}; + +struct MacroParseResult +{ + size_t StructSize; + DWORD ErrCode; + COORD ErrPos; + const wchar_t *ErrSrc; +}; + + +struct MacroSendMacroText +{ + size_t StructSize; + FARKEYMACROFLAGS Flags; + INPUT_RECORD AKey; + const wchar_t *SequenceText; +}; + +typedef unsigned long long FARADDKEYMACROFLAGS; +static const FARADDKEYMACROFLAGS + AKMFLAGS_NONE = 0; + +typedef intptr_t (WINAPI *FARMACROCALLBACK)(void* Id,FARADDKEYMACROFLAGS Flags); + + +struct MacroAddMacro +{ + size_t StructSize; + void* Id; + const wchar_t *SequenceText; + const wchar_t *Description; + FARKEYMACROFLAGS Flags; + INPUT_RECORD AKey; + enum FARMACROAREA Area; + FARMACROCALLBACK Callback; + intptr_t Priority; +}; + +enum FARMACROVARTYPE +{ + FMVT_UNKNOWN = 0, + FMVT_INTEGER = 1, + FMVT_STRING = 2, + FMVT_DOUBLE = 3, + FMVT_BOOLEAN = 4, + FMVT_BINARY = 5, + FMVT_POINTER = 6, + FMVT_NIL = 7, + FMVT_ARRAY = 8, + FMVT_PANEL = 9, + FMVT_ERROR = 10, +}; + +struct FarMacroValue +{ + enum FARMACROVARTYPE Type; + union + { + long long Integer; + long long Boolean; + double Double; + const wchar_t *String; + void *Pointer; + struct + { + void *Data; + size_t Size; + } Binary; + struct + { + struct FarMacroValue *Values; + size_t Count; + } Array; + } +#ifndef __cplusplus + Value +#endif + ; +#ifdef __cplusplus + FarMacroValue() { Type=FMVT_NIL; } + FarMacroValue(int v) { Type=FMVT_INTEGER; Integer=v; } + FarMacroValue(unsigned int v) { Type=FMVT_INTEGER; Integer=v; } + FarMacroValue(long long v) { Type=FMVT_INTEGER; Integer=v; } + FarMacroValue(unsigned long long v) { Type=FMVT_INTEGER; Integer=v; } + FarMacroValue(bool v) { Type=FMVT_BOOLEAN; Boolean=v; } + FarMacroValue(double v) { Type=FMVT_DOUBLE; Double=v; } + FarMacroValue(const wchar_t* v) { Type=FMVT_STRING; String=v; } + FarMacroValue(void* v) { Type=FMVT_POINTER; Pointer=v; } + FarMacroValue(const GUID& v) { Type=FMVT_BINARY; Binary.Data=&const_cast(v); Binary.Size=sizeof(GUID); } + FarMacroValue(FarMacroValue* arr,size_t count) { Type=FMVT_ARRAY; Array.Values=arr; Array.Count=count; } +#endif +}; + +struct FarMacroCall +{ + size_t StructSize; + size_t Count; + struct FarMacroValue *Values; + void (WINAPI *Callback)(void *CallbackData, struct FarMacroValue *Values, size_t Count); + void *CallbackData; +}; + +struct FarGetValue +{ + size_t StructSize; + intptr_t Type; + struct FarMacroValue Value; +}; + +struct MacroExecuteString +{ + size_t StructSize; + FARKEYMACROFLAGS Flags; + const wchar_t *SequenceText; + size_t InCount; + struct FarMacroValue *InValues; + size_t OutCount; + const struct FarMacroValue *OutValues; +}; + +struct FarMacroLoad +{ + size_t StructSize; + const wchar_t *Path; + unsigned long long Flags; +}; + +typedef unsigned long long FARSETCOLORFLAGS; +static const FARSETCOLORFLAGS + FSETCLR_REDRAW = 0x0000000000000001ULL, + FSETCLR_NONE = 0; + +struct FarSetColors +{ + size_t StructSize; + FARSETCOLORFLAGS Flags; + size_t StartIndex; + size_t ColorsCount; + struct FarColor* Colors; +}; + +enum WINDOWINFO_TYPE +{ + WTYPE_UNKNOWN = -1, + WTYPE_DESKTOP = 0, + WTYPE_PANELS = 1, + WTYPE_VIEWER = 2, + WTYPE_EDITOR = 3, + WTYPE_DIALOG = 4, + WTYPE_VMENU = 5, + WTYPE_HELP = 6, + WTYPE_COMBOBOX = 7, + WTYPE_GRABBER = 8, + WTYPE_HMENU = 9, +}; + +typedef unsigned long long WINDOWINFO_FLAGS; +static const WINDOWINFO_FLAGS + WIF_MODIFIED = 0x0000000000000001ULL, + WIF_CURRENT = 0x0000000000000002ULL, + WIF_MODAL = 0x0000000000000004ULL, + WIF_NONE = 0; + +struct WindowInfo +{ + size_t StructSize; + intptr_t Id; + wchar_t *TypeName; + wchar_t *Name; + intptr_t TypeNameSize; + intptr_t NameSize; + intptr_t Pos; + enum WINDOWINFO_TYPE Type; + WINDOWINFO_FLAGS Flags; +}; + +struct WindowType +{ + size_t StructSize; + enum WINDOWINFO_TYPE Type; +}; + +enum TASKBARPROGRESSTATE +{ + TBPS_NOPROGRESS =0x0, + TBPS_INDETERMINATE=0x1, + TBPS_NORMAL =0x2, + TBPS_ERROR =0x4, + TBPS_PAUSED =0x8, +}; + +struct ProgressValue +{ + size_t StructSize; + unsigned long long Completed; + unsigned long long Total; +}; + +enum VIEWER_CONTROL_COMMANDS +{ + VCTL_GETINFO = 0, + VCTL_QUIT = 1, + VCTL_REDRAW = 2, + VCTL_SETKEYBAR = 3, + VCTL_SETPOSITION = 4, + VCTL_SELECT = 5, + VCTL_SETMODE = 6, + VCTL_GETFILENAME = 7, +}; + +typedef unsigned long long VIEWER_OPTIONS; +static const VIEWER_OPTIONS + VOPT_SAVEFILEPOSITION = 0x0000000000000001ULL, + VOPT_AUTODETECTCODEPAGE = 0x0000000000000002ULL, + VOPT_SHOWTITLEBAR = 0x0000000000000004ULL, + VOPT_SHOWKEYBAR = 0x0000000000000008ULL, + VOPT_SHOWSCROLLBAR = 0x0000000000000010ULL, + VOPT_QUICKVIEW = 0x0000000000000020ULL, + VOPT_NONE = 0; + +enum VIEWER_SETMODE_TYPES +{ + VSMT_VIEWMODE = 0, + VSMT_WRAP = 1, + VSMT_WORDWRAP = 2, +}; + +typedef unsigned long long VIEWER_SETMODEFLAGS_TYPES; +static const VIEWER_SETMODEFLAGS_TYPES + VSMFL_REDRAW = 0x0000000000000001ULL, + VSMFL_NONE = 0; + +struct ViewerSetMode +{ + size_t StructSize; + enum VIEWER_SETMODE_TYPES Type; + union + { + intptr_t iParam; + wchar_t *wszParam; + } +#ifndef __cplusplus + Param +#endif + ; + VIEWER_SETMODEFLAGS_TYPES Flags; +}; + +struct ViewerSelect +{ + size_t StructSize; + long long BlockStartPos; + long long BlockLen; +}; + +typedef unsigned long long VIEWER_SETPOS_FLAGS; +static const VIEWER_SETPOS_FLAGS + VSP_NOREDRAW = 0x0000000000000001ULL, + VSP_PERCENT = 0x0000000000000002ULL, + VSP_RELATIVE = 0x0000000000000004ULL, + VSP_NORETNEWPOS = 0x0000000000000008ULL, + VSP_NONE = 0; + +struct ViewerSetPosition +{ + size_t StructSize; + VIEWER_SETPOS_FLAGS Flags; + long long StartPos; + long long LeftPos; +}; + +typedef unsigned long long VIEWER_MODE_FLAGS; +static const VIEWER_MODE_FLAGS + VMF_WRAP = 0x0000000000000001ULL, + VMF_WORDWRAP = 0x0000000000000002ULL, + VMF_NONE = 0; + +enum VIEWER_MODE_TYPE +{ + VMT_TEXT =0, + VMT_HEX =1, + VMT_DUMP =2, +}; + +struct ViewerMode +{ + uintptr_t CodePage; + VIEWER_MODE_FLAGS Flags; + enum VIEWER_MODE_TYPE ViewMode; +}; + +struct ViewerInfo +{ + size_t StructSize; + intptr_t ViewerID; + intptr_t TabSize; + struct ViewerMode CurMode; + long long FileSize; + long long FilePos; + long long LeftPos; + VIEWER_OPTIONS Options; + intptr_t WindowSizeX; + intptr_t WindowSizeY; +}; + +enum VIEWER_EVENTS +{ + VE_READ =0, + VE_CLOSE =1, + + VE_GOTFOCUS =6, + VE_KILLFOCUS =7, +}; + + +enum EDITOR_EVENTS +{ + EE_READ =0, + EE_SAVE =1, + EE_REDRAW =2, + EE_CLOSE =3, + + EE_GOTFOCUS =6, + EE_KILLFOCUS =7, + EE_CHANGE =8, +}; + +enum DIALOG_EVENTS +{ + DE_DLGPROCINIT =0, + DE_DEFDLGPROCINIT =1, + DE_DLGPROCEND =2, +}; + +enum SYNCHRO_EVENTS +{ + SE_COMMONSYNCHRO =0, +}; + +#define EEREDRAW_ALL (void*)0 + +#define CURRENT_EDITOR -1 + +enum EDITOR_CONTROL_COMMANDS +{ + ECTL_GETSTRING = 0, + ECTL_SETSTRING = 1, + ECTL_INSERTSTRING = 2, + ECTL_DELETESTRING = 3, + ECTL_DELETECHAR = 4, + ECTL_INSERTTEXT = 5, + ECTL_GETINFO = 6, + ECTL_SETPOSITION = 7, + ECTL_SELECT = 8, + ECTL_REDRAW = 9, + ECTL_TABTOREAL = 10, + ECTL_REALTOTAB = 11, + ECTL_EXPANDTABS = 12, + ECTL_SETTITLE = 13, + ECTL_READINPUT = 14, + ECTL_PROCESSINPUT = 15, + ECTL_ADDCOLOR = 16, + ECTL_GETCOLOR = 17, + ECTL_SAVEFILE = 18, + ECTL_QUIT = 19, + ECTL_SETKEYBAR = 20, + + ECTL_SETPARAM = 22, + ECTL_GETBOOKMARKS = 23, + ECTL_DELETEBLOCK = 25, + ECTL_ADDSESSIONBOOKMARK = 26, + ECTL_PREVSESSIONBOOKMARK = 27, + ECTL_NEXTSESSIONBOOKMARK = 28, + ECTL_CLEARSESSIONBOOKMARKS = 29, + ECTL_DELETESESSIONBOOKMARK = 30, + ECTL_GETSESSIONBOOKMARKS = 31, + ECTL_UNDOREDO = 32, + ECTL_GETFILENAME = 33, + ECTL_DELCOLOR = 34, + ECTL_SUBSCRIBECHANGEEVENT = 36, + ECTL_UNSUBSCRIBECHANGEEVENT = 37, + ECTL_GETTITLE = 38, +}; + +enum EDITOR_SETPARAMETER_TYPES +{ + ESPT_TABSIZE = 0, + ESPT_EXPANDTABS = 1, + ESPT_AUTOINDENT = 2, + ESPT_CURSORBEYONDEOL = 3, + ESPT_CHARCODEBASE = 4, + ESPT_CODEPAGE = 5, + ESPT_SAVEFILEPOSITION = 6, + ESPT_LOCKMODE = 7, + ESPT_SETWORDDIV = 8, + ESPT_GETWORDDIV = 9, + ESPT_SHOWWHITESPACE = 10, + ESPT_SETBOM = 11, +}; + + + +struct EditorSetParameter +{ + size_t StructSize; + enum EDITOR_SETPARAMETER_TYPES Type; + union + { + intptr_t iParam; + wchar_t *wszParam; + intptr_t Reserved; + } +#ifndef __cplusplus + Param +#endif + ; + unsigned long long Flags; + size_t Size; +}; + + +enum EDITOR_UNDOREDO_COMMANDS +{ + EUR_BEGIN = 0, + EUR_END = 1, + EUR_UNDO = 2, + EUR_REDO = 3, +}; + + +struct EditorUndoRedo +{ + size_t StructSize; + enum EDITOR_UNDOREDO_COMMANDS Command; +}; + +struct EditorGetString +{ + size_t StructSize; + intptr_t StringNumber; + intptr_t StringLength; + const wchar_t *StringText; + const wchar_t *StringEOL; + intptr_t SelStart; + intptr_t SelEnd; +}; + + +struct EditorSetString +{ + size_t StructSize; + intptr_t StringNumber; + intptr_t StringLength; + const wchar_t *StringText; + const wchar_t *StringEOL; +}; + +enum EXPAND_TABS +{ + EXPAND_NOTABS = 0, + EXPAND_ALLTABS = 1, + EXPAND_NEWTABS = 2, +}; + + +enum EDITOR_OPTIONS +{ + EOPT_EXPANDALLTABS = 0x00000001, + EOPT_PERSISTENTBLOCKS = 0x00000002, + EOPT_DELREMOVESBLOCKS = 0x00000004, + EOPT_AUTOINDENT = 0x00000008, + EOPT_SAVEFILEPOSITION = 0x00000010, + EOPT_AUTODETECTCODEPAGE= 0x00000020, + EOPT_CURSORBEYONDEOL = 0x00000040, + EOPT_EXPANDONLYNEWTABS = 0x00000080, + EOPT_SHOWWHITESPACE = 0x00000100, + EOPT_BOM = 0x00000200, + EOPT_SHOWLINEBREAK = 0x00000400, + EOPT_SHOWTITLEBAR = 0x00000800, + EOPT_SHOWKEYBAR = 0x00001000, + EOPT_SHOWSCROLLBAR = 0x00002000, +}; + + +enum EDITOR_BLOCK_TYPES +{ + BTYPE_NONE = 0, + BTYPE_STREAM = 1, + BTYPE_COLUMN = 2, +}; + +enum EDITOR_CURRENTSTATE +{ + ECSTATE_MODIFIED = 0x00000001, + ECSTATE_SAVED = 0x00000002, + ECSTATE_LOCKED = 0x00000004, +}; + + +struct EditorInfo +{ + size_t StructSize; + intptr_t EditorID; + intptr_t WindowSizeX; + intptr_t WindowSizeY; + intptr_t TotalLines; + intptr_t CurLine; + intptr_t CurPos; + intptr_t CurTabPos; + intptr_t TopScreenLine; + intptr_t LeftPos; + intptr_t Overtype; + intptr_t BlockType; + intptr_t BlockStartLine; + uintptr_t Options; + intptr_t TabSize; + size_t BookmarkCount; + size_t SessionBookmarkCount; + uintptr_t CurState; + uintptr_t CodePage; +}; + +struct EditorBookmarks +{ + size_t StructSize; + size_t Size; + size_t Count; + intptr_t *Line; + intptr_t *Cursor; + intptr_t *ScreenLine; + intptr_t *LeftPos; +}; + +struct EditorSetPosition +{ + size_t StructSize; + intptr_t CurLine; + intptr_t CurPos; + intptr_t CurTabPos; + intptr_t TopScreenLine; + intptr_t LeftPos; + intptr_t Overtype; +}; + + +struct EditorSelect +{ + size_t StructSize; + intptr_t BlockType; + intptr_t BlockStartLine; + intptr_t BlockStartPos; + intptr_t BlockWidth; + intptr_t BlockHeight; +}; + + +struct EditorConvertPos +{ + size_t StructSize; + intptr_t StringNumber; + intptr_t SrcPos; + intptr_t DestPos; +}; + +typedef unsigned long long EDITORCOLORFLAGS; +static const EDITORCOLORFLAGS + ECF_TABMARKFIRST = 0x0000000000000001ULL, + ECF_TABMARKCURRENT = 0x0000000000000002ULL, + ECF_AUTODELETE = 0x0000000000000004ULL, + ECF_NONE = 0; + +struct EditorColor +{ + size_t StructSize; + intptr_t StringNumber; + intptr_t ColorItem; + intptr_t StartPos; + intptr_t EndPos; + uintptr_t Priority; + EDITORCOLORFLAGS Flags; + struct FarColor Color; + GUID Owner; +}; + +struct EditorDeleteColor +{ + size_t StructSize; + GUID Owner; + intptr_t StringNumber; + intptr_t StartPos; +}; + +#define EDITOR_COLOR_NORMAL_PRIORITY 0x80000000U + +struct EditorSaveFile +{ + size_t StructSize; + const wchar_t *FileName; + const wchar_t *FileEOL; + uintptr_t CodePage; +}; + +enum EDITOR_CHANGETYPE +{ + ECTYPE_CHANGED = 0, + ECTYPE_ADDED = 1, + ECTYPE_DELETED = 2, +}; + +struct EditorChange +{ + size_t StructSize; + enum EDITOR_CHANGETYPE Type; + intptr_t StringNumber; +}; + +struct EditorSubscribeChangeEvent +{ + size_t StructSize; + GUID PluginId; +}; + +typedef unsigned long long INPUTBOXFLAGS; +static const INPUTBOXFLAGS + FIB_ENABLEEMPTY = 0x0000000000000001ULL, + FIB_PASSWORD = 0x0000000000000002ULL, + FIB_EXPANDENV = 0x0000000000000004ULL, + FIB_NOUSELASTHISTORY = 0x0000000000000008ULL, + FIB_BUTTONS = 0x0000000000000010ULL, + FIB_NOAMPERSAND = 0x0000000000000020ULL, + FIB_EDITPATH = 0x0000000000000040ULL, + FIB_EDITPATHEXEC = 0x0000000000000080ULL, + FIB_NONE = 0; + +typedef intptr_t (WINAPI *FARAPIINPUTBOX)( + const GUID* PluginId, + const GUID* Id, + const wchar_t *Title, + const wchar_t *SubTitle, + const wchar_t *HistoryName, + const wchar_t *SrcText, + wchar_t *DestText, + size_t DestSize, + const wchar_t *HelpTopic, + INPUTBOXFLAGS Flags +); + +enum FAR_PLUGINS_CONTROL_COMMANDS +{ + PCTL_LOADPLUGIN = 0, + PCTL_UNLOADPLUGIN = 1, + PCTL_FORCEDLOADPLUGIN = 2, + PCTL_FINDPLUGIN = 3, + PCTL_GETPLUGININFORMATION = 4, + PCTL_GETPLUGINS = 5, +}; + +enum FAR_PLUGIN_LOAD_TYPE +{ + PLT_PATH = 0, +}; + +enum FAR_PLUGIN_FIND_TYPE +{ + PFM_GUID = 0, + PFM_MODULENAME = 1, +}; + +typedef unsigned long long FAR_PLUGIN_FLAGS; +static const FAR_PLUGIN_FLAGS + FPF_LOADED = 0x0000000000000001ULL, + FPF_ANSI = 0x1000000000000000ULL, + FPF_NONE = 0; + +enum FAR_FILE_FILTER_CONTROL_COMMANDS +{ + FFCTL_CREATEFILEFILTER = 0, + FFCTL_FREEFILEFILTER = 1, + FFCTL_OPENFILTERSMENU = 2, + FFCTL_STARTINGTOFILTER = 3, + FFCTL_ISFILEINFILTER = 4, +}; + +enum FAR_FILE_FILTER_TYPE +{ + FFT_PANEL = 0, + FFT_FINDFILE = 1, + FFT_COPY = 2, + FFT_SELECT = 3, + FFT_CUSTOM = 4, +}; + +enum FAR_REGEXP_CONTROL_COMMANDS +{ + RECTL_CREATE = 0, + RECTL_FREE = 1, + RECTL_COMPILE = 2, + RECTL_OPTIMIZE = 3, + RECTL_MATCHEX = 4, + RECTL_SEARCHEX = 5, + RECTL_BRACKETSCOUNT = 6, +}; + +struct RegExpMatch +{ + intptr_t start,end; +}; + +struct RegExpSearch +{ + const wchar_t* Text; + intptr_t Position; + intptr_t Length; + struct RegExpMatch* Match; + intptr_t Count; + void* Reserved; +}; + +enum FAR_SETTINGS_CONTROL_COMMANDS +{ + SCTL_CREATE = 0, + SCTL_FREE = 1, + SCTL_SET = 2, + SCTL_GET = 3, + SCTL_ENUM = 4, + SCTL_DELETE = 5, + SCTL_CREATESUBKEY = 6, + SCTL_OPENSUBKEY = 7, +}; + +enum FARSETTINGSTYPES +{ + FST_UNKNOWN = 0, + FST_SUBKEY = 1, + FST_QWORD = 2, + FST_STRING = 3, + FST_DATA = 4, +}; + +enum FARSETTINGS_SUBFOLDERS +{ + FSSF_ROOT = 0, + FSSF_HISTORY_CMD = 1, + FSSF_HISTORY_FOLDER = 2, + FSSF_HISTORY_VIEW = 3, + FSSF_HISTORY_EDIT = 4, + FSSF_HISTORY_EXTERNAL = 5, + FSSF_FOLDERSHORTCUT_0 = 6, + FSSF_FOLDERSHORTCUT_1 = 7, + FSSF_FOLDERSHORTCUT_2 = 8, + FSSF_FOLDERSHORTCUT_3 = 9, + FSSF_FOLDERSHORTCUT_4 = 10, + FSSF_FOLDERSHORTCUT_5 = 11, + FSSF_FOLDERSHORTCUT_6 = 12, + FSSF_FOLDERSHORTCUT_7 = 13, + FSSF_FOLDERSHORTCUT_8 = 14, + FSSF_FOLDERSHORTCUT_9 = 15, + FSSF_CONFIRMATIONS = 16, + FSSF_SYSTEM = 17, + FSSF_PANEL = 18, + FSSF_EDITOR = 19, + FSSF_SCREEN = 20, + FSSF_DIALOG = 21, + FSSF_INTERFACE = 22, + FSSF_PANELLAYOUT = 23, +}; + +enum FAR_PLUGIN_SETTINGS_LOCATION +{ + PSL_ROAMING = 0, + PSL_LOCAL = 1, +}; + +struct FarSettingsCreate +{ + size_t StructSize; + GUID Guid; + HANDLE Handle; +}; + +struct FarSettingsItem +{ + size_t StructSize; + size_t Root; + const wchar_t* Name; + enum FARSETTINGSTYPES Type; + union + { + unsigned long long Number; + const wchar_t* String; + struct + { + size_t Size; + const void* Data; + } Data; + } +#ifndef __cplusplus + Value +#endif + ; +}; + +struct FarSettingsName +{ + const wchar_t* Name; + enum FARSETTINGSTYPES Type; +}; + +struct FarSettingsHistory +{ + const wchar_t* Name; + const wchar_t* Param; + GUID PluginId; + const wchar_t* File; + FILETIME Time; + BOOL Lock; +}; + +struct FarSettingsEnum +{ + size_t StructSize; + size_t Root; + size_t Count; + union + { + const struct FarSettingsName* Items; + const struct FarSettingsHistory* Histories; + } +#ifndef __cplusplus + Value +#endif + ; +}; + +struct FarSettingsValue +{ + size_t StructSize; + size_t Root; + const wchar_t* Value; +}; + +typedef intptr_t (WINAPI *FARAPIPANELCONTROL)( + HANDLE hPanel, + enum FILE_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t(WINAPI *FARAPIADVCONTROL)( + const GUID* PluginId, + enum ADVANCED_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIVIEWERCONTROL)( + intptr_t ViewerID, + enum VIEWER_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIEDITORCONTROL)( + intptr_t EditorID, + enum EDITOR_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIMACROCONTROL)( + const GUID* PluginId, + enum FAR_MACRO_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIPLUGINSCONTROL)( + HANDLE hHandle, + enum FAR_PLUGINS_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIFILEFILTERCONTROL)( + HANDLE hHandle, + enum FAR_FILE_FILTER_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPIREGEXPCONTROL)( + HANDLE hHandle, + enum FAR_REGEXP_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +typedef intptr_t (WINAPI *FARAPISETTINGSCONTROL)( + HANDLE hHandle, + enum FAR_SETTINGS_CONTROL_COMMANDS Command, + intptr_t Param1, + void* Param2 +); + +enum FARCLIPBOARD_TYPE +{ + FCT_ANY=0, + FCT_STREAM=1, + FCT_COLUMN=2 +}; + +// +typedef int (WINAPIV *FARSTDSPRINTF)(wchar_t *Buffer,const wchar_t *Format,...); +typedef int (WINAPIV *FARSTDSNPRINTF)(wchar_t *Buffer,size_t Sizebuf,const wchar_t *Format,...); +typedef int (WINAPIV *FARSTDSSCANF)(const wchar_t *Buffer, const wchar_t *Format,...); +// +typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (WINAPI *fcmp)(const void *, const void *,void *userparam),void *userparam); +typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (WINAPI *fcmp)(const void *, const void *,void *userparam),void *userparam); +typedef size_t (WINAPI *FARSTDGETFILEOWNER)(const wchar_t *Computer,const wchar_t *Name,wchar_t *Owner,size_t Size); +typedef size_t (WINAPI *FARSTDGETNUMBEROFLINKS)(const wchar_t *Name); +typedef int (WINAPI *FARSTDATOI)(const wchar_t *s); +typedef long long (WINAPI *FARSTDATOI64)(const wchar_t *s); +typedef wchar_t *(WINAPI *FARSTDITOA64)(long long value, wchar_t *Str, int radix); +typedef wchar_t *(WINAPI *FARSTDITOA)(int value, wchar_t *Str, int radix); +typedef wchar_t *(WINAPI *FARSTDLTRIM)(wchar_t *Str); +typedef wchar_t *(WINAPI *FARSTDRTRIM)(wchar_t *Str); +typedef wchar_t *(WINAPI *FARSTDTRIM)(wchar_t *Str); +typedef wchar_t *(WINAPI *FARSTDTRUNCSTR)(wchar_t *Str,intptr_t MaxLength); +typedef wchar_t *(WINAPI *FARSTDTRUNCPATHSTR)(wchar_t *Str,intptr_t MaxLength); +typedef wchar_t *(WINAPI *FARSTDQUOTESPACEONLY)(wchar_t *Str); +typedef const wchar_t*(WINAPI *FARSTDPOINTTONAME)(const wchar_t *Path); +typedef BOOL (WINAPI *FARSTDADDENDSLASH)(wchar_t *Path); +typedef BOOL (WINAPI *FARSTDCOPYTOCLIPBOARD)(enum FARCLIPBOARD_TYPE Type, const wchar_t *Data); +typedef size_t (WINAPI *FARSTDPASTEFROMCLIPBOARD)(enum FARCLIPBOARD_TYPE Type, wchar_t *Data, size_t Size); +typedef int (WINAPI *FARSTDLOCALISLOWER)(wchar_t Ch); +typedef int (WINAPI *FARSTDLOCALISUPPER)(wchar_t Ch); +typedef int (WINAPI *FARSTDLOCALISALPHA)(wchar_t Ch); +typedef int (WINAPI *FARSTDLOCALISALPHANUM)(wchar_t Ch); +typedef wchar_t (WINAPI *FARSTDLOCALUPPER)(wchar_t LowerChar); +typedef wchar_t (WINAPI *FARSTDLOCALLOWER)(wchar_t UpperChar); +typedef void (WINAPI *FARSTDLOCALUPPERBUF)(wchar_t *Buf,intptr_t Length); +typedef void (WINAPI *FARSTDLOCALLOWERBUF)(wchar_t *Buf,intptr_t Length); +typedef void (WINAPI *FARSTDLOCALSTRUPR)(wchar_t *s1); +typedef void (WINAPI *FARSTDLOCALSTRLWR)(wchar_t *s1); +typedef int (WINAPI *FARSTDLOCALSTRICMP)(const wchar_t *s1,const wchar_t *s2); // Deprecated, don't use +typedef int (WINAPI *FARSTDLOCALSTRNICMP)(const wchar_t *s1,const wchar_t *s2,intptr_t n); // Deprecated, don't use +typedef unsigned long long (WINAPI *FARSTDFARCLOCK)(); +typedef int (WINAPI *FARSTDCOMPARESTRINGS)(const wchar_t*Str1, size_t Size1, const wchar_t* Str2, size_t Size2); + +typedef unsigned long long PROCESSNAME_FLAGS; +static const PROCESSNAME_FLAGS + // 0xFFFF - length + // 0xFF0000 - mode + // 0xFFFFFFFFFF000000 - flags + PN_CMPNAME = 0x0000000000000000ULL, + PN_CMPNAMELIST = 0x0000000000010000ULL, + PN_GENERATENAME = 0x0000000000020000ULL, + PN_CHECKMASK = 0x0000000000030000ULL, + + PN_SKIPPATH = 0x0000000001000000ULL, + PN_SHOWERRORMESSAGE = 0x0000000002000000ULL, + PN_NONE = 0; + +typedef size_t (WINAPI *FARSTDPROCESSNAME)(const wchar_t *param1, wchar_t *param2, size_t size, PROCESSNAME_FLAGS flags); + +typedef void (WINAPI *FARSTDUNQUOTE)(wchar_t *Str); + +typedef unsigned long long XLAT_FLAGS; +static const XLAT_FLAGS + XLAT_SWITCHKEYBLAYOUT = 0x0000000000000001ULL, + XLAT_SWITCHKEYBBEEP = 0x0000000000000002ULL, + XLAT_USEKEYBLAYOUTNAME = 0x0000000000000004ULL, + XLAT_CONVERTALLCMDLINE = 0x0000000000010000ULL, + XLAT_NONE = 0; + +typedef size_t (WINAPI *FARSTDINPUTRECORDTOKEYNAME)(const INPUT_RECORD* Key, wchar_t *KeyText, size_t Size); + +typedef wchar_t*(WINAPI *FARSTDXLAT)(wchar_t *Line,intptr_t StartPos,intptr_t EndPos,XLAT_FLAGS Flags); + +typedef BOOL (WINAPI *FARSTDKEYNAMETOINPUTRECORD)(const wchar_t *Name,INPUT_RECORD* Key); + +typedef int (WINAPI *FRSUSERFUNC)( + const struct PluginPanelItem *FData, + const wchar_t *FullName, + void *Param +); + +typedef unsigned long long FRSMODE; +static const FRSMODE + FRS_RETUPDIR = 0x0000000000000001ULL, + FRS_RECUR = 0x0000000000000002ULL, + FRS_SCANSYMLINK = 0x0000000000000004ULL, + FRS_NONE = 0; + +typedef void (WINAPI *FARSTDRECURSIVESEARCH)(const wchar_t *InitDir,const wchar_t *Mask,FRSUSERFUNC Func,FRSMODE Flags,void *Param); +typedef size_t (WINAPI *FARSTDMKTEMP)(wchar_t *Dest, size_t DestSize, const wchar_t *Prefix); +typedef size_t (WINAPI *FARSTDGETPATHROOT)(const wchar_t *Path,wchar_t *Root, size_t DestSize); + +enum LINK_TYPE +{ + LINK_HARDLINK = 1, + LINK_JUNCTION = 2, + LINK_VOLMOUNT = 3, + LINK_SYMLINKFILE = 4, + LINK_SYMLINKDIR = 5, + LINK_SYMLINK = 6, +}; + +typedef unsigned long long MKLINK_FLAGS; +static const MKLINK_FLAGS + MLF_SHOWERRMSG = 0x0000000000010000ULL, + MLF_DONOTUPDATEPANEL = 0x0000000000020000ULL, + MLF_HOLDTARGET = 0x0000000000040000ULL, + MLF_NONE = 0; + +typedef BOOL (WINAPI *FARSTDMKLINK)(const wchar_t *Src,const wchar_t *Dest,enum LINK_TYPE Type, MKLINK_FLAGS Flags); +typedef size_t (WINAPI *FARGETREPARSEPOINTINFO)(const wchar_t *Src, wchar_t *Dest, size_t DestSize); + +enum CONVERTPATHMODES +{ + CPM_FULL = 0, + CPM_REAL = 1, + CPM_NATIVE = 2, +}; + +typedef size_t (WINAPI *FARCONVERTPATH)(enum CONVERTPATHMODES Mode, const wchar_t *Src, wchar_t *Dest, size_t DestSize); + +typedef size_t (WINAPI *FARGETCURRENTDIRECTORY)(size_t Size, wchar_t* Buffer); + +typedef unsigned long long FARFORMATFILESIZEFLAGS; +static const FARFORMATFILESIZEFLAGS + FFFS_COMMAS = 0x0100000000000000LL, + FFFS_FLOATSIZE = 0x0200000000000000LL, + FFFS_SHOWBYTESINDEX = 0x0400000000000000LL, + FFFS_ECONOMIC = 0x0800000000000000LL, + FFFS_THOUSAND = 0x1000000000000000LL, + FFFS_MINSIZEINDEX = 0x2000000000000000LL, + FFFS_MINSIZEINDEX_MASK = 0x0000000000000003LL, + FFFS_NONE = 0; + +typedef size_t (WINAPI *FARFORMATFILESIZE)(unsigned long long Size, intptr_t Width, FARFORMATFILESIZEFLAGS Flags, wchar_t *Dest, size_t DestSize); + +typedef struct FarStandardFunctions +{ + size_t StructSize; + + FARSTDATOI atoi; + FARSTDATOI64 atoi64; + FARSTDITOA itoa; + FARSTDITOA64 itoa64; + // + FARSTDSPRINTF sprintf; + FARSTDSSCANF sscanf; + // + FARSTDQSORT qsort; + FARSTDBSEARCH bsearch; + // + FARSTDSNPRINTF snprintf; + // + + FARSTDLOCALISLOWER LIsLower; + FARSTDLOCALISUPPER LIsUpper; + FARSTDLOCALISALPHA LIsAlpha; + FARSTDLOCALISALPHANUM LIsAlphanum; + FARSTDLOCALUPPER LUpper; + FARSTDLOCALLOWER LLower; + FARSTDLOCALUPPERBUF LUpperBuf; + FARSTDLOCALLOWERBUF LLowerBuf; + FARSTDLOCALSTRUPR LStrupr; + FARSTDLOCALSTRLWR LStrlwr; + FARSTDLOCALSTRICMP LStricmp; // Deprecated, don't use + FARSTDLOCALSTRNICMP LStrnicmp; // Deprecated, don't use + + FARSTDUNQUOTE Unquote; + FARSTDLTRIM LTrim; + FARSTDRTRIM RTrim; + FARSTDTRIM Trim; + FARSTDTRUNCSTR TruncStr; + FARSTDTRUNCPATHSTR TruncPathStr; + FARSTDQUOTESPACEONLY QuoteSpaceOnly; + FARSTDPOINTTONAME PointToName; + FARSTDGETPATHROOT GetPathRoot; + FARSTDADDENDSLASH AddEndSlash; + FARSTDCOPYTOCLIPBOARD CopyToClipboard; + FARSTDPASTEFROMCLIPBOARD PasteFromClipboard; + FARSTDINPUTRECORDTOKEYNAME FarInputRecordToName; + FARSTDKEYNAMETOINPUTRECORD FarNameToInputRecord; + FARSTDXLAT XLat; + FARSTDGETFILEOWNER GetFileOwner; + FARSTDGETNUMBEROFLINKS GetNumberOfLinks; + FARSTDRECURSIVESEARCH FarRecursiveSearch; + FARSTDMKTEMP MkTemp; + FARSTDPROCESSNAME ProcessName; + FARSTDMKLINK MkLink; + FARCONVERTPATH ConvertPath; + FARGETREPARSEPOINTINFO GetReparsePointInfo; + FARGETCURRENTDIRECTORY GetCurrentDirectory; + FARFORMATFILESIZE FormatFileSize; + FARSTDFARCLOCK FarClock; + FARSTDCOMPARESTRINGS CompareStrings; +} FARSTANDARDFUNCTIONS; + +struct PluginStartupInfo +{ + size_t StructSize; + const wchar_t *ModuleName; + FARAPIMENU Menu; + FARAPIMESSAGE Message; + FARAPIGETMSG GetMsg; + FARAPIPANELCONTROL PanelControl; + FARAPISAVESCREEN SaveScreen; + FARAPIRESTORESCREEN RestoreScreen; + FARAPIGETDIRLIST GetDirList; + FARAPIGETPLUGINDIRLIST GetPluginDirList; + FARAPIFREEDIRLIST FreeDirList; + FARAPIFREEPLUGINDIRLIST FreePluginDirList; + FARAPIVIEWER Viewer; + FARAPIEDITOR Editor; + FARAPITEXT Text; + FARAPIEDITORCONTROL EditorControl; + + FARSTANDARDFUNCTIONS *FSF; + + FARAPISHOWHELP ShowHelp; + FARAPIADVCONTROL AdvControl; + FARAPIINPUTBOX InputBox; + FARAPICOLORDIALOG ColorDialog; + FARAPIDIALOGINIT DialogInit; + FARAPIDIALOGRUN DialogRun; + FARAPIDIALOGFREE DialogFree; + + FARAPISENDDLGMESSAGE SendDlgMessage; + FARAPIDEFDLGPROC DefDlgProc; + FARAPIVIEWERCONTROL ViewerControl; + FARAPIPLUGINSCONTROL PluginsControl; + FARAPIFILEFILTERCONTROL FileFilterControl; + FARAPIREGEXPCONTROL RegExpControl; + FARAPIMACROCONTROL MacroControl; + FARAPISETTINGSCONTROL SettingsControl; + const void* Private; + void* Instance; + FARAPIFREESCREEN FreeScreen; +}; + +typedef HANDLE (WINAPI *FARAPICREATEFILE)(const wchar_t *Object,DWORD DesiredAccess,DWORD ShareMode,LPSECURITY_ATTRIBUTES SecurityAttributes,DWORD CreationDistribution,DWORD FlagsAndAttributes,HANDLE TemplateFile); +typedef DWORD (WINAPI *FARAPIGETFILEATTRIBUTES)(const wchar_t *FileName); +typedef BOOL (WINAPI *FARAPISETFILEATTRIBUTES)(const wchar_t *FileName,DWORD dwFileAttributes); +typedef BOOL (WINAPI *FARAPIMOVEFILEEX)(const wchar_t *ExistingFileName,const wchar_t *NewFileName,DWORD dwFlags); +typedef BOOL (WINAPI *FARAPIDELETEFILE)(const wchar_t *FileName); +typedef BOOL (WINAPI *FARAPIREMOVEDIRECTORY)(const wchar_t *DirName); +typedef BOOL (WINAPI *FARAPICREATEDIRECTORY)(const wchar_t *PathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); + +struct ArclitePrivateInfo +{ + size_t StructSize; + FARAPICREATEFILE CreateFile; + FARAPIGETFILEATTRIBUTES GetFileAttributes; + FARAPISETFILEATTRIBUTES SetFileAttributes; + FARAPIMOVEFILEEX MoveFileEx; + FARAPIDELETEFILE DeleteFile; + FARAPIREMOVEDIRECTORY RemoveDirectory; + FARAPICREATEDIRECTORY CreateDirectory; +}; + +struct NetBoxPrivateInfo +{ + size_t StructSize; + FARAPICREATEFILE CreateFile; + FARAPIGETFILEATTRIBUTES GetFileAttributes; + FARAPISETFILEATTRIBUTES SetFileAttributes; + FARAPIMOVEFILEEX MoveFileEx; + FARAPIDELETEFILE DeleteFile; + FARAPIREMOVEDIRECTORY RemoveDirectory; + FARAPICREATEDIRECTORY CreateDirectory; +}; + +struct MacroPluginReturn +{ + intptr_t ReturnType; + size_t Count; + struct FarMacroValue *Values; +}; + +typedef intptr_t (WINAPI *FARAPICALLFAR)(intptr_t CheckCode, struct FarMacroCall* Data); + +struct MacroPrivateInfo +{ + size_t StructSize; + FARAPICALLFAR CallFar; +}; + +typedef unsigned long long PLUGIN_FLAGS; +static const PLUGIN_FLAGS + PF_PRELOAD = 0x0000000000000001ULL, + PF_DISABLEPANELS = 0x0000000000000002ULL, + PF_EDITOR = 0x0000000000000004ULL, + PF_VIEWER = 0x0000000000000008ULL, + PF_FULLCMDLINE = 0x0000000000000010ULL, + PF_DIALOG = 0x0000000000000020ULL, + PF_NONE = 0; + +struct PluginMenuItem +{ + const GUID *Guids; + const wchar_t * const *Strings; + size_t Count; +}; + +enum VERSION_STAGE +{ + VS_RELEASE = 0, + VS_ALPHA = 1, + VS_BETA = 2, + VS_RC = 3, + VS_SPECIAL = 4, + VS_PRIVATE = 5, +}; + +struct VersionInfo +{ + DWORD Major; + DWORD Minor; + DWORD Revision; + DWORD Build; + enum VERSION_STAGE Stage; +}; + +static __inline BOOL CheckVersion(const struct VersionInfo* Current, const struct VersionInfo* Required) +{ + return + (Current->Major > Required->Major) || + (Current->Major == Required->Major && Current->Minor > Required->Minor) || + (Current->Major == Required->Major && Current->Minor == Required->Minor && Current->Revision > Required->Revision) || + (Current->Major == Required->Major && Current->Minor == Required->Minor && Current->Revision == Required->Revision && Current->Build >= Required->Build); +} + +static __inline struct VersionInfo MAKEFARVERSION(DWORD Major, DWORD Minor, DWORD Revision, DWORD Build, enum VERSION_STAGE Stage) +{ + struct VersionInfo Info = {Major, Minor, Revision, Build, Stage}; + return Info; +} + +#define FARMANAGERVERSION MAKEFARVERSION(FARMANAGERVERSION_MAJOR,FARMANAGERVERSION_MINOR, FARMANAGERVERSION_REVISION, FARMANAGERVERSION_BUILD, FARMANAGERVERSION_STAGE) + +struct GlobalInfo +{ + size_t StructSize; + struct VersionInfo MinFarVersion; + struct VersionInfo Version; + GUID Guid; + const wchar_t *Title; + const wchar_t *Description; + const wchar_t *Author; + void* Instance; +}; + +struct PluginInfo +{ + size_t StructSize; + PLUGIN_FLAGS Flags; + struct PluginMenuItem DiskMenu; + struct PluginMenuItem PluginMenu; + struct PluginMenuItem PluginConfig; + const wchar_t *CommandPrefix; + void* Instance; +}; + +struct FarGetPluginInformation +{ + size_t StructSize; + const wchar_t *ModuleName; + FAR_PLUGIN_FLAGS Flags; + struct PluginInfo *PInfo; + struct GlobalInfo *GInfo; +}; + +typedef unsigned long long INFOPANELLINE_FLAGS; +static const INFOPANELLINE_FLAGS + IPLFLAGS_SEPARATOR = 0x0000000000000001ULL, + IPLFLAGS_NONE = 0; + +struct InfoPanelLine +{ + const wchar_t *Text; + const wchar_t *Data; + INFOPANELLINE_FLAGS Flags; +}; + +typedef unsigned long long PANELMODE_FLAGS; +static const PANELMODE_FLAGS + PMFLAGS_FULLSCREEN = 0x0000000000000001ULL, + PMFLAGS_DETAILEDSTATUS = 0x0000000000000002ULL, + PMFLAGS_ALIGNEXTENSIONS = 0x0000000000000004ULL, + PMFLAGS_CASECONVERSION = 0x0000000000000008ULL, + PMFLAGS_NONE = 0; + +struct PanelMode +{ + const wchar_t *ColumnTypes; + const wchar_t *ColumnWidths; + const wchar_t * const *ColumnTitles; + const wchar_t *StatusColumnTypes; + const wchar_t *StatusColumnWidths; + PANELMODE_FLAGS Flags; +}; + +typedef unsigned long long OPENPANELINFO_FLAGS; +static const OPENPANELINFO_FLAGS + OPIF_DISABLEFILTER = 0x0000000000000001ULL, + OPIF_DISABLESORTGROUPS = 0x0000000000000002ULL, + OPIF_DISABLEHIGHLIGHTING = 0x0000000000000004ULL, + OPIF_ADDDOTS = 0x0000000000000008ULL, + OPIF_RAWSELECTION = 0x0000000000000010ULL, + OPIF_REALNAMES = 0x0000000000000020ULL, + OPIF_SHOWNAMESONLY = 0x0000000000000040ULL, + OPIF_SHOWRIGHTALIGNNAMES = 0x0000000000000080ULL, + OPIF_SHOWPRESERVECASE = 0x0000000000000100ULL, + OPIF_COMPAREFATTIME = 0x0000000000000400ULL, + OPIF_EXTERNALGET = 0x0000000000000800ULL, + OPIF_EXTERNALPUT = 0x0000000000001000ULL, + OPIF_EXTERNALDELETE = 0x0000000000002000ULL, + OPIF_EXTERNALMKDIR = 0x0000000000004000ULL, + OPIF_USEATTRHIGHLIGHTING = 0x0000000000008000ULL, + OPIF_USECRC32 = 0x0000000000010000ULL, + OPIF_USEFREESIZE = 0x0000000000020000ULL, + OPIF_SHORTCUT = 0x0000000000040000ULL, + OPIF_NONE = 0; + +struct KeyBarLabel +{ + struct FarKey Key; + const wchar_t *Text; + const wchar_t *LongText; +}; + +struct KeyBarTitles +{ + size_t CountLabels; + struct KeyBarLabel *Labels; +}; + +struct FarSetKeyBarTitles +{ + size_t StructSize; + struct KeyBarTitles *Titles; +}; + +typedef unsigned long long OPERATION_MODES; +static const OPERATION_MODES + OPM_SILENT =0x0000000000000001ULL, + OPM_FIND =0x0000000000000002ULL, + OPM_VIEW =0x0000000000000004ULL, + OPM_EDIT =0x0000000000000008ULL, + OPM_TOPLEVEL =0x0000000000000010ULL, + OPM_DESCR =0x0000000000000020ULL, + OPM_QUICKVIEW =0x0000000000000040ULL, + OPM_PGDN =0x0000000000000080ULL, + OPM_COMMANDS =0x0000000000000100ULL, + OPM_NONE =0; + +struct OpenPanelInfo +{ + size_t StructSize; + HANDLE hPanel; + OPENPANELINFO_FLAGS Flags; + const wchar_t *HostFile; + const wchar_t *CurDir; + const wchar_t *Format; + const wchar_t *PanelTitle; + const struct InfoPanelLine *InfoLines; + size_t InfoLinesNumber; + const wchar_t * const *DescrFiles; + size_t DescrFilesNumber; + const struct PanelMode *PanelModesArray; + size_t PanelModesNumber; + intptr_t StartPanelMode; + enum OPENPANELINFO_SORTMODES StartSortMode; + intptr_t StartSortOrder; + const struct KeyBarTitles *KeyBar; + const wchar_t *ShortcutData; + unsigned long long FreeSize; + struct UserDataItem UserData; + void* Instance; +}; + +struct AnalyseInfo +{ + size_t StructSize; + const wchar_t *FileName; + void *Buffer; + size_t BufferSize; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct OpenAnalyseInfo +{ + size_t StructSize; + struct AnalyseInfo* Info; + HANDLE Handle; +}; + +struct OpenMacroInfo +{ + size_t StructSize; + size_t Count; + struct FarMacroValue *Values; +}; + +typedef unsigned long long FAROPENSHORTCUTFLAGS; +static const FAROPENSHORTCUTFLAGS + FOSF_ACTIVE = 0x0000000000000001ULL, + FOSF_NONE = 0; + +struct OpenShortcutInfo +{ + size_t StructSize; + const wchar_t *HostFile; + const wchar_t *ShortcutData; + FAROPENSHORTCUTFLAGS Flags; +}; + +struct OpenCommandLineInfo +{ + size_t StructSize; + const wchar_t *CommandLine; +}; + +enum OPENFROM +{ + OPEN_LEFTDISKMENU = 0, + OPEN_PLUGINSMENU = 1, + OPEN_FINDLIST = 2, + OPEN_SHORTCUT = 3, + OPEN_COMMANDLINE = 4, + OPEN_EDITOR = 5, + OPEN_VIEWER = 6, + OPEN_FILEPANEL = 7, + OPEN_DIALOG = 8, + OPEN_ANALYSE = 9, + OPEN_RIGHTDISKMENU = 10, + OPEN_FROMMACRO = 11, + OPEN_LUAMACRO = 100, +}; + +enum MACROCALLTYPE +{ + MCT_MACROPARSE = 0, + MCT_LOADMACROS = 1, + MCT_ENUMMACROS = 2, + MCT_WRITEMACROS = 3, + MCT_GETMACRO = 4, + MCT_RECORDEDMACRO = 5, + MCT_DELMACRO = 6, + MCT_RUNSTARTMACRO = 7, + MCT_EXECSTRING = 8, + MCT_PANELSORT = 9, + MCT_GETCUSTOMSORTMODES = 10, + MCT_ADDMACRO = 11, + MCT_KEYMACRO = 12, + MCT_CANPANELSORT = 13, +}; + +enum MACROPLUGINRETURNTYPE +{ + MPRT_NORMALFINISH = 0, + MPRT_ERRORFINISH = 1, + MPRT_ERRORPARSE = 2, + MPRT_KEYS = 3, + MPRT_PRINT = 4, + MPRT_PLUGINCALL = 5, + MPRT_PLUGINMENU = 6, + MPRT_PLUGINCONFIG = 7, + MPRT_PLUGINCOMMAND = 8, + MPRT_USERMENU = 9, + MPRT_HASNOMACRO = 10, +}; + +struct OpenMacroPluginInfo +{ + enum MACROCALLTYPE CallType; + struct FarMacroCall *Data; + struct MacroPluginReturn Ret; +}; + +enum FAR_EVENTS +{ + FE_CHANGEVIEWMODE =0, + FE_REDRAW =1, + FE_IDLE =2, + FE_CLOSE =3, + FE_BREAK =4, + FE_COMMAND =5, + + FE_GOTFOCUS =6, + FE_KILLFOCUS =7, + FE_CHANGESORTPARAMS =8, +}; + +struct OpenInfo +{ + size_t StructSize; + enum OPENFROM OpenFrom; + const GUID* Guid; + intptr_t Data; + void* Instance; +}; + +struct SetDirectoryInfo +{ + size_t StructSize; + HANDLE hPanel; + const wchar_t *Dir; + intptr_t Reserved; + OPERATION_MODES OpMode; + struct UserDataItem UserData; + void* Instance; +}; + +struct SetFindListInfo +{ + size_t StructSize; + HANDLE hPanel; + const struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + void* Instance; +}; + +struct PutFilesInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + BOOL Move; + const wchar_t *SrcPath; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct ProcessHostFileInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct MakeDirectoryInfo +{ + size_t StructSize; + HANDLE hPanel; + const wchar_t *Name; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct CompareInfo +{ + size_t StructSize; + HANDLE hPanel; + const struct PluginPanelItem *Item1; + const struct PluginPanelItem *Item2; + enum OPENPANELINFO_SORTMODES Mode; + void* Instance; +}; + +struct GetFindDataInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + OPERATION_MODES OpMode; + void* Instance; +}; + + +struct FreeFindDataInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + void* Instance; +}; + +struct GetFilesInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + BOOL Move; + const wchar_t *DestPath; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct DeleteFilesInfo +{ + size_t StructSize; + HANDLE hPanel; + struct PluginPanelItem *PanelItem; + size_t ItemsNumber; + OPERATION_MODES OpMode; + void* Instance; +}; + +struct ProcessPanelInputInfo +{ + size_t StructSize; + HANDLE hPanel; + INPUT_RECORD Rec; + void* Instance; +}; + +struct ProcessEditorInputInfo +{ + size_t StructSize; + INPUT_RECORD Rec; + void* Instance; +}; + +typedef unsigned long long PROCESSCONSOLEINPUT_FLAGS; +static const PROCESSCONSOLEINPUT_FLAGS + PCIF_NONE = 0; + +struct ProcessConsoleInputInfo +{ + size_t StructSize; + PROCESSCONSOLEINPUT_FLAGS Flags; + INPUT_RECORD Rec; + void* Instance; +}; + +struct ExitInfo +{ + size_t StructSize; + void* Instance; +}; + +struct ProcessPanelEventInfo +{ + size_t StructSize; + intptr_t Event; + void* Param; + HANDLE hPanel; + void* Instance; +}; + +struct ProcessEditorEventInfo +{ + size_t StructSize; + intptr_t Event; + void* Param; + intptr_t EditorID; + void* Instance; +}; + +struct ProcessDialogEventInfo +{ + size_t StructSize; + intptr_t Event; + struct FarDialogEvent* Param; + void* Instance; +}; + +struct ProcessSynchroEventInfo +{ + size_t StructSize; + intptr_t Event; + void* Param; + void* Instance; +}; + +struct ProcessViewerEventInfo +{ + size_t StructSize; + intptr_t Event; + void* Param; + intptr_t ViewerID; + void* Instance; +}; + +struct ClosePanelInfo +{ + size_t StructSize; + HANDLE hPanel; + void* Instance; +}; + +struct CloseAnalyseInfo +{ + size_t StructSize; + HANDLE Handle; + void* Instance; +}; + +struct ConfigureInfo +{ + size_t StructSize; + const GUID* Guid; + void* Instance; +}; + +struct GetContentFieldsInfo +{ + size_t StructSize; + size_t Count; + const wchar_t* const *Names; + void* Instance; +}; + +struct GetContentDataInfo +{ + size_t StructSize; + const wchar_t *FilePath; + size_t Count; + const wchar_t* const *Names; + const wchar_t **Values; + void* Instance; +}; + +struct ErrorInfo +{ + size_t StructSize; + const wchar_t* Summary; + const wchar_t* Description; +}; + +static const GUID FarGuid = +{0x00000000, 0x0000, 0x0000, {0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00}}; + +#ifdef __cplusplus +extern "C" +{ +#endif +// Exported Functions + + HANDLE WINAPI AnalyseW(const struct AnalyseInfo *Info); + void WINAPI CloseAnalyseW(const struct CloseAnalyseInfo *Info); + void WINAPI ClosePanelW(const struct ClosePanelInfo *Info); + intptr_t WINAPI CompareW(const struct CompareInfo *Info); + intptr_t WINAPI ConfigureW(const struct ConfigureInfo *Info); + intptr_t WINAPI DeleteFilesW(const struct DeleteFilesInfo *Info); + void WINAPI ExitFARW(const struct ExitInfo *Info); + void WINAPI FreeFindDataW(const struct FreeFindDataInfo *Info); + intptr_t WINAPI GetFilesW(struct GetFilesInfo *Info); + intptr_t WINAPI GetFindDataW(struct GetFindDataInfo *Info); + void WINAPI GetGlobalInfoW(struct GlobalInfo *Info); + void WINAPI GetOpenPanelInfoW(struct OpenPanelInfo *Info); + void WINAPI GetPluginInfoW(struct PluginInfo *Info); + intptr_t WINAPI MakeDirectoryW(struct MakeDirectoryInfo *Info); + HANDLE WINAPI OpenW(const struct OpenInfo *Info); + intptr_t WINAPI ProcessDialogEventW(const struct ProcessDialogEventInfo *Info); + intptr_t WINAPI ProcessEditorEventW(const struct ProcessEditorEventInfo *Info); + intptr_t WINAPI ProcessEditorInputW(const struct ProcessEditorInputInfo *Info); + intptr_t WINAPI ProcessPanelEventW(const struct ProcessPanelEventInfo *Info); + intptr_t WINAPI ProcessHostFileW(const struct ProcessHostFileInfo *Info); + intptr_t WINAPI ProcessPanelInputW(const struct ProcessPanelInputInfo *Info); + intptr_t WINAPI ProcessConsoleInputW(struct ProcessConsoleInputInfo *Info); + intptr_t WINAPI ProcessSynchroEventW(const struct ProcessSynchroEventInfo *Info); + intptr_t WINAPI ProcessViewerEventW(const struct ProcessViewerEventInfo *Info); + intptr_t WINAPI PutFilesW(const struct PutFilesInfo *Info); + intptr_t WINAPI SetDirectoryW(const struct SetDirectoryInfo *Info); + intptr_t WINAPI SetFindListW(const struct SetFindListInfo *Info); + void WINAPI SetStartupInfoW(const struct PluginStartupInfo *Info); + intptr_t WINAPI GetContentFieldsW(const struct GetContentFieldsInfo *Info); + intptr_t WINAPI GetContentDataW(struct GetContentDataInfo *Info); + void WINAPI FreeContentDataW(const struct GetContentDataInfo *Info); + +#ifdef __cplusplus +} +#endif + +#endif /* RC_INVOKED */ + +#endif // PLUGIN_HPP_3FC978E9_63BE_4FC2_8F96_8188B0AF8363 diff --git a/farsdk/unicode3/farcolor.hpp b/farsdk/unicode3/farcolor.hpp deleted file mode 100644 index f5be709..0000000 --- a/farsdk/unicode3/farcolor.hpp +++ /dev/null @@ -1,218 +0,0 @@ -#pragma once -#ifndef __COLORS_HPP__ -#define __COLORS_HPP__ -/* - farcolor.hpp - - Colors Index for FAR Manager 3.0 build 3205 -*/ - -/* -Copyright 1996 Eugene Roshal -Copyright 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - - -enum PaletteColors -{ - COL_MENUTEXT, - COL_MENUSELECTEDTEXT, - COL_MENUHIGHLIGHT, - COL_MENUSELECTEDHIGHLIGHT, - COL_MENUBOX, - COL_MENUTITLE, - - COL_HMENUTEXT, - COL_HMENUSELECTEDTEXT, - COL_HMENUHIGHLIGHT, - COL_HMENUSELECTEDHIGHLIGHT, - - COL_PANELTEXT, - COL_PANELSELECTEDTEXT, - COL_PANELHIGHLIGHTTEXT, - COL_PANELINFOTEXT, - COL_PANELCURSOR, - COL_PANELSELECTEDCURSOR, - COL_PANELTITLE, - COL_PANELSELECTEDTITLE, - COL_PANELCOLUMNTITLE, - COL_PANELTOTALINFO, - COL_PANELSELECTEDINFO, - - COL_DIALOGTEXT, - COL_DIALOGHIGHLIGHTTEXT, - COL_DIALOGBOX, - COL_DIALOGBOXTITLE, - COL_DIALOGHIGHLIGHTBOXTITLE, - COL_DIALOGEDIT, - COL_DIALOGBUTTON, - COL_DIALOGSELECTEDBUTTON, - COL_DIALOGHIGHLIGHTBUTTON, - COL_DIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_DIALOGLISTTEXT, - COL_DIALOGLISTSELECTEDTEXT, - COL_DIALOGLISTHIGHLIGHT, - COL_DIALOGLISTSELECTEDHIGHLIGHT, - - COL_WARNDIALOGTEXT, - COL_WARNDIALOGHIGHLIGHTTEXT, - COL_WARNDIALOGBOX, - COL_WARNDIALOGBOXTITLE, - COL_WARNDIALOGHIGHLIGHTBOXTITLE, - COL_WARNDIALOGEDIT, - COL_WARNDIALOGBUTTON, - COL_WARNDIALOGSELECTEDBUTTON, - COL_WARNDIALOGHIGHLIGHTBUTTON, - COL_WARNDIALOGHIGHLIGHTSELECTEDBUTTON, - - COL_KEYBARNUM, - COL_KEYBARTEXT, - COL_KEYBARBACKGROUND, - - COL_COMMANDLINE, - - COL_CLOCK, - - COL_VIEWERTEXT, - COL_VIEWERSELECTEDTEXT, - COL_VIEWERSTATUS, - - COL_EDITORTEXT, - COL_EDITORSELECTEDTEXT, - COL_EDITORSTATUS, - - COL_HELPTEXT, - COL_HELPHIGHLIGHTTEXT, - COL_HELPTOPIC, - COL_HELPSELECTEDTOPIC, - COL_HELPBOX, - COL_HELPBOXTITLE, - - COL_PANELDRAGTEXT, - COL_DIALOGEDITUNCHANGED, - COL_PANELSCROLLBAR, - COL_HELPSCROLLBAR, - COL_PANELBOX, - COL_PANELSCREENSNUMBER, - COL_DIALOGEDITSELECTED, - COL_COMMANDLINESELECTED, - COL_VIEWERARROWS, - - COL_DIALOGLISTSCROLLBAR, - COL_MENUSCROLLBAR, - COL_VIEWERSCROLLBAR, - COL_COMMANDLINEPREFIX, - COL_DIALOGDISABLED, - COL_DIALOGEDITDISABLED, - COL_DIALOGLISTDISABLED, - COL_WARNDIALOGDISABLED, - COL_WARNDIALOGEDITDISABLED, - COL_WARNDIALOGLISTDISABLED, - - COL_MENUDISABLEDTEXT, - - COL_EDITORCLOCK, - COL_VIEWERCLOCK, - - COL_DIALOGLISTTITLE, - COL_DIALOGLISTBOX, - - COL_WARNDIALOGEDITSELECTED, - COL_WARNDIALOGEDITUNCHANGED, - - COL_DIALOGCOMBOTEXT, - COL_DIALOGCOMBOSELECTEDTEXT, - COL_DIALOGCOMBOHIGHLIGHT, - COL_DIALOGCOMBOSELECTEDHIGHLIGHT, - COL_DIALOGCOMBOBOX, - COL_DIALOGCOMBOTITLE, - COL_DIALOGCOMBODISABLED, - COL_DIALOGCOMBOSCROLLBAR, - - COL_WARNDIALOGLISTTEXT, - COL_WARNDIALOGLISTSELECTEDTEXT, - COL_WARNDIALOGLISTHIGHLIGHT, - COL_WARNDIALOGLISTSELECTEDHIGHLIGHT, - COL_WARNDIALOGLISTBOX, - COL_WARNDIALOGLISTTITLE, - COL_WARNDIALOGLISTSCROLLBAR, - - COL_WARNDIALOGCOMBOTEXT, - COL_WARNDIALOGCOMBOSELECTEDTEXT, - COL_WARNDIALOGCOMBOHIGHLIGHT, - COL_WARNDIALOGCOMBOSELECTEDHIGHLIGHT, - COL_WARNDIALOGCOMBOBOX, - COL_WARNDIALOGCOMBOTITLE, - COL_WARNDIALOGCOMBODISABLED, - COL_WARNDIALOGCOMBOSCROLLBAR, - - COL_DIALOGLISTARROWS, - COL_DIALOGLISTARROWSDISABLED, - COL_DIALOGLISTARROWSSELECTED, - COL_DIALOGCOMBOARROWS, - COL_DIALOGCOMBOARROWSDISABLED, - COL_DIALOGCOMBOARROWSSELECTED, - COL_WARNDIALOGLISTARROWS, - COL_WARNDIALOGLISTARROWSDISABLED, - COL_WARNDIALOGLISTARROWSSELECTED, - COL_WARNDIALOGCOMBOARROWS, - COL_WARNDIALOGCOMBOARROWSDISABLED, - COL_WARNDIALOGCOMBOARROWSSELECTED, - COL_MENUARROWS, - COL_MENUARROWSDISABLED, - COL_MENUARROWSSELECTED, - COL_COMMANDLINEUSERSCREEN, - COL_EDITORSCROLLBAR, - - COL_MENUGRAYTEXT, - COL_MENUSELECTEDGRAYTEXT, - COL_DIALOGCOMBOGRAY, - COL_DIALOGCOMBOSELECTEDGRAYTEXT, - COL_DIALOGLISTGRAY, - COL_DIALOGLISTSELECTEDGRAYTEXT, - COL_WARNDIALOGCOMBOGRAY, - COL_WARNDIALOGCOMBOSELECTEDGRAYTEXT, - COL_WARNDIALOGLISTGRAY, - COL_WARNDIALOGLISTSELECTEDGRAYTEXT, - - COL_DIALOGDEFAULTBUTTON, - COL_DIALOGSELECTEDDEFAULTBUTTON, - COL_DIALOGHIGHLIGHTDEFAULTBUTTON, - COL_DIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON, - COL_WARNDIALOGDEFAULTBUTTON, - COL_WARNDIALOGSELECTEDDEFAULTBUTTON, - COL_WARNDIALOGHIGHLIGHTDEFAULTBUTTON, - COL_WARNDIALOGHIGHLIGHTSELECTEDDEFAULTBUTTON, - - COL_LASTPALETTECOLOR -}; - -#endif // __COLORS_HPP__ diff --git a/farsdk/unicode3/farkeys.hpp b/farsdk/unicode3/farkeys.hpp deleted file mode 100644 index b8d895c..0000000 --- a/farsdk/unicode3/farkeys.hpp +++ /dev/null @@ -1,700 +0,0 @@ -#pragma once -#ifndef __FARKEYS_HPP__ -#define __FARKEYS_HPP__ -/* - farkeys.hpp - - Inside KeyName for FAR Manager 2.0 build 1420 -*/ - -/* -Copyright (c) 1996 Eugene Roshal -Copyright (c) 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - - -#define EXTENDED_KEY_BASE 0x00010000 -#define INTERNAL_KEY_BASE 0x00020000 -#define INTERNAL_KEY_BASE_2 0x00030000 - -enum BaseDefKeyboard -{ - KEY_CTRL =0x01000000, - KEY_ALT =0x02000000, - KEY_SHIFT =0x04000000, - KEY_RCTRL =0x10000000, - KEY_RALT =0x20000000, - KEY_CTRLMASK =0xFF000000, - - KEY_BRACKET ='[', - KEY_BACKBRACKET =']', - KEY_COMMA =',', - KEY_QUOTE ='"', - KEY_DOT ='.', - KEY_SLASH ='/', - KEY_COLON =':', - KEY_SEMICOLON =';', - KEY_BACKSLASH ='\\', - - KEY_BS =0x00000008, - KEY_TAB =0x00000009, - KEY_ENTER =0x0000000D, - KEY_ESC =0x0000001B, - KEY_SPACE =0x00000020, - - KEY_MASKF =0x0001FFFF, - - KEY_FKEY_BEGIN =EXTENDED_KEY_BASE, - - KEY_BREAK =EXTENDED_KEY_BASE+VK_CANCEL, - - KEY_PAUSE =EXTENDED_KEY_BASE+VK_PAUSE, - KEY_CAPSLOCK =EXTENDED_KEY_BASE+VK_CAPITAL, - - KEY_PGUP =EXTENDED_KEY_BASE+VK_PRIOR, - KEY_PGDN =EXTENDED_KEY_BASE+VK_NEXT, - KEY_END =EXTENDED_KEY_BASE+VK_END, - KEY_HOME =EXTENDED_KEY_BASE+VK_HOME, - KEY_LEFT =EXTENDED_KEY_BASE+VK_LEFT, - KEY_UP =EXTENDED_KEY_BASE+VK_UP, - KEY_RIGHT =EXTENDED_KEY_BASE+VK_RIGHT, - KEY_DOWN =EXTENDED_KEY_BASE+VK_DOWN, - KEY_PRNTSCRN =EXTENDED_KEY_BASE+VK_SNAPSHOT, - KEY_INS =EXTENDED_KEY_BASE+VK_INSERT, - KEY_DEL =EXTENDED_KEY_BASE+VK_DELETE, - - KEY_LWIN =EXTENDED_KEY_BASE+VK_LWIN, - KEY_RWIN =EXTENDED_KEY_BASE+VK_RWIN, - KEY_APPS =EXTENDED_KEY_BASE+VK_APPS, - KEY_STANDBY =EXTENDED_KEY_BASE+VK_SLEEP, - - KEY_NUMPAD0 =EXTENDED_KEY_BASE+VK_NUMPAD0, - KEY_NUMPAD1 =EXTENDED_KEY_BASE+VK_NUMPAD1, - KEY_NUMPAD2 =EXTENDED_KEY_BASE+VK_NUMPAD2, - KEY_NUMPAD3 =EXTENDED_KEY_BASE+VK_NUMPAD3, - KEY_NUMPAD4 =EXTENDED_KEY_BASE+VK_NUMPAD4, - KEY_NUMPAD5 =EXTENDED_KEY_BASE+VK_NUMPAD5, - KEY_CLEAR =KEY_NUMPAD5, - KEY_NUMPAD6 =EXTENDED_KEY_BASE+VK_NUMPAD6, - KEY_NUMPAD7 =EXTENDED_KEY_BASE+VK_NUMPAD7, - KEY_NUMPAD8 =EXTENDED_KEY_BASE+VK_NUMPAD8, - KEY_NUMPAD9 =EXTENDED_KEY_BASE+VK_NUMPAD9, - - KEY_MULTIPLY =EXTENDED_KEY_BASE+VK_MULTIPLY, - KEY_ADD =EXTENDED_KEY_BASE+VK_ADD, - KEY_SUBTRACT =EXTENDED_KEY_BASE+VK_SUBTRACT, - KEY_DECIMAL =EXTENDED_KEY_BASE+VK_DECIMAL, - KEY_DIVIDE =EXTENDED_KEY_BASE+VK_DIVIDE, - - KEY_F1 =EXTENDED_KEY_BASE+VK_F1, - KEY_F2 =EXTENDED_KEY_BASE+VK_F2, - KEY_F3 =EXTENDED_KEY_BASE+VK_F3, - KEY_F4 =EXTENDED_KEY_BASE+VK_F4, - KEY_F5 =EXTENDED_KEY_BASE+VK_F5, - KEY_F6 =EXTENDED_KEY_BASE+VK_F6, - KEY_F7 =EXTENDED_KEY_BASE+VK_F7, - KEY_F8 =EXTENDED_KEY_BASE+VK_F8, - KEY_F9 =EXTENDED_KEY_BASE+VK_F9, - KEY_F10 =EXTENDED_KEY_BASE+VK_F10, - KEY_F11 =EXTENDED_KEY_BASE+VK_F11, - KEY_F12 =EXTENDED_KEY_BASE+VK_F12, - - KEY_F13 =EXTENDED_KEY_BASE+VK_F13, - KEY_F14 =EXTENDED_KEY_BASE+VK_F14, - KEY_F15 =EXTENDED_KEY_BASE+VK_F15, - KEY_F16 =EXTENDED_KEY_BASE+VK_F16, - KEY_F17 =EXTENDED_KEY_BASE+VK_F17, - KEY_F18 =EXTENDED_KEY_BASE+VK_F18, - KEY_F19 =EXTENDED_KEY_BASE+VK_F19, - KEY_F20 =EXTENDED_KEY_BASE+VK_F20, - KEY_F21 =EXTENDED_KEY_BASE+VK_F21, - KEY_F22 =EXTENDED_KEY_BASE+VK_F22, - KEY_F23 =EXTENDED_KEY_BASE+VK_F23, - KEY_F24 =EXTENDED_KEY_BASE+VK_F24, - - KEY_NUMLOCK =EXTENDED_KEY_BASE+VK_NUMLOCK, - KEY_SCROLLLOCK =EXTENDED_KEY_BASE+VK_SCROLL, - -#if (_WIN32_WINNT >= 0x0500) - KEY_BROWSER_BACK =EXTENDED_KEY_BASE+VK_BROWSER_BACK, - KEY_BROWSER_FORWARD =EXTENDED_KEY_BASE+VK_BROWSER_FORWARD, - KEY_BROWSER_REFRESH =EXTENDED_KEY_BASE+VK_BROWSER_REFRESH, - KEY_BROWSER_STOP =EXTENDED_KEY_BASE+VK_BROWSER_STOP, - KEY_BROWSER_SEARCH =EXTENDED_KEY_BASE+VK_BROWSER_SEARCH, - KEY_BROWSER_FAVORITES =EXTENDED_KEY_BASE+VK_BROWSER_FAVORITES, - KEY_BROWSER_HOME =EXTENDED_KEY_BASE+VK_BROWSER_HOME, - KEY_VOLUME_MUTE =EXTENDED_KEY_BASE+VK_VOLUME_MUTE, - KEY_VOLUME_DOWN =EXTENDED_KEY_BASE+VK_VOLUME_DOWN, - KEY_VOLUME_UP =EXTENDED_KEY_BASE+VK_VOLUME_UP, - KEY_MEDIA_NEXT_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_NEXT_TRACK, - KEY_MEDIA_PREV_TRACK =EXTENDED_KEY_BASE+VK_MEDIA_PREV_TRACK, - KEY_MEDIA_STOP =EXTENDED_KEY_BASE+VK_MEDIA_STOP, - KEY_MEDIA_PLAY_PAUSE =EXTENDED_KEY_BASE+VK_MEDIA_PLAY_PAUSE, - KEY_LAUNCH_MAIL =EXTENDED_KEY_BASE+VK_LAUNCH_MAIL, - KEY_LAUNCH_MEDIA_SELECT =EXTENDED_KEY_BASE+VK_LAUNCH_MEDIA_SELECT, - KEY_LAUNCH_APP1 =EXTENDED_KEY_BASE+VK_LAUNCH_APP1, - KEY_LAUNCH_APP2 =EXTENDED_KEY_BASE+VK_LAUNCH_APP2, -#endif - - KEY_CTRLALTSHIFTPRESS =INTERNAL_KEY_BASE+1, - KEY_CTRLALTSHIFTRELEASE =INTERNAL_KEY_BASE+2, - - KEY_MSWHEEL_UP =INTERNAL_KEY_BASE+3, - KEY_MSWHEEL_DOWN =INTERNAL_KEY_BASE+4, - KEY_NUMDEL =INTERNAL_KEY_BASE+9, - KEY_NUMENTER =INTERNAL_KEY_BASE+0xB, - - KEY_MSWHEEL_LEFT =INTERNAL_KEY_BASE+0xC, - KEY_MSWHEEL_RIGHT =INTERNAL_KEY_BASE+0xD, - - KEY_MSLCLICK =INTERNAL_KEY_BASE+0xF, - KEY_MSRCLICK =INTERNAL_KEY_BASE+0x10, - - KEY_MSM1CLICK =INTERNAL_KEY_BASE+0x11, - KEY_MSM2CLICK =INTERNAL_KEY_BASE+0x12, - KEY_MSM3CLICK =INTERNAL_KEY_BASE+0x13, - - - - KEY_VK_0xFF_BEGIN =EXTENDED_KEY_BASE+0x00000100, - KEY_VK_0xFF_END =EXTENDED_KEY_BASE+0x000001FF, - - KEY_END_FKEY =0x0001FFFF, - - KEY_NONE =INTERNAL_KEY_BASE_2+1, - KEY_IDLE =INTERNAL_KEY_BASE_2+2, - - KEY_END_SKEY =0x0003FFFF, - KEY_LAST_BASE =KEY_END_SKEY, - -}; - -enum AddDefKeyboard -{ - KEY_CTRLSHIFT =KEY_CTRL|KEY_SHIFT, - KEY_ALTSHIFT =KEY_ALT|KEY_SHIFT, - KEY_CTRLALT =KEY_CTRL|KEY_ALT, - - KEY_CTRL0 =KEY_CTRL+'0', - KEY_CTRL1 =KEY_CTRL+'1', - KEY_CTRL2 =KEY_CTRL+'2', - KEY_CTRL3 =KEY_CTRL+'3', - KEY_CTRL4 =KEY_CTRL+'4', - KEY_CTRL5 =KEY_CTRL+'5', - KEY_CTRL6 =KEY_CTRL+'6', - KEY_CTRL7 =KEY_CTRL+'7', - KEY_CTRL8 =KEY_CTRL+'8', - KEY_CTRL9 =KEY_CTRL+'9', - - KEY_RCTRL0 =KEY_RCTRL+'0', - KEY_RCTRL1 =KEY_RCTRL+'1', - KEY_RCTRL2 =KEY_RCTRL+'2', - KEY_RCTRL3 =KEY_RCTRL+'3', - KEY_RCTRL4 =KEY_RCTRL+'4', - KEY_RCTRL5 =KEY_RCTRL+'5', - KEY_RCTRL6 =KEY_RCTRL+'6', - KEY_RCTRL7 =KEY_RCTRL+'7', - KEY_RCTRL8 =KEY_RCTRL+'8', - KEY_RCTRL9 =KEY_RCTRL+'9', - - KEY_CTRLA =KEY_CTRL+'A', - KEY_CTRLB =KEY_CTRL+'B', - KEY_CTRLC =KEY_CTRL+'C', - KEY_CTRLD =KEY_CTRL+'D', - KEY_CTRLE =KEY_CTRL+'E', - KEY_CTRLF =KEY_CTRL+'F', - KEY_CTRLG =KEY_CTRL+'G', - KEY_CTRLH =KEY_CTRL+'H', - KEY_CTRLI =KEY_CTRL+'I', - KEY_CTRLJ =KEY_CTRL+'J', - KEY_CTRLK =KEY_CTRL+'K', - KEY_CTRLL =KEY_CTRL+'L', - KEY_CTRLM =KEY_CTRL+'M', - KEY_CTRLN =KEY_CTRL+'N', - KEY_CTRLO =KEY_CTRL+'O', - KEY_CTRLP =KEY_CTRL+'P', - KEY_CTRLQ =KEY_CTRL+'Q', - KEY_CTRLR =KEY_CTRL+'R', - KEY_CTRLS =KEY_CTRL+'S', - KEY_CTRLT =KEY_CTRL+'T', - KEY_CTRLU =KEY_CTRL+'U', - KEY_CTRLV =KEY_CTRL+'V', - KEY_CTRLW =KEY_CTRL+'W', - KEY_CTRLX =KEY_CTRL+'X', - KEY_CTRLY =KEY_CTRL+'Y', - KEY_CTRLZ =KEY_CTRL+'Z', - - KEY_CTRLBRACKET =KEY_CTRL|KEY_BRACKET, - KEY_CTRLBACKBRACKET =KEY_CTRL|KEY_BACKBRACKET, - KEY_CTRLCOMMA =KEY_CTRL|KEY_COMMA, - KEY_CTRLQUOTE =KEY_CTRL|KEY_QUOTE, - KEY_CTRLDOT =KEY_CTRL|KEY_DOT, - - KEY_ALT0 =KEY_ALT+'0', - KEY_ALT1 =KEY_ALT+'1', - KEY_ALT2 =KEY_ALT+'2', - KEY_ALT3 =KEY_ALT+'3', - KEY_ALT4 =KEY_ALT+'4', - KEY_ALT5 =KEY_ALT+'5', - KEY_ALT6 =KEY_ALT+'6', - KEY_ALT7 =KEY_ALT+'7', - KEY_ALT8 =KEY_ALT+'8', - KEY_ALT9 =KEY_ALT+'9', - - KEY_ALTADD =KEY_ALT|KEY_ADD, - KEY_ALTDOT =KEY_ALT|KEY_DOT, - KEY_ALTCOMMA =KEY_ALT|KEY_COMMA, - KEY_ALTMULTIPLY =KEY_ALT|KEY_MULTIPLY, - - KEY_ALTA =KEY_ALT+'A', - KEY_ALTB =KEY_ALT+'B', - KEY_ALTC =KEY_ALT+'C', - KEY_ALTD =KEY_ALT+'D', - KEY_ALTE =KEY_ALT+'E', - KEY_ALTF =KEY_ALT+'F', - KEY_ALTG =KEY_ALT+'G', - KEY_ALTH =KEY_ALT+'H', - KEY_ALTI =KEY_ALT+'I', - KEY_ALTJ =KEY_ALT+'J', - KEY_ALTK =KEY_ALT+'K', - KEY_ALTL =KEY_ALT+'L', - KEY_ALTM =KEY_ALT+'M', - KEY_ALTN =KEY_ALT+'N', - KEY_ALTO =KEY_ALT+'O', - KEY_ALTP =KEY_ALT+'P', - KEY_ALTQ =KEY_ALT+'Q', - KEY_ALTR =KEY_ALT+'R', - KEY_ALTS =KEY_ALT+'S', - KEY_ALTT =KEY_ALT+'T', - KEY_ALTU =KEY_ALT+'U', - KEY_ALTV =KEY_ALT+'V', - KEY_ALTW =KEY_ALT+'W', - KEY_ALTX =KEY_ALT+'X', - KEY_ALTY =KEY_ALT+'Y', - KEY_ALTZ =KEY_ALT+'Z', - - KEY_CTRLSHIFTADD =KEY_CTRL|KEY_SHIFT|KEY_ADD, - KEY_CTRLSHIFTSUBTRACT =KEY_CTRL|KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLSHIFTDOT =KEY_CTRL|KEY_SHIFT|KEY_DOT, - KEY_CTRLSHIFTSLASH =KEY_CTRL|KEY_SHIFT|KEY_SLASH, - - KEY_CTRLSHIFT0 =(KEY_CTRL|KEY_SHIFT)+'0', - KEY_CTRLSHIFT1 =(KEY_CTRL|KEY_SHIFT)+'1', - KEY_CTRLSHIFT2 =(KEY_CTRL|KEY_SHIFT)+'2', - KEY_CTRLSHIFT3 =(KEY_CTRL|KEY_SHIFT)+'3', - KEY_CTRLSHIFT4 =(KEY_CTRL|KEY_SHIFT)+'4', - KEY_CTRLSHIFT5 =(KEY_CTRL|KEY_SHIFT)+'5', - KEY_CTRLSHIFT6 =(KEY_CTRL|KEY_SHIFT)+'6', - KEY_CTRLSHIFT7 =(KEY_CTRL|KEY_SHIFT)+'7', - KEY_CTRLSHIFT8 =(KEY_CTRL|KEY_SHIFT)+'8', - KEY_CTRLSHIFT9 =(KEY_CTRL|KEY_SHIFT)+'9', - - KEY_RCTRLSHIFT0 =KEY_RCTRL+KEY_SHIFT+'0', - KEY_RCTRLSHIFT1 =KEY_RCTRL+KEY_SHIFT+'1', - KEY_RCTRLSHIFT2 =KEY_RCTRL+KEY_SHIFT+'2', - KEY_RCTRLSHIFT3 =KEY_RCTRL+KEY_SHIFT+'3', - KEY_RCTRLSHIFT4 =KEY_RCTRL+KEY_SHIFT+'4', - KEY_RCTRLSHIFT5 =KEY_RCTRL+KEY_SHIFT+'5', - KEY_RCTRLSHIFT6 =KEY_RCTRL+KEY_SHIFT+'6', - KEY_RCTRLSHIFT7 =KEY_RCTRL+KEY_SHIFT+'7', - KEY_RCTRLSHIFT8 =KEY_RCTRL+KEY_SHIFT+'8', - KEY_RCTRLSHIFT9 =KEY_RCTRL+KEY_SHIFT+'9', - - KEY_CTRLSHIFTA =(KEY_CTRL|KEY_SHIFT)+'A', - KEY_CTRLSHIFTB =(KEY_CTRL|KEY_SHIFT)+'B', - KEY_CTRLSHIFTC =(KEY_CTRL|KEY_SHIFT)+'C', - KEY_CTRLSHIFTD =(KEY_CTRL|KEY_SHIFT)+'D', - KEY_CTRLSHIFTE =(KEY_CTRL|KEY_SHIFT)+'E', - KEY_CTRLSHIFTF =(KEY_CTRL|KEY_SHIFT)+'F', - KEY_CTRLSHIFTG =(KEY_CTRL|KEY_SHIFT)+'G', - KEY_CTRLSHIFTH =(KEY_CTRL|KEY_SHIFT)+'H', - KEY_CTRLSHIFTI =(KEY_CTRL|KEY_SHIFT)+'I', - KEY_CTRLSHIFTJ =(KEY_CTRL|KEY_SHIFT)+'J', - KEY_CTRLSHIFTK =(KEY_CTRL|KEY_SHIFT)+'K', - KEY_CTRLSHIFTL =(KEY_CTRL|KEY_SHIFT)+'L', - KEY_CTRLSHIFTM =(KEY_CTRL|KEY_SHIFT)+'M', - KEY_CTRLSHIFTN =(KEY_CTRL|KEY_SHIFT)+'N', - KEY_CTRLSHIFTO =(KEY_CTRL|KEY_SHIFT)+'O', - KEY_CTRLSHIFTP =(KEY_CTRL|KEY_SHIFT)+'P', - KEY_CTRLSHIFTQ =(KEY_CTRL|KEY_SHIFT)+'Q', - KEY_CTRLSHIFTR =(KEY_CTRL|KEY_SHIFT)+'R', - KEY_CTRLSHIFTS =(KEY_CTRL|KEY_SHIFT)+'S', - KEY_CTRLSHIFTT =(KEY_CTRL|KEY_SHIFT)+'T', - KEY_CTRLSHIFTU =(KEY_CTRL|KEY_SHIFT)+'U', - KEY_CTRLSHIFTV =(KEY_CTRL|KEY_SHIFT)+'V', - KEY_CTRLSHIFTW =(KEY_CTRL|KEY_SHIFT)+'W', - KEY_CTRLSHIFTX =(KEY_CTRL|KEY_SHIFT)+'X', - KEY_CTRLSHIFTY =(KEY_CTRL|KEY_SHIFT)+'Y', - KEY_CTRLSHIFTZ =(KEY_CTRL|KEY_SHIFT)+'Z', - - KEY_CTRLSHIFTBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BRACKET, - KEY_CTRLSHIFTBACKSLASH =KEY_CTRL|KEY_SHIFT|KEY_BACKSLASH, - KEY_CTRLSHIFTBACKBRACKET =KEY_CTRL|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_ALTSHIFT0 =(KEY_ALT|KEY_SHIFT)+'0', - KEY_ALTSHIFT1 =(KEY_ALT|KEY_SHIFT)+'1', - KEY_ALTSHIFT2 =(KEY_ALT|KEY_SHIFT)+'2', - KEY_ALTSHIFT3 =(KEY_ALT|KEY_SHIFT)+'3', - KEY_ALTSHIFT4 =(KEY_ALT|KEY_SHIFT)+'4', - KEY_ALTSHIFT5 =(KEY_ALT|KEY_SHIFT)+'5', - KEY_ALTSHIFT6 =(KEY_ALT|KEY_SHIFT)+'6', - KEY_ALTSHIFT7 =(KEY_ALT|KEY_SHIFT)+'7', - KEY_ALTSHIFT8 =(KEY_ALT|KEY_SHIFT)+'8', - KEY_ALTSHIFT9 =(KEY_ALT|KEY_SHIFT)+'9', - - KEY_ALTSHIFTA =(KEY_ALT|KEY_SHIFT)+'A', - KEY_ALTSHIFTB =(KEY_ALT|KEY_SHIFT)+'B', - KEY_ALTSHIFTC =(KEY_ALT|KEY_SHIFT)+'C', - KEY_ALTSHIFTD =(KEY_ALT|KEY_SHIFT)+'D', - KEY_ALTSHIFTE =(KEY_ALT|KEY_SHIFT)+'E', - KEY_ALTSHIFTF =(KEY_ALT|KEY_SHIFT)+'F', - KEY_ALTSHIFTG =(KEY_ALT|KEY_SHIFT)+'G', - KEY_ALTSHIFTH =(KEY_ALT|KEY_SHIFT)+'H', - KEY_ALTSHIFTI =(KEY_ALT|KEY_SHIFT)+'I', - KEY_ALTSHIFTJ =(KEY_ALT|KEY_SHIFT)+'J', - KEY_ALTSHIFTK =(KEY_ALT|KEY_SHIFT)+'K', - KEY_ALTSHIFTL =(KEY_ALT|KEY_SHIFT)+'L', - KEY_ALTSHIFTM =(KEY_ALT|KEY_SHIFT)+'M', - KEY_ALTSHIFTN =(KEY_ALT|KEY_SHIFT)+'N', - KEY_ALTSHIFTO =(KEY_ALT|KEY_SHIFT)+'O', - KEY_ALTSHIFTP =(KEY_ALT|KEY_SHIFT)+'P', - KEY_ALTSHIFTQ =(KEY_ALT|KEY_SHIFT)+'Q', - KEY_ALTSHIFTR =(KEY_ALT|KEY_SHIFT)+'R', - KEY_ALTSHIFTS =(KEY_ALT|KEY_SHIFT)+'S', - KEY_ALTSHIFTT =(KEY_ALT|KEY_SHIFT)+'T', - KEY_ALTSHIFTU =(KEY_ALT|KEY_SHIFT)+'U', - KEY_ALTSHIFTV =(KEY_ALT|KEY_SHIFT)+'V', - KEY_ALTSHIFTW =(KEY_ALT|KEY_SHIFT)+'W', - KEY_ALTSHIFTX =(KEY_ALT|KEY_SHIFT)+'X', - KEY_ALTSHIFTY =(KEY_ALT|KEY_SHIFT)+'Y', - KEY_ALTSHIFTZ =(KEY_ALT|KEY_SHIFT)+'Z', - - KEY_ALTSHIFTBRACKET =KEY_ALT|KEY_SHIFT|KEY_BRACKET, - KEY_ALTSHIFTBACKBRACKET =KEY_ALT|KEY_SHIFT|KEY_BACKBRACKET, - - KEY_CTRLALT0 =(KEY_CTRL|KEY_ALT)+'0', - KEY_CTRLALT1 =(KEY_CTRL|KEY_ALT)+'1', - KEY_CTRLALT2 =(KEY_CTRL|KEY_ALT)+'2', - KEY_CTRLALT3 =(KEY_CTRL|KEY_ALT)+'3', - KEY_CTRLALT4 =(KEY_CTRL|KEY_ALT)+'4', - KEY_CTRLALT5 =(KEY_CTRL|KEY_ALT)+'5', - KEY_CTRLALT6 =(KEY_CTRL|KEY_ALT)+'6', - KEY_CTRLALT7 =(KEY_CTRL|KEY_ALT)+'7', - KEY_CTRLALT8 =(KEY_CTRL|KEY_ALT)+'8', - KEY_CTRLALT9 =(KEY_CTRL|KEY_ALT)+'9', - - KEY_CTRLALTA =(KEY_CTRL|KEY_ALT)+'A', - KEY_CTRLALTB =(KEY_CTRL|KEY_ALT)+'B', - KEY_CTRLALTC =(KEY_CTRL|KEY_ALT)+'C', - KEY_CTRLALTD =(KEY_CTRL|KEY_ALT)+'D', - KEY_CTRLALTE =(KEY_CTRL|KEY_ALT)+'E', - KEY_CTRLALTF =(KEY_CTRL|KEY_ALT)+'F', - KEY_CTRLALTG =(KEY_CTRL|KEY_ALT)+'G', - KEY_CTRLALTH =(KEY_CTRL|KEY_ALT)+'H', - KEY_CTRLALTI =(KEY_CTRL|KEY_ALT)+'I', - KEY_CTRLALTJ =(KEY_CTRL|KEY_ALT)+'J', - KEY_CTRLALTK =(KEY_CTRL|KEY_ALT)+'K', - KEY_CTRLALTL =(KEY_CTRL|KEY_ALT)+'L', - KEY_CTRLALTM =(KEY_CTRL|KEY_ALT)+'M', - KEY_CTRLALTN =(KEY_CTRL|KEY_ALT)+'N', - KEY_CTRLALTO =(KEY_CTRL|KEY_ALT)+'O', - KEY_CTRLALTP =(KEY_CTRL|KEY_ALT)+'P', - KEY_CTRLALTQ =(KEY_CTRL|KEY_ALT)+'Q', - KEY_CTRLALTR =(KEY_CTRL|KEY_ALT)+'R', - KEY_CTRLALTS =(KEY_CTRL|KEY_ALT)+'S', - KEY_CTRLALTT =(KEY_CTRL|KEY_ALT)+'T', - KEY_CTRLALTU =(KEY_CTRL|KEY_ALT)+'U', - KEY_CTRLALTV =(KEY_CTRL|KEY_ALT)+'V', - KEY_CTRLALTW =(KEY_CTRL|KEY_ALT)+'W', - KEY_CTRLALTX =(KEY_CTRL|KEY_ALT)+'X', - KEY_CTRLALTY =(KEY_CTRL|KEY_ALT)+'Y', - KEY_CTRLALTZ =(KEY_CTRL|KEY_ALT)+'Z', - - KEY_CTRLALTBRACKET =KEY_CTRL|KEY_ALT|KEY_BRACKET, - KEY_CTRLALTBACKBRACKET =KEY_CTRL|KEY_ALT|KEY_BACKBRACKET, - - KEY_CTRLF1 =KEY_CTRL|KEY_F1, - KEY_CTRLF2 =KEY_CTRL|KEY_F2, - KEY_CTRLF3 =KEY_CTRL|KEY_F3, - KEY_CTRLF4 =KEY_CTRL|KEY_F4, - KEY_CTRLF5 =KEY_CTRL|KEY_F5, - KEY_CTRLF6 =KEY_CTRL|KEY_F6, - KEY_CTRLF7 =KEY_CTRL|KEY_F7, - KEY_CTRLF8 =KEY_CTRL|KEY_F8, - KEY_CTRLF9 =KEY_CTRL|KEY_F9, - KEY_CTRLF10 =KEY_CTRL|KEY_F10, - KEY_CTRLF11 =KEY_CTRL|KEY_F11, - KEY_CTRLF12 =KEY_CTRL|KEY_F12, - - KEY_SHIFTF1 =KEY_SHIFT|KEY_F1, - KEY_SHIFTF2 =KEY_SHIFT|KEY_F2, - KEY_SHIFTF3 =KEY_SHIFT|KEY_F3, - KEY_SHIFTF4 =KEY_SHIFT|KEY_F4, - KEY_SHIFTF5 =KEY_SHIFT|KEY_F5, - KEY_SHIFTF6 =KEY_SHIFT|KEY_F6, - KEY_SHIFTF7 =KEY_SHIFT|KEY_F7, - KEY_SHIFTF8 =KEY_SHIFT|KEY_F8, - KEY_SHIFTF9 =KEY_SHIFT|KEY_F9, - KEY_SHIFTF10 =KEY_SHIFT|KEY_F10, - KEY_SHIFTF11 =KEY_SHIFT|KEY_F11, - KEY_SHIFTF12 =KEY_SHIFT|KEY_F12, - - KEY_ALTF1 =KEY_ALT|KEY_F1, - KEY_ALTF2 =KEY_ALT|KEY_F2, - KEY_ALTF3 =KEY_ALT|KEY_F3, - KEY_ALTF4 =KEY_ALT|KEY_F4, - KEY_ALTF5 =KEY_ALT|KEY_F5, - KEY_ALTF6 =KEY_ALT|KEY_F6, - KEY_ALTF7 =KEY_ALT|KEY_F7, - KEY_ALTF8 =KEY_ALT|KEY_F8, - KEY_ALTF9 =KEY_ALT|KEY_F9, - KEY_ALTF10 =KEY_ALT|KEY_F10, - KEY_ALTF11 =KEY_ALT|KEY_F11, - KEY_ALTF12 =KEY_ALT|KEY_F12, - - KEY_CTRLSHIFTF1 =KEY_CTRL|KEY_SHIFT|KEY_F1, - KEY_CTRLSHIFTF2 =KEY_CTRL|KEY_SHIFT|KEY_F2, - KEY_CTRLSHIFTF3 =KEY_CTRL|KEY_SHIFT|KEY_F3, - KEY_CTRLSHIFTF4 =KEY_CTRL|KEY_SHIFT|KEY_F4, - KEY_CTRLSHIFTF5 =KEY_CTRL|KEY_SHIFT|KEY_F5, - KEY_CTRLSHIFTF6 =KEY_CTRL|KEY_SHIFT|KEY_F6, - KEY_CTRLSHIFTF7 =KEY_CTRL|KEY_SHIFT|KEY_F7, - KEY_CTRLSHIFTF8 =KEY_CTRL|KEY_SHIFT|KEY_F8, - KEY_CTRLSHIFTF9 =KEY_CTRL|KEY_SHIFT|KEY_F9, - KEY_CTRLSHIFTF10 =KEY_CTRL|KEY_SHIFT|KEY_F10, - KEY_CTRLSHIFTF11 =KEY_CTRL|KEY_SHIFT|KEY_F11, - KEY_CTRLSHIFTF12 =KEY_CTRL|KEY_SHIFT|KEY_F12, - - KEY_ALTSHIFTF1 =KEY_ALT|KEY_SHIFT|KEY_F1, - KEY_ALTSHIFTF2 =KEY_ALT|KEY_SHIFT|KEY_F2, - KEY_ALTSHIFTF3 =KEY_ALT|KEY_SHIFT|KEY_F3, - KEY_ALTSHIFTF4 =KEY_ALT|KEY_SHIFT|KEY_F4, - KEY_ALTSHIFTF5 =KEY_ALT|KEY_SHIFT|KEY_F5, - KEY_ALTSHIFTF6 =KEY_ALT|KEY_SHIFT|KEY_F6, - KEY_ALTSHIFTF7 =KEY_ALT|KEY_SHIFT|KEY_F7, - KEY_ALTSHIFTF8 =KEY_ALT|KEY_SHIFT|KEY_F8, - KEY_ALTSHIFTF9 =KEY_ALT|KEY_SHIFT|KEY_F9, - KEY_ALTSHIFTF10 =KEY_ALT|KEY_SHIFT|KEY_F10, - KEY_ALTSHIFTF11 =KEY_ALT|KEY_SHIFT|KEY_F11, - KEY_ALTSHIFTF12 =KEY_ALT|KEY_SHIFT|KEY_F12, - - KEY_CTRLALTF1 =KEY_CTRL|KEY_ALT|KEY_F1, - KEY_CTRLALTF2 =KEY_CTRL|KEY_ALT|KEY_F2, - KEY_CTRLALTF3 =KEY_CTRL|KEY_ALT|KEY_F3, - KEY_CTRLALTF4 =KEY_CTRL|KEY_ALT|KEY_F4, - KEY_CTRLALTF5 =KEY_CTRL|KEY_ALT|KEY_F5, - KEY_CTRLALTF6 =KEY_CTRL|KEY_ALT|KEY_F6, - KEY_CTRLALTF7 =KEY_CTRL|KEY_ALT|KEY_F7, - KEY_CTRLALTF8 =KEY_CTRL|KEY_ALT|KEY_F8, - KEY_CTRLALTF9 =KEY_CTRL|KEY_ALT|KEY_F9, - KEY_CTRLALTF10 =KEY_CTRL|KEY_ALT|KEY_F10, - KEY_CTRLALTF11 =KEY_CTRL|KEY_ALT|KEY_F11, - KEY_CTRLALTF12 =KEY_CTRL|KEY_ALT|KEY_F12, - - KEY_CTRLHOME =KEY_CTRL|KEY_HOME, - KEY_CTRLUP =KEY_CTRL|KEY_UP, - KEY_CTRLPGUP =KEY_CTRL|KEY_PGUP, - KEY_CTRLLEFT =KEY_CTRL|KEY_LEFT, - KEY_CTRLRIGHT =KEY_CTRL|KEY_RIGHT, - KEY_CTRLEND =KEY_CTRL|KEY_END, - KEY_CTRLDOWN =KEY_CTRL|KEY_DOWN, - KEY_CTRLPGDN =KEY_CTRL|KEY_PGDN, - KEY_CTRLINS =KEY_CTRL|KEY_INS, - KEY_CTRLDEL =KEY_CTRL|KEY_DEL, - KEY_CTRLNUMDEL =KEY_CTRL|KEY_NUMDEL, - KEY_CTRLDECIMAL =KEY_CTRL|KEY_DECIMAL, - - KEY_SHIFTHOME =KEY_SHIFT|KEY_HOME, - KEY_SHIFTUP =KEY_SHIFT|KEY_UP, - KEY_SHIFTPGUP =KEY_SHIFT|KEY_PGUP, - KEY_SHIFTLEFT =KEY_SHIFT|KEY_LEFT, - KEY_SHIFTRIGHT =KEY_SHIFT|KEY_RIGHT, - KEY_SHIFTEND =KEY_SHIFT|KEY_END, - KEY_SHIFTDOWN =KEY_SHIFT|KEY_DOWN, - KEY_SHIFTPGDN =KEY_SHIFT|KEY_PGDN, - KEY_SHIFTINS =KEY_SHIFT|KEY_INS, - KEY_SHIFTDEL =KEY_SHIFT|KEY_DEL, - KEY_SHIFTNUMDEL =KEY_SHIFT|KEY_NUMDEL, - KEY_SHIFTDECIMAL =KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTHOME =KEY_ALT|KEY_HOME, - KEY_ALTUP =KEY_ALT|KEY_UP, - KEY_ALTPGUP =KEY_ALT|KEY_PGUP, - KEY_ALTLEFT =KEY_ALT|KEY_LEFT, - KEY_ALTRIGHT =KEY_ALT|KEY_RIGHT, - KEY_ALTEND =KEY_ALT|KEY_END, - KEY_ALTDOWN =KEY_ALT|KEY_DOWN, - KEY_ALTPGDN =KEY_ALT|KEY_PGDN, - KEY_ALTINS =KEY_ALT|KEY_INS, - KEY_ALTDEL =KEY_ALT|KEY_DEL, - KEY_ALTNUMDEL =KEY_ALT|KEY_NUMDEL, - KEY_ALTDECIMAL =KEY_ALT|KEY_DECIMAL, - - KEY_CTRLSHIFTHOME =KEY_CTRL|KEY_SHIFT|KEY_HOME, - KEY_CTRLSHIFTUP =KEY_CTRL|KEY_SHIFT|KEY_UP, - KEY_CTRLSHIFTPGUP =KEY_CTRL|KEY_SHIFT|KEY_PGUP, - KEY_CTRLSHIFTLEFT =KEY_CTRL|KEY_SHIFT|KEY_LEFT, - KEY_CTRLSHIFTRIGHT =KEY_CTRL|KEY_SHIFT|KEY_RIGHT, - KEY_CTRLSHIFTEND =KEY_CTRL|KEY_SHIFT|KEY_END, - KEY_CTRLSHIFTDOWN =KEY_CTRL|KEY_SHIFT|KEY_DOWN, - KEY_CTRLSHIFTPGDN =KEY_CTRL|KEY_SHIFT|KEY_PGDN, - KEY_CTRLSHIFTINS =KEY_CTRL|KEY_SHIFT|KEY_INS, - KEY_CTRLSHIFTDEL =KEY_CTRL|KEY_SHIFT|KEY_DEL, - KEY_CTRLSHIFTNUMDEL =KEY_CTRL|KEY_SHIFT|KEY_NUMDEL, - KEY_CTRLSHIFTDECIMAL =KEY_CTRL|KEY_SHIFT|KEY_DECIMAL, - - KEY_ALTSHIFTHOME =KEY_ALT|KEY_SHIFT|KEY_HOME, - KEY_ALTSHIFTUP =KEY_ALT|KEY_SHIFT|KEY_UP, - KEY_ALTSHIFTPGUP =KEY_ALT|KEY_SHIFT|KEY_PGUP, - KEY_ALTSHIFTLEFT =KEY_ALT|KEY_SHIFT|KEY_LEFT, - KEY_ALTSHIFTRIGHT =KEY_ALT|KEY_SHIFT|KEY_RIGHT, - KEY_ALTSHIFTEND =KEY_ALT|KEY_SHIFT|KEY_END, - KEY_ALTSHIFTDOWN =KEY_ALT|KEY_SHIFT|KEY_DOWN, - KEY_ALTSHIFTPGDN =KEY_ALT|KEY_SHIFT|KEY_PGDN, - KEY_ALTSHIFTINS =KEY_ALT|KEY_SHIFT|KEY_INS, - KEY_ALTSHIFTDEL =KEY_ALT|KEY_SHIFT|KEY_DEL, - KEY_ALTSHIFTNUMDEL =KEY_ALT|KEY_SHIFT|KEY_NUMDEL, - KEY_ALTSHIFTDECIMAL =KEY_ALT|KEY_SHIFT|KEY_DECIMAL, - - KEY_CTRLALTHOME =KEY_CTRL|KEY_ALT|KEY_HOME, - KEY_CTRLALTUP =KEY_CTRL|KEY_ALT|KEY_UP, - KEY_CTRLALTPGUP =KEY_CTRL|KEY_ALT|KEY_PGUP, - KEY_CTRLALTLEFT =KEY_CTRL|KEY_ALT|KEY_LEFT, - KEY_CTRLALTRIGHT =KEY_CTRL|KEY_ALT|KEY_RIGHT, - KEY_CTRLALTEND =KEY_CTRL|KEY_ALT|KEY_END, - KEY_CTRLALTDOWN =KEY_CTRL|KEY_ALT|KEY_DOWN, - KEY_CTRLALTPGDN =KEY_CTRL|KEY_ALT|KEY_PGDN, - KEY_CTRLALTINS =KEY_CTRL|KEY_ALT|KEY_INS, - - KEY_CTRLNUMPAD0 =KEY_CTRL|KEY_NUMPAD0, - KEY_CTRLNUMPAD1 =KEY_CTRL|KEY_NUMPAD1, - KEY_CTRLNUMPAD2 =KEY_CTRL|KEY_NUMPAD2, - KEY_CTRLNUMPAD3 =KEY_CTRL|KEY_NUMPAD3, - KEY_CTRLNUMPAD4 =KEY_CTRL|KEY_NUMPAD4, - KEY_CTRLNUMPAD5 =KEY_CTRL|KEY_NUMPAD5, - KEY_CTRLNUMPAD6 =KEY_CTRL|KEY_NUMPAD6, - KEY_CTRLNUMPAD7 =KEY_CTRL|KEY_NUMPAD7, - KEY_CTRLNUMPAD8 =KEY_CTRL|KEY_NUMPAD8, - KEY_CTRLNUMPAD9 =KEY_CTRL|KEY_NUMPAD9, - - KEY_SHIFTNUMPAD0 =KEY_SHIFT|KEY_NUMPAD0, - KEY_SHIFTNUMPAD1 =KEY_SHIFT|KEY_NUMPAD1, - KEY_SHIFTNUMPAD2 =KEY_SHIFT|KEY_NUMPAD2, - KEY_SHIFTNUMPAD3 =KEY_SHIFT|KEY_NUMPAD3, - KEY_SHIFTNUMPAD4 =KEY_SHIFT|KEY_NUMPAD4, - KEY_SHIFTNUMPAD5 =KEY_SHIFT|KEY_NUMPAD5, - KEY_SHIFTNUMPAD6 =KEY_SHIFT|KEY_NUMPAD6, - KEY_SHIFTNUMPAD7 =KEY_SHIFT|KEY_NUMPAD7, - KEY_SHIFTNUMPAD8 =KEY_SHIFT|KEY_NUMPAD8, - KEY_SHIFTNUMPAD9 =KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSHIFTNUMPAD0 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD0, - KEY_CTRLSHIFTNUMPAD1 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD1, - KEY_CTRLSHIFTNUMPAD2 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD2, - KEY_CTRLSHIFTNUMPAD3 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD3, - KEY_CTRLSHIFTNUMPAD4 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD4, - KEY_CTRLSHIFTNUMPAD5 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD5, - KEY_CTRLSHIFTNUMPAD6 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD6, - KEY_CTRLSHIFTNUMPAD7 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD7, - KEY_CTRLSHIFTNUMPAD8 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD8, - KEY_CTRLSHIFTNUMPAD9 =KEY_CTRL|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLALTNUMPAD0 =KEY_CTRL|KEY_ALT|KEY_NUMPAD0, - KEY_CTRLALTNUMPAD1 =KEY_CTRL|KEY_ALT|KEY_NUMPAD1, - KEY_CTRLALTNUMPAD2 =KEY_CTRL|KEY_ALT|KEY_NUMPAD2, - KEY_CTRLALTNUMPAD3 =KEY_CTRL|KEY_ALT|KEY_NUMPAD3, - KEY_CTRLALTNUMPAD4 =KEY_CTRL|KEY_ALT|KEY_NUMPAD4, - KEY_CTRLALTNUMPAD5 =KEY_CTRL|KEY_ALT|KEY_NUMPAD5, - KEY_CTRLALTNUMPAD6 =KEY_CTRL|KEY_ALT|KEY_NUMPAD6, - KEY_CTRLALTNUMPAD7 =KEY_CTRL|KEY_ALT|KEY_NUMPAD7, - KEY_CTRLALTNUMPAD8 =KEY_CTRL|KEY_ALT|KEY_NUMPAD8, - KEY_CTRLALTNUMPAD9 =KEY_CTRL|KEY_ALT|KEY_NUMPAD9, - - KEY_ALTSHIFTNUMPAD0 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD0, - KEY_ALTSHIFTNUMPAD1 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD1, - KEY_ALTSHIFTNUMPAD2 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD2, - KEY_ALTSHIFTNUMPAD3 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD3, - KEY_ALTSHIFTNUMPAD4 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD4, - KEY_ALTSHIFTNUMPAD5 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD5, - KEY_ALTSHIFTNUMPAD6 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD6, - KEY_ALTSHIFTNUMPAD7 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD7, - KEY_ALTSHIFTNUMPAD8 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD8, - KEY_ALTSHIFTNUMPAD9 =KEY_ALT|KEY_SHIFT|KEY_NUMPAD9, - - KEY_CTRLSLASH =KEY_CTRL|KEY_SLASH, - KEY_CTRLBACKSLASH =KEY_CTRL|KEY_BACKSLASH, - KEY_CTRLCLEAR =KEY_CTRL|KEY_CLEAR, - KEY_CTRLSHIFTCLEAR =KEY_CTRL|KEY_SHIFT|KEY_CLEAR, - KEY_CTRLADD =KEY_CTRL|KEY_ADD, - KEY_SHIFTADD =KEY_SHIFT|KEY_ADD, - - KEY_CTRLSUBTRACT =KEY_CTRL|KEY_SUBTRACT, - KEY_ALTSUBTRACT =KEY_ALT|KEY_SUBTRACT, - KEY_SHIFTSUBTRACT =KEY_SHIFT|KEY_SUBTRACT, - KEY_CTRLMULTIPLY =KEY_CTRL|KEY_MULTIPLY, - - KEY_CTRLBS =KEY_CTRL|KEY_BS, - KEY_ALTBS =KEY_ALT|KEY_BS, - KEY_CTRLSHIFTBS =KEY_CTRL|KEY_SHIFT|KEY_BS, - KEY_SHIFTBS =KEY_SHIFT|KEY_BS, - - KEY_CTRLSHIFTTAB =KEY_CTRL|KEY_SHIFT|KEY_TAB, - KEY_CTRLTAB =KEY_CTRL|KEY_TAB, - KEY_SHIFTTAB =KEY_SHIFT|KEY_TAB, - - KEY_CTRLENTER =KEY_CTRL|KEY_ENTER, - KEY_SHIFTENTER =KEY_SHIFT|KEY_ENTER, - KEY_ALTSHIFTENTER =KEY_ALT|KEY_SHIFT|KEY_ENTER, - KEY_CTRLALTENTER =KEY_CTRL|KEY_ALT|KEY_ENTER, - KEY_CTRLSHIFTENTER =KEY_CTRL|KEY_SHIFT|KEY_ENTER, - - KEY_CTRLNUMENTER =KEY_CTRL|KEY_NUMENTER, - KEY_SHIFTNUMENTER =KEY_SHIFT|KEY_NUMENTER, - KEY_ALTSHIFTNUMENTER =KEY_ALT|KEY_SHIFT|KEY_NUMENTER, - KEY_CTRLALTNUMENTER =KEY_CTRL|KEY_ALT|KEY_NUMENTER, - KEY_CTRLSHIFTNUMENTER =KEY_CTRL|KEY_SHIFT|KEY_NUMENTER, - - KEY_CTRLAPPS =KEY_CTRL|KEY_APPS, - KEY_ALTAPPS =KEY_ALT|KEY_APPS, - KEY_SHIFTAPPS =KEY_SHIFT|KEY_APPS, - KEY_CTRLSHIFTAPPS =KEY_CTRL|KEY_SHIFT|KEY_APPS, - KEY_ALTSHIFTAPPS =KEY_ALT|KEY_SHIFT|KEY_APPS, - KEY_CTRLALTAPPS =KEY_CTRL|KEY_ALT|KEY_APPS, - - KEY_CTRLSPACE =KEY_CTRL|KEY_SPACE, - KEY_SHIFTSPACE =KEY_SHIFT|KEY_SPACE, - KEY_CTRLSHIFTSPACE =KEY_CTRL|KEY_SHIFT|KEY_SPACE, - - KEY_ALT_BASE =KEY_ALT, - KEY_ALTSHIFT_BASE =KEY_ALTSHIFT, -}; - - -#endif // __FARKEYS_HPP__ diff --git a/farsdk/unicode3/plugin.hpp b/farsdk/unicode3/plugin.hpp deleted file mode 100644 index 6ceea37..0000000 --- a/farsdk/unicode3/plugin.hpp +++ /dev/null @@ -1,2664 +0,0 @@ -#pragma once -#ifndef __PLUGIN_HPP__ -#define __PLUGIN_HPP__ - -/* - plugin.hpp - - Plugin API for Far Manager 3.0 build 3192 -*/ - -/* -Copyright 1996 Eugene Roshal -Copyright 2000 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -EXCEPTION: -Far Manager plugins that use this header file can be distributed under any -other possible license with no implications from the above license on them. -*/ - -#define FARMANAGERVERSION_MAJOR 3 -#define FARMANAGERVERSION_MINOR 0 -#define FARMANAGERVERSION_REVISION 0 -#define FARMANAGERVERSION_BUILD 3192 -#define FARMANAGERVERSION_STAGE VS_RELEASE - -#ifndef RC_INVOKED - -#include -#include - -#undef DefDlgProc - -#define FARMACRO_KEY_EVENT (KEY_EVENT|0x8000) - - -#define CP_UNICODE ((uintptr_t)1200) -#define CP_REVERSEBOM ((uintptr_t)1201) -#define CP_DEFAULT ((uintptr_t)-1) -#define CP_REDETECT ((uintptr_t)-2) - -typedef unsigned __int64 FARCOLORFLAGS; -static const FARCOLORFLAGS - FCF_FG_4BIT = 0x0000000000000001ULL, - FCF_BG_4BIT = 0x0000000000000002ULL, - FCF_4BITMASK = 0x0000000000000003ULL, // FCF_FG_4BIT|FCF_BG_4BIT - - FCF_EXTENDEDFLAGS = 0xFFFFFFFFFFFFFFFCULL, // ~FCF_4BITMASK - - FCF_FG_BOLD = 0x1000000000000000ULL, - FCF_FG_ITALIC = 0x2000000000000000ULL, - FCF_FG_UNDERLINE = 0x4000000000000000ULL, - FCF_STYLEMASK = 0x7000000000000000ULL, // FCF_FG_BOLD|FCF_FG_ITALIC|FCF_FG_UNDERLINE - - FCF_NONE = 0; - -struct FarColor -{ - FARCOLORFLAGS Flags; - COLORREF ForegroundColor; - COLORREF BackgroundColor; - void* Reserved; -}; - -#define INDEXMASK 0x0000000f -#define COLORMASK 0x00ffffff -#define ALPHAMASK 0xff000000 - -#define INDEXVALUE(x) ((x)&INDEXMASK) -#define COLORVALUE(x) ((x)&COLORMASK) -#define ALPHAVALUE(x) ((x)&ALPHAMASK) - -#define IS_OPAQUE(x) (ALPHAVALUE(x)==ALPHAMASK) -#define IS_TRANSPARENT(x) (!ALPHAVALUE(x)) -#define MAKE_OPAQUE(x) (x|=ALPHAMASK) -#define MAKE_TRANSPARENT(x) (x&=COLORMASK) - -typedef unsigned __int64 COLORDIALOGFLAGS; -static const COLORDIALOGFLAGS - CDF_NONE = 0; - -typedef BOOL (WINAPI *FARAPICOLORDIALOG)( - const GUID* PluginId, - COLORDIALOGFLAGS Flags, - struct FarColor *Color -); - -typedef unsigned __int64 FARMESSAGEFLAGS; -static const FARMESSAGEFLAGS - FMSG_WARNING = 0x0000000000000001ULL, - FMSG_ERRORTYPE = 0x0000000000000002ULL, - FMSG_KEEPBACKGROUND = 0x0000000000000004ULL, - FMSG_LEFTALIGN = 0x0000000000000008ULL, - FMSG_ALLINONE = 0x0000000000000010ULL, - FMSG_MB_OK = 0x0000000000010000ULL, - FMSG_MB_OKCANCEL = 0x0000000000020000ULL, - FMSG_MB_ABORTRETRYIGNORE = 0x0000000000030000ULL, - FMSG_MB_YESNO = 0x0000000000040000ULL, - FMSG_MB_YESNOCANCEL = 0x0000000000050000ULL, - FMSG_MB_RETRYCANCEL = 0x0000000000060000ULL, - FMSG_NONE = 0; - -typedef intptr_t (WINAPI *FARAPIMESSAGE)( - const GUID* PluginId, - const GUID* Id, - FARMESSAGEFLAGS Flags, - const wchar_t *HelpTopic, - const wchar_t * const *Items, - size_t ItemsNumber, - intptr_t ButtonsNumber -); - -enum FARDIALOGITEMTYPES -{ - DI_TEXT = 0, - DI_VTEXT = 1, - DI_SINGLEBOX = 2, - DI_DOUBLEBOX = 3, - DI_EDIT = 4, - DI_PSWEDIT = 5, - DI_FIXEDIT = 6, - DI_BUTTON = 7, - DI_CHECKBOX = 8, - DI_RADIOBUTTON = 9, - DI_COMBOBOX = 10, - DI_LISTBOX = 11, - - DI_USERCONTROL =255, -}; - -/* - Check diagol element type has inputstring? - (DI_EDIT, DI_FIXEDIT, DI_PSWEDIT, etc) -*/ -static __inline BOOL IsEdit(enum FARDIALOGITEMTYPES Type) -{ - switch (Type) - { - case DI_EDIT: - case DI_FIXEDIT: - case DI_PSWEDIT: - case DI_COMBOBOX: - return TRUE; - default: - return FALSE; - } -} - -typedef unsigned __int64 FARDIALOGITEMFLAGS; -static const FARDIALOGITEMFLAGS - DIF_BOXCOLOR = 0x0000000000000200ULL, - DIF_GROUP = 0x0000000000000400ULL, - DIF_LEFTTEXT = 0x0000000000000800ULL, - DIF_MOVESELECT = 0x0000000000001000ULL, - DIF_SHOWAMPERSAND = 0x0000000000002000ULL, - DIF_CENTERGROUP = 0x0000000000004000ULL, - DIF_NOBRACKETS = 0x0000000000008000ULL, - DIF_MANUALADDHISTORY = 0x0000000000008000ULL, - DIF_SEPARATOR = 0x0000000000010000ULL, - DIF_SEPARATOR2 = 0x0000000000020000ULL, - DIF_EDITOR = 0x0000000000020000ULL, - DIF_LISTNOAMPERSAND = 0x0000000000020000ULL, - DIF_LISTNOBOX = 0x0000000000040000ULL, - DIF_HISTORY = 0x0000000000040000ULL, - DIF_BTNNOCLOSE = 0x0000000000040000ULL, - DIF_CENTERTEXT = 0x0000000000040000ULL, - DIF_SEPARATORUSER = 0x0000000000080000ULL, - DIF_SETSHIELD = 0x0000000000080000ULL, - DIF_EDITEXPAND = 0x0000000000080000ULL, - DIF_DROPDOWNLIST = 0x0000000000100000ULL, - DIF_USELASTHISTORY = 0x0000000000200000ULL, - DIF_MASKEDIT = 0x0000000000400000ULL, - DIF_LISTTRACKMOUSE = 0x0000000000400000ULL, - DIF_LISTTRACKMOUSEINFOCUS = 0x0000000000800000ULL, - DIF_SELECTONENTRY = 0x0000000000800000ULL, - DIF_3STATE = 0x0000000000800000ULL, - DIF_EDITPATH = 0x0000000001000000ULL, - DIF_LISTWRAPMODE = 0x0000000001000000ULL, - DIF_NOAUTOCOMPLETE = 0x0000000002000000ULL, - DIF_LISTAUTOHIGHLIGHT = 0x0000000002000000ULL, - DIF_LISTNOCLOSE = 0x0000000004000000ULL, - DIF_EDITPATHEXEC = 0x0000000004000000ULL, - DIF_HIDDEN = 0x0000000010000000ULL, - DIF_READONLY = 0x0000000020000000ULL, - DIF_NOFOCUS = 0x0000000040000000ULL, - DIF_DISABLE = 0x0000000080000000ULL, - DIF_DEFAULTBUTTON = 0x0000000100000000ULL, - DIF_FOCUS = 0x0000000200000000ULL, - DIF_RIGHTTEXT = 0x0000000400000000ULL, - DIF_WORDWRAP = 0x0000000800000000ULL, - DIF_NONE = 0; - -enum FARMESSAGE -{ - DM_FIRST = 0, - DM_CLOSE = 1, - DM_ENABLE = 2, - DM_ENABLEREDRAW = 3, - DM_GETDLGDATA = 4, - DM_GETDLGITEM = 5, - DM_GETDLGRECT = 6, - DM_GETTEXT = 7, - DM_KEY = 9, - DM_MOVEDIALOG = 10, - DM_SETDLGDATA = 11, - DM_SETDLGITEM = 12, - DM_SETFOCUS = 13, - DM_REDRAW = 14, - DM_SETTEXT = 15, - DM_SETMAXTEXTLENGTH = 16, - DM_SHOWDIALOG = 17, - DM_GETFOCUS = 18, - DM_GETCURSORPOS = 19, - DM_SETCURSORPOS = 20, - DM_SETTEXTPTR = 22, - DM_SHOWITEM = 23, - DM_ADDHISTORY = 24, - - DM_GETCHECK = 25, - DM_SETCHECK = 26, - DM_SET3STATE = 27, - - DM_LISTSORT = 28, - DM_LISTGETITEM = 29, - DM_LISTGETCURPOS = 30, - DM_LISTSETCURPOS = 31, - DM_LISTDELETE = 32, - DM_LISTADD = 33, - DM_LISTADDSTR = 34, - DM_LISTUPDATE = 35, - DM_LISTINSERT = 36, - DM_LISTFINDSTRING = 37, - DM_LISTINFO = 38, - DM_LISTGETDATA = 39, - DM_LISTSETDATA = 40, - DM_LISTSETTITLES = 41, - DM_LISTGETTITLES = 42, - - DM_RESIZEDIALOG = 43, - DM_SETITEMPOSITION = 44, - - DM_GETDROPDOWNOPENED = 45, - DM_SETDROPDOWNOPENED = 46, - - DM_SETHISTORY = 47, - - DM_GETITEMPOSITION = 48, - DM_SETMOUSEEVENTNOTIFY = 49, - - DM_EDITUNCHANGEDFLAG = 50, - - DM_GETITEMDATA = 51, - DM_SETITEMDATA = 52, - - DM_LISTSET = 53, - - DM_GETCURSORSIZE = 54, - DM_SETCURSORSIZE = 55, - - DM_LISTGETDATASIZE = 56, - - DM_GETSELECTION = 57, - DM_SETSELECTION = 58, - - DM_GETEDITPOSITION = 59, - DM_SETEDITPOSITION = 60, - - DM_SETCOMBOBOXEVENT = 61, - DM_GETCOMBOBOXEVENT = 62, - - DM_GETCONSTTEXTPTR = 63, - DM_GETDLGITEMSHORT = 64, - DM_SETDLGITEMSHORT = 65, - - DM_GETDIALOGINFO = 66, - - DN_FIRST = 4096, - DN_BTNCLICK = 4097, - DN_CTLCOLORDIALOG = 4098, - DN_CTLCOLORDLGITEM = 4099, - DN_CTLCOLORDLGLIST = 4100, - DN_DRAWDIALOG = 4101, - DN_DRAWDLGITEM = 4102, - DN_EDITCHANGE = 4103, - DN_ENTERIDLE = 4104, - DN_GOTFOCUS = 4105, - DN_HELP = 4106, - DN_HOTKEY = 4107, - DN_INITDIALOG = 4108, - DN_KILLFOCUS = 4109, - DN_LISTCHANGE = 4110, - DN_DRAGGED = 4111, - DN_RESIZECONSOLE = 4112, - DN_DRAWDIALOGDONE = 4113, - DN_LISTHOTKEY = 4114, - DN_INPUT = 4115, - DN_CONTROLINPUT = 4116, - DN_CLOSE = 4117, - DN_GETVALUE = 4118, - - DM_USER = 0x4000, - -}; - -enum FARCHECKEDSTATE -{ - BSTATE_UNCHECKED = 0, - BSTATE_CHECKED = 1, - BSTATE_3STATE = 2, - BSTATE_TOGGLE = 3, -}; - -enum FARCOMBOBOXEVENTTYPE -{ - CBET_KEY = 0x00000001, - CBET_MOUSE = 0x00000002, -}; - -typedef unsigned __int64 LISTITEMFLAGS; -static const LISTITEMFLAGS - LIF_SELECTED = 0x0000000000010000ULL, - LIF_CHECKED = 0x0000000000020000ULL, - LIF_SEPARATOR = 0x0000000000040000ULL, - LIF_DISABLE = 0x0000000000080000ULL, - LIF_GRAYED = 0x0000000000100000ULL, - LIF_HIDDEN = 0x0000000000200000ULL, - LIF_DELETEUSERDATA = 0x0000000080000000ULL, - LIF_NONE = 0; - - - -struct FarListItem -{ - LISTITEMFLAGS Flags; - const wchar_t *Text; - intptr_t Reserved[2]; -}; - -struct FarListUpdate -{ - size_t StructSize; - intptr_t Index; - struct FarListItem Item; -}; - -struct FarListInsert -{ - size_t StructSize; - intptr_t Index; - struct FarListItem Item; -}; - -struct FarListGetItem -{ - size_t StructSize; - intptr_t ItemIndex; - struct FarListItem Item; -}; - -struct FarListPos -{ - size_t StructSize; - intptr_t SelectPos; - intptr_t TopPos; -}; - -typedef unsigned __int64 FARLISTFINDFLAGS; -static const FARLISTFINDFLAGS - LIFIND_EXACTMATCH = 0x0000000000000001ULL, - LIFIND_NONE = 0; - - -struct FarListFind -{ - size_t StructSize; - intptr_t StartIndex; - const wchar_t *Pattern; - FARLISTFINDFLAGS Flags; -}; - -struct FarListDelete -{ - size_t StructSize; - intptr_t StartIndex; - intptr_t Count; -}; - -typedef unsigned __int64 FARLISTINFOFLAGS; -static const FARLISTINFOFLAGS - LINFO_SHOWNOBOX = 0x0000000000000400ULL, - LINFO_AUTOHIGHLIGHT = 0x0000000000000800ULL, - LINFO_REVERSEHIGHLIGHT = 0x0000000000001000ULL, - LINFO_WRAPMODE = 0x0000000000008000ULL, - LINFO_SHOWAMPERSAND = 0x0000000000010000ULL, - LINFO_NONE = 0; - -struct FarListInfo -{ - size_t StructSize; - FARLISTINFOFLAGS Flags; - size_t ItemsNumber; - intptr_t SelectPos; - intptr_t TopPos; - intptr_t MaxHeight; - intptr_t MaxLength; -}; - -struct FarListItemData -{ - size_t StructSize; - intptr_t Index; - size_t DataSize; - void *Data; -}; - -struct FarList -{ - size_t StructSize; - size_t ItemsNumber; - struct FarListItem *Items; -}; - -struct FarListTitles -{ - size_t StructSize; - size_t TitleSize; - const wchar_t *Title; - size_t BottomSize; - const wchar_t *Bottom; -}; - -struct FarDialogItemColors -{ - size_t StructSize; - unsigned __int64 Flags; - size_t ColorsCount; - struct FarColor* Colors; -}; - -struct FAR_CHAR_INFO -{ - WCHAR Char; - struct FarColor Attributes; -}; - -struct FarDialogItem -{ - enum FARDIALOGITEMTYPES Type; - intptr_t X1,Y1,X2,Y2; - union - { - intptr_t Selected; - struct FarList *ListItems; - struct FAR_CHAR_INFO *VBuf; - intptr_t Reserved0; - } -#ifndef __cplusplus - Param -#endif - ; - const wchar_t *History; - const wchar_t *Mask; - FARDIALOGITEMFLAGS Flags; - const wchar_t *Data; - size_t MaxLength; // terminate 0 not included (if == 0 string size is unlimited) - intptr_t UserData; - intptr_t Reserved[2]; -}; - -struct FarDialogItemData -{ - size_t StructSize; - size_t PtrLength; - wchar_t *PtrData; -}; - -struct FarDialogEvent -{ - size_t StructSize; - HANDLE hDlg; - intptr_t Msg; - intptr_t Param1; - void* Param2; - intptr_t Result; -}; - -struct OpenDlgPluginData -{ - size_t StructSize; - HANDLE hDlg; -}; - -struct DialogInfo -{ - size_t StructSize; - GUID Id; - GUID Owner; -}; - -struct FarGetDialogItem -{ - size_t StructSize; - size_t Size; - struct FarDialogItem* Item; -}; - -#define Dlg_RedrawDialog(Info,hDlg) Info.SendDlgMessage(hDlg,DM_REDRAW,0,0) - -#define Dlg_GetDlgData(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETDLGDATA,0,0) -#define Dlg_SetDlgData(Info,hDlg,Data) Info.SendDlgMessage(hDlg,DM_SETDLGDATA,0,(intptr_t)Data) - -#define Dlg_GetDlgItemData(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETITEMDATA,0,0) -#define Dlg_SetDlgItemData(Info,hDlg,ID,Data) Info.SendDlgMessage(hDlg,DM_SETITEMDATA,0,(intptr_t)Data) - -#define DlgItem_GetFocus(Info,hDlg) Info.SendDlgMessage(hDlg,DM_GETFOCUS,0,0) -#define DlgItem_SetFocus(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_SETFOCUS,ID,0) -#define DlgItem_Enable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,TRUE) -#define DlgItem_Disable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,FALSE) -#define DlgItem_IsEnable(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_ENABLE,ID,-1) -#define DlgItem_SetText(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,ID,(intptr_t)Str) - -#define DlgItem_GetCheck(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_GETCHECK,ID,0) -#define DlgItem_SetCheck(Info,hDlg,ID,State) Info.SendDlgMessage(hDlg,DM_SETCHECK,ID,State) - -#define DlgEdit_AddHistory(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_ADDHISTORY,ID,(intptr_t)Str) - -#define DlgList_AddString(Info,hDlg,ID,Str) Info.SendDlgMessage(hDlg,DM_LISTADDSTR,ID,(intptr_t)Str) -#define DlgList_GetCurPos(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,ID,0) -#define DlgList_SetCurPos(Info,hDlg,ID,NewPos) {struct FarListPos LPos={sizeof(FarListPos),NewPos,-1};Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,ID,(intptr_t)&LPos);} -#define DlgList_ClearList(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,0) -#define DlgList_DeleteItem(Info,hDlg,ID,Index) {struct FarListDelete FLDItem={sizeof(FarListDelete),Index,1}; Info.SendDlgMessage(hDlg,DM_LISTDELETE,ID,(intptr_t)&FLDItem);} -#define DlgList_SortUp(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,0) -#define DlgList_SortDown(Info,hDlg,ID) Info.SendDlgMessage(hDlg,DM_LISTSORT,ID,1) -#define DlgList_GetItemData(Info,hDlg,ID,Index) Info.SendDlgMessage(hDlg,DM_LISTGETDATA,ID,Index) -#define DlgList_SetItemStrAsData(Info,hDlg,ID,Index,Str) {struct FarListItemData FLID{sizeof(FarListItemData),Index,0,Str,0}; Info.SendDlgMessage(hDlg,DM_LISTSETDATA,ID,(intptr_t)&FLID);} - -typedef unsigned __int64 FARDIALOGFLAGS; -static const FARDIALOGFLAGS - FDLG_WARNING = 0x0000000000000001ULL, - FDLG_SMALLDIALOG = 0x0000000000000002ULL, - FDLG_NODRAWSHADOW = 0x0000000000000004ULL, - FDLG_NODRAWPANEL = 0x0000000000000008ULL, - FDLG_KEEPCONSOLETITLE = 0x0000000000000010ULL, - FDLG_NONE = 0; - -typedef intptr_t(WINAPI *FARWINDOWPROC)( - HANDLE hDlg, - intptr_t Msg, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t(WINAPI *FARAPISENDDLGMESSAGE)( - HANDLE hDlg, - intptr_t Msg, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t(WINAPI *FARAPIDEFDLGPROC)( - HANDLE hDlg, - intptr_t Msg, - intptr_t Param1, - void* Param2 -); - -typedef HANDLE(WINAPI *FARAPIDIALOGINIT)( - const GUID* PluginId, - const GUID* Id, - intptr_t X1, - intptr_t Y1, - intptr_t X2, - intptr_t Y2, - const wchar_t *HelpTopic, - const struct FarDialogItem *Item, - size_t ItemsNumber, - intptr_t Reserved, - FARDIALOGFLAGS Flags, - FARWINDOWPROC DlgProc, - void* Param -); - -typedef intptr_t (WINAPI *FARAPIDIALOGRUN)( - HANDLE hDlg -); - -typedef void (WINAPI *FARAPIDIALOGFREE)( - HANDLE hDlg -); - -struct FarKey -{ - WORD VirtualKeyCode; - DWORD ControlKeyState; -}; - -typedef unsigned __int64 MENUITEMFLAGS; -static const MENUITEMFLAGS - MIF_SELECTED = 0x000000000010000ULL, - MIF_CHECKED = 0x000000000020000ULL, - MIF_SEPARATOR = 0x000000000040000ULL, - MIF_DISABLE = 0x000000000080000ULL, - MIF_GRAYED = 0x000000000100000ULL, - MIF_HIDDEN = 0x000000000200000ULL, - MIF_NONE = 0; - -struct FarMenuItem -{ - MENUITEMFLAGS Flags; - const wchar_t *Text; - struct FarKey AccelKey; - intptr_t UserData; - intptr_t Reserved[2]; -}; - -typedef unsigned __int64 FARMENUFLAGS; -static const FARMENUFLAGS - FMENU_SHOWAMPERSAND = 0x0000000000000001ULL, - FMENU_WRAPMODE = 0x0000000000000002ULL, - FMENU_AUTOHIGHLIGHT = 0x0000000000000004ULL, - FMENU_REVERSEAUTOHIGHLIGHT = 0x0000000000000008ULL, - FMENU_CHANGECONSOLETITLE = 0x0000000000000010ULL, - FMENU_NONE = 0; - -typedef intptr_t (WINAPI *FARAPIMENU)( - const GUID* PluginId, - const GUID* Id, - intptr_t X, - intptr_t Y, - intptr_t MaxHeight, - FARMENUFLAGS Flags, - const wchar_t *Title, - const wchar_t *Bottom, - const wchar_t *HelpTopic, - const struct FarKey *BreakKeys, - intptr_t *BreakCode, - const struct FarMenuItem *Item, - size_t ItemsNumber -); - - -typedef unsigned __int64 PLUGINPANELITEMFLAGS; -static const PLUGINPANELITEMFLAGS - PPIF_SELECTED = 0x0000000040000000ULL, - PPIF_PROCESSDESCR = 0x0000000080000000ULL, - PPIF_NONE = 0; - -struct FarPanelItemFreeInfo -{ - size_t StructSize; - HANDLE hPlugin; -}; - -typedef void (WINAPI *FARPANELITEMFREECALLBACK)(void* UserData, const struct FarPanelItemFreeInfo* Info); - -struct UserDataItem -{ - void* Data; - FARPANELITEMFREECALLBACK FreeData; -}; - - -struct PluginPanelItem -{ - FILETIME CreationTime; - FILETIME LastAccessTime; - FILETIME LastWriteTime; - FILETIME ChangeTime; - unsigned __int64 FileSize; - unsigned __int64 AllocationSize; - const wchar_t *FileName; - const wchar_t *AlternateFileName; - const wchar_t *Description; - const wchar_t *Owner; - const wchar_t * const *CustomColumnData; - size_t CustomColumnNumber; - PLUGINPANELITEMFLAGS Flags; - struct UserDataItem UserData; - uintptr_t FileAttributes; - uintptr_t NumberOfLinks; - uintptr_t CRC32; - intptr_t Reserved[2]; -}; - -struct FarGetPluginPanelItem -{ - size_t StructSize; - size_t Size; - struct PluginPanelItem* Item; -}; - -typedef unsigned __int64 PANELINFOFLAGS; -static const PANELINFOFLAGS - PFLAGS_SHOWHIDDEN = 0x0000000000000001ULL, - PFLAGS_HIGHLIGHT = 0x0000000000000002ULL, - PFLAGS_REVERSESORTORDER = 0x0000000000000004ULL, - PFLAGS_USESORTGROUPS = 0x0000000000000008ULL, - PFLAGS_SELECTEDFIRST = 0x0000000000000010ULL, - PFLAGS_REALNAMES = 0x0000000000000020ULL, - PFLAGS_NUMERICSORT = 0x0000000000000040ULL, - PFLAGS_PANELLEFT = 0x0000000000000080ULL, - PFLAGS_DIRECTORIESFIRST = 0x0000000000000100ULL, - PFLAGS_USECRC32 = 0x0000000000000200ULL, - PFLAGS_CASESENSITIVESORT = 0x0000000000000400ULL, - PFLAGS_PLUGIN = 0x0000000000000800ULL, - PFLAGS_VISIBLE = 0x0000000000001000ULL, - PFLAGS_FOCUS = 0x0000000000002000ULL, - PFLAGS_ALTERNATIVENAMES = 0x0000000000004000ULL, - PFLAGS_SHORTCUT = 0x0000000000008000ULL, - PFLAGS_NONE = 0; - -enum PANELINFOTYPE -{ - PTYPE_FILEPANEL = 0, - PTYPE_TREEPANEL = 1, - PTYPE_QVIEWPANEL = 2, - PTYPE_INFOPANEL = 3, -}; - -enum OPENPANELINFO_SORTMODES -{ - SM_DEFAULT = 0, - SM_UNSORTED = 1, - SM_NAME = 2, - SM_EXT = 3, - SM_MTIME = 4, - SM_CTIME = 5, - SM_ATIME = 6, - SM_SIZE = 7, - SM_DESCR = 8, - SM_OWNER = 9, - SM_COMPRESSEDSIZE = 10, - SM_NUMLINKS = 11, - SM_NUMSTREAMS = 12, - SM_STREAMSSIZE = 13, - SM_FULLNAME = 14, - SM_CHTIME = 15, -}; - -struct PanelInfo -{ - size_t StructSize; - HANDLE PluginHandle; - GUID OwnerGuid; - PANELINFOFLAGS Flags; - size_t ItemsNumber; - size_t SelectedItemsNumber; - RECT PanelRect; - size_t CurrentItem; - size_t TopPanelItem; - intptr_t ViewMode; - enum PANELINFOTYPE PanelType; - enum OPENPANELINFO_SORTMODES SortMode; -}; - - -struct PanelRedrawInfo -{ - size_t StructSize; - size_t CurrentItem; - size_t TopPanelItem; -}; - -struct CmdLineSelect -{ - size_t StructSize; - intptr_t SelStart; - intptr_t SelEnd; -}; - -struct FarPanelDirectory -{ - size_t StructSize; - const wchar_t* Name; - const wchar_t* Param; - GUID PluginId; - const wchar_t* File; -}; - -#define PANEL_NONE ((HANDLE)(-1)) -#define PANEL_ACTIVE ((HANDLE)(-1)) -#define PANEL_PASSIVE ((HANDLE)(-2)) -#define PANEL_STOP ((HANDLE)(-1)) - -enum FILE_CONTROL_COMMANDS -{ - FCTL_CLOSEPANEL = 0, - FCTL_GETPANELINFO = 1, - FCTL_UPDATEPANEL = 2, - FCTL_REDRAWPANEL = 3, - FCTL_GETCMDLINE = 4, - FCTL_SETCMDLINE = 5, - FCTL_SETSELECTION = 6, - FCTL_SETVIEWMODE = 7, - FCTL_INSERTCMDLINE = 8, - FCTL_SETUSERSCREEN = 9, - FCTL_SETPANELDIRECTORY = 10, - FCTL_SETCMDLINEPOS = 11, - FCTL_GETCMDLINEPOS = 12, - FCTL_SETSORTMODE = 13, - FCTL_SETSORTORDER = 14, - FCTL_SETCMDLINESELECTION = 15, - FCTL_GETCMDLINESELECTION = 16, - FCTL_CHECKPANELSEXIST = 17, - FCTL_SETNUMERICSORT = 18, - FCTL_GETUSERSCREEN = 19, - FCTL_ISACTIVEPANEL = 20, - FCTL_GETPANELITEM = 21, - FCTL_GETSELECTEDPANELITEM = 22, - FCTL_GETCURRENTPANELITEM = 23, - FCTL_GETPANELDIRECTORY = 24, - FCTL_GETCOLUMNTYPES = 25, - FCTL_GETCOLUMNWIDTHS = 26, - FCTL_BEGINSELECTION = 27, - FCTL_ENDSELECTION = 28, - FCTL_CLEARSELECTION = 29, - FCTL_SETDIRECTORIESFIRST = 30, - FCTL_GETPANELFORMAT = 31, - FCTL_GETPANELHOSTFILE = 32, - FCTL_SETCASESENSITIVESORT = 33, - FCTL_GETPANELPREFIX = 34, -}; - -typedef void (WINAPI *FARAPITEXT)( - intptr_t X, - intptr_t Y, - const struct FarColor* Color, - const wchar_t *Str -); - -typedef HANDLE(WINAPI *FARAPISAVESCREEN)(intptr_t X1, intptr_t Y1, intptr_t X2, intptr_t Y2); - -typedef void (WINAPI *FARAPIRESTORESCREEN)(HANDLE hScreen); - - -typedef intptr_t (WINAPI *FARAPIGETDIRLIST)( - const wchar_t *Dir, - struct PluginPanelItem **pPanelItem, - size_t *pItemsNumber -); - -typedef intptr_t (WINAPI *FARAPIGETPLUGINDIRLIST)( - const GUID* PluginId, - HANDLE hPanel, - const wchar_t *Dir, - struct PluginPanelItem **pPanelItem, - size_t *pItemsNumber -); - -typedef void (WINAPI *FARAPIFREEDIRLIST)(struct PluginPanelItem *PanelItem, size_t nItemsNumber); -typedef void (WINAPI *FARAPIFREEPLUGINDIRLIST)(HANDLE hPanel, struct PluginPanelItem *PanelItem, size_t nItemsNumber); - -typedef unsigned __int64 VIEWER_FLAGS; -static const VIEWER_FLAGS - VF_NONMODAL = 0x0000000000000001ULL, - VF_DELETEONCLOSE = 0x0000000000000002ULL, - VF_ENABLE_F6 = 0x0000000000000004ULL, - VF_DISABLEHISTORY = 0x0000000000000008ULL, - VF_IMMEDIATERETURN = 0x0000000000000100ULL, - VF_DELETEONLYFILEONCLOSE = 0x0000000000000200ULL, - VF_NONE = 0; - -typedef intptr_t (WINAPI *FARAPIVIEWER)( - const wchar_t *FileName, - const wchar_t *Title, - intptr_t X1, - intptr_t Y1, - intptr_t X2, - intptr_t Y2, - VIEWER_FLAGS Flags, - uintptr_t CodePage -); - -typedef unsigned __int64 EDITOR_FLAGS; -static const EDITOR_FLAGS - EF_NONMODAL = 0x0000000000000001ULL, - EF_CREATENEW = 0x0000000000000002ULL, - EF_ENABLE_F6 = 0x0000000000000004ULL, - EF_DISABLEHISTORY = 0x0000000000000008ULL, - EF_DELETEONCLOSE = 0x0000000000000010ULL, - EF_IMMEDIATERETURN = 0x0000000000000100ULL, - EF_DELETEONLYFILEONCLOSE = 0x0000000000000200ULL, - EF_LOCKED = 0x0000000000000400ULL, - EF_DISABLESAVEPOS = 0x0000000000000800ULL, - EN_NONE = 0; - -enum EDITOR_EXITCODE -{ - EEC_OPEN_ERROR = 0, - EEC_MODIFIED = 1, - EEC_NOT_MODIFIED = 2, - EEC_LOADING_INTERRUPTED = 3, -}; - -typedef intptr_t (WINAPI *FARAPIEDITOR)( - const wchar_t *FileName, - const wchar_t *Title, - intptr_t X1, - intptr_t Y1, - intptr_t X2, - intptr_t Y2, - EDITOR_FLAGS Flags, - intptr_t StartLine, - intptr_t StartChar, - uintptr_t CodePage -); - -typedef const wchar_t*(WINAPI *FARAPIGETMSG)( - const GUID* PluginId, - intptr_t MsgId -); - -typedef unsigned __int64 FARHELPFLAGS; -static const FARHELPFLAGS - FHELP_NOSHOWERROR = 0x0000000080000000ULL, - FHELP_SELFHELP = 0x0000000000000000ULL, - FHELP_FARHELP = 0x0000000000000001ULL, - FHELP_CUSTOMFILE = 0x0000000000000002ULL, - FHELP_CUSTOMPATH = 0x0000000000000004ULL, - FHELP_USECONTENTS = 0x0000000040000000ULL, - FHELP_NONE = 0; - -typedef BOOL (WINAPI *FARAPISHOWHELP)( - const wchar_t *ModuleName, - const wchar_t *Topic, - FARHELPFLAGS Flags -); - -enum ADVANCED_CONTROL_COMMANDS -{ - ACTL_GETFARMANAGERVERSION = 0, - ACTL_WAITKEY = 2, - ACTL_GETCOLOR = 3, - ACTL_GETARRAYCOLOR = 4, - ACTL_GETWINDOWINFO = 6, - ACTL_GETWINDOWCOUNT = 7, - ACTL_SETCURRENTWINDOW = 8, - ACTL_COMMIT = 9, - ACTL_GETFARHWND = 10, - ACTL_SETARRAYCOLOR = 16, - ACTL_REDRAWALL = 19, - ACTL_SYNCHRO = 20, - ACTL_SETPROGRESSSTATE = 21, - ACTL_SETPROGRESSVALUE = 22, - ACTL_QUIT = 23, - ACTL_GETFARRECT = 24, - ACTL_GETCURSORPOS = 25, - ACTL_SETCURSORPOS = 26, - ACTL_PROGRESSNOTIFY = 27, - ACTL_GETWINDOWTYPE = 28, - - -}; - - - - -enum FAR_MACRO_CONTROL_COMMANDS -{ - MCTL_LOADALL = 0, - MCTL_SAVEALL = 1, - MCTL_SENDSTRING = 2, - MCTL_GETSTATE = 5, - MCTL_GETAREA = 6, - MCTL_ADDMACRO = 7, - MCTL_DELMACRO = 8, - MCTL_GETLASTERROR = 9, -}; - -typedef unsigned __int64 FARKEYMACROFLAGS; -static const FARKEYMACROFLAGS - KMFLAGS_DISABLEOUTPUT = 0x0000000000000001, - KMFLAGS_NOSENDKEYSTOPLUGINS = 0x0000000000000002, - KMFLAGS_SILENTCHECK = 0x0000000000000001, - KMFLAGS_NONE = 0; - -enum FARMACROSENDSTRINGCOMMAND -{ - MSSC_POST =0, - MSSC_CHECK =2, -}; - -enum FARMACROAREA -{ - MACROAREA_OTHER = 0, - MACROAREA_SHELL = 1, - MACROAREA_VIEWER = 2, - MACROAREA_EDITOR = 3, - MACROAREA_DIALOG = 4, - MACROAREA_SEARCH = 5, - MACROAREA_DISKS = 6, - MACROAREA_MAINMENU = 7, - MACROAREA_MENU = 8, - MACROAREA_HELP = 9, - MACROAREA_INFOPANEL = 10, - MACROAREA_QVIEWPANEL = 11, - MACROAREA_TREEPANEL = 12, - MACROAREA_FINDFOLDER = 13, - MACROAREA_USERMENU = 14, - MACROAREA_SHELLAUTOCOMPLETION = 15, - MACROAREA_DIALOGAUTOCOMPLETION = 16, - - MACROAREA_COMMON = 255, -}; - -enum FARMACROSTATE -{ - MACROSTATE_NOMACRO = 0, - MACROSTATE_EXECUTING = 1, - MACROSTATE_EXECUTING_COMMON = 2, - MACROSTATE_RECORDING = 3, - MACROSTATE_RECORDING_COMMON = 4, -}; - -enum FARMACROPARSEERRORCODE -{ - MPEC_SUCCESS = 0, - MPEC_ERROR = 1, -}; - -struct MacroParseResult -{ - size_t StructSize; - DWORD ErrCode; - COORD ErrPos; - const wchar_t *ErrSrc; -}; - - -struct MacroSendMacroText -{ - size_t StructSize; - FARKEYMACROFLAGS Flags; - INPUT_RECORD AKey; - const wchar_t *SequenceText; -}; - -typedef unsigned __int64 FARADDKEYMACROFLAGS; -static const FARADDKEYMACROFLAGS - AKMFLAGS_NONE = 0; - -typedef intptr_t (WINAPI *FARMACROCALLBACK)(void* Id,FARADDKEYMACROFLAGS Flags); - -struct MacroAddMacro -{ - size_t StructSize; - void* Id; - const wchar_t *SequenceText; - const wchar_t *Description; - FARKEYMACROFLAGS Flags; - INPUT_RECORD AKey; - enum FARMACROAREA Area; - FARMACROCALLBACK Callback; -}; - -enum FARMACROVARTYPE -{ - FMVT_UNKNOWN = 0, - FMVT_INTEGER = 1, - FMVT_STRING = 2, - FMVT_DOUBLE = 3, - FMVT_BOOLEAN = 4, - FMVT_BINARY = 5, - FMVT_POINTER = 6, -}; - -struct FarMacroValue -{ - enum FARMACROVARTYPE Type; - union - { - __int64 Integer; - __int64 Boolean; - double Double; - const wchar_t *String; - void *Pointer; - struct - { - void *Data; - size_t Size; - } Binary; - } -#ifndef __cplusplus - Value -#endif - ; -}; - -enum MACROPLUGINRETURNTYPE -{ - MPRT_NORMALFINISH = 0, - MPRT_ERRORFINISH = 1, - MPRT_ERRORPARSE = 2, - MPRT_KEYS = 3, - MPRT_PRINT = 4, - MPRT_PLUGINCALL = 5, - MPRT_PLUGINMENU = 6, - MPRT_PLUGINCONFIG = 7, - MPRT_PLUGINCOMMAND = 8, - MPRT_COMMONCASE = 9, -}; - -struct MacroPluginReturn -{ - size_t Count; - struct FarMacroValue *Values; - enum MACROPLUGINRETURNTYPE ReturnType; -}; - -struct FarMacroCall -{ - size_t StructSize; - size_t Count; - struct FarMacroValue *Values; - void (WINAPI *Callback)(void *CallbackData, struct FarMacroValue *Values, size_t Count); - void *CallbackData; -}; - - -struct FarGetValue -{ - size_t StructSize; - intptr_t Type; - struct FarMacroValue Value; -}; - -typedef unsigned __int64 FARSETCOLORFLAGS; -static const FARSETCOLORFLAGS - FSETCLR_REDRAW = 0x0000000000000001ULL, - FSETCLR_NONE = 0; - -struct FarSetColors -{ - size_t StructSize; - FARSETCOLORFLAGS Flags; - size_t StartIndex; - size_t ColorsCount; - struct FarColor* Colors; -}; - -enum WINDOWINFO_TYPE -{ - WTYPE_PANELS = 1, - WTYPE_VIEWER = 2, - WTYPE_EDITOR = 3, - WTYPE_DIALOG = 4, - WTYPE_VMENU = 5, - WTYPE_HELP = 6, -}; - -typedef unsigned __int64 WINDOWINFO_FLAGS; -static const WINDOWINFO_FLAGS - WIF_MODIFIED = 0x0000000000000001ULL, - WIF_CURRENT = 0x0000000000000002ULL, - WIF_MODAL = 0x0000000000000004ULL; - -struct WindowInfo -{ - size_t StructSize; - intptr_t Id; - wchar_t *TypeName; - wchar_t *Name; - intptr_t TypeNameSize; - intptr_t NameSize; - intptr_t Pos; - enum WINDOWINFO_TYPE Type; - WINDOWINFO_FLAGS Flags; -}; - -struct WindowType -{ - size_t StructSize; - enum WINDOWINFO_TYPE Type; -}; - -enum TASKBARPROGRESSTATE -{ - TBPS_NOPROGRESS =0x0, - TBPS_INDETERMINATE=0x1, - TBPS_NORMAL =0x2, - TBPS_ERROR =0x4, - TBPS_PAUSED =0x8, -}; - -struct ProgressValue -{ - size_t StructSize; - unsigned __int64 Completed; - unsigned __int64 Total; -}; - -enum VIEWER_CONTROL_COMMANDS -{ - VCTL_GETINFO = 0, - VCTL_QUIT = 1, - VCTL_REDRAW = 2, - VCTL_SETKEYBAR = 3, - VCTL_SETPOSITION = 4, - VCTL_SELECT = 5, - VCTL_SETMODE = 6, - VCTL_GETFILENAME = 7, -}; - -typedef unsigned __int64 VIEWER_OPTIONS; -static const VIEWER_OPTIONS - VOPT_SAVEFILEPOSITION = 0x0000000000000001ULL, - VOPT_AUTODETECTCODEPAGE = 0x0000000000000002ULL, - VOPT_NONE = 0; - -enum VIEWER_SETMODE_TYPES -{ - VSMT_VIEWMODE = 0, - VSMT_WRAP = 1, - VSMT_WORDWRAP = 2, -}; - -typedef unsigned __int64 VIEWER_SETMODEFLAGS_TYPES; -static const VIEWER_SETMODEFLAGS_TYPES - VSMFL_REDRAW = 0x0000000000000001ULL; - -struct ViewerSetMode -{ - size_t StructSize; - enum VIEWER_SETMODE_TYPES Type; - union - { - intptr_t iParam; - wchar_t *wszParam; - } -#ifndef __cplusplus - Param -#endif - ; - VIEWER_SETMODEFLAGS_TYPES Flags; -}; - -struct ViewerSelect -{ - size_t StructSize; - __int64 BlockStartPos; - __int64 BlockLen; -}; - -typedef unsigned __int64 VIEWER_SETPOS_FLAGS; -static const VIEWER_SETPOS_FLAGS - VSP_NOREDRAW = 0x0000000000000001ULL, - VSP_PERCENT = 0x0000000000000002ULL, - VSP_RELATIVE = 0x0000000000000004ULL, - VSP_NORETNEWPOS = 0x0000000000000008ULL; - -struct ViewerSetPosition -{ - size_t StructSize; - VIEWER_SETPOS_FLAGS Flags; - __int64 StartPos; - __int64 LeftPos; -}; - -typedef unsigned __int64 VIEWER_MODE_FLAGS; -static const VIEWER_MODE_FLAGS - VMF_WRAP = 0x0000000000000001ULL, - VMF_WORDWRAP = 0x0000000000000002ULL; - -enum VIEWER_MODE_TYPE -{ - VMT_TEXT =0, - VMT_HEX =1, - VMT_DUMP =2, -}; - -struct ViewerMode -{ - uintptr_t CodePage; - VIEWER_MODE_FLAGS Flags; - enum VIEWER_MODE_TYPE ViewMode; -}; - -struct ViewerInfo -{ - size_t StructSize; - intptr_t ViewerID; - intptr_t TabSize; - struct ViewerMode CurMode; - __int64 FileSize; - __int64 FilePos; - __int64 LeftPos; - VIEWER_OPTIONS Options; - intptr_t WindowSizeX; - intptr_t WindowSizeY; -}; - -enum VIEWER_EVENTS -{ - VE_READ =0, - VE_CLOSE =1, - - VE_GOTFOCUS =6, - VE_KILLFOCUS =7, -}; - - -enum EDITOR_EVENTS -{ - EE_READ =0, - EE_SAVE =1, - EE_REDRAW =2, - EE_CLOSE =3, - - EE_GOTFOCUS =6, - EE_KILLFOCUS =7, - EE_CHANGE =8, -}; - -enum DIALOG_EVENTS -{ - DE_DLGPROCINIT =0, - DE_DEFDLGPROCINIT =1, - DE_DLGPROCEND =2, -}; - -enum SYNCHRO_EVENTS -{ - SE_COMMONSYNCHRO =0, -}; - -#define EEREDRAW_ALL (void*)0 -#define CURRENT_EDITOR -1 - -enum EDITOR_CONTROL_COMMANDS -{ - ECTL_GETSTRING = 0, - ECTL_SETSTRING = 1, - ECTL_INSERTSTRING = 2, - ECTL_DELETESTRING = 3, - ECTL_DELETECHAR = 4, - ECTL_INSERTTEXT = 5, - ECTL_GETINFO = 6, - ECTL_SETPOSITION = 7, - ECTL_SELECT = 8, - ECTL_REDRAW = 9, - ECTL_TABTOREAL = 10, - ECTL_REALTOTAB = 11, - ECTL_EXPANDTABS = 12, - ECTL_SETTITLE = 13, - ECTL_READINPUT = 14, - ECTL_PROCESSINPUT = 15, - ECTL_ADDCOLOR = 16, - ECTL_GETCOLOR = 17, - ECTL_SAVEFILE = 18, - ECTL_QUIT = 19, - ECTL_SETKEYBAR = 20, - - ECTL_SETPARAM = 22, - ECTL_GETBOOKMARKS = 23, - ECTL_DELETEBLOCK = 25, - ECTL_ADDSESSIONBOOKMARK = 26, - ECTL_PREVSESSIONBOOKMARK = 27, - ECTL_NEXTSESSIONBOOKMARK = 28, - ECTL_CLEARSESSIONBOOKMARKS = 29, - ECTL_DELETESESSIONBOOKMARK = 30, - ECTL_GETSESSIONBOOKMARKS = 31, - ECTL_UNDOREDO = 32, - ECTL_GETFILENAME = 33, - ECTL_DELCOLOR = 34, -}; - -enum EDITOR_SETPARAMETER_TYPES -{ - ESPT_TABSIZE = 0, - ESPT_EXPANDTABS = 1, - ESPT_AUTOINDENT = 2, - ESPT_CURSORBEYONDEOL = 3, - ESPT_CHARCODEBASE = 4, - ESPT_CODEPAGE = 5, - ESPT_SAVEFILEPOSITION = 6, - ESPT_LOCKMODE = 7, - ESPT_SETWORDDIV = 8, - ESPT_GETWORDDIV = 9, - ESPT_SHOWWHITESPACE = 10, - ESPT_SETBOM = 11, -}; - - - -struct EditorSetParameter -{ - size_t StructSize; - enum EDITOR_SETPARAMETER_TYPES Type; - union - { - intptr_t iParam; - wchar_t *wszParam; - intptr_t Reserved; - } -#ifndef __cplusplus - Param -#endif - ; - unsigned __int64 Flags; - size_t Size; -}; - - -enum EDITOR_UNDOREDO_COMMANDS -{ - EUR_BEGIN = 0, - EUR_END = 1, - EUR_UNDO = 2, - EUR_REDO = 3, -}; - - -struct EditorUndoRedo -{ - size_t StructSize; - enum EDITOR_UNDOREDO_COMMANDS Command; -}; - -struct EditorGetString -{ - size_t StructSize; - intptr_t StringNumber; - intptr_t StringLength; - const wchar_t *StringText; - const wchar_t *StringEOL; - intptr_t SelStart; - intptr_t SelEnd; -}; - - -struct EditorSetString -{ - size_t StructSize; - intptr_t StringNumber; - intptr_t StringLength; - const wchar_t *StringText; - const wchar_t *StringEOL; -}; - -enum EXPAND_TABS -{ - EXPAND_NOTABS = 0, - EXPAND_ALLTABS = 1, - EXPAND_NEWTABS = 2, -}; - - -enum EDITOR_OPTIONS -{ - EOPT_EXPANDALLTABS = 0x00000001, - EOPT_PERSISTENTBLOCKS = 0x00000002, - EOPT_DELREMOVESBLOCKS = 0x00000004, - EOPT_AUTOINDENT = 0x00000008, - EOPT_SAVEFILEPOSITION = 0x00000010, - EOPT_AUTODETECTCODEPAGE= 0x00000020, - EOPT_CURSORBEYONDEOL = 0x00000040, - EOPT_EXPANDONLYNEWTABS = 0x00000080, - EOPT_SHOWWHITESPACE = 0x00000100, - EOPT_BOM = 0x00000200, - EOPT_SHOWLINEBREAK = 0x00000400, -}; - - -enum EDITOR_BLOCK_TYPES -{ - BTYPE_NONE = 0, - BTYPE_STREAM = 1, - BTYPE_COLUMN = 2, -}; - -enum EDITOR_CURRENTSTATE -{ - ECSTATE_MODIFIED = 0x00000001, - ECSTATE_SAVED = 0x00000002, - ECSTATE_LOCKED = 0x00000004, -}; - - -struct EditorInfo -{ - size_t StructSize; - intptr_t EditorID; - intptr_t WindowSizeX; - intptr_t WindowSizeY; - intptr_t TotalLines; - intptr_t CurLine; - intptr_t CurPos; - intptr_t CurTabPos; - intptr_t TopScreenLine; - intptr_t LeftPos; - intptr_t Overtype; - intptr_t BlockType; - intptr_t BlockStartLine; - uintptr_t Options; - intptr_t TabSize; - size_t BookmarkCount; - size_t SessionBookmarkCount; - uintptr_t CurState; - uintptr_t CodePage; -}; - -struct EditorBookmarks -{ - size_t StructSize; - size_t Size; - size_t Count; - intptr_t *Line; - intptr_t *Cursor; - intptr_t *ScreenLine; - intptr_t *LeftPos; -}; - -struct EditorSetPosition -{ - size_t StructSize; - intptr_t CurLine; - intptr_t CurPos; - intptr_t CurTabPos; - intptr_t TopScreenLine; - intptr_t LeftPos; - intptr_t Overtype; -}; - - -struct EditorSelect -{ - size_t StructSize; - intptr_t BlockType; - intptr_t BlockStartLine; - intptr_t BlockStartPos; - intptr_t BlockWidth; - intptr_t BlockHeight; -}; - - -struct EditorConvertPos -{ - size_t StructSize; - intptr_t StringNumber; - intptr_t SrcPos; - intptr_t DestPos; -}; - - -typedef unsigned __int64 EDITORCOLORFLAGS; -static const EDITORCOLORFLAGS - ECF_TABMARKFIRST = 0x0000000000000001ULL, - ECF_TABMARKCURRENT = 0x0000000000000002ULL; - -struct EditorColor -{ - size_t StructSize; - intptr_t StringNumber; - intptr_t ColorItem; - intptr_t StartPos; - intptr_t EndPos; - uintptr_t Priority; - EDITORCOLORFLAGS Flags; - struct FarColor Color; - GUID Owner; -}; - -struct EditorDeleteColor -{ - size_t StructSize; - GUID Owner; - intptr_t StringNumber; - intptr_t StartPos; -}; - -#define EDITOR_COLOR_NORMAL_PRIORITY 0x80000000U - -struct EditorSaveFile -{ - size_t StructSize; - const wchar_t *FileName; - const wchar_t *FileEOL; - uintptr_t CodePage; -}; - -enum EDITOR_CHANGETYPE -{ - ECTYPE_CHANGED = 0, - ECTYPE_ADDED = 1, - ECTYPE_DELETED = 2, -}; - -struct EditorChange -{ - size_t StructSize; - enum EDITOR_CHANGETYPE Type; - intptr_t StringNumber; -}; - -typedef unsigned __int64 INPUTBOXFLAGS; -static const INPUTBOXFLAGS - FIB_ENABLEEMPTY = 0x0000000000000001ULL, - FIB_PASSWORD = 0x0000000000000002ULL, - FIB_EXPANDENV = 0x0000000000000004ULL, - FIB_NOUSELASTHISTORY = 0x0000000000000008ULL, - FIB_BUTTONS = 0x0000000000000010ULL, - FIB_NOAMPERSAND = 0x0000000000000020ULL, - FIB_EDITPATH = 0x0000000000000040ULL, - FIB_EDITPATHEXEC = 0x0000000000000080ULL, - FIB_NONE = 0; - -typedef intptr_t (WINAPI *FARAPIINPUTBOX)( - const GUID* PluginId, - const GUID* Id, - const wchar_t *Title, - const wchar_t *SubTitle, - const wchar_t *HistoryName, - const wchar_t *SrcText, - wchar_t *DestText, - size_t DestSize, - const wchar_t *HelpTopic, - INPUTBOXFLAGS Flags -); - -enum FAR_PLUGINS_CONTROL_COMMANDS -{ - PCTL_LOADPLUGIN = 0, - PCTL_UNLOADPLUGIN = 1, - PCTL_FORCEDLOADPLUGIN = 2, - PCTL_FINDPLUGIN = 3, - PCTL_GETPLUGININFORMATION = 4, - PCTL_GETPLUGINS = 5, -}; - -enum FAR_PLUGIN_LOAD_TYPE -{ - PLT_PATH = 0, -}; - -enum FAR_PLUGIN_FIND_TYPE -{ - PFM_GUID = 0, - PFM_MODULENAME = 1, -}; - -typedef unsigned __int64 FAR_PLUGIN_FLAGS; -static const FAR_PLUGIN_FLAGS - FPF_LOADED = 0x0000000000000001ULL, - FPF_ANSI = 0x1000000000000000ULL, - FPF_NONE = 0; - -enum FAR_FILE_FILTER_CONTROL_COMMANDS -{ - FFCTL_CREATEFILEFILTER = 0, - FFCTL_FREEFILEFILTER = 1, - FFCTL_OPENFILTERSMENU = 2, - FFCTL_STARTINGTOFILTER = 3, - FFCTL_ISFILEINFILTER = 4, -}; - -enum FAR_FILE_FILTER_TYPE -{ - FFT_PANEL = 0, - FFT_FINDFILE = 1, - FFT_COPY = 2, - FFT_SELECT = 3, - FFT_CUSTOM = 4, -}; - -enum FAR_REGEXP_CONTROL_COMMANDS -{ - RECTL_CREATE = 0, - RECTL_FREE = 1, - RECTL_COMPILE = 2, - RECTL_OPTIMIZE = 3, - RECTL_MATCHEX = 4, - RECTL_SEARCHEX = 5, - RECTL_BRACKETSCOUNT = 6, -}; - -struct RegExpMatch -{ - intptr_t start,end; -}; - -struct RegExpSearch -{ - const wchar_t* Text; - intptr_t Position; - intptr_t Length; - struct RegExpMatch* Match; - intptr_t Count; - void* Reserved; -}; - -enum FAR_SETTINGS_CONTROL_COMMANDS -{ - SCTL_CREATE = 0, - SCTL_FREE = 1, - SCTL_SET = 2, - SCTL_GET = 3, - SCTL_ENUM = 4, - SCTL_DELETE = 5, - SCTL_CREATESUBKEY = 6, - SCTL_OPENSUBKEY = 7, -}; - -enum FARSETTINGSTYPES -{ - FST_UNKNOWN = 0, - FST_SUBKEY = 1, - FST_QWORD = 2, - FST_STRING = 3, - FST_DATA = 4, -}; - -enum FARSETTINGS_SUBFOLDERS -{ - FSSF_ROOT = 0, - FSSF_HISTORY_CMD = 1, - FSSF_HISTORY_FOLDER = 2, - FSSF_HISTORY_VIEW = 3, - FSSF_HISTORY_EDIT = 4, - FSSF_HISTORY_EXTERNAL = 5, - FSSF_FOLDERSHORTCUT_0 = 6, - FSSF_FOLDERSHORTCUT_1 = 7, - FSSF_FOLDERSHORTCUT_2 = 8, - FSSF_FOLDERSHORTCUT_3 = 9, - FSSF_FOLDERSHORTCUT_4 = 10, - FSSF_FOLDERSHORTCUT_5 = 11, - FSSF_FOLDERSHORTCUT_6 = 12, - FSSF_FOLDERSHORTCUT_7 = 13, - FSSF_FOLDERSHORTCUT_8 = 14, - FSSF_FOLDERSHORTCUT_9 = 15, - FSSF_CONFIRMATIONS = 16, - FSSF_SYSTEM = 17, - FSSF_PANEL = 18, - FSSF_EDITOR = 19, - FSSF_SCREEN = 20, - FSSF_DIALOG = 21, - FSSF_INTERFACE = 22, - FSSF_PANELLAYOUT = 23, -}; - -enum FAR_PLUGIN_SETTINGS_LOCATION -{ - PSL_ROAMING = 0, - PSL_LOCAL = 1, -}; - -struct FarSettingsCreate -{ - size_t StructSize; - GUID Guid; - HANDLE Handle; -}; - -struct FarSettingsItem -{ - size_t StructSize; - size_t Root; - const wchar_t* Name; - enum FARSETTINGSTYPES Type; - union - { - unsigned __int64 Number; - const wchar_t* String; - struct - { - size_t Size; - const void* Data; - } Data; - } -#ifndef __cplusplus - Value -#endif - ; -}; - -struct FarSettingsName -{ - const wchar_t* Name; - enum FARSETTINGSTYPES Type; -}; - -struct FarSettingsHistory -{ - const wchar_t* Name; - const wchar_t* Param; - GUID PluginId; - const wchar_t* File; - FILETIME Time; - BOOL Lock; -}; - -struct FarSettingsEnum -{ - size_t StructSize; - size_t Root; - size_t Count; - union - { - const struct FarSettingsName* Items; - const struct FarSettingsHistory* Histories; - } -#ifndef __cplusplus - Value -#endif - ; -}; - -struct FarSettingsValue -{ - size_t StructSize; - size_t Root; - const wchar_t* Value; -}; - -typedef intptr_t (WINAPI *FARAPIPANELCONTROL)( - HANDLE hPanel, - enum FILE_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t(WINAPI *FARAPIADVCONTROL)( - const GUID* PluginId, - enum ADVANCED_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIVIEWERCONTROL)( - intptr_t ViewerID, - enum VIEWER_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIEDITORCONTROL)( - intptr_t EditorID, - enum EDITOR_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIMACROCONTROL)( - const GUID* PluginId, - enum FAR_MACRO_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIPLUGINSCONTROL)( - HANDLE hHandle, - enum FAR_PLUGINS_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIFILEFILTERCONTROL)( - HANDLE hHandle, - enum FAR_FILE_FILTER_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPIREGEXPCONTROL)( - HANDLE hHandle, - enum FAR_REGEXP_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -typedef intptr_t (WINAPI *FARAPISETTINGSCONTROL)( - HANDLE hHandle, - enum FAR_SETTINGS_CONTROL_COMMANDS Command, - intptr_t Param1, - void* Param2 -); - -enum FARCLIPBOARD_TYPE -{ - FCT_ANY=0, - FCT_STREAM=1, - FCT_COLUMN=2 -}; - -// -typedef int (WINAPIV *FARSTDSPRINTF)(wchar_t *Buffer,const wchar_t *Format,...); -typedef int (WINAPIV *FARSTDSNPRINTF)(wchar_t *Buffer,size_t Sizebuf,const wchar_t *Format,...); -typedef int (WINAPIV *FARSTDSSCANF)(const wchar_t *Buffer, const wchar_t *Format,...); -// -typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (WINAPI *fcmp)(const void *, const void *,void *userparam),void *userparam); -typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (WINAPI *fcmp)(const void *, const void *,void *userparam),void *userparam); -typedef size_t (WINAPI *FARSTDGETFILEOWNER)(const wchar_t *Computer,const wchar_t *Name,wchar_t *Owner,size_t Size); -typedef size_t (WINAPI *FARSTDGETNUMBEROFLINKS)(const wchar_t *Name); -typedef int (WINAPI *FARSTDATOI)(const wchar_t *s); -typedef __int64 (WINAPI *FARSTDATOI64)(const wchar_t *s); -typedef wchar_t *(WINAPI *FARSTDITOA64)(__int64 value, wchar_t *string, int radix); -typedef wchar_t *(WINAPI *FARSTDITOA)(int value, wchar_t *string, int radix); -typedef wchar_t *(WINAPI *FARSTDLTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDRTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDTRIM)(wchar_t *Str); -typedef wchar_t *(WINAPI *FARSTDTRUNCSTR)(wchar_t *Str,intptr_t MaxLength); -typedef wchar_t *(WINAPI *FARSTDTRUNCPATHSTR)(wchar_t *Str,intptr_t MaxLength); -typedef wchar_t *(WINAPI *FARSTDQUOTESPACEONLY)(wchar_t *Str); -typedef const wchar_t*(WINAPI *FARSTDPOINTTONAME)(const wchar_t *Path); -typedef BOOL (WINAPI *FARSTDADDENDSLASH)(wchar_t *Path); -typedef BOOL (WINAPI *FARSTDCOPYTOCLIPBOARD)(enum FARCLIPBOARD_TYPE Type, const wchar_t *Data); -typedef size_t (WINAPI *FARSTDPASTEFROMCLIPBOARD)(enum FARCLIPBOARD_TYPE Type, wchar_t *Data, size_t Size); -typedef int (WINAPI *FARSTDLOCALISLOWER)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISUPPER)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISALPHA)(wchar_t Ch); -typedef int (WINAPI *FARSTDLOCALISALPHANUM)(wchar_t Ch); -typedef wchar_t (WINAPI *FARSTDLOCALUPPER)(wchar_t LowerChar); -typedef wchar_t (WINAPI *FARSTDLOCALLOWER)(wchar_t UpperChar); -typedef void (WINAPI *FARSTDLOCALUPPERBUF)(wchar_t *Buf,intptr_t Length); -typedef void (WINAPI *FARSTDLOCALLOWERBUF)(wchar_t *Buf,intptr_t Length); -typedef void (WINAPI *FARSTDLOCALSTRUPR)(wchar_t *s1); -typedef void (WINAPI *FARSTDLOCALSTRLWR)(wchar_t *s1); -typedef int (WINAPI *FARSTDLOCALSTRICMP)(const wchar_t *s1,const wchar_t *s2); -typedef int (WINAPI *FARSTDLOCALSTRNICMP)(const wchar_t *s1,const wchar_t *s2,intptr_t n); - -typedef unsigned __int64 PROCESSNAME_FLAGS; -static const PROCESSNAME_FLAGS - // 0xFFFF - length - // 0xFF0000 - mode - // 0xFFFFFFFFFF000000 - flags - PN_CMPNAME = 0x0000000000000000ULL, - PN_CMPNAMELIST = 0x0000000000010000ULL, - PN_GENERATENAME = 0x0000000000020000ULL, - PN_CHECKMASK = 0x0000000000030000ULL, - - PN_SKIPPATH = 0x0000000001000000ULL, - PN_SHOWERRORMESSAGE = 0x0000000002000000ULL; - -typedef size_t (WINAPI *FARSTDPROCESSNAME)(const wchar_t *param1, wchar_t *param2, size_t size, PROCESSNAME_FLAGS flags); - -typedef void (WINAPI *FARSTDUNQUOTE)(wchar_t *Str); - -typedef unsigned __int64 XLAT_FLAGS; -static const XLAT_FLAGS - XLAT_SWITCHKEYBLAYOUT = 0x0000000000000001ULL, - XLAT_SWITCHKEYBBEEP = 0x0000000000000002ULL, - XLAT_USEKEYBLAYOUTNAME = 0x0000000000000004ULL, - XLAT_CONVERTALLCMDLINE = 0x0000000000010000ULL, - XLAT_NONE = 0; - -typedef size_t (WINAPI *FARSTDINPUTRECORDTOKEYNAME)(const INPUT_RECORD* Key, wchar_t *KeyText, size_t Size); - -typedef wchar_t*(WINAPI *FARSTDXLAT)(wchar_t *Line,intptr_t StartPos,intptr_t EndPos,XLAT_FLAGS Flags); - -typedef BOOL (WINAPI *FARSTDKEYNAMETOINPUTRECORD)(const wchar_t *Name,INPUT_RECORD* Key); - -typedef int (WINAPI *FRSUSERFUNC)( - const struct PluginPanelItem *FData, - const wchar_t *FullName, - void *Param -); - -typedef unsigned __int64 FRSMODE; -static const FRSMODE - FRS_RETUPDIR = 0x0000000000000001ULL, - FRS_RECUR = 0x0000000000000002ULL, - FRS_SCANSYMLINK = 0x0000000000000004ULL; - -typedef void (WINAPI *FARSTDRECURSIVESEARCH)(const wchar_t *InitDir,const wchar_t *Mask,FRSUSERFUNC Func,FRSMODE Flags,void *Param); -typedef size_t (WINAPI *FARSTDMKTEMP)(wchar_t *Dest, size_t DestSize, const wchar_t *Prefix); -typedef size_t (WINAPI *FARSTDGETPATHROOT)(const wchar_t *Path,wchar_t *Root, size_t DestSize); - -enum LINK_TYPE -{ - LINK_HARDLINK = 1, - LINK_JUNCTION = 2, - LINK_VOLMOUNT = 3, - LINK_SYMLINKFILE = 4, - LINK_SYMLINKDIR = 5, - LINK_SYMLINK = 6, -}; - -typedef unsigned __int64 MKLINK_FLAGS; -static const MKLINK_FLAGS - MLF_SHOWERRMSG = 0x0000000000010000ULL, - MLF_DONOTUPDATEPANEL = 0x0000000000020000ULL, - MLF_NONE = 0; - -typedef BOOL (WINAPI *FARSTDMKLINK)(const wchar_t *Src,const wchar_t *Dest,enum LINK_TYPE Type, MKLINK_FLAGS Flags); -typedef size_t (WINAPI *FARGETREPARSEPOINTINFO)(const wchar_t *Src, wchar_t *Dest, size_t DestSize); - -enum CONVERTPATHMODES -{ - CPM_FULL = 0, - CPM_REAL = 1, - CPM_NATIVE = 2, -}; - -typedef size_t (WINAPI *FARCONVERTPATH)(enum CONVERTPATHMODES Mode, const wchar_t *Src, wchar_t *Dest, size_t DestSize); - -typedef size_t (WINAPI *FARGETCURRENTDIRECTORY)(size_t Size, wchar_t* Buffer); - -typedef unsigned __int64 FARFORMATFILESIZEFLAGS; -static const FARFORMATFILESIZEFLAGS - FFFS_COMMAS = 0x0100000000000000LL, - FFFS_FLOATSIZE = 0x0200000000000000LL, - FFFS_SHOWBYTESINDEX = 0x0400000000000000LL, - FFFS_ECONOMIC = 0x0800000000000000LL, - FFFS_THOUSAND = 0x1000000000000000LL, - FFFS_MINSIZEINDEX = 0x2000000000000000LL, - FFFS_MINSIZEINDEX_MASK = 0x0000000000000003LL; - -typedef size_t (WINAPI *FARFORMATFILESIZE)(unsigned __int64 Size, intptr_t Width, FARFORMATFILESIZEFLAGS Flags, wchar_t *Dest, size_t DestSize); - -typedef struct FarStandardFunctions -{ - size_t StructSize; - - FARSTDATOI atoi; - FARSTDATOI64 atoi64; - FARSTDITOA itoa; - FARSTDITOA64 itoa64; - // - FARSTDSPRINTF sprintf; - FARSTDSSCANF sscanf; - // - FARSTDQSORT qsort; - FARSTDBSEARCH bsearch; - // - FARSTDSNPRINTF snprintf; - // - - FARSTDLOCALISLOWER LIsLower; - FARSTDLOCALISUPPER LIsUpper; - FARSTDLOCALISALPHA LIsAlpha; - FARSTDLOCALISALPHANUM LIsAlphanum; - FARSTDLOCALUPPER LUpper; - FARSTDLOCALLOWER LLower; - FARSTDLOCALUPPERBUF LUpperBuf; - FARSTDLOCALLOWERBUF LLowerBuf; - FARSTDLOCALSTRUPR LStrupr; - FARSTDLOCALSTRLWR LStrlwr; - FARSTDLOCALSTRICMP LStricmp; - FARSTDLOCALSTRNICMP LStrnicmp; - - FARSTDUNQUOTE Unquote; - FARSTDLTRIM LTrim; - FARSTDRTRIM RTrim; - FARSTDTRIM Trim; - FARSTDTRUNCSTR TruncStr; - FARSTDTRUNCPATHSTR TruncPathStr; - FARSTDQUOTESPACEONLY QuoteSpaceOnly; - FARSTDPOINTTONAME PointToName; - FARSTDGETPATHROOT GetPathRoot; - FARSTDADDENDSLASH AddEndSlash; - FARSTDCOPYTOCLIPBOARD CopyToClipboard; - FARSTDPASTEFROMCLIPBOARD PasteFromClipboard; - FARSTDINPUTRECORDTOKEYNAME FarInputRecordToName; - FARSTDKEYNAMETOINPUTRECORD FarNameToInputRecord; - FARSTDXLAT XLat; - FARSTDGETFILEOWNER GetFileOwner; - FARSTDGETNUMBEROFLINKS GetNumberOfLinks; - FARSTDRECURSIVESEARCH FarRecursiveSearch; - FARSTDMKTEMP MkTemp; - FARSTDPROCESSNAME ProcessName; - FARSTDMKLINK MkLink; - FARCONVERTPATH ConvertPath; - FARGETREPARSEPOINTINFO GetReparsePointInfo; - FARGETCURRENTDIRECTORY GetCurrentDirectory; - FARFORMATFILESIZE FormatFileSize; -} FARSTANDARDFUNCTIONS; - -struct PluginStartupInfo -{ - size_t StructSize; - const wchar_t *ModuleName; - FARAPIMENU Menu; - FARAPIMESSAGE Message; - FARAPIGETMSG GetMsg; - FARAPIPANELCONTROL PanelControl; - FARAPISAVESCREEN SaveScreen; - FARAPIRESTORESCREEN RestoreScreen; - FARAPIGETDIRLIST GetDirList; - FARAPIGETPLUGINDIRLIST GetPluginDirList; - FARAPIFREEDIRLIST FreeDirList; - FARAPIFREEPLUGINDIRLIST FreePluginDirList; - FARAPIVIEWER Viewer; - FARAPIEDITOR Editor; - FARAPITEXT Text; - FARAPIEDITORCONTROL EditorControl; - - FARSTANDARDFUNCTIONS *FSF; - - FARAPISHOWHELP ShowHelp; - FARAPIADVCONTROL AdvControl; - FARAPIINPUTBOX InputBox; - FARAPICOLORDIALOG ColorDialog; - FARAPIDIALOGINIT DialogInit; - FARAPIDIALOGRUN DialogRun; - FARAPIDIALOGFREE DialogFree; - - FARAPISENDDLGMESSAGE SendDlgMessage; - FARAPIDEFDLGPROC DefDlgProc; - FARAPIVIEWERCONTROL ViewerControl; - FARAPIPLUGINSCONTROL PluginsControl; - FARAPIFILEFILTERCONTROL FileFilterControl; - FARAPIREGEXPCONTROL RegExpControl; - FARAPIMACROCONTROL MacroControl; - FARAPISETTINGSCONTROL SettingsControl; - void *Private; -}; - -typedef HANDLE (WINAPI *FARAPICREATEFILE)(const wchar_t *Object,DWORD DesiredAccess,DWORD ShareMode,LPSECURITY_ATTRIBUTES SecurityAttributes,DWORD CreationDistribution,DWORD FlagsAndAttributes,HANDLE TemplateFile); -typedef DWORD (WINAPI *FARAPIGETFILEATTRIBUTES)(const wchar_t *FileName); -typedef BOOL (WINAPI *FARAPISETFILEATTRIBUTES)(const wchar_t *FileName,DWORD dwFileAttributes); -typedef BOOL (WINAPI *FARAPIMOVEFILEEX)(const wchar_t *ExistingFileName,const wchar_t *NewFileName,DWORD dwFlags); -typedef BOOL (WINAPI *FARAPIDELETEFILE)(const wchar_t *FileName); -typedef BOOL (WINAPI *FARAPIREMOVEDIRECTORY)(const wchar_t *DirName); -typedef BOOL (WINAPI *FARAPICREATEDIRECTORY)(const wchar_t *PathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - -struct ArclitePrivateInfo -{ - size_t StructSize; - FARAPICREATEFILE CreateFile; - FARAPIGETFILEATTRIBUTES GetFileAttributes; - FARAPISETFILEATTRIBUTES SetFileAttributes; - FARAPIMOVEFILEEX MoveFileEx; - FARAPIDELETEFILE DeleteFile; - FARAPIREMOVEDIRECTORY RemoveDirectory; - FARAPICREATEDIRECTORY CreateDirectory; -}; - -typedef intptr_t (WINAPI *FARAPICALLFAR)(intptr_t CheckCode, struct FarMacroCall* Data); - -struct MacroPrivateInfo -{ - size_t StructSize; - FARAPICALLFAR CallFar; -}; - -typedef unsigned __int64 PLUGIN_FLAGS; -static const PLUGIN_FLAGS - PF_PRELOAD = 0x0000000000000001ULL, - PF_DISABLEPANELS = 0x0000000000000002ULL, - PF_EDITOR = 0x0000000000000004ULL, - PF_VIEWER = 0x0000000000000008ULL, - PF_FULLCMDLINE = 0x0000000000000010ULL, - PF_DIALOG = 0x0000000000000020ULL, - PF_NONE = 0; - -struct PluginMenuItem -{ - const GUID *Guids; - const wchar_t * const *Strings; - size_t Count; -}; - -enum VERSION_STAGE -{ - VS_RELEASE = 0, - VS_ALPHA = 1, - VS_BETA = 2, - VS_RC = 3, -}; - -struct VersionInfo -{ - DWORD Major; - DWORD Minor; - DWORD Revision; - DWORD Build; - enum VERSION_STAGE Stage; -}; - -static __inline BOOL CheckVersion(const struct VersionInfo* Current, const struct VersionInfo* Required) -{ - return (Current->Major > Required->Major) || (Current->Major == Required->Major && Current->Minor > Required->Minor) || (Current->Major == Required->Major && Current->Minor == Required->Minor && Current->Revision > Required->Revision) || (Current->Major == Required->Major && Current->Minor == Required->Minor && Current->Revision == Required->Revision && Current->Build >= Required->Build); -} - -static __inline struct VersionInfo MAKEFARVERSION(DWORD Major, DWORD Minor, DWORD Revision, DWORD Build, enum VERSION_STAGE Stage) -{ - struct VersionInfo Info = {Major, Minor, Revision, Build, Stage}; - return Info; -} - -#define FARMANAGERVERSION MAKEFARVERSION(FARMANAGERVERSION_MAJOR,FARMANAGERVERSION_MINOR, FARMANAGERVERSION_REVISION, FARMANAGERVERSION_BUILD, FARMANAGERVERSION_STAGE) - -struct GlobalInfo -{ - size_t StructSize; - struct VersionInfo MinFarVersion; - struct VersionInfo Version; - GUID Guid; - const wchar_t *Title; - const wchar_t *Description; - const wchar_t *Author; -}; - -struct PluginInfo -{ - size_t StructSize; - PLUGIN_FLAGS Flags; - struct PluginMenuItem DiskMenu; - struct PluginMenuItem PluginMenu; - struct PluginMenuItem PluginConfig; - const wchar_t *CommandPrefix; -}; - -struct FarGetPluginInformation -{ - size_t StructSize; - const wchar_t *ModuleName; - FAR_PLUGIN_FLAGS Flags; - struct PluginInfo *PInfo; - struct GlobalInfo *GInfo; -}; - -typedef unsigned __int64 INFOPANELLINE_FLAGS; -static const INFOPANELLINE_FLAGS - IPLFLAGS_SEPARATOR = 0x0000000000000001ULL; - -struct InfoPanelLine -{ - const wchar_t *Text; - const wchar_t *Data; - INFOPANELLINE_FLAGS Flags; -}; - -typedef unsigned __int64 PANELMODE_FLAGS; -static const PANELMODE_FLAGS - PMFLAGS_FULLSCREEN = 0x0000000000000001ULL, - PMFLAGS_DETAILEDSTATUS = 0x0000000000000002ULL, - PMFLAGS_ALIGNEXTENSIONS = 0x0000000000000004ULL, - PMFLAGS_CASECONVERSION = 0x0000000000000008ULL; - -struct PanelMode -{ - const wchar_t *ColumnTypes; - const wchar_t *ColumnWidths; - const wchar_t * const *ColumnTitles; - const wchar_t *StatusColumnTypes; - const wchar_t *StatusColumnWidths; - PANELMODE_FLAGS Flags; -}; - -typedef unsigned __int64 OPENPANELINFO_FLAGS; -static const OPENPANELINFO_FLAGS - OPIF_DISABLEFILTER = 0x0000000000000001ULL, - OPIF_DISABLESORTGROUPS = 0x0000000000000002ULL, - OPIF_DISABLEHIGHLIGHTING = 0x0000000000000004ULL, - OPIF_ADDDOTS = 0x0000000000000008ULL, - OPIF_RAWSELECTION = 0x0000000000000010ULL, - OPIF_REALNAMES = 0x0000000000000020ULL, - OPIF_SHOWNAMESONLY = 0x0000000000000040ULL, - OPIF_SHOWRIGHTALIGNNAMES = 0x0000000000000080ULL, - OPIF_SHOWPRESERVECASE = 0x0000000000000100ULL, - OPIF_COMPAREFATTIME = 0x0000000000000400ULL, - OPIF_EXTERNALGET = 0x0000000000000800ULL, - OPIF_EXTERNALPUT = 0x0000000000001000ULL, - OPIF_EXTERNALDELETE = 0x0000000000002000ULL, - OPIF_EXTERNALMKDIR = 0x0000000000004000ULL, - OPIF_USEATTRHIGHLIGHTING = 0x0000000000008000ULL, - OPIF_USECRC32 = 0x0000000000010000ULL, - OPIF_USEFREESIZE = 0x0000000000020000ULL, - OPIF_SHORTCUT = 0x0000000000040000ULL, - OPIF_NONE = 0; - -struct KeyBarLabel -{ - struct FarKey Key; - const wchar_t *Text; - const wchar_t *LongText; -}; - -struct KeyBarTitles -{ - size_t CountLabels; - struct KeyBarLabel *Labels; -}; - -struct FarSetKeyBarTitles -{ - size_t StructSize; - struct KeyBarTitles *Titles; -}; - -typedef unsigned __int64 OPERATION_MODES; -static const OPERATION_MODES - OPM_SILENT =0x0000000000000001ULL, - OPM_FIND =0x0000000000000002ULL, - OPM_VIEW =0x0000000000000004ULL, - OPM_EDIT =0x0000000000000008ULL, - OPM_TOPLEVEL =0x0000000000000010ULL, - OPM_DESCR =0x0000000000000020ULL, - OPM_QUICKVIEW =0x0000000000000040ULL, - OPM_PGDN =0x0000000000000080ULL, - OPM_COMMANDS =0x0000000000000100ULL, - OPM_NONE =0; - -struct OpenPanelInfo -{ - size_t StructSize; - HANDLE hPanel; - OPENPANELINFO_FLAGS Flags; - const wchar_t *HostFile; - const wchar_t *CurDir; - const wchar_t *Format; - const wchar_t *PanelTitle; - const struct InfoPanelLine *InfoLines; - size_t InfoLinesNumber; - const wchar_t * const *DescrFiles; - size_t DescrFilesNumber; - const struct PanelMode *PanelModesArray; - size_t PanelModesNumber; - intptr_t StartPanelMode; - enum OPENPANELINFO_SORTMODES StartSortMode; - intptr_t StartSortOrder; - const struct KeyBarTitles *KeyBar; - const wchar_t *ShortcutData; - unsigned __int64 FreeSize; - struct UserDataItem UserData; -}; - -struct AnalyseInfo -{ - size_t StructSize; - const wchar_t *FileName; - void *Buffer; - size_t BufferSize; - OPERATION_MODES OpMode; -}; - -struct OpenAnalyseInfo -{ - size_t StructSize; - struct AnalyseInfo* Info; - HANDLE Handle; -}; - -struct OpenMacroInfo -{ - size_t StructSize; - size_t Count; - struct FarMacroValue *Values; -}; - -typedef unsigned __int64 FAROPENSHORTCUTFLAGS; -static const FAROPENSHORTCUTFLAGS - FOSF_ACTIVE = 0x0000000000000001ULL, - FOSF_NONE = 0; - -struct OpenShortcutInfo -{ - size_t StructSize; - const wchar_t *HostFile; - const wchar_t *ShortcutData; - FAROPENSHORTCUTFLAGS Flags; -}; - -struct OpenCommandLineInfo -{ - size_t StructSize; - const wchar_t *CommandLine; -}; - -enum OPENFROM -{ - OPEN_LEFTDISKMENU = 0, - OPEN_PLUGINSMENU = 1, - OPEN_FINDLIST = 2, - OPEN_SHORTCUT = 3, - OPEN_COMMANDLINE = 4, - OPEN_EDITOR = 5, - OPEN_VIEWER = 6, - OPEN_FILEPANEL = 7, - OPEN_DIALOG = 8, - OPEN_ANALYSE = 9, - OPEN_RIGHTDISKMENU = 10, - OPEN_FROMMACRO = 11, - OPEN_LUAMACRO = 100, -}; - -enum MACROCALLTYPE -{ - MCT_MACROINIT = 0, - MCT_MACROSTEP = 1, - MCT_MACROFINAL = 2, - MCT_MACROPARSE = 3, - MCT_LOADMACROS = 4, - MCT_ENUMMACROS = 5, - MCT_WRITEMACROS = 6, - MCT_GETMACRO = 7, - MCT_PROCESSMACRO = 8, - MCT_DELMACRO = 9, - MCT_RUNSTARTMACRO = 10, -}; - -struct OpenMacroPluginInfo -{ - size_t StructSize; - enum MACROCALLTYPE CallType; - HANDLE Handle; - struct FarMacroCall *Data; -}; - - -enum FAR_EVENTS -{ - FE_CHANGEVIEWMODE =0, - FE_REDRAW =1, - FE_IDLE =2, - FE_CLOSE =3, - FE_BREAK =4, - FE_COMMAND =5, - - FE_GOTFOCUS =6, - FE_KILLFOCUS =7, -}; - -struct OpenInfo -{ - size_t StructSize; - enum OPENFROM OpenFrom; - const GUID* Guid; - intptr_t Data; -}; - -struct SetDirectoryInfo -{ - size_t StructSize; - HANDLE hPanel; - const wchar_t *Dir; - intptr_t Reserved; - OPERATION_MODES OpMode; - struct UserDataItem UserData; -}; - -struct SetFindListInfo -{ - size_t StructSize; - HANDLE hPanel; - const struct PluginPanelItem *PanelItem; - size_t ItemsNumber; -}; - -struct PutFilesInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; - BOOL Move; - const wchar_t *SrcPath; - OPERATION_MODES OpMode; -}; - -struct ProcessHostFileInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; - OPERATION_MODES OpMode; -}; - -struct MakeDirectoryInfo -{ - size_t StructSize; - HANDLE hPanel; - const wchar_t *Name; - OPERATION_MODES OpMode; -}; - -struct CompareInfo -{ - size_t StructSize; - HANDLE hPanel; - const struct PluginPanelItem *Item1; - const struct PluginPanelItem *Item2; - enum OPENPANELINFO_SORTMODES Mode; -}; - -struct GetFindDataInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; - OPERATION_MODES OpMode; -}; - - -struct FreeFindDataInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; -}; - -struct GetFilesInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; - BOOL Move; - const wchar_t *DestPath; - OPERATION_MODES OpMode; -}; - -struct DeleteFilesInfo -{ - size_t StructSize; - HANDLE hPanel; - struct PluginPanelItem *PanelItem; - size_t ItemsNumber; - OPERATION_MODES OpMode; -}; - -struct ProcessPanelInputInfo -{ - size_t StructSize; - HANDLE hPanel; - INPUT_RECORD Rec; -}; - -struct ProcessEditorInputInfo -{ - size_t StructSize; - INPUT_RECORD Rec; -}; - -typedef unsigned __int64 PROCESSCONSOLEINPUT_FLAGS; -static const PROCESSCONSOLEINPUT_FLAGS - PCIF_FROMMAIN = 0x0000000000000001ULL, - PCIF_NONE = 0; - -struct ProcessConsoleInputInfo -{ - size_t StructSize; - PROCESSCONSOLEINPUT_FLAGS Flags; - INPUT_RECORD Rec; -}; - -struct ExitInfo -{ - size_t StructSize; -}; - -struct ProcessPanelEventInfo -{ - size_t StructSize; - intptr_t Event; - void* Param; - HANDLE hPanel; -}; - -struct ProcessEditorEventInfo -{ - size_t StructSize; - intptr_t Event; - void* Param; - intptr_t EditorID; -}; - -struct ProcessDialogEventInfo -{ - size_t StructSize; - intptr_t Event; - struct FarDialogEvent* Param; -}; - -struct ProcessSynchroEventInfo -{ - size_t StructSize; - intptr_t Event; - void* Param; -}; - -struct ProcessViewerEventInfo -{ - size_t StructSize; - intptr_t Event; - void* Param; - intptr_t ViewerID; -}; - -struct ClosePanelInfo -{ - size_t StructSize; - HANDLE hPanel; -}; - -struct CloseAnalyseInfo -{ - size_t StructSize; - HANDLE Handle; -}; - -struct ConfigureInfo -{ - size_t StructSize; - const GUID* Guid; -}; - -#ifdef __cplusplus -extern "C" -{ -#endif -// Exported Functions - - HANDLE WINAPI AnalyseW(const struct AnalyseInfo *Info); - void WINAPI CloseAnalyseW(const struct CloseAnalyseInfo *Info); - void WINAPI ClosePanelW(const struct ClosePanelInfo *Info); - intptr_t WINAPI CompareW(const struct CompareInfo *Info); - intptr_t WINAPI ConfigureW(const struct ConfigureInfo *Info); - intptr_t WINAPI DeleteFilesW(const struct DeleteFilesInfo *Info); - void WINAPI ExitFARW(const struct ExitInfo *Info); - void WINAPI FreeFindDataW(const struct FreeFindDataInfo *Info); - intptr_t WINAPI GetFilesW(struct GetFilesInfo *Info); - intptr_t WINAPI GetFindDataW(struct GetFindDataInfo *Info); - void WINAPI GetGlobalInfoW(struct GlobalInfo *Info); - void WINAPI GetOpenPanelInfoW(struct OpenPanelInfo *Info); - void WINAPI GetPluginInfoW(struct PluginInfo *Info); - intptr_t WINAPI MakeDirectoryW(struct MakeDirectoryInfo *Info); - HANDLE WINAPI OpenW(const struct OpenInfo *Info); - intptr_t WINAPI ProcessDialogEventW(const struct ProcessDialogEventInfo *Info); - intptr_t WINAPI ProcessEditorEventW(const struct ProcessEditorEventInfo *Info); - intptr_t WINAPI ProcessEditorInputW(const struct ProcessEditorInputInfo *Info); - intptr_t WINAPI ProcessPanelEventW(const struct ProcessPanelEventInfo *Info); - intptr_t WINAPI ProcessHostFileW(const struct ProcessHostFileInfo *Info); - intptr_t WINAPI ProcessPanelInputW(const struct ProcessPanelInputInfo *Info); - intptr_t WINAPI ProcessConsoleInputW(struct ProcessConsoleInputInfo *Info); - intptr_t WINAPI ProcessSynchroEventW(const struct ProcessSynchroEventInfo *Info); - intptr_t WINAPI ProcessViewerEventW(const struct ProcessViewerEventInfo *Info); - intptr_t WINAPI PutFilesW(const struct PutFilesInfo *Info); - intptr_t WINAPI SetDirectoryW(const struct SetDirectoryInfo *Info); - intptr_t WINAPI SetFindListW(const struct SetFindListInfo *Info); - void WINAPI SetStartupInfoW(const struct PluginStartupInfo *Info); - -#ifdef __cplusplus -}; -#endif - -#endif /* RC_INVOKED */ - -#endif /* __PLUGIN_HPP__ */ diff --git a/makefile b/makefile deleted file mode 100644 index 2e3d55c..0000000 --- a/makefile +++ /dev/null @@ -1,184 +0,0 @@ -!include project.ini - -TOOLSDIR = .\tools - -CPPFLAGS = -nologo -Zi -W3 -Gy -GS -GR -EHsc -MP -c -DEFINES = -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_WIN32_WINNT=0x0500 -D_FAR_USE_FARFINDDATA -DSTRSAFE_NO_DEPRECATE -LINKFLAGS = -nologo -debug -incremental:no -map -manifest:no -dynamicbase -nxcompat -largeaddressaware -dll -base:0x68000000 -RCFLAGS = -nologo - -!if "$(CPU)" == "AMD64" || "$(PLATFORM)" == "x64" -PLATFORM = x64 -LIBSUFFIX = 64 -LINK_MACHINE = /MACHINE:X64 -!ifdef WIDE -DLLSUFFIX = W64 -!else -DLLSUFFIX = A64 -!endif -RCFLAGS = $(RCFLAGS) -Dx64 -!else -PLATFORM = x86 -LINK_MACHINE = /MACHINE:X86 -!ifdef WIDE -DLLSUFFIX = W -!else -DLLSUFFIX = A -!endif -LINKFLAGS = $(LINKFLAGS) -safeseh -LIBSUFFIX = 32 -!endif - -MODULEFULL=$(MODULE)$(DLLSUFFIX) - -!ifdef RELEASE -OUTDIR = ..\Release -DEFINES = $(DEFINES) -DNDEBUG -CPPFLAGS = $(CPPFLAGS) -O1 -GL -MT -LINKFLAGS = $(LINKFLAGS) $(LINK_MACHINE) -opt:ref -opt:icf -LTCG /pdb:".\$(OUTDIR)\$(MODULE)$(DLLSUFFIX).pdb" -!else -OUTDIR = ..\Debug -DEFINES = $(DEFINES) -DDEBUG -CPPFLAGS = $(CPPFLAGS) -Od -RTC1 -MTd -LINKFLAGS = $(LINKFLAGS) $(LINK_MACHINE) -fixed:no /pdb:".\$(OUTDIR)\$(MODULE)$(DLLSUFFIX).pdb" -LIBSUFFIX=$(LIBSUFFIX)d -!endif - -!ifdef FAR1 -FARSDK = farsdk\ansi -DEFFILE = UnInstall.def -DEFINES = $(DEFINES) -DFARAPI17 -FARBRANCH = 1 -!elseifdef FAR2 -FARSDK = farsdk\unicode -DEFFILE = UnInstallW.def -DEFINES = $(DEFINES) -DFARAPI18 -DUNICODE -D_UNICODE -FARBRANCH = 2 -!else -FARSDK = farsdk\unicode3 -DEFFILE = UnInstallW3.def -DEFINES = $(DEFINES) -DFARAPI3 -DUNICODE -D_UNICODE -FARBRANCH = 3 -!endif - -OUTDIR = $(OUTDIR).$(PLATFORM).$(FARBRANCH) -INCLUDES = -I$(FARSDK) -I$(OUTDIR) -CPPFLAGS = $(CPPFLAGS) -Fo$(OUTDIR)\ -Fd$(OUTDIR)\ $(INCLUDES) $(DEFINES) -RCFLAGS = $(RCFLAGS) $(INCLUDES) $(DEFINES) - -!ifdef BUILD -!include $(OUTDIR)\far.ini -!endif - -OBJS = $(OUTDIR)\UnInstall.obj - -LIBS = user32.lib advapi32.lib ole32.lib shell32.lib - -project: depfile $(OUTDIR)\far.ini - $(MAKE) -nologo -$(MAKEFLAGS) build_project BUILD=1 - -distrib: depfile $(OUTDIR)\far.ini - $(MAKE) -nologo -$(MAKEFLAGS) build_distrib BUILD=1 - -build_project: $(OUTDIR)\$(MODULE)$(DLLSUFFIX).dll $(OUTDIR)\UnInstall_Eng.lng $(OUTDIR)\UnInstall_Rus.lng \ - $(OUTDIR)\UnInstall_Eng.hlf $(OUTDIR)\UnInstall_Rus.hlf $(OUTDIR)\File_ID.diz \ - $(OUTDIR)\ReadMe.Rus.txt $(OUTDIR)\WhatsNew.Rus.txt - -$(OUTDIR)\$(MODULE)$(DLLSUFFIX).dll: $(OUTDIR)\plugin.def $(OBJS) $(OUTDIR)\UnInstall.res project.ini - link $(LINKFLAGS) -def:$(OUTDIR)\plugin.def -out:$@ $(OBJS) $(OUTDIR)\UnInstall.res $(LIBS) - -.cpp{$(OUTDIR)}.obj:: - $(CPP) $(CPPFLAGS) $< - -depfile: $(OUTDIR) - $(TOOLSDIR)\gendep.exe $(INCLUDES) > $(OUTDIR)\dep.mak - -$(OUTDIR)\UnInstall.res: $(OUTDIR)\UnInstall.rc - $(RC) $(RCFLAGS) -fo$@ $** - -PREPROC = $(TOOLSDIR)\preproc $** $@ - -$(OUTDIR)\UnInstall.rc: project.ini UnInstall.rc - $(PREPROC) - -$(OUTDIR)\version.h: project.ini UnInstall_h.h - $(PREPROC) - -$(OUTDIR)\plugin.def: project.ini $(DEFFILE) - $(PREPROC) - -$(OUTDIR)\UnInstall_Eng.hlf.1: project.ini UnInstall_Eng.hlf - $(PREPROC) - -$(OUTDIR)\UnInstall_Rus.hlf.1: project.ini UnInstall_Rus.hlf - $(PREPROC) - -$(OUTDIR)\File_ID.diz.1: project.ini File_ID.diz - $(PREPROC) - -$(OUTDIR)\File_ID.diz.2: $(OUTDIR)\far.ini $(OUTDIR)\File_ID.diz.1 - $(PREPROC) - -!ifdef FAR1 -CONVCP = $(TOOLSDIR)\convcp $** $@ 866 -!else -CONVCP = copy $** $@ -!endif - -$(OUTDIR)\UnInstall_Eng.lng: UnInstall_Eng.lng - $(CONVCP) - -$(OUTDIR)\UnInstall_Rus.lng: UnInstall_Rus.lng - $(CONVCP) - -$(OUTDIR)\UnInstall_Eng.hlf: $(OUTDIR)\UnInstall_Eng.hlf.1 - $(CONVCP) - -$(OUTDIR)\UnInstall_Rus.hlf: $(OUTDIR)\UnInstall_Rus.hlf.1 - $(CONVCP) - -$(OUTDIR)\File_ID.diz: $(OUTDIR)\File_ID.diz.2 - $(CONVCP) - -$(OUTDIR)\ReadMe.Rus.txt: ReadMe.Rus.txt - $(CONVCP) - -$(OUTDIR)\WhatsNew.Rus.txt: WhatsNew.Rus.txt - $(CONVCP) - -$(OUTDIR)\far.ini: $(FARSDK)\plugin.hpp - $(TOOLSDIR)\farver $** $@ - -$(OUTDIR): - if not exist $(OUTDIR) mkdir $(OUTDIR) - -!ifdef BUILD -!include $(OUTDIR)\dep.mak -!endif - - -DISTRIB = $(OUTDIR)\$(MODULE)_$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH) -!ifndef FAR1 -DISTRIB = $(DISTRIB)_uni -!endif -DISTRIB_FILES = .\$(OUTDIR)\$(MODULE)$(DLLSUFFIX).dll .\$(OUTDIR)\$(MODULE)$(DLLSUFFIX).map .\$(OUTDIR)\UnInstall_Eng.lng .\$(OUTDIR)\UnInstall_Rus.lng .\$(OUTDIR)\UnInstall_Eng.hlf .\$(OUTDIR)\UnInstall_Rus.hlf .\$(OUTDIR)\File_ID.diz .\$(OUTDIR)\ReadMe.Rus.txt .\$(OUTDIR)\WhatsNew.Rus.txt .\TechInfo.Rus.reg -!if "$(PLATFORM)" != "x86" -DISTRIB = $(DISTRIB)_$(PLATFORM) -!endif -!ifndef RELEASE -DISTRIB = $(DISTRIB)_dbg -DISTRIB_FILES = $(DISTRIB_FILES) .\$(OUTDIR)\$(MODULE)$(DLLSUFFIX).pdb -!endif - -build_distrib: $(DISTRIB).7z - -$(DISTRIB).7z: $(DISTRIB_FILES) project.ini - 7z a -mx=9 $@ $(DISTRIB_FILES) - - -clean: - if exist $(OUTDIR) rd /s /q $(OUTDIR) - - -.PHONY: project distrib build_project build_distrib depfile clean -.SUFFIXES: .wxs diff --git a/project.ini b/project.ini deleted file mode 100644 index 279e4a7..0000000 --- a/project.ini +++ /dev/null @@ -1,5 +0,0 @@ -NAME = UnInstall -MODULE = UnInstall -VER_MAJOR = 1 -VER_MINOR = 10 -VER_PATCH = 17 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e2f9030 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,99 @@ +project(UnInstall CXX) + +set(SRC_CPP + UnInstall.cpp + UnInstall.hpp + DlgBuilder.hpp + FarLang.h + guid.hpp + version.hpp + UnInstall.rc) + +set(SRC_DEF UnInstall.def) + +#==================================================== +# common flags +#==================================================== +if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + # default for msvc project + # CMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /GR /EHsc + # CMAKE_CXX_FLAGS_DEBUG= /MDd /Zi /Ob0 /Od /RTC1 + # CMAKE_CXX_FLAGS_RELEASE= /MD /O2 /Ob2 /DNDEBUG + + if (CMAKE_BUILD_TYPE MATCHES Debug) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") + else () + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") + endif () + + set(FLAGS_CXX_DEFAULT /Zi) + set(FLAGS_CXX_RELEASE /W3 /Oi /Ot /GL /GS-) + set(FLAGS_CXX_DEBUG /W4 /GS) + + set(LINK_FLAGS "/MAP /MANIFEST:NO") + + # build with debug info in pdb + if (CMAKE_BUILD_TYPE MATCHES "Release") + set(LINK_FLAGS "${LINK_FLAGS} /incremental:no /OPT:REF /OPT:ICF /debug /ltcg") + endif () + + add_definitions(-DUNICODE -D_UNICODE) + + if (IS_x64_PLATFORM) + set(CMAKE_RC_FLAGS -D_WIN64) + endif () +endif () + +# set options for target +set(MAIN_FLAGS_CXX_DEBUG ${FLAGS_CXX_DEBUG} ${FLAGS_CXX_DEFAULT}) +set(MAIN_FLAGS_CXX_RELEASE ${FLAGS_CXX_RELEASE} ${FLAGS_CXX_DEFAULT}) +set(MAIN_FLAGS_C_DEBUG ${FLAGS_C_DEBUG} ${FLAGS_C_DEFAULT}) +set(MAIN_FLAGS_C_RELEASE ${FLAGS_C_RELEASE} ${FLAGS_C_DEFAULT}) + +#==================================================== +# build +#==================================================== + +set(SRC_FILES ${SRC_CPP} ${SRC_DEF}) +add_library(UnInstall SHARED ${SRC_FILES}) +target_include_directories(UnInstall + PUBLIC ${PROJECT_SOURCE_DIR}/../farsdk/unicode + ) + +set_target_properties(UnInstall PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO + ) + +if (${CMAKE_BUILD_TYPE} MATCHES Debug) + target_compile_options(UnInstall + PUBLIC $<$:${MAIN_FLAGS_C_DEBUG}> + PUBLIC $<$:${MAIN_FLAGS_CXX_DEBUG}> + ) +else () + target_compile_options(UnInstall + PUBLIC $<$:${MAIN_FLAGS_C_RELEASE}> + PUBLIC $<$:${MAIN_FLAGS_CXX_RELEASE}> + ) +endif () + +set_target_properties(UnInstall + PROPERTIES + LINK_FLAGS "${LINK_FLAGS}" + ) + +#==================================================== +# build misc files +#==================================================== +configure_file(File_ID.diz File_ID.diz) +configure_file(UnInstall_Eng.hlf UnInstall_Eng.hlf) +configure_file(UnInstall_Rus.hlf UnInstall_Rus.hlf) + +#==================================================== +# install +#==================================================== +install(TARGETS UnInstall RUNTIME DESTINATION .) +install(FILES $ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.map DESTINATION .) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/UnInstall_Eng.hlf ${CMAKE_CURRENT_BINARY_DIR}/UnInstall_Rus.hlf UnInstall_Eng.lng UnInstall_Rus.lng DESTINATION .) +install(FILES ${PROJECT_SOURCE_DIR}/../WhatsNew.Rus.txt ${PROJECT_SOURCE_DIR}/../ReadMe.Rus.txt ${CMAKE_CURRENT_BINARY_DIR}/File_ID.diz DESTINATION .) \ No newline at end of file diff --git a/DlgBuilder.hpp b/src/DlgBuilder.hpp similarity index 84% rename from DlgBuilder.hpp rename to src/DlgBuilder.hpp index fd8395b..6846467 100644 --- a/DlgBuilder.hpp +++ b/src/DlgBuilder.hpp @@ -1,1126 +1,1088 @@ -#pragma once - -/* -DlgBuilder.hpp - - -*/ -/* -Copyright (c) 2009 Far Group -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifdef UNICODE -#define EMPTY_TEXT L"" -#else -#define EMPTY_TEXT "" -#endif - -// . -struct DialogBuilderListItem -{ - // LNG-, . - int MessageId; - - // , Value . - int ItemValue; -}; - -template -struct DialogItemBinding -{ - int BeforeLabelID; - int AfterLabelID; - - DialogItemBinding() - : BeforeLabelID(-1), AfterLabelID(-1) - { - } - - virtual void SaveValue(T *Item, int RadioGroupIndex) - { - } -}; - -template -struct CheckBoxBinding: public DialogItemBinding -{ - private: - BOOL *Value; - int Mask; - - public: - CheckBoxBinding(BOOL *aValue, int aMask) : Value(aValue), Mask(aMask) { } - - virtual void SaveValue(T *Item, int RadioGroupIndex) - { - if(Mask == 0) - { - *Value = Item->Selected; - } - else - { - if(Item->Selected) - *Value |= Mask; - else - *Value &= ~Mask; - } - } -}; - -template -struct RadioButtonBinding: public DialogItemBinding -{ - private: - int *Value; - - public: - RadioButtonBinding(int *aValue) : Value(aValue) { } - - virtual void SaveValue(T *Item, int RadioGroupIndex) - { - if(Item->Selected) - *Value = RadioGroupIndex; - } -}; - -template -struct ComboBoxBinding: public DialogItemBinding -{ - int *Value; - FarList *List; - - ComboBoxBinding(int *aValue, FarList *aList) - : Value(aValue), List(aList) - { - } - - ~ComboBoxBinding() - { - delete [] List->Items; - delete List; - } - - virtual void SaveValue(T *Item, int RadioGroupIndex) - { - FarListItem &ListItem = List->Items[Item->ListPos]; - *Value = ListItem.Reserved[0]; - } -}; - -/* - . - , . - OK. - - . , -checkbox radio button , . - , - AddTextBefore AddTextAfter. - - . -: -- StartColumns() -- -- ColumnBreak() -- -- EndColumns() - - FAR, . -*/ - -template -class DialogBuilderBase -{ - protected: - T *DialogItems; - DialogItemBinding **Bindings; - int DialogItemsCount; - int DialogItemsAllocated; - int NextY; - int OKButtonID, CancelButtonID; - int ColumnStartIndex; - int ColumnBreakIndex; - int ColumnStartY; - int ColumnEndY; - int ColumnMinWidth; - - static const int SECOND_COLUMN = -2; - static const int RIGHT_SLIDE = -3; - - void ReallocDialogItems() - { - // DialogItemEx, - // AddDialogItem , , - // - // TODO , - DialogItemsAllocated += 128; - - if(DialogItems == nullptr) - { - DialogItems = new T[DialogItemsAllocated]; - Bindings = new DialogItemBinding * [DialogItemsAllocated]; - } - else - { - T *NewDialogItems = new T[DialogItemsAllocated]; - DialogItemBinding **NewBindings = new DialogItemBinding * [DialogItemsAllocated]; - - for(int i=0; iType = Type; - Bindings [Index] = nullptr; - return Item; - } - - public: - void SetNextY(T *Item) - { - Item->X1 = 5; - Item->Y1 = Item->Y2 = NextY++; - } - - void SlideItemUp(T *Item) - { - int Width = Item->X2 - Item->X1; - Item->X1 = RIGHT_SLIDE; - Item->X2 = Item->X1 + Width; - NextY--; - Item->Y1 = Item->Y2 = NextY - 1; - } - - int ItemWidth(const T &Item) - { - switch(Item.Type) - { - case DI_TEXT: - return TextWidth(Item); - case DI_CHECKBOX: - case DI_RADIOBUTTON: - return TextWidth(Item) + 4; - case DI_EDIT: - case DI_FIXEDIT: - case DI_COMBOBOX: - int Width = Item.X2 - Item.X1 + 1; - /* history , - if (Item.Flags & DIF_HISTORY) - Width++; - */ - return Width; - break; - } - - return 0; - } - - void AddBorder(const TCHAR *TitleText) - { - T *Title = AddDialogItem(DI_DOUBLEBOX, TitleText); - Title->X1 = 3; - Title->Y1 = 1; - } - - void UpdateBorderSize() - { - T *Title = &DialogItems[0]; - Title->X2 = Title->X1 + MaxTextWidth() + 3; - Title->Y2 = DialogItems [DialogItemsCount-1].Y2 + 1; - } - - int MaxTextWidth() - { - int MaxWidth = 0; - - for(int i=1; i *Binding = FindBinding(DialogItems+i); - int BeforeWidth = 0; - - if(Binding && Binding->BeforeLabelID != -1) - { - BeforeWidth = DialogItems [Binding->BeforeLabelID].X2 - DialogItems [Binding->BeforeLabelID].X1 + 1; - } - - int Width = DialogItems [i].X2 - DialogItems [i].X1; - DialogItems [i].X1 = SecondColumnX1 + BeforeWidth; - DialogItems [i].X2 = DialogItems [i].X1 + Width; - - if(Binding && Binding->AfterLabelID != -1) - { - int j = Binding->AfterLabelID; - int AfterWidth = DialogItems [j].X2 - DialogItems [j].X1; - - if(DialogItems [j].X1 == SECOND_COLUMN) - { - DialogItems [j].X1 = SecondColumnX1 + Width + 2; - DialogItems [j].X2 = DialogItems [j].X1 + AfterWidth; - } - else - { - DialogItems [j].X1 += Width + 2; - DialogItems [j].X2 += Width + 2; - } - } - } - } - } - - void UpdateRightSlidePosition() - { - int SlideX2 = DialogItems [0].X2 - 2; - - for(int i=0; i *Binding) - { - Bindings [DialogItemsCount-1] = Binding; - } - - int GetItemID(T *Item) - { - int Index = static_cast(Item - DialogItems); - - if(Index >= 0 && Index < DialogItemsCount) - return Index; - - return -1; - } - - DialogItemBinding* FindBinding(const T *Item) - { - int Index = static_cast(Item - DialogItems); - - if(Index >= 0 && Index < DialogItemsCount) - return Bindings [Index]; - - return nullptr; - } - - void SaveValues() - { - int RadioGroupIndex = 0; - - for(int i=0; iSaveValue(&DialogItems [i], RadioGroupIndex); - } - } - - virtual const TCHAR* GetLangString(int MessageID) - { - return nullptr; - } - - virtual int DoShowDialog() - { - return -1; - } - - virtual DialogItemBinding* CreateCheckBoxBinding(BOOL *Value, int Mask) - { - return nullptr; - } - - virtual DialogItemBinding* CreateComboBoxBinding(int *Value) - { - return nullptr; - } - - virtual DialogItemBinding* CreateRadioButtonBinding(int *Value) - { - return nullptr; - } - - DialogBuilderBase() - : DialogItems(nullptr), DialogItemsCount(0), DialogItemsAllocated(0), NextY(2), - ColumnStartIndex(-1), ColumnBreakIndex(-1), ColumnMinWidth(0) - { - } - - ~DialogBuilderBase() - { - for(int i=0; iFlags |= DIF_CENTERTEXT; - // Item->X2 = Item->X1 + ItemWidth(*Item); - //} - - // . - T* AddCheckbox(int TextMessageId, BOOL *Value, int Mask=0) - { - T *Item = AddDialogItem(DI_CHECKBOX, GetLangString(TextMessageId)); - SetNextY(Item); - Item->X2 = Item->X1 + ItemWidth(*Item); - - if(Mask == 0) - Item->Selected = *Value; - else - Item->Selected = (*Value & Mask) != 0; - - SetLastItemBinding(CreateCheckBoxBinding(Value, Mask)); - return Item; - } - - // . - int AddRadioButtons(int *Value, int OptionCount, int MessageIDs[], DWORD AddFlags=0, BOOL abTwoColumns = FALSE) - { - if(abTwoColumns && (ColumnStartIndex != -1 || OptionCount < 2)) - abTwoColumns = FALSE; - - if(abTwoColumns) - StartColumns(); - - int nBreakColumn = abTwoColumns ? (((OptionCount+1)>>1)-1) : (OptionCount+1); - int nFirstID = DialogItemsCount; - - for(int i=0; iX2 = Item->X1 + ItemWidth(*Item); - - if(i == 0) - Item->Flags |= DIF_GROUP; - - if(*Value == i) - Item->Selected = TRUE; - - if(AddFlags) - Item->Flags |= AddFlags; - - SetLastItemBinding(CreateRadioButtonBinding(Value)); - - if(i == nBreakColumn) - ColumnBreak(); - } - - if(abTwoColumns) - EndColumns(); - - return nFirstID; - } - - // ComboBox - T* AddComboBox(int Width, FarList* ListItems, int *Value, DWORD AddFlags=DIF_DROPDOWNLIST) - { - T *Item = AddDialogItem(DI_COMBOBOX, nullptr); -#ifdef FARAPI3 + +// Элемент выпадающего списка в диалоге. +struct DialogBuilderListItem +{ + // Строчка из LNG-файла, которая будет показана в диалоге. + int MessageId; + + // Значение, которое будет записано в поле Value при выборе этой строчки. + int ItemValue; +}; + +template +struct DialogItemBinding +{ + int BeforeLabelID; + int AfterLabelID; + + DialogItemBinding() + : BeforeLabelID(-1), AfterLabelID(-1) + { + } + + virtual void SaveValue(T *Item, int RadioGroupIndex) + { + } +}; + +template +struct CheckBoxBinding: public DialogItemBinding +{ + private: + BOOL *Value; + int Mask; + + public: + CheckBoxBinding(BOOL *aValue, int aMask) : Value(aValue), Mask(aMask) { } + + virtual void SaveValue(T *Item, int RadioGroupIndex) + { + if(Mask == 0) + { + *Value = Item->Selected; + } + else + { + if(Item->Selected) + *Value |= Mask; + else + *Value &= ~Mask; + } + } +}; + +template +struct RadioButtonBinding: public DialogItemBinding +{ + private: + int *Value; + + public: + RadioButtonBinding(int *aValue) : Value(aValue) { } + + virtual void SaveValue(T *Item, int RadioGroupIndex) + { + if(Item->Selected) + *Value = RadioGroupIndex; + } +}; + +template +struct ComboBoxBinding: public DialogItemBinding +{ + int *Value; + FarList *List; + + ComboBoxBinding(int *aValue, FarList *aList) + : Value(aValue), List(aList) + { + } + + ~ComboBoxBinding() + { + delete [] List->Items; + delete List; + } + + virtual void SaveValue(T *Item, int RadioGroupIndex) + { + FarListItem &ListItem = List->Items[Item->ListPos]; + *Value = ListItem.Reserved[0]; + } +}; + +/* +Класс для динамического построения диалогов. Автоматически вычисляет положение и размер +для добавляемых контролов, а также размер самого диалога. Автоматически записывает выбранные +значения в указанное место после закрытия диалога по OK. + +По умолчанию каждый контрол размещается в новой строке диалога. Ширина для текстовых строк, +checkbox и radio button вычисляется автоматически, для других элементов передаётся явно. +Есть также возможность добавить статический текст слева или справа от контрола, при помощи +методов AddTextBefore и AddTextAfter. + +Поддерживается также возможность расположения контролов в две колонки. Используется следующим +образом: +- StartColumns() +- добавляются контролы для первой колонки +- ColumnBreak() +- добавляются контролы для второй колонки +- EndColumns() + +Базовая версия класса используется как внутри кода FAR, так и в плагинах. +*/ + +template +class DialogBuilderBase +{ + protected: + T *DialogItems; + DialogItemBinding **Bindings; + int DialogItemsCount; + int DialogItemsAllocated; + int NextY; + int OKButtonID, CancelButtonID; + int ColumnStartIndex; + int ColumnBreakIndex; + int ColumnStartY; + int ColumnEndY; + int ColumnMinWidth; + + static const int SECOND_COLUMN = -2; + static const int RIGHT_SLIDE = -3; + + void ReallocDialogItems() + { + // реаллокация инвалидирует указатели на DialogItemEx, возвращённые из + // AddDialogItem и аналогичных методов, поэтому размер массива подбираем такой, + // чтобы все нормальные диалоги помещались без реаллокации + // TODO хорошо бы, чтобы они вообще не инвалидировались + DialogItemsAllocated += 128; + + if(DialogItems == nullptr) + { + DialogItems = new T[DialogItemsAllocated]; + Bindings = new DialogItemBinding * [DialogItemsAllocated]; + } + else + { + T *NewDialogItems = new T[DialogItemsAllocated]; + DialogItemBinding **NewBindings = new DialogItemBinding * [DialogItemsAllocated]; + + for(int i=0; iType = Type; + Bindings [Index] = nullptr; + return Item; + } + + public: + void SetNextY(T *Item) + { + Item->X1 = 5; + Item->Y1 = Item->Y2 = NextY++; + } + + void SlideItemUp(T *Item) + { + int Width = Item->X2 - Item->X1; + Item->X1 = RIGHT_SLIDE; + Item->X2 = Item->X1 + Width; + NextY--; + Item->Y1 = Item->Y2 = NextY - 1; + } + + int ItemWidth(const T &Item) + { + switch(Item.Type) + { + case DI_TEXT: + return TextWidth(Item); + case DI_CHECKBOX: + case DI_RADIOBUTTON: + return TextWidth(Item) + 4; + case DI_EDIT: + case DI_FIXEDIT: + case DI_COMBOBOX: + int Width = Item.X2 - Item.X1 + 1; + /* стрелка history занимает дополнительное место, но раньше она рисовалась поверх рамки + if (Item.Flags & DIF_HISTORY) + Width++; + */ + return Width; + break; + } + + return 0; + } + + void AddBorder(const TCHAR *TitleText) + { + T *Title = AddDialogItem(DI_DOUBLEBOX, TitleText); + Title->X1 = 3; + Title->Y1 = 1; + } + + void UpdateBorderSize() + { + T *Title = &DialogItems[0]; + Title->X2 = Title->X1 + MaxTextWidth() + 3; + Title->Y2 = DialogItems [DialogItemsCount-1].Y2 + 1; + } + + int MaxTextWidth() + { + int MaxWidth = 0; + + for(int i=1; i *Binding = FindBinding(DialogItems+i); + int BeforeWidth = 0; + + if(Binding && Binding->BeforeLabelID != -1) + { + BeforeWidth = DialogItems [Binding->BeforeLabelID].X2 - DialogItems [Binding->BeforeLabelID].X1 + 1; + } + + int Width = DialogItems [i].X2 - DialogItems [i].X1; + DialogItems [i].X1 = SecondColumnX1 + BeforeWidth; + DialogItems [i].X2 = DialogItems [i].X1 + Width; + + if(Binding && Binding->AfterLabelID != -1) + { + int j = Binding->AfterLabelID; + int AfterWidth = DialogItems [j].X2 - DialogItems [j].X1; + + if(DialogItems [j].X1 == SECOND_COLUMN) + { + DialogItems [j].X1 = SecondColumnX1 + Width + 2; + DialogItems [j].X2 = DialogItems [j].X1 + AfterWidth; + } + else + { + DialogItems [j].X1 += Width + 2; + DialogItems [j].X2 += Width + 2; + } + } + } + } + } + + void UpdateRightSlidePosition() + { + int SlideX2 = DialogItems [0].X2 - 2; + + for(int i=0; i *Binding) + { + Bindings [DialogItemsCount-1] = Binding; + } + + int GetItemID(T *Item) + { + int Index = static_cast(Item - DialogItems); + + if(Index >= 0 && Index < DialogItemsCount) + return Index; + + return -1; + } + + DialogItemBinding* FindBinding(const T *Item) + { + int Index = static_cast(Item - DialogItems); + + if(Index >= 0 && Index < DialogItemsCount) + return Bindings [Index]; + + return nullptr; + } + + void SaveValues() + { + int RadioGroupIndex = 0; + + for(int i=0; iSaveValue(&DialogItems [i], RadioGroupIndex); + } + } + + virtual const TCHAR* GetLangString(int MessageID) + { + return nullptr; + } + + virtual int DoShowDialog() + { + return -1; + } + + virtual DialogItemBinding* CreateCheckBoxBinding(BOOL *Value, int Mask) + { + return nullptr; + } + + virtual DialogItemBinding* CreateComboBoxBinding(int *Value) + { + return nullptr; + } + + virtual DialogItemBinding* CreateRadioButtonBinding(int *Value) + { + return nullptr; + } + + DialogBuilderBase() + : DialogItems(nullptr), DialogItemsCount(0), DialogItemsAllocated(0), NextY(2), + ColumnStartIndex(-1), ColumnBreakIndex(-1), ColumnMinWidth(0) + { + } + + ~DialogBuilderBase() + { + for(int i=0; iFlags |= DIF_CENTERTEXT; + // Item->X2 = Item->X1 + ItemWidth(*Item); + //} + + // Добавляет чекбокс. + T* AddCheckbox(int TextMessageId, BOOL *Value, int Mask=0) + { + T *Item = AddDialogItem(DI_CHECKBOX, GetLangString(TextMessageId)); + SetNextY(Item); + Item->X2 = Item->X1 + ItemWidth(*Item); + + if(Mask == 0) + Item->Selected = *Value; + else + Item->Selected = (*Value & Mask) != 0; + + SetLastItemBinding(CreateCheckBoxBinding(Value, Mask)); + return Item; + } + + // Добавляет группу радиокнопок. + int AddRadioButtons(int *Value, int OptionCount, int MessageIDs[], DWORD AddFlags=0, BOOL abTwoColumns = FALSE) + { + if(abTwoColumns && (ColumnStartIndex != -1 || OptionCount < 2)) + abTwoColumns = FALSE; + + if(abTwoColumns) + StartColumns(); + + int nBreakColumn = abTwoColumns ? (((OptionCount+1)>>1)-1) : (OptionCount+1); + int nFirstID = DialogItemsCount; + + for(int i=0; iX2 = Item->X1 + ItemWidth(*Item); + + if(i == 0) + Item->Flags |= DIF_GROUP; + + if(*Value == i) + Item->Selected = TRUE; + + if(AddFlags) + Item->Flags |= AddFlags; + + SetLastItemBinding(CreateRadioButtonBinding(Value)); + + if(i == nBreakColumn) + ColumnBreak(); + } + + if(abTwoColumns) + EndColumns(); + + return nFirstID; + } + + // Добавляет ComboBox + T* AddComboBox(int Width, FarList* ListItems, int *Value, DWORD AddFlags=DIF_DROPDOWNLIST) + { + T *Item = AddDialogItem(DI_COMBOBOX, nullptr); + for(size_t i = 0; i < ListItems->ItemsNumber; i++) -#else - for(int i = 0; i < ListItems->ItemsNumber; i++) -#endif - { - if(i == *Value) - ListItems->Items[i].Flags |= LIF_SELECTED; - else if(ListItems->Items[i].Flags & LIF_SELECTED) - ListItems->Items[i].Flags &= ~LIF_SELECTED; - } - - Item->ListItems = ListItems; - Item->Flags |= AddFlags; - SetNextY(Item); - Item->X2 = Item->X1 + Width; - SetLastItemBinding(CreateComboBoxBinding(Value)); - return Item; - } - - // DI_FIXEDIT . - virtual T* AddIntEditField(int *Value, int Width) - { - return nullptr; - } - - // RelativeTo. - T* AddTextBefore(T *RelativeTo, int LabelId) - { - T *Item = AddDialogItem(DI_TEXT, GetLangString(LabelId)); - Item->Y1 = Item->Y2 = RelativeTo->Y1; - Item->X1 = 5; - Item->X2 = Item->X1 + ItemWidth(*Item) - 1; - int RelativeToWidth = RelativeTo->X2 - RelativeTo->X1; - RelativeTo->X1 = Item->X2 + 2; - RelativeTo->X2 = RelativeTo->X1 + RelativeToWidth; - //// , - //T P; P = *RelativeTo; *RelativeTo = *Item; *Item = P; - //Item--; RelativeTo++; - //int I1 = static_cast(Item - DialogItems); - //int I2 = static_cast(RelativeTo - DialogItems); - //DialogItemBinding *B1; - //B1 = Bindings[I1]; Bindings[I1] = Bindings[I2]; Bindings[I2] = B1; - DialogItemBinding *Binding = FindBinding(RelativeTo); - - if(Binding) - Binding->BeforeLabelID = GetItemID(Item); - - return Item; - } - - // (a'la AddTextAfter) - void MoveItemAfter(T *FirstItem, T *AfterItem) - { - int Width = ItemWidth(*AfterItem); - int Height = AfterItem->Y2 - AfterItem->Y1; - AfterItem->Y1 = FirstItem->Y1; - AfterItem->Y2 = FirstItem->Y1 + Height; - AfterItem->X1 = FirstItem->X1 + ItemWidth(*FirstItem); - AfterItem->X2 = AfterItem->X1 + Width - 1; - DialogItemBinding *Binding = FindBinding(AfterItem); - - if(Binding) - { - Binding->BeforeLabelID = GetItemID(FirstItem); - _ASSERTE(Binding->BeforeLabelID != -1); - } - - NextY--; - } - - // RelativeTo. - T* AddTextAfter(T *RelativeTo, int LabelId) - { - T *Item = AddDialogItem(DI_TEXT, GetLangString(LabelId)); - Item->Y1 = Item->Y2 = RelativeTo->Y1; - Item->X1 = RelativeTo->X2 + 2; - DialogItemBinding *Binding = FindBinding(RelativeTo); - - if(Binding) - Binding->AfterLabelID = GetItemID(Item); - - return Item; - } - - // . - void StartColumns() - { - ColumnStartIndex = DialogItemsCount; - ColumnStartY = NextY; - } - - // . - void ColumnBreak() - { - ColumnBreakIndex = DialogItemsCount; - ColumnEndY = NextY; - NextY = ColumnStartY; - } - - // . - void EndColumns() - { - for(int i=ColumnStartIndex; i *Binding = FindBinding(DialogItems + i); - int BindingAdd = 0; - - if(Binding) - { - if(Binding->BeforeLabelID != -1) - BindingAdd = ItemWidth(DialogItems [Binding->BeforeLabelID]) + 1; - else if(Binding->AfterLabelID != -1) - BindingAdd = ItemWidth(DialogItems [Binding->AfterLabelID]) + 1; - } - - if((Width + BindingAdd) > ColumnMinWidth) - ColumnMinWidth = Width + BindingAdd; - - if(i >= ColumnBreakIndex) - { - DialogItems [i].X1 = SECOND_COLUMN; - DialogItems [i].X2 = SECOND_COLUMN + Width; - } - } - - if(ColumnEndY > NextY) - NextY = ColumnEndY; - - ColumnStartIndex = -1; - ColumnBreakIndex = -1; - } - - // . - void AddEmptyLine() - { - NextY++; - } - - // . - void AddSeparator(int MessageId=-1) - { - T *Separator = AddDialogItem(DI_TEXT, MessageId == -1 ? EMPTY_TEXT : GetLangString(MessageId)); - Separator->Flags = DIF_SEPARATOR; - Separator->X1 = 3; - Separator->Y1 = Separator->Y2 = NextY++; - } - - // , OK Cancel. - void AddOKCancel(int OKMessageId, int CancelMessageId) - { - AddSeparator(); - T *OKButton = AddDialogItem(DI_BUTTON, GetLangString(OKMessageId)); - OKButton->Flags = DIF_CENTERGROUP; -#ifdef FARAPI3 + { + if(i == *Value) + ListItems->Items[i].Flags |= LIF_SELECTED; + else if(ListItems->Items[i].Flags & LIF_SELECTED) + ListItems->Items[i].Flags &= ~LIF_SELECTED; + } + + Item->ListItems = ListItems; + Item->Flags |= AddFlags; + SetNextY(Item); + Item->X2 = Item->X1 + Width; + SetLastItemBinding(CreateComboBoxBinding(Value)); + return Item; + } + + // Добавляет поле типа DI_FIXEDIT для редактирования указанного числового значения. + virtual T* AddIntEditField(int *Value, int Width) + { + return nullptr; + } + + // Добавляет указанную текстовую строку слева от элемента RelativeTo. + T* AddTextBefore(T *RelativeTo, int LabelId) + { + T *Item = AddDialogItem(DI_TEXT, GetLangString(LabelId)); + Item->Y1 = Item->Y2 = RelativeTo->Y1; + Item->X1 = 5; + Item->X2 = Item->X1 + ItemWidth(*Item) - 1; + int RelativeToWidth = RelativeTo->X2 - RelativeTo->X1; + RelativeTo->X1 = Item->X2 + 2; + RelativeTo->X2 = RelativeTo->X1 + RelativeToWidth; + //// Текст должен идти первым элементом, чтобы хоткеи срабатывали + //T P; P = *RelativeTo; *RelativeTo = *Item; *Item = P; + //Item--; RelativeTo++; + //int I1 = static_cast(Item - DialogItems); + //int I2 = static_cast(RelativeTo - DialogItems); + //DialogItemBinding *B1; + //B1 = Bindings[I1]; Bindings[I1] = Bindings[I2]; Bindings[I2] = B1; + DialogItemBinding *Binding = FindBinding(RelativeTo); + + if(Binding) + Binding->BeforeLabelID = GetItemID(Item); + + return Item; + } + + // Подвязать (a'la AddTextAfter) любой элемент к любому элементу + void MoveItemAfter(T *FirstItem, T *AfterItem) + { + int Width = ItemWidth(*AfterItem); + int Height = AfterItem->Y2 - AfterItem->Y1; + AfterItem->Y1 = FirstItem->Y1; + AfterItem->Y2 = FirstItem->Y1 + Height; + AfterItem->X1 = FirstItem->X1 + ItemWidth(*FirstItem); + AfterItem->X2 = AfterItem->X1 + Width - 1; + DialogItemBinding *Binding = FindBinding(AfterItem); + + if(Binding) + { + Binding->BeforeLabelID = GetItemID(FirstItem); + _ASSERTE(Binding->BeforeLabelID != -1); + } + + NextY--; + } + + // Добавляет указанную текстовую строку справа от элемента RelativeTo. + T* AddTextAfter(T *RelativeTo, int LabelId) + { + T *Item = AddDialogItem(DI_TEXT, GetLangString(LabelId)); + Item->Y1 = Item->Y2 = RelativeTo->Y1; + Item->X1 = RelativeTo->X2 + 2; + DialogItemBinding *Binding = FindBinding(RelativeTo); + + if(Binding) + Binding->AfterLabelID = GetItemID(Item); + + return Item; + } + + // Начинает располагать поля диалога в две колонки. + void StartColumns() + { + ColumnStartIndex = DialogItemsCount; + ColumnStartY = NextY; + } + + // Завершает колонку полей в диалоге и переходит к следующей колонке. + void ColumnBreak() + { + ColumnBreakIndex = DialogItemsCount; + ColumnEndY = NextY; + NextY = ColumnStartY; + } + + // Завершает расположение полей диалога в две колонки. + void EndColumns() + { + for(int i=ColumnStartIndex; i *Binding = FindBinding(DialogItems + i); + int BindingAdd = 0; + + if(Binding) + { + if(Binding->BeforeLabelID != -1) + BindingAdd = ItemWidth(DialogItems [Binding->BeforeLabelID]) + 1; + else if(Binding->AfterLabelID != -1) + BindingAdd = ItemWidth(DialogItems [Binding->AfterLabelID]) + 1; + } + + if((Width + BindingAdd) > ColumnMinWidth) + ColumnMinWidth = Width + BindingAdd; + + if(i >= ColumnBreakIndex) + { + DialogItems [i].X1 = SECOND_COLUMN; + DialogItems [i].X2 = SECOND_COLUMN + Width; + } + } + + if(ColumnEndY > NextY) + NextY = ColumnEndY; + + ColumnStartIndex = -1; + ColumnBreakIndex = -1; + } + + // Добавляет пустую строку. + void AddEmptyLine() + { + NextY++; + } + + // Добавляет сепаратор. + void AddSeparator(int MessageId=-1) + { + T *Separator = AddDialogItem(DI_TEXT, MessageId == -1 ? EMPTY_TEXT : GetLangString(MessageId)); + Separator->Flags = DIF_SEPARATOR; + Separator->X1 = 3; + Separator->Y1 = Separator->Y2 = NextY++; + } + + // Добавляет сепаратор, кнопки OK и Cancel. + void AddOKCancel(int OKMessageId, int CancelMessageId) + { + AddSeparator(); + T *OKButton = AddDialogItem(DI_BUTTON, GetLangString(OKMessageId)); + OKButton->Flags = DIF_CENTERGROUP; OKButton->Flags |= DIF_DEFAULTBUTTON; + OKButton->Y1 = OKButton->Y2 = NextY++; + OKButtonID = DialogItemsCount-1; + T *CancelButton = AddDialogItem(DI_BUTTON, GetLangString(CancelMessageId)); + CancelButton->Flags = DIF_CENTERGROUP; + CancelButton->Y1 = CancelButton->Y2 = OKButton->Y1; + CancelButtonID = DialogItemsCount-1; + } + + void AddFooterButtons(int* BtnID, int nBtnCount) + { + AddSeparator(); + + for(int i = 0; i < nBtnCount; i++) + { + T *Button = AddDialogItem(DI_BUTTON, GetLangString(BtnID[i])); + Button->Flags = DIF_CENTERGROUP; + Button->DefaultButton = TRUE; + Button->Y1 = Button->Y2 = NextY; + + if(i == 0) + OKButtonID = DialogItemsCount-1; + } + + CancelButtonID = DialogItemsCount-1; + NextY++; + } + + bool ShowDialog(int *pnBtnNo = NULL) + { + _ASSERTE(OKButtonID > 0 && OKButtonID < DialogItemsCount); + UpdateBorderSize(); + UpdateSecondColumnPosition(); + UpdateRightSlidePosition(); + int Result = DoShowDialog(); + + if(Result >= OKButtonID && Result < CancelButtonID) + { + SaveValues(); + + if(pnBtnNo) *pnBtnNo = (Result - OKButtonID); + + return true; + } + + return false; + } +}; + +class PluginDialogBuilder; + +class DialogAPIBinding: public DialogItemBinding +{ + protected: + const PluginStartupInfo &Info; + HANDLE *DialogHandle; + int ID; + + DialogAPIBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID) + : Info(aInfo), DialogHandle(aHandle), ID(aID) + { + } +}; + +class PluginCheckBoxBinding: public DialogAPIBinding +{ + BOOL *Value; + int Mask; + + public: + PluginCheckBoxBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, BOOL *aValue, int aMask) + : DialogAPIBinding(aInfo, aHandle, aID), + Value(aValue), Mask(aMask) + { + } + + virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) + { + BOOL Selected = static_cast(Info.SendDlgMessage(*DialogHandle, DM_GETCHECK, ID, 0)); + + if(Mask == 0) + { + *Value = Selected; + } + else + { + if(Selected) + *Value |= Mask; + else + *Value &= ~Mask; + } + } +}; + +class PluginRadioButtonBinding: public DialogAPIBinding +{ + private: + int *Value; + + public: + PluginRadioButtonBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue) + : DialogAPIBinding(aInfo, aHandle, aID), + Value(aValue) + { + } + + virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) + { + if(Info.SendDlgMessage(*DialogHandle, DM_GETCHECK, ID, 0)) + *Value = RadioGroupIndex; + } +}; + +class PluginComboBoxBinding: public DialogAPIBinding +{ + private: + int *Value; + + public: + PluginComboBoxBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue) + : DialogAPIBinding(aInfo, aHandle, aID), + Value(aValue) + { + } + + virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) + { + *Value = (int)Info.SendDlgMessage(*DialogHandle, DM_LISTGETCURPOS, ID, 0); + } +}; + +#ifdef UNICODE + +class PluginEditFieldBinding: public DialogAPIBinding +{ + private: + TCHAR *Value; + int MaxSize; + + public: + PluginEditFieldBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, TCHAR *aValue, int aMaxSize) + : DialogAPIBinding(aInfo, aHandle, aID), Value(aValue), MaxSize(aMaxSize) + { + } + + virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) + { + const TCHAR *DataPtr = (const TCHAR *) Info.SendDlgMessage(*DialogHandle, DM_GETCONSTTEXTPTR, ID, 0); + lstrcpyn(Value, DataPtr, MaxSize); + } +}; + +class PluginIntEditFieldBinding: public DialogAPIBinding +{ + private: + int *Value; + TCHAR Buffer[32]; + TCHAR Mask[32]; + + public: + PluginIntEditFieldBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue, int Width) + : DialogAPIBinding(aInfo, aHandle, aID), + Value(aValue) + { + aInfo.FSF->itoa(*aValue, Buffer, 10); + int MaskWidth = Width < 31 ? Width : 31; + + for(int i=0; iatoi(DataPtr); + } + + TCHAR* GetBuffer() + { + return Buffer; + } + + const TCHAR* GetMask() + { + return Mask; + } +}; + #else - OKButton->DefaultButton = TRUE; + +class PluginEditFieldBinding: public DialogItemBinding +{ + private: + TCHAR *Value; + int MaxSize; + + public: + PluginEditFieldBinding(TCHAR *aValue, int aMaxSize) + : Value(aValue), MaxSize(aMaxSize) + { + } + + virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) + { + lstrcpyn(Value, Item->Data, MaxSize); + } +}; + +class PluginIntEditFieldBinding: public DialogItemBinding +{ + private: + const PluginStartupInfo &Info; + int *Value; + TCHAR Mask[32]; + + public: + PluginIntEditFieldBinding(const PluginStartupInfo &aInfo, int *aValue, int Width) + : Info(aInfo), Value(aValue) + { + int MaskWidth = Width < 31 ? Width : 31; + + for(int i=0; iatoi(Item->Data); + } + + const TCHAR* GetMask() + { + return Mask; + } +}; + #endif - OKButton->Y1 = OKButton->Y2 = NextY++; - OKButtonID = DialogItemsCount-1; - T *CancelButton = AddDialogItem(DI_BUTTON, GetLangString(CancelMessageId)); - CancelButton->Flags = DIF_CENTERGROUP; - CancelButton->Y1 = CancelButton->Y2 = OKButton->Y1; - CancelButtonID = DialogItemsCount-1; - } - - void AddFooterButtons(int* BtnID, int nBtnCount) - { - AddSeparator(); - - for(int i = 0; i < nBtnCount; i++) - { - T *Button = AddDialogItem(DI_BUTTON, GetLangString(BtnID[i])); - Button->Flags = DIF_CENTERGROUP; - Button->DefaultButton = TRUE; - Button->Y1 = Button->Y2 = NextY; - - if(i == 0) - OKButtonID = DialogItemsCount-1; - } - - CancelButtonID = DialogItemsCount-1; - NextY++; - } - - bool ShowDialog(int *pnBtnNo = NULL) - { - _ASSERTE(OKButtonID > 0 && OKButtonID < DialogItemsCount); - UpdateBorderSize(); - UpdateSecondColumnPosition(); - UpdateRightSlidePosition(); - int Result = DoShowDialog(); - - if(Result >= OKButtonID && Result < CancelButtonID) - { - SaveValues(); - - if(pnBtnNo) *pnBtnNo = (Result - OKButtonID); - - return true; - } - - return false; - } -}; - -class PluginDialogBuilder; - -class DialogAPIBinding: public DialogItemBinding -{ - protected: - const PluginStartupInfo &Info; - HANDLE *DialogHandle; - int ID; - - DialogAPIBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID) - : Info(aInfo), DialogHandle(aHandle), ID(aID) - { - } -}; - -class PluginCheckBoxBinding: public DialogAPIBinding -{ - BOOL *Value; - int Mask; - - public: - PluginCheckBoxBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, BOOL *aValue, int aMask) - : DialogAPIBinding(aInfo, aHandle, aID), - Value(aValue), Mask(aMask) - { - } - - virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) - { - BOOL Selected = static_cast(Info.SendDlgMessage(*DialogHandle, DM_GETCHECK, ID, 0)); - - if(Mask == 0) - { - *Value = Selected; - } - else - { - if(Selected) - *Value |= Mask; - else - *Value &= ~Mask; - } - } -}; - -class PluginRadioButtonBinding: public DialogAPIBinding -{ - private: - int *Value; - - public: - PluginRadioButtonBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue) - : DialogAPIBinding(aInfo, aHandle, aID), - Value(aValue) - { - } - - virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) - { - if(Info.SendDlgMessage(*DialogHandle, DM_GETCHECK, ID, 0)) - *Value = RadioGroupIndex; - } -}; - -class PluginComboBoxBinding: public DialogAPIBinding -{ - private: - int *Value; - - public: - PluginComboBoxBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue) - : DialogAPIBinding(aInfo, aHandle, aID), - Value(aValue) - { - } - - virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) - { - *Value = (int)Info.SendDlgMessage(*DialogHandle, DM_LISTGETCURPOS, ID, 0); - } -}; - -#ifdef UNICODE - -class PluginEditFieldBinding: public DialogAPIBinding -{ - private: - TCHAR *Value; - int MaxSize; - - public: - PluginEditFieldBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, TCHAR *aValue, int aMaxSize) - : DialogAPIBinding(aInfo, aHandle, aID), Value(aValue), MaxSize(aMaxSize) - { - } - - virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) - { - const TCHAR *DataPtr = (const TCHAR *) Info.SendDlgMessage(*DialogHandle, DM_GETCONSTTEXTPTR, ID, 0); - lstrcpyn(Value, DataPtr, MaxSize); - } -}; - -class PluginIntEditFieldBinding: public DialogAPIBinding -{ - private: - int *Value; - TCHAR Buffer[32]; - TCHAR Mask[32]; - - public: - PluginIntEditFieldBinding(const PluginStartupInfo &aInfo, HANDLE *aHandle, int aID, int *aValue, int Width) - : DialogAPIBinding(aInfo, aHandle, aID), - Value(aValue) - { - aInfo.FSF->itoa(*aValue, Buffer, 10); - int MaskWidth = Width < 31 ? Width : 31; - - for(int i=0; iatoi(DataPtr); - } - - TCHAR* GetBuffer() - { - return Buffer; - } - - const TCHAR* GetMask() - { - return Mask; - } -}; - -#else - -class PluginEditFieldBinding: public DialogItemBinding -{ - private: - TCHAR *Value; - int MaxSize; - - public: - PluginEditFieldBinding(TCHAR *aValue, int aMaxSize) - : Value(aValue), MaxSize(aMaxSize) - { - } - - virtual void SaveValue(FarDialogItem *Item, int RadioGroupIndex) - { - lstrcpyn(Value, Item->Data, MaxSize); - } -}; - -class PluginIntEditFieldBinding: public DialogItemBinding -{ - private: - const PluginStartupInfo &Info; - int *Value; - TCHAR Mask[32]; - - public: - PluginIntEditFieldBinding(const PluginStartupInfo &aInfo, int *aValue, int Width) - : Info(aInfo), Value(aValue) - { - int MaskWidth = Width < 31 ? Width : 31; - - for(int i=0; iatoi(Item->Data); - } - - const TCHAR* GetMask() - { - return Mask; - } -}; - -#endif - -/* - , FAR. -*/ -class PluginDialogBuilder: public DialogBuilderBase -{ - public: - DWORD DialogFlags; - protected: - const PluginStartupInfo &Info; - HANDLE DialogHandle; - const TCHAR *HelpTopic; -#ifdef FARAPI3 + +/* +Версия класса для динамического построения диалогов, используемая в плагинах к FAR. +*/ +class PluginDialogBuilder: public DialogBuilderBase +{ + public: + DWORD DialogFlags; + protected: + const PluginStartupInfo &Info; + HANDLE DialogHandle; + const TCHAR *HelpTopic; GUID PluginId; GUID Id; -#endif - - virtual void InitDialogItem(FarDialogItem *Item, const TCHAR *Text) - { - memset(Item, 0, sizeof(FarDialogItem)); - - if(Text) - { -#ifdef UNICODE -#ifdef FARAPI3 + + virtual void InitDialogItem(FarDialogItem *Item, const TCHAR *Text) + { + memset(Item, 0, sizeof(FarDialogItem)); + + if(Text) + { +#ifdef UNICODE Item->Data = Text; #else - Item->PtrData = Text; + lstrcpyn(Item->Data, Text, sizeof(Item->Data)/sizeof(Item->Data[0])); #endif -#else - lstrcpyn(Item->Data, Text, sizeof(Item->Data)/sizeof(Item->Data[0])); -#endif - } - } - - virtual int TextWidth(const FarDialogItem &Item) - { -#ifdef UNICODE -#ifdef FARAPI3 + } + } + + virtual int TextWidth(const FarDialogItem &Item) + { +#ifdef UNICODE return lstrlen(Item.Data); #else - return lstrlen(Item.PtrData); + return lstrlen(Item.Data); #endif -#else - return lstrlen(Item.Data); -#endif - } - - virtual const TCHAR* GetLangString(int MessageID) - { -#ifdef FARAPI3 + } + + virtual const TCHAR* GetLangString(int MessageID) + { return Info.GetMsg(&PluginId, MessageID); -#else - return Info.GetMsg(Info.ModuleNumber, MessageID); -#endif - } - - virtual int DoShowDialog() - { - int Width = DialogItems [0].X2+4; - int Height = DialogItems [0].Y2+2; -#ifdef UNICODE -#ifdef FARAPI3 + } + + virtual int DoShowDialog() + { + int Width = DialogItems [0].X2+4; + int Height = DialogItems [0].Y2+2; +#ifdef UNICODE DialogHandle = Info.DialogInit(&PluginId, &Id, -1, -1, Width, Height, HelpTopic, DialogItems, DialogItemsCount, 0, DialogFlags, nullptr, 0); + return Info.DialogRun(DialogHandle); #else - DialogHandle = Info.DialogInit(Info.ModuleNumber, -1, -1, Width, Height, - HelpTopic, DialogItems, DialogItemsCount, 0, DialogFlags, nullptr, 0); + return Info.DialogEx(Info.ModuleNumber, -1, -1, Width, Height, + HelpTopic, DialogItems, DialogItemsCount, 0, DialogFlags, nullptr, 0); #endif - return Info.DialogRun(DialogHandle); -#else - return Info.DialogEx(Info.ModuleNumber, -1, -1, Width, Height, - HelpTopic, DialogItems, DialogItemsCount, 0, DialogFlags, nullptr, 0); -#endif - } - - virtual DialogItemBinding* CreateCheckBoxBinding(BOOL *Value, int Mask) - { -#ifdef UNICODE - return new PluginCheckBoxBinding(Info, &DialogHandle, DialogItemsCount-1, Value, Mask); -#else - return new CheckBoxBinding(Value, Mask); -#endif - } - - virtual DialogItemBinding* CreateRadioButtonBinding(BOOL *Value) - { -#ifdef UNICODE - return new PluginRadioButtonBinding(Info, &DialogHandle, DialogItemsCount-1, Value); -#else - return new RadioButtonBinding(Value); -#endif - } - - virtual DialogItemBinding* CreateComboBoxBinding(int *Value) - { -#ifdef UNICODE - return new PluginComboBoxBinding(Info, &DialogHandle, DialogItemsCount-1, Value); -#else - return new PluginComboBoxBinding(Value); -#endif - } - - public: -#ifdef FARAPI3 + } + + virtual DialogItemBinding* CreateCheckBoxBinding(BOOL *Value, int Mask) + { +#ifdef UNICODE + return new PluginCheckBoxBinding(Info, &DialogHandle, DialogItemsCount-1, Value, Mask); +#else + return new CheckBoxBinding(Value, Mask); +#endif + } + + virtual DialogItemBinding* CreateRadioButtonBinding(BOOL *Value) + { +#ifdef UNICODE + return new PluginRadioButtonBinding(Info, &DialogHandle, DialogItemsCount-1, Value); +#else + return new RadioButtonBinding(Value); +#endif + } + + virtual DialogItemBinding* CreateComboBoxBinding(int *Value) + { +#ifdef UNICODE + return new PluginComboBoxBinding(Info, &DialogHandle, DialogItemsCount-1, Value); +#else + return new PluginComboBoxBinding(Value); +#endif + } + + public: + PluginDialogBuilder(const PluginStartupInfo &aInfo, const GUID &aPluginId, const GUID &aId, int TitleMessageID, const TCHAR *aHelpTopic) : DialogFlags(0), Info(aInfo), DialogHandle(NULL), HelpTopic(aHelpTopic),PluginId(aPluginId), Id(aId) -#else - PluginDialogBuilder(const PluginStartupInfo &aInfo, int TitleMessageID, const TCHAR *aHelpTopic) - : DialogFlags(0), Info(aInfo), DialogHandle(NULL), HelpTopic(aHelpTopic) + { + AddBorder(GetLangString(TitleMessageID)); + } + + ~PluginDialogBuilder() + { +#ifdef UNICODE + + if(DialogHandle) + { + Info.DialogFree(DialogHandle); + DialogHandle = NULL; + } + #endif - { - AddBorder(GetLangString(TitleMessageID)); - } - - ~PluginDialogBuilder() - { -#ifdef UNICODE - - if(DialogHandle) - { - Info.DialogFree(DialogHandle); - DialogHandle = NULL; - } - -#endif - } - - FarDialogItem* GetItemByIndex(int Index) - { - if(Index >= 0 && Index < DialogItemsCount) - return (DialogItems + Index); - - return NULL; - } - - int GetItemIndex(FarDialogItem* p) - { - return GetItemID(p); - } - - virtual FarDialogItem* AddIntEditField(int *Value, int Width) - { - FarDialogItem *Item = AddDialogItem(DI_FIXEDIT, EMPTY_TEXT); - Item->Flags |= DIF_MASKEDIT; - PluginIntEditFieldBinding *Binding; -#ifdef UNICODE - Binding = new PluginIntEditFieldBinding(Info, &DialogHandle, DialogItemsCount-1, Value, Width); -#ifdef FARAPI3 + } + + FarDialogItem* GetItemByIndex(int Index) + { + if(Index >= 0 && Index < DialogItemsCount) + return (DialogItems + Index); + + return NULL; + } + + int GetItemIndex(FarDialogItem* p) + { + return GetItemID(p); + } + + virtual FarDialogItem* AddIntEditField(int *Value, int Width) + { + FarDialogItem *Item = AddDialogItem(DI_FIXEDIT, EMPTY_TEXT); + Item->Flags |= DIF_MASKEDIT; + PluginIntEditFieldBinding *Binding; +#ifdef UNICODE + Binding = new PluginIntEditFieldBinding(Info, &DialogHandle, DialogItemsCount-1, Value, Width); Item->Data = Binding->GetBuffer(); #else - Item->PtrData = Binding->GetBuffer(); + Binding = new PluginIntEditFieldBinding(Info, Value, Width); + Info.FSF->itoa(*Value, (TCHAR *) Item->Data, 10); +#endif +#ifdef _FAR_NO_NAMELESS_UNIONS + Item->Param.Mask = Binding->GetMask(); +#else + Item->Mask = Binding->GetMask(); +#endif + SetNextY(Item); + Item->X2 = Item->X1 + Width - 1; + SetLastItemBinding(Binding); + return Item; + } + + FarDialogItem* AddEditField(TCHAR *Value, int MaxSize, int Width, const TCHAR *HistoryID = nullptr) + { + FarDialogItem *Item = AddDialogItem(DI_EDIT, Value); + SetNextY(Item); + Item->X2 = Item->X1 + Width; + + if(HistoryID) + { +#ifdef _FAR_NO_NAMELESS_UNIONS + Item->Param.History = HistoryID; +#else + Item->History = HistoryID; +#endif + Item->Flags |= DIF_HISTORY; + } + +#ifdef UNICODE + SetLastItemBinding(new PluginEditFieldBinding(Info, &DialogHandle, DialogItemsCount-1, Value, MaxSize)); +#else + SetLastItemBinding(new PluginEditFieldBinding(Value, MaxSize)); #endif -#else - Binding = new PluginIntEditFieldBinding(Info, Value, Width); - Info.FSF->itoa(*Value, (TCHAR *) Item->Data, 10); -#endif -#ifdef _FAR_NO_NAMELESS_UNIONS - Item->Param.Mask = Binding->GetMask(); -#else - Item->Mask = Binding->GetMask(); -#endif - SetNextY(Item); - Item->X2 = Item->X1 + Width - 1; - SetLastItemBinding(Binding); - return Item; - } - - FarDialogItem* AddEditField(TCHAR *Value, int MaxSize, int Width, const TCHAR *HistoryID = nullptr) - { - FarDialogItem *Item = AddDialogItem(DI_EDIT, Value); - SetNextY(Item); - Item->X2 = Item->X1 + Width; - - if(HistoryID) - { -#ifdef _FAR_NO_NAMELESS_UNIONS - Item->Param.History = HistoryID; -#else - Item->History = HistoryID; -#endif - Item->Flags |= DIF_HISTORY; - } - -#ifdef UNICODE - SetLastItemBinding(new PluginEditFieldBinding(Info, &DialogHandle, DialogItemsCount-1, Value, MaxSize)); -#else - SetLastItemBinding(new PluginEditFieldBinding(Value, MaxSize)); -#endif - return Item; - } -}; + return Item; + } +}; diff --git a/src/EPlugin.cpp b/src/EPlugin.cpp new file mode 100644 index 0000000..386e681 --- /dev/null +++ b/src/EPlugin.cpp @@ -0,0 +1,97 @@ +#include "guid.hpp" + +static struct PluginStartupInfo Info; +static struct FarStandardFunctions FSF; + +const wchar_t* GetMsg(int MsgId) +{ + return(Info.GetMsg(&MainGuid,MsgId)); +} + +void ShowHelp(const wchar_t * HelpTopic) +{ + Info.ShowHelp(Info.ModuleName,HelpTopic,0); +} + +int EMessage(const wchar_t * const * s, int nType, int n) +{ + return Info.Message(&MainGuid, &AnyMessage, FMSG_ALLINONE|nType, NULL, s, + 0, //этот параметр при FMSG_ALLINONE игнорируется + n); //количество кнопок +} + +int DrawMessage(int nType, int n, char *msg, ...) +{ + int total = 0; + wchar_t * string = NULL; + va_list ap; + wchar_t * arg; + va_start(ap, msg); + + while((arg = va_arg(ap,wchar_t*))!= 0) + { + total += lstrlen(arg) + 1; //мы еще будем записывать символ перевода строки + } + + va_end(ap); + total--; //последний знак перевода строки мы сотрем + string = (wchar_t *) realloc(string, sizeof(wchar_t)*(total + 1)); + string[0]=L'\0'; + va_start(ap, msg); + + while((arg = va_arg(ap,wchar_t*))!= NULL) + { + StringCchCat(string, total+1, arg); + StringCchCat(string, total+1, L"\n"); + } + + va_end(ap); + string[total]=L'\0'; + int result = EMessage((const wchar_t * const *) string, nType, n); + realloc(string, 0); + return result; +} + +const wchar_t * strstri(const wchar_t *s, const wchar_t *c) +{ + if(c) + { + int l = lstrlen(c); + + for(const wchar_t *p = s ; *p ; p++) + if(FSF.LStrnicmp(p, c, l) == 0) + return p; + } + + return NULL; +} + +wchar_t * strnstri(wchar_t *s, const wchar_t *c, int n) +{ + if(c) + { + int l = min(lstrlen(c), n); + + for(wchar_t *p = s ; *p ; p++) + if(FSF.LStrnicmp(p, c, l) == 0) + return p; + } + + return NULL; +} + +wchar_t * unQuote(wchar_t *vStr) +{ + unsigned l; + l = lstrlen(vStr); + + if(*vStr == L'\"') + memmove(vStr,vStr+1,l*sizeof(wchar_t)); + + l = lstrlen(vStr); + + if(vStr[l-1] == L'\"') + vStr[l-1] = L'\0'; + + return(vStr); +} diff --git a/FarLang.h b/src/FarLang.h similarity index 93% rename from FarLang.h rename to src/FarLang.h index 666882b..7775897 100644 --- a/FarLang.h +++ b/src/FarLang.h @@ -1,51 +1,51 @@ - -#pragma once - -enum { - MPlugIn=0, - MBtnOk, - MBtnCancel, - MWaitingCompletion, - MShowInEditor, - MShowInViewer, - MEnterWaitCompletion, - MUseElevation, - MLowPriority, - MForceMsiUse, - MEnterAction, - MShiftEnterAction, - MActionUninstallWait, - MActionUninstall, - MActionModifyWait, - MActionModify, - MActionRepairWait, - MActionRepair, - MActionMenu, - MUninstallEntry, - MUninstallEntryMSI, - MName, - MSubKeyName, - MInstallLocation, - MModifyCommand, - MUninstallCommand, - MPublisher, - MSupportInfo, - MProductUpdates, - MComments, - MVersion, - MInstallDate, - MBottomLine, - MFilter, - MMenuBottomLine1, - MMenuBottomLine2, - MMenuTopLine, - MMenuTopLineN, - MListHKLMx86, - MListHKLMx64, - MListHKLM, - MListHKCU, - MRunProgErr, - MCancelledByUser, - MDelRegErr, - MConfirm, - }; + +#pragma once + +enum { + MPlugIn=0, + MBtnOk, + MBtnCancel, + MWaitingCompletion, + MShowInEditor, + MShowInViewer, + MEnterWaitCompletion, + MUseElevation, + MLowPriority, + MForceMsiUse, + MEnterAction, + MShiftEnterAction, + MActionUninstallWait, + MActionUninstall, + MActionModifyWait, + MActionModify, + MActionRepairWait, + MActionRepair, + MActionMenu, + MUninstallEntry, + MUninstallEntryMSI, + MName, + MSubKeyName, + MInstallLocation, + MModifyCommand, + MUninstallCommand, + MPublisher, + MSupportInfo, + MProductUpdates, + MComments, + MVersion, + MInstallDate, + MBottomLine, + MFilter, + MMenuBottomLine1, + MMenuBottomLine2, + MMenuTopLine, + MMenuTopLineN, + MListHKLMx86, + MListHKLMx64, + MListHKLM, + MListHKCU, + MRunProgErr, + MCancelledByUser, + MDelRegErr, + MConfirm, + }; diff --git a/File_ID.diz b/src/File_ID.diz similarity index 67% rename from File_ID.diz rename to src/File_ID.diz index 9c1a1d9..d9d1103 100644 --- a/File_ID.diz +++ b/src/File_ID.diz @@ -1,17 +1,21 @@ -<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)>. Плагин "Удаление программ" -Far Manager <(FAR_VER_MAJOR)>.<(FAR_VER_MINOR)>.<(FAR_VER_BUILD)> - -Автор оригинальной версии: -Eugene Sementsov, 2005 -E-Mail: rels@inbox.ru -HomePage: www.e-sementsov.narod.ru - -Поддержка начиная с версии 1.10: -Олег Маковский -E-Mail: farplug@gmail.com -Сайт: http://farplug.googlecode.com/ -Новые версии: http://forum.farmanager.com/viewtopic.php?t=3529 -Обсуждение: http://forum.farmanager.com/viewtopic.php?t=3597 - -Поддержка начиная с версии 1.10.8: -ConEmu.Maximus5@gmail.com +UnInstall ${PLUGIN_VERSION}. Плагин "Удаление программ" +Far Manager 3 + +Сайт: https://github.com/FarPlugins/UnInstall +Новые версии: http://forum.farmanager.com/viewtopic.php?t=3529 +Обсуждение: http://forum.farmanager.com/viewtopic.php?t=3597 + +Автор оригинальной версии: +Eugene Sementsov, 2005 +E-Mail: rels@inbox.ru +HomePage: www.e-sementsov.narod.ru + +Поддержка начиная с версии 1.10: +Олег Маковский +E-Mail: farplug@gmail.com + +Поддержка начиная с версии 1.10.8: +ConEmu.Maximus5@gmail.com + +Поддержка начиная с версии 1.10.16: +Community diff --git a/Registry.cpp b/src/Registry.cpp similarity index 83% rename from Registry.cpp rename to src/Registry.cpp index b6c5b6b..4ef0171 100644 --- a/Registry.cpp +++ b/src/Registry.cpp @@ -1,170 +1,170 @@ -TCHAR PluginRootKey[80]; - -#define HKCU HKEY_CURRENT_USER -#define HKCR HKEY_CLASSES_ROOT -#define HKCC HKEY_CURRENT_CONFIG -#define HKLM HKEY_LOCAL_MACHINE -#define HKU HKEY_USERS - -/* - 㭪樨 ࠡ ॥஬ - ॡ ६ PluginRootKey -*/ - -#ifdef __cplusplus - -HKEY CreateRegKey(HKEY hRoot,TCHAR *Key); -HKEY OpenRegKey(HKEY hRoot,TCHAR *Key); - -// 祭 ValueName ⠭ 祭 ⨯ char* -void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,TCHAR *ValueData) -{ - HKEY hKey=CreateRegKey(hRoot,Key); - RegSetValueEx(hKey,ValueName,0,REG_SZ,(const BYTE*)ValueData,(lstrlen(ValueData)+1)*sizeof(TCHAR)); - RegCloseKey(hKey); -} - - -// ⠭ 祭 ⨯ DWORD -void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,DWORD ValueData) -{ - HKEY hKey=CreateRegKey(hRoot,Key); - RegSetValueEx(hKey,ValueName,0,REG_DWORD,(BYTE *)&ValueData,sizeof(ValueData)); - RegCloseKey(hKey); -} - - -// ⠭ 祭 ⨯ Binary -void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,BYTE *ValueData,DWORD ValueSize) -{ - HKEY hKey=CreateRegKey(hRoot,Key); - RegSetValueEx(hKey,ValueName,0,REG_BINARY,ValueData,ValueSize); - RegCloseKey(hKey); -} - - -// ⨯ char* -int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,TCHAR *ValueData,TCHAR *Default,DWORD DataSize) -{ - HKEY hKey=OpenRegKey(hRoot,Key); - DWORD Type; - DWORD Size = DataSize * sizeof(TCHAR); - int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,(LPBYTE)ValueData,&Size); - ValueData[DataSize - 1] = 0; - RegCloseKey(hKey); - - if(hKey==NULL || ExitCode!=ERROR_SUCCESS) - { - StringCchCopy(ValueData,DataSize,Default); - return(FALSE); - } - - return(TRUE); -} - - -// ⨯ DWORD -int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,int &ValueData,DWORD Default) -{ - HKEY hKey=OpenRegKey(hRoot,Key); - DWORD Type,Size=sizeof(ValueData); - int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,(BYTE *)&ValueData,&Size); - RegCloseKey(hKey); - - if(hKey==NULL || ExitCode!=ERROR_SUCCESS) - { - ValueData=Default; - return(FALSE); - } - - return(TRUE); -} - - -// ⨯ DWORD -int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,DWORD Default) -{ - int ValueData; - GetRegKey(hRoot,Key,ValueName,ValueData,Default); - return(ValueData); -} - - -// ⨯ Binary -int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,BYTE *ValueData,BYTE *Default,DWORD DataSize) -{ - HKEY hKey=OpenRegKey(hRoot,Key); - DWORD Type; - int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,ValueData,&DataSize); - RegCloseKey(hKey); - - if(hKey==NULL || ExitCode!=ERROR_SUCCESS) - { - if(Default!=NULL) - memcpy(ValueData,Default,DataSize); - else - memset(ValueData,0,DataSize); - - return(FALSE); - } - - return(TRUE); -} - - -// 㤠 -void DeleteRegKey(HKEY hRoot,TCHAR *Key) -{ - TCHAR FullKeyName[512]; - StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); - RegDeleteKey(hRoot,FullKeyName); -} - - -// ᮧ -HKEY CreateRegKey(HKEY hRoot,TCHAR *Key) -{ - HKEY hKey; - DWORD Disposition; - TCHAR FullKeyName[512]; - StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); - - if(RegCreateKeyEx(hRoot,FullKeyName,0,NULL,0,KEY_WRITE,NULL, - &hKey,&Disposition) != ERROR_SUCCESS) - hKey=NULL; - - return(hKey); -} - - -// ॥ -HKEY OpenRegKey(HKEY hRoot,TCHAR *Key) -{ - HKEY hKey; - TCHAR FullKeyName[512]; - StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); - StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); - - if(RegOpenKeyEx(hRoot,FullKeyName,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return(NULL); - - return(hKey); -} - -// ஢ ⢮ -BOOL CheckRegKey(HKEY hRoot,TCHAR *Key) -{ - HKEY hKey=OpenRegKey(hRoot,Key); - - if(hKey!=NULL) - RegCloseKey(hKey); - - return(hKey!=NULL); -} - -#endif +TCHAR PluginRootKey[80]; + +#define HKCU HKEY_CURRENT_USER +#define HKCR HKEY_CLASSES_ROOT +#define HKCC HKEY_CURRENT_CONFIG +#define HKLM HKEY_LOCAL_MACHINE +#define HKU HKEY_USERS + +/* + Функции работы с реестром + Требуется внешняя переменная PluginRootKey +*/ + +#ifdef __cplusplus + +HKEY CreateRegKey(HKEY hRoot,TCHAR *Key); +HKEY OpenRegKey(HKEY hRoot,TCHAR *Key); + +// для значения с именем ValueName установить значение типа char* +void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,TCHAR *ValueData) +{ + HKEY hKey=CreateRegKey(hRoot,Key); + RegSetValueEx(hKey,ValueName,0,REG_SZ,(const BYTE*)ValueData,(lstrlen(ValueData)+1)*sizeof(TCHAR)); + RegCloseKey(hKey); +} + + +// установить значение типа DWORD +void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,DWORD ValueData) +{ + HKEY hKey=CreateRegKey(hRoot,Key); + RegSetValueEx(hKey,ValueName,0,REG_DWORD,(BYTE *)&ValueData,sizeof(ValueData)); + RegCloseKey(hKey); +} + + +// установить значение типа Binary +void SetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,BYTE *ValueData,DWORD ValueSize) +{ + HKEY hKey=CreateRegKey(hRoot,Key); + RegSetValueEx(hKey,ValueName,0,REG_BINARY,ValueData,ValueSize); + RegCloseKey(hKey); +} + + +// получить данные типа char* +int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,TCHAR *ValueData,TCHAR *Default,DWORD DataSize) +{ + HKEY hKey=OpenRegKey(hRoot,Key); + DWORD Type; + DWORD Size = DataSize * sizeof(TCHAR); + int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,(LPBYTE)ValueData,&Size); + ValueData[DataSize - 1] = 0; + RegCloseKey(hKey); + + if(hKey==NULL || ExitCode!=ERROR_SUCCESS) + { + StringCchCopy(ValueData,DataSize,Default); + return(FALSE); + } + + return(TRUE); +} + + +// получить данные типа DWORD +int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,int &ValueData,DWORD Default) +{ + HKEY hKey=OpenRegKey(hRoot,Key); + DWORD Type,Size=sizeof(ValueData); + int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,(BYTE *)&ValueData,&Size); + RegCloseKey(hKey); + + if(hKey==NULL || ExitCode!=ERROR_SUCCESS) + { + ValueData=Default; + return(FALSE); + } + + return(TRUE); +} + + +// получить данные типа DWORD +int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,DWORD Default) +{ + int ValueData; + GetRegKey(hRoot,Key,ValueName,ValueData,Default); + return(ValueData); +} + + +// получить данные типа Binary +int GetRegKey(HKEY hRoot,TCHAR *Key,TCHAR *ValueName,BYTE *ValueData,BYTE *Default,DWORD DataSize) +{ + HKEY hKey=OpenRegKey(hRoot,Key); + DWORD Type; + int ExitCode=RegQueryValueEx(hKey,ValueName,0,&Type,ValueData,&DataSize); + RegCloseKey(hKey); + + if(hKey==NULL || ExitCode!=ERROR_SUCCESS) + { + if(Default!=NULL) + memcpy(ValueData,Default,DataSize); + else + memset(ValueData,0,DataSize); + + return(FALSE); + } + + return(TRUE); +} + + +// удаляет ключ +void DeleteRegKey(HKEY hRoot,TCHAR *Key) +{ + TCHAR FullKeyName[512]; + StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); + RegDeleteKey(hRoot,FullKeyName); +} + + +// создать ключ +HKEY CreateRegKey(HKEY hRoot,TCHAR *Key) +{ + HKEY hKey; + DWORD Disposition; + TCHAR FullKeyName[512]; + StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); + + if(RegCreateKeyEx(hRoot,FullKeyName,0,NULL,0,KEY_WRITE,NULL, + &hKey,&Disposition) != ERROR_SUCCESS) + hKey=NULL; + + return(hKey); +} + + +// открыть заданную ветвь реестра +HKEY OpenRegKey(HKEY hRoot,TCHAR *Key) +{ + HKEY hKey; + TCHAR FullKeyName[512]; + StringCchCopy(FullKeyName,ARRAYSIZE(FullKeyName),PluginRootKey); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),(Key && *Key ? _T("\\"):_T(""))); + StringCchCat(FullKeyName,ARRAYSIZE(FullKeyName),Key); + + if(RegOpenKeyEx(hRoot,FullKeyName,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) + return(NULL); + + return(hKey); +} + +// проверить существование ключа +BOOL CheckRegKey(HKEY hRoot,TCHAR *Key) +{ + HKEY hKey=OpenRegKey(hRoot,Key); + + if(hKey!=NULL) + RegCloseKey(hKey); + + return(hKey!=NULL); +} + +#endif diff --git a/UnInstall.cpp b/src/UnInstall.cpp similarity index 58% rename from UnInstall.cpp rename to src/UnInstall.cpp index 953542e..76871ba 100644 --- a/UnInstall.cpp +++ b/src/UnInstall.cpp @@ -1,307 +1,213 @@ -#include -#include -#include -#include -#include -#include "plugin.hpp" -#include "memory.h" -#define realloc my_realloc -#ifndef nullptr -#define nullptr NULL -#endif -#ifndef _ASSERTE -#define _ASSERTE(x) -#endif -#include "DlgBuilder.hpp" -#include "eplugin.cpp" -#include "farcolor.hpp" -#include "farkeys.hpp" -#include "farlang.h" -#include "registry.cpp" -#include "uninstall.hpp" - -#ifdef FARAPI18 -# define SetStartupInfo SetStartupInfoW -# define GetPluginInfo GetPluginInfoW -# define OpenPlugin OpenPluginW -# define Configure ConfigureW -#endif - -#ifdef FARAPI3 -# define SetStartupInfo SetStartupInfoW -# define GetPluginInfo GetPluginInfoW -# define Configure ConfigureW -#endif +#include +#include +#include +#include +#include "plugin.hpp" +#include "memory.h" +#ifndef _ASSERTE +#define _ASSERTE(x) +#endif +#include "DlgBuilder.hpp" +#include "EPlugin.cpp" +#include "farcolor.hpp" +#include "farkeys.hpp" +#include "FarLang.h" +#include "UnInstall.hpp" +#include "version.hpp" -#ifdef FARAPI17 -int WINAPI GetMinFarVersion(void) -{ - return MAKEFARVERSION(1,75,2555); -} -#endif -#ifdef FARAPI18 -int WINAPI GetMinFarVersion(void) -{ - return FARMANAGERVERSION; -} -int WINAPI GetMinFarVersionW(void) -{ - return FARMANAGERVERSION; -} -#endif - -#ifdef FARAPI3 -int WINAPI GetMinFarVersionW(void) +void WINAPI GetGlobalInfoW(struct GlobalInfo *gInfo) { - #define MAKEFARVERSION_OLD(major,minor,build) ( ((major)<<8) | (minor) | ((build)<<16)) - - return MAKEFARVERSION_OLD(FARMANAGERVERSION_MAJOR,FARMANAGERVERSION_MINOR,FARMANAGERVERSION_BUILD); + gInfo->StructSize = sizeof(GlobalInfo); + gInfo->MinFarVersion = MAKEFARVERSION(3, 0, 0, 3192, VS_RELEASE); + gInfo->Version = MAKEFARVERSION(PLUGIN_VER_MAJOR,PLUGIN_VER_MINOR,PLUGIN_VER_PATCH,0,VS_RELEASE); + gInfo->Guid = MainGuid; + gInfo->Title = L"UnInstall"; + gInfo->Description = L"UnInstall"; + gInfo->Author = L"ConEmu.Maximus5@gmail.com"; } -void WINAPI GetGlobalInfoW(struct GlobalInfo *Info) +void WINAPI SetStartupInfoW(const struct PluginStartupInfo *psInfo) { - Info->StructSize = sizeof(GlobalInfo); - Info->MinFarVersion = FARMANAGERVERSION; - - Info->Version = MAKEFARVERSION(1,10,17,0,VS_RELEASE); - Info->Guid = MainGuid; - Info->Title = L"UnInstall"; - Info->Description = L"UnInstall"; - Info->Author = L"ConEmu.Maximus5@gmail.com"; + Info = *psInfo; + FSF = *psInfo->FSF; + Info.FSF = &FSF; + ReadRegistry(); } -#endif -void WINAPI SetStartupInfo(const struct PluginStartupInfo *psInfo) -{ - Info = *psInfo; - FSF = *psInfo->FSF; - Info.FSF = &FSF; - InitHeap(); -#ifndef FARAPI3 - StringCchCopy(PluginRootKey,ARRAYSIZE(PluginRootKey),Info.RootKey); - StringCchCat(PluginRootKey,ARRAYSIZE(PluginRootKey),_T("\\UnInstall")); -#endif - ReadRegistry(); -} - -void WINAPI GetPluginInfo(struct PluginInfo *Info) -{ - static const TCHAR *PluginMenuStrings[1]; - PluginMenuStrings[0] = GetMsg(MPlugIn); - Info -> StructSize = sizeof(*Info); - - if(Opt.WhereWork & 2) - Info -> Flags |= PF_EDITOR; - - if(Opt.WhereWork & 1) - Info -> Flags |= PF_VIEWER; -#ifdef FARAPI3 +void WINAPI GetPluginInfoW(struct PluginInfo *Info) +{ + static const wchar_t *PluginMenuStrings[1]; + PluginMenuStrings[0] = GetMsg(MPlugIn); + Info -> StructSize = sizeof(*Info); + + if(Opt.WhereWork & 2) + Info -> Flags |= PF_EDITOR; + + if(Opt.WhereWork & 1) + Info -> Flags |= PF_VIEWER; + Info ->PluginMenu.Strings = PluginMenuStrings; Info ->PluginMenu.Count = ARRAYSIZE(PluginMenuStrings); Info ->PluginMenu.Guids = &PluginMenuGuid; Info ->PluginConfig.Strings = PluginMenuStrings; Info ->PluginConfig.Count = ARRAYSIZE(PluginMenuStrings); Info ->PluginConfig.Guids = &PluginConfigGuid; -#else - Info -> PluginMenuStrings = PluginMenuStrings; - Info -> PluginConfigStrings = PluginMenuStrings; - Info -> PluginMenuStringsNumber = ARRAYSIZE(PluginMenuStrings); - Info -> PluginConfigStringsNumber = ARRAYSIZE(PluginMenuStrings); -#endif -} - -void ResizeDialog(HANDLE hDlg) -{ - CONSOLE_SCREEN_BUFFER_INFO con_info; - GetConsoleScreenBufferInfo(hStdout, &con_info); - unsigned con_sx = con_info.srWindow.Right - con_info.srWindow.Left + 1; - int max_items = con_info.srWindow.Bottom - con_info.srWindow.Top + 1 - 7; - int s = ((ListSize>0) && (ListSize0 ? max_items : 0)); - SMALL_RECT NewPos = { 2, 1, con_sx - 7, s + 2 }; - SMALL_RECT OldPos; -#ifdef FARAPI3 +} + +void ResizeDialog(HANDLE hDlg) +{ + CONSOLE_SCREEN_BUFFER_INFO con_info; + GetConsoleScreenBufferInfo(hStdout, &con_info); + unsigned con_sx = con_info.srWindow.Right - con_info.srWindow.Left + 1; + int max_items = con_info.srWindow.Bottom - con_info.srWindow.Top + 1 - 7; + int s = ((ListSize>0) && (ListSize0 ? max_items : 0)); + SMALL_RECT NewPos = { 2, 1, con_sx - 7, s + 2 }; + SMALL_RECT OldPos; + Info.SendDlgMessage(hDlg,DM_GETITEMPOSITION,LIST_BOX,&OldPos); -#else - Info.SendDlgMessage(hDlg,DM_GETITEMPOSITION,LIST_BOX,reinterpret_cast(&OldPos)); -#endif - - if(NewPos.Right!=OldPos.Right || NewPos.Bottom!=OldPos.Bottom) - { - COORD coord; - coord.X = con_sx - 4; - coord.Y = s + 4; -#ifdef FARAPI3 + + if(NewPos.Right!=OldPos.Right || NewPos.Bottom!=OldPos.Bottom) + { + COORD coord; + coord.X = con_sx - 4; + coord.Y = s + 4; Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,&coord); -#else - Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,reinterpret_cast(&coord)); -#endif - coord.X = -1; - coord.Y = -1; -#ifdef FARAPI3 + + coord.X = -1; + coord.Y = -1; + Info.SendDlgMessage(hDlg,DM_MOVEDIALOG,TRUE,&coord); Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,LIST_BOX,&NewPos); -#else - Info.SendDlgMessage(hDlg,DM_MOVEDIALOG,TRUE,reinterpret_cast(&coord)); - Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,LIST_BOX,reinterpret_cast(&NewPos)); -#endif - } -} - -#ifdef FARAPI3 + } +} + static INT_PTR WINAPI DlgProc(HANDLE hDlg,intptr_t Msg,intptr_t Param1,void* Param2) -#else -static LONG_PTR WINAPI DlgProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2) -#endif -{ - static TCHAR Filter[MAX_PATH]; - static TCHAR spFilter[MAX_PATH]; - static FarListTitles ListTitle; - -#ifdef FARAPI3 +{ + static wchar_t Filter[MAX_PATH]; + static wchar_t spFilter[MAX_PATH]; + static FarListTitles ListTitle; + INPUT_RECORD* record=nullptr; -#endif - switch(Msg) - { - case DN_RESIZECONSOLE: - { - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0); - ResizeDialog(hDlg); - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0); - } - return TRUE; - case DMU_UPDATE: - { - int OldPos = static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,0)); - - if(Param1) - UpDateInfo(); - - ListSize = 0; - int NewPos = -1; - - if(OldPos >= 0 && OldPos < nCount) - { - if(!*Filter || strstri(p[OldPos].Keys[DisplayName],Filter)) // OEM - NewPos = OldPos; - } - - for(int i = 0; i < nCount; i++) - { - const TCHAR* DispName = p[i].Keys[DisplayName], *Find; - - if(*Filter) - Find = strstri(DispName,Filter); - else - Find = DispName; - - if(Find != nullptr) // OEM - { - FLI[i].Flags &= ~LIF_HIDDEN; - - if(Param2 && (i == OldPos)) - { - if(FLI[i].Flags & LIF_CHECKED) - { - FLI[i].Flags &= ~LIF_CHECKED; - } - else - { - FLI[i].Flags |= LIF_CHECKED; - } - } - - // - ANSI - if(NewPos == -1 && Find == DispName) - NewPos = i; - - ListSize++; - } - else - FLI[i].Flags |= LIF_HIDDEN; - } - - if(Param1 == 0 && Param2) - { - // (Ins) -#ifdef FARAPI3 + switch(Msg) + { + case DN_RESIZECONSOLE: + { + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,nullptr); + ResizeDialog(hDlg); + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,nullptr); + } + return TRUE; + case DMU_UPDATE: + { + int OldPos = static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,nullptr)); + + if(Param1) + UpDateInfo(); + + ListSize = 0; + int NewPos = -1; + + if(OldPos >= 0 && OldPos < nCount) + { + if(!*Filter || strstri(p[OldPos].Keys[DisplayName],Filter)) //без учета регистра в OEM кодировке + NewPos = OldPos; + } + + for(int i = 0; i < nCount; i++) + { + const wchar_t* DispName = p[i].Keys[DisplayName], *Find; + + if(*Filter) + Find = strstri(DispName,Filter); + else + Find = DispName; + + if(Find != nullptr) //без учета регистра в OEM кодировке + { + FLI[i].Flags &= ~LIF_HIDDEN; + + if(Param2 && (i == OldPos)) + { + if(FLI[i].Flags & LIF_CHECKED) + { + FLI[i].Flags &= ~LIF_CHECKED; + } + else + { + FLI[i].Flags |= LIF_CHECKED; + } + } + + //без учета регистра - а кодировка ANSI + if(NewPos == -1 && Find == DispName) + NewPos = i; + + ListSize++; + } + else + FLI[i].Flags |= LIF_HIDDEN; + } + + if(Param1 == 0 && Param2) + { + // Снятие или установка пометки (Ins) if(*(int*)Param2 == 1) -#else - if(Param2 == 1) -#endif - { - for(int i = (OldPos+1); i < nCount; i++) - { - if(!(FLI[i].Flags & LIF_HIDDEN)) - { - OldPos = i; break; - } - } - - NewPos = OldPos; - } - // (RClick) -#ifdef FARAPI3 + { + for(int i = (OldPos+1); i < nCount; i++) + { + if(!(FLI[i].Flags & LIF_HIDDEN)) + { + OldPos = i; break; + } + } + + NewPos = OldPos; + } + // Снятие или установка пометки (RClick) + else if(*(int*)Param2 == 2) -#else - else if(Param2 == 2) -#endif - { - NewPos = OldPos; - } - } - else if(NewPos == -1) - { - NewPos = OldPos; - } - - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0); -#ifdef FARAPI3 + { + NewPos = OldPos; + } + } + else if(NewPos == -1) + { + NewPos = OldPos; + } + + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,nullptr); Info.SendDlgMessage(hDlg,DM_LISTSET,LIST_BOX,&FL); -#else - Info.SendDlgMessage(hDlg,DM_LISTSET,LIST_BOX,reinterpret_cast(&FL)); -#endif - StringCchPrintf(spFilter,ARRAYSIZE(spFilter), GetMsg(MFilter),Filter,ListSize,nCount); - ListTitle.Title = spFilter; -#ifdef FARAPI3 + + StringCchPrintf(spFilter,ARRAYSIZE(spFilter), GetMsg(MFilter),Filter,ListSize,nCount); + ListTitle.Title = spFilter; ListTitle.TitleSize = lstrlen(spFilter); ListTitle.StructSize = sizeof(FarListTitles); Info.SendDlgMessage(hDlg,DM_LISTSETTITLES,LIST_BOX,&ListTitle); -#else - ListTitle.TitleLen = lstrlen(spFilter); - Info.SendDlgMessage(hDlg,DM_LISTSETTITLES,LIST_BOX,reinterpret_cast(&ListTitle)); -#endif - ResizeDialog(hDlg); - struct FarListPos FLP; - FLP.SelectPos = NewPos; - FLP.TopPos = -1; -#ifdef FARAPI3 + + ResizeDialog(hDlg); + struct FarListPos FLP{}; + FLP.SelectPos = NewPos; + FLP.TopPos = -1; FLP.StructSize = sizeof(FarListPos); Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,&FLP); -#else - Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,reinterpret_cast(&FLP)); -#endif - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0); - } - break; - case DN_INITDIALOG: - { - StringCchCopy(Filter,ARRAYSIZE(Filter),_T("")); - ListTitle.Bottom = const_cast(GetMsg(MBottomLine)); -#ifdef FARAPI3 + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,nullptr); + } + break; + case DN_INITDIALOG: + { + StringCchCopy(Filter,ARRAYSIZE(Filter),L""); + ListTitle.Bottom = const_cast(GetMsg(MBottomLine)); ListTitle.BottomSize = lstrlen(GetMsg(MBottomLine)); -#else - ListTitle.BottomLen = lstrlen(GetMsg(MBottomLine)); -#endif - // - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0); - ResizeDialog(hDlg); - Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0); - // - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); - } - break; -#ifdef FARAPI3 + + //подстраиваемся под размеры консоли + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,nullptr); + ResizeDialog(hDlg); + Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,nullptr); + //заполняем диалог + Info.SendDlgMessage(hDlg,DMU_UPDATE,1,nullptr); + } + break; case DN_CONTROLINPUT: { record=(INPUT_RECORD *)Param2; @@ -309,22 +215,12 @@ static LONG_PTR WINAPI DlgProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2) if (Param1 == LIST_BOX) { MOUSE_EVENT_RECORD *mer = &record->Event.MouseEvent; -#else - case DN_MOUSECLICK: - { - if(Param1 == LIST_BOX) - { - MOUSE_EVENT_RECORD *mer = (MOUSE_EVENT_RECORD *)Param2; -#endif + if(mer->dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) - { + { // find list on-screen coords (excluding frame and border) SMALL_RECT list_rect; -#ifdef FARAPI3 Info.SendDlgMessage(hDlg, DM_GETDLGRECT, 0, &list_rect); -#else - Info.SendDlgMessage(hDlg, DM_GETDLGRECT, 0, reinterpret_cast(&list_rect)); -#endif list_rect.Left += 2; list_rect.Top += 1; list_rect.Right -= 2; @@ -332,281 +228,202 @@ static LONG_PTR WINAPI DlgProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2) if((mer->dwEventFlags == 0) && (mer->dwMousePosition.X > list_rect.Left) && (mer->dwMousePosition.X < list_rect.Right) && (mer->dwMousePosition.Y > list_rect.Top) && (mer->dwMousePosition.Y < list_rect.Bottom)) { -#ifdef FARAPI3 INPUT_RECORD irecord; irecord.EventType=KEY_EVENT; KEY_EVENT_RECORD key = { false,0,KEY_ENTER,0,0 }; irecord.Event.KeyEvent = key; DlgProc(hDlg, DN_CONTROLINPUT, LIST_BOX, &irecord); -#else - DlgProc(hDlg, DN_KEY, LIST_BOX, KEY_ENTER); -#endif + return TRUE; } - + // pass message to scrollbar if needed if((mer->dwMousePosition.X == list_rect.Right) && (mer->dwMousePosition.Y > list_rect.Top) && (mer->dwMousePosition.Y < list_rect.Bottom)) return FALSE; - + return TRUE; } else if(mer->dwButtonState == RIGHTMOST_BUTTON_PRESSED) { -#ifdef FARAPI3 int k=2; Info.SendDlgMessage(hDlg,DMU_UPDATE,0,&k); -#else - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,2); -#endif return TRUE; } return false; - } - } -#ifdef FARAPI3 + } + } else if (record->EventType == KEY_EVENT) { switch(record->Event.KeyEvent.wVirtualKeyCode) -#else - break; - case DN_KEY: - switch(Param2) -#endif - { -#ifdef FARAPI3 + { case VK_F8: -#else - case KEY_F8: -#endif - { - if(ListSize) - { - TCHAR DlgText[MAX_PATH + 200]; - StringCchPrintf(DlgText, ARRAYSIZE(DlgText), GetMsg(MConfirm), p[Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)].Keys[DisplayName]); - - if(EMessage((const TCHAR * const *) DlgText, 0, 2) == 0) - { - if(!DeleteEntry(static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)))) - DrawMessage(FMSG_WARNING, 1, "%s",GetMsg(MPlugIn),GetMsg(MDelRegErr),GetMsg(MBtnOk),NULL); - - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); - } - } - } - return TRUE; -#ifdef FARAPI3 + { + if(ListSize) + { + wchar_t DlgText[MAX_PATH + 200]; + StringCchPrintf(DlgText, ARRAYSIZE(DlgText), GetMsg(MConfirm), p[Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,nullptr)].Keys[DisplayName]); + + if(EMessage((const wchar_t * const *) DlgText, 0, 2) == 0) + { + if(!DeleteEntry(static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,nullptr)))) + DrawMessage(FMSG_WARNING, 1, "%s",GetMsg(MPlugIn),GetMsg(MDelRegErr),GetMsg(MBtnOk),nullptr); + + Info.SendDlgMessage(hDlg,DMU_UPDATE,1,nullptr); + } + } + } + return TRUE; case VK_F9: -#else - case(KEY_F9|KEY_SHIFT|KEY_ALT): - case(KEY_F9): -#endif - { - Configure(0); - } - return TRUE; -#ifdef FARAPI3 // far3 default. -#else - case KEY_CTRLR: - { - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); - } - return TRUE; -#endif -#ifdef FARAPI3 + { + ConfigureW(nullptr); + } + return TRUE; case VK_RETURN: -#else - case KEY_ENTER: - case KEY_SHIFTENTER: -#endif - { - if(ListSize) - { - int liChanged = 0; - int liSelected = 0, liFirst = -1; - - for(int i = 0; i < nCount; i++) - { - if(FLI[i].Flags & LIF_CHECKED) - { - if(liFirst == -1) - liFirst = i; - - liSelected++; - } - } - - if(liSelected <= 1) - { -#ifdef FARAPI3 + { + if(ListSize) + { + int liChanged = 0; + int liSelected = 0, liFirst = -1; + + for(int i = 0; i < nCount; i++) + { + if(FLI[i].Flags & LIF_CHECKED) + { + if(liFirst == -1) + liFirst = i; + + liSelected++; + } + } + + if(liSelected <= 1) + { int liAction; if ((record->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) && (record->Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)) { liAction = Opt.ShiftEnterAction; }else{ liAction = Opt.EnterAction; } -#else - int liAction = (Param2 == KEY_ENTER) ? Opt.EnterAction : Opt.ShiftEnterAction; -#endif - int pos = (liFirst == -1) ? static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)) : liFirst; - liChanged = ExecuteEntry(pos, liAction, (Opt.RunLowPriority!=0)); - } - else - { -#ifdef FARAPI3 + int pos = (liFirst == -1) ? static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,nullptr)) : liFirst; + liChanged = ExecuteEntry(pos, liAction, (Opt.RunLowPriority!=0)); + } + else + { int liAction; if ((record->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) && (record->Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)) { liAction = Opt.ShiftEnterAction; }else{ liAction = Opt.EnterAction; } -#else - int liAction = (Param2 == KEY_ENTER) ? Opt.EnterAction : Opt.ShiftEnterAction; -#endif - bool LowPriority = (Opt.RunLowPriority!=0); - - // - - if(liAction == Action_Menu) - { - if(EntryMenu(0, liAction, LowPriority, liSelected) < 0) - return TRUE; - } - else if(liAction == Action_Uninstall) - liAction = Action_UninstallWait; - else if(liAction == Action_Modify) - liAction = Action_ModifyWait; - else if(liAction == Action_Repair) - liAction = Action_RepairWait; - - for(int pos = 0; pos < nCount; pos++) - { - if(!(FLI[pos].Flags & LIF_CHECKED)) - continue; - - struct FarListPos FLP; - FLP.SelectPos = pos; - FLP.TopPos = -1; -#ifdef FARAPI3 + + bool LowPriority = (Opt.RunLowPriority!=0); + + // Обязательно ожидание - два инсталлятора сразу недопускаются + if(liAction == Action_Menu) + { + if(EntryMenu(0, liAction, LowPriority, liSelected) < 0) + return TRUE; + } + else if(liAction == Action_Uninstall) + liAction = Action_UninstallWait; + else if(liAction == Action_Modify) + liAction = Action_ModifyWait; + else if(liAction == Action_Repair) + liAction = Action_RepairWait; + + for(int pos = 0; pos < nCount; pos++) + { + if(!(FLI[pos].Flags & LIF_CHECKED)) + continue; + + struct FarListPos FLP{}; + FLP.SelectPos = pos; + FLP.TopPos = -1; FLP.StructSize = sizeof(FarListPos); Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,&FLP); -#else - Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,reinterpret_cast(&FLP)); -#endif - int li = ExecuteEntry(pos, liAction, LowPriority); - - if(li == -1) - break; // - - if(li == 1) - liChanged = 1; - } - } - - if(liChanged == 1) - { - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); - } - } - } - return TRUE; -#ifdef FARAPI3 + + int li = ExecuteEntry(pos, liAction, LowPriority); + + if(li == -1) + break; // отмена + + if(li == 1) + liChanged = 1; + } + } + + if(liChanged == 1) + { + Info.SendDlgMessage(hDlg,DMU_UPDATE,1,nullptr); + } + } + } + return TRUE; case VK_DELETE: -#else - case KEY_DEL: -#endif - { - if(lstrlen(Filter) > 0) - { - StringCchCopy(Filter,ARRAYSIZE(Filter),_T("")); - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0); - } - } - return TRUE; -#ifdef FARAPI3 + { + if(lstrlen(Filter) > 0) + { + StringCchCopy(Filter,ARRAYSIZE(Filter),L""); + Info.SendDlgMessage(hDlg,DMU_UPDATE,0,nullptr); + } + } + return TRUE; case VK_F3: case VK_F4: -#else - case KEY_F3: - case KEY_F4: -#endif - { - if(ListSize) - { - DisplayEntry(static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL))); - Info.SendDlgMessage(hDlg,DM_REDRAW,NULL,NULL); - } - } - return TRUE; -#ifdef FARAPI3 + { + if(ListSize) + { + DisplayEntry(static_cast(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,nullptr))); + Info.SendDlgMessage(hDlg,DM_REDRAW,0,nullptr); + } + } + return TRUE; case VK_F2: -#else - case KEY_F2: -#endif - { - Opt.SortByDate = !Opt.SortByDate; - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); - } - return TRUE; -#ifdef FARAPI3 + { + Opt.SortByDate = !Opt.SortByDate; + Info.SendDlgMessage(hDlg,DMU_UPDATE,1,nullptr); + } + return TRUE; case VK_BACK: -#else - case KEY_BS: -#endif - { - if(lstrlen(Filter)) - { - Filter[lstrlen(Filter)-1] = '\0'; - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0); - } - } - return TRUE; + { + if(lstrlen(Filter)) + { + Filter[lstrlen(Filter)-1] = '\0'; + Info.SendDlgMessage(hDlg,DMU_UPDATE,0,nullptr); + } + } + return TRUE; default: - { -#ifdef FARAPI3 + { //case KEY_CTRLR: if ((record->Event.KeyEvent.wVirtualKeyCode=='R')&&((record->Event.KeyEvent.dwControlKeyState & RIGHT_CTRL_PRESSED)||(record->Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED))) { - Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0); + Info.SendDlgMessage(hDlg,DMU_UPDATE,1,nullptr); return TRUE; } -#endif // KEY_INS -#ifdef FARAPI3 + if((record->Event.KeyEvent.wVirtualKeyCode==VK_INSERT)&&(!(record->Event.KeyEvent.dwControlKeyState &(LEFT_ALT_PRESSED |LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED |RIGHT_CTRL_PRESSED |SHIFT_PRESSED )))) - { + { int k=1; Info.SendDlgMessage(hDlg,DMU_UPDATE,0,&k); return TRUE; } -#else - if (Param2==KEY_INS) { - { - int k=1; - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,1); - return TRUE; - } -#endif + //-- KEY_SHIFTINS KEY_CTRLV -#ifdef FARAPI3 + if ( ((record->Event.KeyEvent.wVirtualKeyCode=='V')&&((record->Event.KeyEvent.dwControlKeyState & RIGHT_CTRL_PRESSED)||(record->Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED))) ||((record->Event.KeyEvent.wVirtualKeyCode==VK_INSERT)&&(record->Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED))){ -#else - if ((Param2==KEY_SHIFTINS)||(Param2==KEY_CTRLV)) { -#endif - static TCHAR bufData[MAX_PATH]; -#ifdef FARAPI3 + + static wchar_t bufData[MAX_PATH]; size_t size = FSF.PasteFromClipboard(FCT_STREAM,nullptr,0); - TCHAR *bufP = new TCHAR[size]; + wchar_t *bufP = new wchar_t[size]; FSF.PasteFromClipboard(FCT_STREAM,bufP,size); -#else - TCHAR * bufP = FSF.PasteFromClipboard(); -#endif + if(bufP) { StringCchCopy(bufData,ARRAYSIZE(bufData),bufP); -#ifdef FARAPI3 delete[] bufP; -#else - FSF.DeleteBuffer(bufP); -#endif + unQuote(bufData); FSF.LStrlwr(bufData); @@ -615,127 +432,82 @@ static LONG_PTR WINAPI DlgProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2) if(strnstri(p[j].Keys[DisplayName],bufData,i)) { lstrcpyn(Filter,bufData,i+1); - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0); + Info.SendDlgMessage(hDlg,DMU_UPDATE,0,nullptr); return TRUE; } } - return TRUE; - } + return TRUE; + } //--default -#ifdef FARAPI3 + if(record->Event.KeyEvent.wVirtualKeyCode >= VK_SPACE && record->Event.KeyEvent.wVirtualKeyCode <= VK_DIVIDE && record->Event.KeyEvent.uChar.UnicodeChar!=0) -#else - if(Param2 >= KEY_SPACE && Param2 < KEY_FKEY_BEGIN) -#endif { - struct FarListInfo ListInfo; -#ifdef FARAPI3 + struct FarListInfo ListInfo{}; ListInfo.StructSize = sizeof(FarListInfo); Info.SendDlgMessage(hDlg,DM_LISTINFO,LIST_BOX,&ListInfo); -#else - Info.SendDlgMessage(hDlg,DM_LISTINFO,LIST_BOX,reinterpret_cast(&ListInfo)); -#endif if((lstrlen(Filter) < sizeof(Filter)) && ListInfo.ItemsNumber) { int filterL = lstrlen(Filter); -#ifdef FARAPI3 Filter[filterL] = FSF.LLower(record->Event.KeyEvent.uChar.UnicodeChar); -#else - Filter[filterL] = FSF.LLower(static_cast(Param2)); -#endif Filter[filterL+1] = '\0'; - Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0); + Info.SendDlgMessage(hDlg,DMU_UPDATE,0,nullptr); return TRUE; } } - } - } + } } -#ifdef FARAPI3 - } -#endif - - return FALSE; - case DN_CTLCOLORDIALOG: -#ifdef FARAPI3 + } + } + + return FALSE; + case DN_CTLCOLORDIALOG: + Info.AdvControl(&MainGuid,ACTL_GETCOLOR,COL_MENUTEXT, Param2); return true; -#else - return Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)COL_MENUTEXT); -#endif - case DN_CTLCOLORDLGLIST: - if(Param1 == LIST_BOX) - { -#ifdef FARAPI3 + + case DN_CTLCOLORDLGLIST: + if(Param1 == LIST_BOX) + { FarDialogItemColors *fdic=(FarDialogItemColors *)Param2; FarColor *Colors = fdic->Colors; -#else - FarListColors *Colors = (FarListColors *)Param2; -#endif - int ColorIndex[] = { COL_MENUBOX, COL_MENUBOX, COL_MENUTITLE, COL_MENUTEXT, COL_MENUHIGHLIGHT, COL_MENUBOX, COL_MENUSELECTEDTEXT, COL_MENUSELECTEDHIGHLIGHT, COL_MENUSCROLLBAR, COL_MENUDISABLEDTEXT, COL_MENUARROWS, COL_MENUARROWSSELECTED, COL_MENUARROWSDISABLED }; - int Count = ARRAYSIZE(ColorIndex); -#ifdef FARAPI3 + + int ColorIndex[] = { COL_MENUBOX, COL_MENUBOX, COL_MENUTITLE, COL_MENUTEXT, COL_MENUHIGHLIGHT, COL_MENUBOX, COL_MENUSELECTEDTEXT, COL_MENUSELECTEDHIGHLIGHT, COL_MENUSCROLLBAR, COL_MENUDISABLEDTEXT, COL_MENUARROWS, COL_MENUARROWSSELECTED, COL_MENUARROWSDISABLED }; + int Count = ARRAYSIZE(ColorIndex); if(Count > fdic->ColorsCount) Count = fdic->ColorsCount; -#else - if(Count > Colors->ColorCount) - Count = Colors->ColorCount; -#endif + for(int i = 0; i < Count; i++){ -#ifdef FARAPI3 - FarColor fc; + FarColor fc{}; if (static_cast(Info.AdvControl(&MainGuid, ACTL_GETCOLOR, ColorIndex[i],&fc))) { Colors[i] = fc; } -#else - Colors->Colors[i] = static_cast(Info.AdvControl(Info.ModuleNumber, ACTL_GETCOLOR, reinterpret_cast(ColorIndex[i]))); -#endif } - return TRUE; - } - break; - } - - return Info.DefDlgProc(hDlg,Msg,Param1,Param2); -} - -#ifdef FARAPI3 + return TRUE; + } + break; + } + + return Info.DefDlgProc(hDlg,Msg,Param1,Param2); +} + HANDLE WINAPI OpenW(const struct OpenInfo *oInfo) -#else -HANDLE WINAPI OpenPlugin(int /*OpenFrom*/, INT_PTR /*Item*/) -#endif -{ - ReadRegistry(); - struct FarDialogItem DialogItems[1]; - ZeroMemory(DialogItems, sizeof(DialogItems)); - p = NULL; - FLI = NULL; - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - UpDateInfo(); - DialogItems[0].Type = DI_LISTBOX; +{ + ReadRegistry(); + struct FarDialogItem DialogItems[1]; + ZeroMemory(DialogItems, sizeof(DialogItems)); + p = nullptr; + FLI = nullptr; + hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + UpDateInfo(); + DialogItems[0].Type = DI_LISTBOX; DialogItems[0].Flags = DIF_LISTNOAMPERSAND ; -#ifdef FARAPI3 DialogItems[0].Flags |=DIF_LISTTRACKMOUSEINFOCUS; -#endif - DialogItems[0].X1 = 2; - DialogItems[0].Y1 = 1; -#ifdef FARAPI17 - Info.DialogEx(Info.ModuleNumber,-1,-1,0,0,"Contents",DialogItems,ARRAYSIZE(DialogItems),0,0,DlgProc,0); -#endif -#ifdef FARAPI18 - HANDLE h_dlg = Info.DialogInit(Info.ModuleNumber,-1,-1,1,1,L"Contents",DialogItems,ARRAYSIZE(DialogItems),0,0,DlgProc,0); - - if(h_dlg != INVALID_HANDLE_VALUE) - { - Info.DialogRun(h_dlg); - Info.DialogFree(h_dlg); - } - -#endif -#ifdef FARAPI3 - HANDLE h_dlg = Info.DialogInit(&MainGuid,&ContentsGuid,-1,-1,0,0,L"Contents",DialogItems,ARRAYSIZE(DialogItems),0,0,DlgProc,0); + DialogItems[0].X1 = 2; + DialogItems[0].Y1 = 1; + + HANDLE h_dlg = Info.DialogInit(&MainGuid,&ContentsGuid,-1,-1,0,0,L"Contents",DialogItems,ARRAYSIZE(DialogItems),0,0,DlgProc,nullptr); if(h_dlg != INVALID_HANDLE_VALUE) { @@ -743,69 +515,55 @@ HANDLE WINAPI OpenPlugin(int /*OpenFrom*/, INT_PTR /*Item*/) Info.DialogFree(h_dlg); } -#endif - FLI = (FarListItem *) realloc(FLI, 0); - p = (KeyInfo *) realloc(p, 0); - return NULL; -} - -#ifdef FARAPI3 -intptr_t WINAPI Configure(const struct ConfigureInfo *cInfo) + + FLI = (FarListItem *) realloc(FLI, 0); + p = (KeyInfo *) realloc(p, 0); + return nullptr; +} + +intptr_t WINAPI ConfigureW(const struct ConfigureInfo *cInfo) { - PluginDialogBuilder Config(Info, MainGuid,ConfigGuid, MPlugIn, _T("Configuration")); -#else -int WINAPI Configure(int ItemNumber) -{ - PluginDialogBuilder Config(Info, MPlugIn, _T("Configuration")); -#endif - FarDialogItem *p1, *p2; - BOOL bShowInViewer = (Opt.WhereWork & 1) != 0; - BOOL bShowInEditor = (Opt.WhereWork & 2) != 0; - //BOOL bEnterWaitCompletion = (Opt.EnterFunction != 0); - BOOL bUseElevation = (Opt.UseElevation != 0); - BOOL bLowPriority = (Opt.RunLowPriority != 0); - BOOL bForceMsiUse = (Opt.ForceMsiUse != 0); - Config.AddCheckbox(MShowInEditor, &bShowInEditor); - Config.AddCheckbox(MShowInViewer, &bShowInViewer); - //Config.AddCheckbox(MEnterWaitCompletion, &bEnterWaitCompletion); - Config.AddCheckbox(MUseElevation, &bUseElevation); - Config.AddCheckbox(MLowPriority, &bUseElevation); - Config.AddCheckbox(MForceMsiUse, &bForceMsiUse); - Config.AddSeparator(); - FarList AEnter, AShiftEnter; - AEnter.ItemsNumber = AShiftEnter.ItemsNumber = 7; - AEnter.Items = (FarListItem*)calloc(AEnter.ItemsNumber,sizeof(FarListItem)); - AShiftEnter.Items = (FarListItem*)calloc(AEnter.ItemsNumber,sizeof(FarListItem)); - -#ifdef FARAPI3 + PluginDialogBuilder Config(Info, MainGuid,ConfigGuid, MPlugIn, L"Configuration"); + FarDialogItem *p1, *p2; + BOOL bShowInViewer = (Opt.WhereWork & 1) != 0; + BOOL bShowInEditor = (Opt.WhereWork & 2) != 0; + //BOOL bEnterWaitCompletion = (Opt.EnterFunction != 0); + BOOL bUseElevation = (Opt.UseElevation != 0); + BOOL bLowPriority = (Opt.RunLowPriority != 0); + BOOL bForceMsiUse = (Opt.ForceMsiUse != 0); + Config.AddCheckbox(MShowInEditor, &bShowInEditor); + Config.AddCheckbox(MShowInViewer, &bShowInViewer); + //Config.AddCheckbox(MEnterWaitCompletion, &bEnterWaitCompletion); + Config.AddCheckbox(MUseElevation, &bUseElevation); + Config.AddCheckbox(MLowPriority, &bUseElevation); + Config.AddCheckbox(MForceMsiUse, &bForceMsiUse); + Config.AddSeparator(); + FarList AEnter{}, AShiftEnter{}; + AEnter.ItemsNumber = AShiftEnter.ItemsNumber = 7; + AEnter.Items = (FarListItem*)calloc(AEnter.ItemsNumber,sizeof(FarListItem)); + AShiftEnter.Items = (FarListItem*)calloc(AEnter.ItemsNumber,sizeof(FarListItem)); + AEnter.StructSize = sizeof(FarList); AShiftEnter.StructSize = sizeof(FarList); -#endif for(size_t i = 0; i < AEnter.ItemsNumber; i++) - { -#if defined FARAPI18 || defined FARAPI3 - AEnter.Items[i].Text = GetMsg(MActionUninstallWait+i); - AShiftEnter.Items[i].Text = AEnter.Items[i].Text; -#else - StringCchCopy(AEnter.Items[i].Text,ARRAYSIZE(AEnter.Items[i].Text),GetMsg(MActionUninstallWait+i)); - StringCchCopy(AShiftEnter.Items[i].Text,ARRAYSIZE(AShiftEnter.Items[i].Text),AEnter.Items[i].Text); -#endif - } - - p1 = Config.AddText(MEnterAction); p2 = Config.AddComboBox(23, &AEnter, &Opt.EnterAction); - Config.MoveItemAfter(p1,p2); - p1 = Config.AddText(MShiftEnterAction); p2 = Config.AddComboBox(23, &AShiftEnter, &Opt.ShiftEnterAction); - Config.MoveItemAfter(p1,p2); - Config.AddOKCancel(MBtnOk, MBtnCancel); - - if(Config.ShowDialog()) - { - Opt.WhereWork = (bShowInViewer ? 1 : 0) | (bShowInEditor ? 2 : 0); - //Opt.EnterFunction = bEnterWaitCompletion; - Opt.UseElevation = bUseElevation; - Opt.RunLowPriority = bLowPriority; - Opt.ForceMsiUse = bForceMsiUse; -#ifdef FARAPI3 + { + AEnter.Items[i].Text = GetMsg(MActionUninstallWait+i); + AShiftEnter.Items[i].Text = AEnter.Items[i].Text; + } + + p1 = Config.AddText(MEnterAction); p2 = Config.AddComboBox(23, &AEnter, &Opt.EnterAction); + Config.MoveItemAfter(p1,p2); + p1 = Config.AddText(MShiftEnterAction); p2 = Config.AddComboBox(23, &AShiftEnter, &Opt.ShiftEnterAction); + Config.MoveItemAfter(p1,p2); + Config.AddOKCancel(MBtnOk, MBtnCancel); + + if(Config.ShowDialog()) + { + Opt.WhereWork = (bShowInViewer ? 1 : 0) | (bShowInEditor ? 2 : 0); + //Opt.EnterFunction = bEnterWaitCompletion; + Opt.UseElevation = bUseElevation; + Opt.RunLowPriority = bLowPriority; + Opt.ForceMsiUse = bForceMsiUse; PluginSettings settings(MainGuid,Info.SettingsControl); settings.Set(0,L"WhereWork",Opt.WhereWork); settings.Set(0,L"EnterAction",Opt.EnterAction); @@ -813,15 +571,7 @@ int WINAPI Configure(int ItemNumber) settings.Set(0,L"UseElevation",Opt.UseElevation); settings.Set(0,L"RunLowPriority",Opt.RunLowPriority); settings.Set(0,L"ForceMsiUse",Opt.ForceMsiUse); -#else - SetRegKey(HKCU,_T(""),_T("WhereWork"),(DWORD) Opt.WhereWork); - SetRegKey(HKCU,_T(""),_T("EnterAction"),(DWORD) Opt.EnterAction); - SetRegKey(HKCU,_T(""),_T("ShiftEnterAction"),(DWORD) Opt.ShiftEnterAction); - SetRegKey(HKCU,_T(""),_T("UseElevation"),(DWORD) Opt.UseElevation); - SetRegKey(HKCU,_T(""),_T("RunLowPriority"),(DWORD) Opt.RunLowPriority); - SetRegKey(HKCU,_T(""),_T("ForceMsiUse"),(DWORD) Opt.ForceMsiUse); -#endif - } - - return FALSE; -} + } + + return FALSE; +} diff --git a/UnInstallW3.def b/src/UnInstall.def similarity index 80% rename from UnInstallW3.def rename to src/UnInstall.def index 41c8d88..5c8712b 100644 --- a/UnInstallW3.def +++ b/src/UnInstall.def @@ -1,6 +1,5 @@ EXPORTS GetGlobalInfoW - GetMinFarVersionW SetStartupInfoW GetPluginInfoW OpenW diff --git a/UnInstall.hpp b/src/UnInstall.hpp similarity index 64% rename from UnInstall.hpp rename to src/UnInstall.hpp index aa786f2..1fa9b67 100644 --- a/UnInstall.hpp +++ b/src/UnInstall.hpp @@ -1,498 +1,424 @@ #include "guid.hpp" -#ifdef FARAPI3 #include "PluginSettings.hpp" -#endif - -// -const TCHAR *HelpTopics[] = -{ - _T("DisplayName"), - _T(""), - _T("InstallLocation"), - _T("ModifyPath"), - _T("UninstallString"), - _T("Publisher"), - _T("URLInfoAbout"), - _T("URLUpdateInfo"), - _T("Comments"), - _T("DisplayVersion"), - _T("InstallDate") // Must be last item! -}; - -const TCHAR *HiddenPrefixes[] = -{ - _T("InstallWIX_{"), - _T("InstallShield_{") -}; - -enum -{ - LIST_BOX, - DMU_UPDATE = DM_USER+1 -}; - -enum ActionEnum -{ - Action_UninstallWait = 0, - Action_Uninstall, - Action_ModifyWait, - Action_Modify, - Action_RepairWait, - Action_Repair, - Action_Menu, -}; - -//enum ActionMenuEnum -//{ -// ActionMenu_UninstallWait = 0, -// ActionMenu_Uninstall, -// ActionMenu_ModifyWait, -// ActionMenu_Modify, -// ActionMenu_RepairWait, -// ActionMenu_Repair, -//}; - -enum -{ - DisplayName, - RegLocation, - InstallLocation, - ModifyPath, - UninstallString, - Publisher, - URLInfoAbout, - URLUpdateInfo, - Comments, - DisplayVersion, - InstallDate -}; - -const int KeysCount = ARRAYSIZE(HelpTopics); -struct RegKeyPath -{ - HKEY Root; - const TCHAR* Path; -} UninstKeys[] = -{ - { HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall") }, - { HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall") }, -}; -int nCount; // -int nRealCount; // -FarList FL; -FarListItem* FLI = NULL; -int ListSize; -HANDLE hStdout; - -struct Options -{ - int WhereWork; //<- TechInfo - //int EnterFunction; //<- TechInfo - int EnterAction; // enum ActionEnum - int ShiftEnterAction; // enum ActionEnum - int UseElevation; //<- TechInfo - int RunLowPriority; - int ForceMsiUse; - bool SortByDate; -} Opt; - -struct KeyInfo -{ - TCHAR Keys[KeysCount][MAX_PATH]; -#if defined FARAPI18 || defined FARAPI3 - TCHAR ListItem[MAX_PATH]; -#endif - bool Avail[KeysCount]; - RegKeyPath RegKey; - FILETIME RegTime; - TCHAR InstDate[10]; - DWORD InstDateN; - REGSAM RegView; - TCHAR SubKeyName[MAX_PATH]; - bool WindowsInstaller; - bool Hidden; - bool NoModify, NoRepair; - bool CanModify, CanRepair; -} *p = NULL; - -bool ValidGuid(const TCHAR* guid) -{ - const unsigned c_max_guid_len = 38; - wchar_t buf[c_max_guid_len + 1]; - ZeroMemory(buf, sizeof(buf)); - unsigned l = lstrlen(guid); - - for(unsigned i = 0; (i < c_max_guid_len) && (i < l); i++) buf[i] = guid[i]; - - IID iid; - return IIDFromString(buf, &iid) == S_OK; -} - -// -bool FillReg(KeyInfo& key, TCHAR* Buf, RegKeyPath& RegKey, REGSAM RegView) -{ - HKEY userKey; - DWORD regType; - TCHAR fullN[MAX_PATH*2], *pszNamePtr; - LONG ExitCode; - DWORD bufSize, dwTest; - memset(&key, 0, sizeof(key)); - key.RegKey = RegKey; - key.RegView = RegView; - StringCchCopy(key.SubKeyName,ARRAYSIZE(key.SubKeyName),Buf); - StringCchCopy(fullN,ARRAYSIZE(fullN),key.RegKey.Path); - StringCchCat(fullN,ARRAYSIZE(fullN),_T("\\")); - pszNamePtr = fullN + _tcslen(fullN); - StringCchCat(fullN,ARRAYSIZE(fullN),key.SubKeyName); - - if(RegOpenKeyEx(key.RegKey.Root, fullN, 0, KEY_READ | RegView, &userKey) != ERROR_SUCCESS) - return FALSE; - - // "InstallWIX_{GUID}", "InstallShield_{" - for(int h = 0; h < ARRAYSIZE(HiddenPrefixes); h++) - { - int nPrefixLen = lstrlen(HiddenPrefixes[h]); - - if(memcmp(key.SubKeyName, HiddenPrefixes[h], nPrefixLen*sizeof(TCHAR)) == 0 - && ValidGuid(key.SubKeyName+nPrefixLen-1)) - { - // "" - *pszNamePtr = 0; - StringCchCat(fullN,ARRAYSIZE(fullN),key.SubKeyName+nPrefixLen-1); - HKEY hTestKey; - - if(RegOpenKeyEx(key.RegKey.Root, fullN, 0, KEY_READ | RegView, &hTestKey) == ERROR_SUCCESS) - { - key.Hidden = true; - RegCloseKey(hTestKey); - } - } - } - - key.WindowsInstaller = (RegQueryValueEx(userKey,_T("WindowsInstaller"),0,NULL,NULL,NULL) == ERROR_SUCCESS) && ValidGuid(key.SubKeyName); - key.NoModify = (RegQueryValueEx(userKey,_T("NoModify"),0,NULL,(LPBYTE)&dwTest,&(bufSize)) == ERROR_SUCCESS) && (dwTest!=0); - key.NoRepair = (RegQueryValueEx(userKey,_T("NoRepair"),0,NULL,(LPBYTE)&dwTest,&(bufSize)) == ERROR_SUCCESS) && (dwTest!=0); - TCHAR sKeyTime[64]; int nKeyTimeLen; - - if(RegQueryInfoKey(userKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&key.RegTime) != ERROR_SUCCESS) - { - memset(&key.RegTime, 0, sizeof(key.RegTime)); - //key.Keys[InstallDate][0] = 0; - sKeyTime[0] = 0; nKeyTimeLen = 0; - } - else - { - SYSTEMTIME st; FILETIME ft; - FileTimeToLocalFileTime(&key.RegTime, &ft); - FileTimeToSystemTime(&ft, &st); - StringCchPrintf(sKeyTime, ARRAYSIZE(sKeyTime), _T(" / %02u.%02u.%04u %u:%02u:%02u"), st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond); - StringCchPrintf(key.InstDate, ARRAYSIZE(key.InstDate), _T("%02u.%02u.%02u"), st.wDay, st.wMonth, (st.wYear % 100)); - key.InstDateN = ((st.wYear & 0xFFFF) << 16) | ((st.wMonth & 0xFF) << 8) | (st.wDay & 0xFF); - nKeyTimeLen = lstrlen(sKeyTime) + 1; - } - - for(int i=0; i(&item)); id++) -#endif - { - if(item.Type == DI_EDIT) - Info.SendDlgMessage(hDlg, DM_EDITUNCHANGEDFLAG, id, 0); - } - } - break; -#ifdef FARAPI3 + { + if(item.Type == DI_EDIT) + Info.SendDlgMessage(hDlg, DM_EDITUNCHANGEDFLAG, id, 0); + } + } + break; case DN_CONTROLINPUT: { INPUT_RECORD* record=(INPUT_RECORD *)Param2; if((record->EventType==KEY_EVENT)&&((record->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR) || (record->Event.KeyEvent.wVirtualKeyCode == VK_NEXT))) -#else - case DN_KEY: - { - if((Param2 == KEY_PGUP) || (Param2 == KEY_PGDN)) -#endif - { - TCHAR sMacro[32]; -#ifdef FARAPI3 + { + wchar_t sMacro[32]; if(record->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR) -#else - if(Param2 == KEY_PGUP) -#endif - StringCchCopy(sMacro, ARRAYSIZE(sMacro), _T("Esc Up F3")); - else - StringCchCopy(sMacro, ARRAYSIZE(sMacro), _T("Esc Down F3")); -#ifdef FARAPI3 - MacroSendMacroText msmt; + StringCchCopy(sMacro, ARRAYSIZE(sMacro), L"Esc Up F3"); + else + StringCchCopy(sMacro, ARRAYSIZE(sMacro), L"Esc Down F3"); + + MacroSendMacroText msmt{}; msmt.StructSize= sizeof(MacroSendMacroText); msmt.SequenceText=sMacro; - msmt.Flags=KMFLAGS_DISABLEOUTPUT; - Info.MacroControl(&MainGuid,MCTL_SENDSTRING, nullptr,&msmt); -#else - ActlKeyMacro m = {MCMD_POSTMACROSTRING}; - m.Param.PlainText.SequenceText = sMacro; - m.Param.PlainText.Flags = KSFLAGS_DISABLEOUTPUT; - Info.AdvControl(Info.ModuleNumber, ACTL_KEYMACRO, &m); -#endif - return TRUE; - } - } - break; - } - - return Info.DefDlgProc(hDlg,Msg,Param1,Param2); -} - -// + msmt.Flags=KMFLAGS_NONE; + Info.MacroControl(&MainGuid,MCTL_SENDSTRING, 0,&msmt); + + return TRUE; + } + } + break; + } + + return Info.DefDlgProc(hDlg,Msg,Param1,Param2); +} + +//заполнение пункта диалога void FillDialog(FarDialogItem & DialogItem, -#ifdef FARAPI3 + FARDIALOGITEMTYPES Type, -#else - int Type, -#endif int X1, int Y1, int X2, int Y2, int Flags, int nData) -{ - const TCHAR* s = nData != -1 ? GetMsg(nData) : _T(""); -#ifdef FARAPI17 - lstrcpy(DialogItem.Data, s); -#endif -#ifdef FARAPI18 - DialogItem.PtrData = s; -#endif -#ifdef FARAPI3 +{ + const wchar_t* s = nData != -1 ? GetMsg(nData) : L""; + + DialogItem.Type = Type; + DialogItem.X1 = X1; + DialogItem.X2 = X2; + DialogItem.Y1 = Y1; + DialogItem.Y2 = Y2; + DialogItem.Selected = 0; + DialogItem.History = nullptr; + DialogItem.Mask = nullptr; + DialogItem.Flags = Flags; DialogItem.Data = s; -#endif - DialogItem.X1 = X1; - DialogItem.X2 = X2; - DialogItem.Y1 = Y1; - DialogItem.Y2 = Y2; - DialogItem.Flags = Flags; - DialogItem.Type = Type; - DialogItem.Selected = 0; -#ifndef FARAPI3 - DialogItem.DefaultButton = 0; - DialogItem.Focus = 0; -#endif - - if(Type == DI_BUTTON) - { -#ifdef FARAPI3 + DialogItem.MaxLength = 0; + DialogItem.UserData = 0; + + if(Type == DI_BUTTON) + { DialogItem.Flags |=DIF_FOCUS | DIF_DEFAULTBUTTON; -#else - DialogItem.DefaultButton = 1; - DialogItem.Focus = 1; -#endif - } -} - -void DisplayEntry(int Sel) -{ - unsigned sx = 70; - unsigned max_len = 0; - unsigned cnt = 0; - - for(int i=0; i sx) sx = len + 3; - - cnt++; - } - } - - unsigned con_sx = 80; - HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); - - if(con != INVALID_HANDLE_VALUE) - { - CONSOLE_SCREEN_BUFFER_INFO con_info; - - if(GetConsoleScreenBufferInfo(con, &con_info)) - { - con_sx = con_info.srWindow.Right - con_info.srWindow.Left + 1; - } - } - - if(sx + 10 > con_sx) sx = con_sx - 10; - - unsigned sy = cnt * 2; - unsigned di_cnt = cnt * 2 + 2; - FarDialogItem* DialogItems = new FarDialogItem[di_cnt]; - unsigned y = 2; - unsigned idx = 1; - - for(int i=0; i sx) sx = len + 3; + + cnt++; + } + } + + unsigned con_sx = 80; + HANDLE con = GetStdHandle(STD_OUTPUT_HANDLE); + + if(con != INVALID_HANDLE_VALUE) + { + CONSOLE_SCREEN_BUFFER_INFO con_info; + + if(GetConsoleScreenBufferInfo(con, &con_info)) + { + con_sx = con_info.srWindow.Right - con_info.srWindow.Left + 1; + } + } + + if(sx + 10 > con_sx) sx = con_sx - 10; + + unsigned sy = cnt * 2; + unsigned di_cnt = cnt * 2 + 1; + FarDialogItem* DialogItems = new FarDialogItem[di_cnt]; + unsigned y = 2; + unsigned idx = 1; + + for(int i=0; i') || - wcschr(asFilePath, L'<') || - wcschr(asFilePath, L'|') - ) - return FALSE; - - // UNC "\\?\" - if(asFilePath[0] == L'\\' && asFilePath[1] == L'\\' && asFilePath[2] == L'?' && asFilePath[3] == L'\\') - asFilePath += 4; - - // asFilePath ( ) ":\" - LPCWSTR pszColon = wcschr(asFilePath, L':'); - - if(pszColon) - { - // ":", "X:\xxx", .. ":" - - if(pszColon != (asFilePath+1)) - return FALSE; - - if(wcschr(pszColon+1, L':')) - return FALSE; - } - - if (abCheckFileExist) - { - DWORD dwErr = 0; - HANDLE hFile = CreateFile(asFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - if (hFile == INVALID_HANDLE_VALUE) - { - dwErr = GetLastError(); + delete[] DialogItems; +} + +BOOL IsUserAdmin() +{ + //OSVERSIONINFO osv = {sizeof(OSVERSIONINFO)}; + //GetVersionEx(&osv); + //// Проверять нужно только для висты, чтобы на XP лишний "Щит" не отображался + //if (osv.dwMajorVersion < 6) + // return FALSE; + BOOL b; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID AdministratorsGroup; + b = AllocateAndInitializeSid( + &NtAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &AdministratorsGroup); + + if(b) + { + if(!CheckTokenMembership(NULL, AdministratorsGroup, &b)) + { + b = FALSE; + } + + FreeSid(AdministratorsGroup); + } + + return(b); +} + +BOOL CheckForEsc() +{ + BOOL bEscaped = FALSE; + INPUT_RECORD *InputRec; + DWORD NumberOfEvents, ReadCnt,i; + HANDLE Console = GetStdHandle(STD_INPUT_HANDLE); + + if(GetNumberOfConsoleInputEvents(Console,&NumberOfEvents) && NumberOfEvents) + { + if((InputRec=(INPUT_RECORD *)calloc(NumberOfEvents,sizeof(INPUT_RECORD))) != NULL) + { + if(PeekConsoleInput(Console,InputRec,NumberOfEvents,&ReadCnt)) + { + i=0; + + while(i < ReadCnt) + { + if(InputRec[i].EventType == KEY_EVENT && InputRec[i].Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) + { + while(((i+1) < ReadCnt) + && InputRec[i+1].EventType == KEY_EVENT + && InputRec[i+1].Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) + i++; + + bEscaped = TRUE; + ReadConsoleInput(Console,InputRec,i+1,&ReadCnt); + break; + } + + i++; + } + } + + free(InputRec); + } + } + + return bEscaped; +} + +// Проверка, может ли asFilePath быть путем +BOOL IsFilePath(LPCWSTR asFilePath, bool abCheckFileExist) +{ + // Если в пути встречаются недопустимые символы + if(wcschr(asFilePath, L'"') || + wcschr(asFilePath, L'>') || + wcschr(asFilePath, L'<') || + wcschr(asFilePath, L'|') + ) + return FALSE; + + // Пропуск UNC "\\?\" + if(asFilePath[0] == L'\\' && asFilePath[1] == L'\\' && asFilePath[2] == L'?' && asFilePath[3] == L'\\') + asFilePath += 4; + + // Если asFilePath содержит два (и более) ":\" + LPCWSTR pszColon = wcschr(asFilePath, L':'); + + if(pszColon) + { + // Если есть ":", то это должен быть путь вида "X:\xxx", т.е. ":" - второй символ + if(pszColon != (asFilePath+1)) + return FALSE; + + if(wcschr(pszColon+1, L':')) + return FALSE; + } + + if (abCheckFileExist) + { + DWORD dwErr = 0; + HANDLE hFile = CreateFile(asFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { + dwErr = GetLastError(); if (dwErr == ERROR_FILE_NOT_FOUND) - return FALSE; - } - BY_HANDLE_FILE_INFORMATION hfi = {}; - BOOL lbInfo = GetFileInformationByHandle(hFile, &hfi); - CloseHandle(hFile); - - if (!lbInfo || (hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - return FALSE; - } - - // May be file path - return TRUE; -} - -BOOL FirstArg(LPCTSTR asCmdLine, TCHAR* rsArg/*[MAX_PATH+1]*/, LPCTSTR* rsNextArg) -{ - LPCTSTR psCmdLine = asCmdLine; - LPCTSTR pch = NULL; - TCHAR ch = *psCmdLine; - size_t nArgLen = 0; - - while(ch == _T(' ') || ch == _T('\t') || ch == _T('\r') || ch == _T('\n')) ch = *(++psCmdLine); - - if(ch == 0) return FALSE; - - // " - if(ch == _T('"')) - { - psCmdLine++; - pch = wcschr(psCmdLine, _T('"')); - - if(!pch) return FALSE; - - while(pch[1] == _T('"')) - { - pch += 2; - pch = wcschr(pch, _T('"')); - - if(!pch) return FALSE; - } - - // pch " - } - else - { - // - //pch = wcschr(psCmdLine, _T(' ')); - // 09.06.2009 Maks - : cmd /c" echo Y " - pch = psCmdLine; - - // ( /) - while(*pch && *pch!=_T(' ') && *pch!=_T('"')) pch++; - - //if (!pch) pch = psCmdLine + lstrlenW(psCmdLine); // - } - - nArgLen = pch - psCmdLine; - - if(nArgLen > MAX_PATH) return FALSE; - - // - memcpy(rsArg, psCmdLine, nArgLen*sizeof(TCHAR)); - rsArg[nArgLen] = 0; - psCmdLine = pch; - // Finalize - ch = *psCmdLine; // - - if(ch == L'"') ch = *(++psCmdLine); - - while(ch == L' ' || ch == L'\t' || ch == L'\r' || ch == L'\n') ch = *(++psCmdLine); - - *rsNextArg = psCmdLine; - return TRUE; -} - -int EntryMenu(int Sel, int& Action, bool& LowPriority, int nChkCount = 0) -{ -#if defined FARAPI18 || defined FARAPI3 -#define SETITEM(i,s) items[i].Text = GetMsg(s) -#else -#define SETITEM(i,s) items[i].Text.TextPtr = GetMsg(s); items[i].Flags |= MIF_USETEXTPTR -#endif -#ifdef FARAPI3 + return FALSE; + } + BY_HANDLE_FILE_INFORMATION hfi = {}; + BOOL lbInfo = GetFileInformationByHandle(hFile, &hfi); + CloseHandle(hFile); + + if (!lbInfo || (hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + return FALSE; + } + + // May be file path + return TRUE; +} + +BOOL FirstArg(LPCTSTR asCmdLine, wchar_t* rsArg/*[MAX_PATH+1]*/, LPCTSTR* rsNextArg) +{ + LPCTSTR psCmdLine = asCmdLine; + LPCTSTR pch = NULL; + wchar_t ch = *psCmdLine; + size_t nArgLen = 0; + + while(ch == L' ' || ch == L'\t' || ch == L'\r' || ch == L'\n') ch = *(++psCmdLine); + + if(ch == 0) return FALSE; + + // аргумент начинается с " + if(ch == L'"') + { + psCmdLine++; + pch = wcschr(psCmdLine, L'"'); + + if(!pch) return FALSE; + + while(pch[1] == L'"') + { + pch += 2; + pch = wcschr(pch, L'"'); + + if(!pch) return FALSE; + } + + // Теперь в pch ссылка на последнюю " + } + else + { + // До конца строки или до первого пробела + //pch = wcschr(psCmdLine, L' ')); + // 09.06.2009 Maks - обломался на: cmd /c" echo Y " + pch = psCmdLine; + + // Ищем обычным образом (до пробела/кавычки) + while(*pch && *pch!=L' ' && *pch!=L'"') pch++; + + //if (!pch) pch = psCmdLine + lstrlenW(psCmdLine); // до конца строки + } + + nArgLen = pch - psCmdLine; + + if(nArgLen > MAX_PATH) return FALSE; + + // Вернуть аргумент + memcpy(rsArg, psCmdLine, nArgLen*sizeof(wchar_t)); + rsArg[nArgLen] = 0; + psCmdLine = pch; + // Finalize + ch = *psCmdLine; // может указывать на закрывающую кавычку + + if(ch == L'"') ch = *(++psCmdLine); + + while(ch == L' ' || ch == L'\t' || ch == L'\r' || ch == L'\n') ch = *(++psCmdLine); + + *rsNextArg = psCmdLine; + return TRUE; +} + +int EntryMenu(int Sel, int& Action, bool& LowPriority, int nChkCount = 0) +{ + +#define SETITEM(i,s) items[i].Text = GetMsg(s) #define FarMenuItemEx FarMenuItem -#endif - FarMenuItemEx items[6]; memset(items, 0, sizeof(items)); - SETITEM(Action_UninstallWait, MActionUninstallWait); - SETITEM(Action_Uninstall, MActionUninstall); - - if(nChkCount > 1) - items[Action_Uninstall].Flags |= MIF_DISABLE; - - SETITEM(Action_ModifyWait, MActionModifyWait); - SETITEM(Action_Modify, MActionModify); - - if(nChkCount > 1) - items[Action_Modify].Flags |= MIF_DISABLE; - else if(!p[Sel].CanModify) - { - items[Action_Modify].Flags |= MIF_DISABLE; - items[Action_ModifyWait].Flags |= MIF_DISABLE; - } - - SETITEM(Action_RepairWait, MActionRepairWait); - SETITEM(Action_Repair, MActionRepair); - - if(nChkCount > 1) - items[Action_Repair].Flags |= MIF_DISABLE; - else if(!p[Sel].CanRepair) - { - items[Action_Repair].Flags |= MIF_DISABLE; - items[Action_RepairWait].Flags |= MIF_DISABLE; - } - -#ifdef FARAPI3 + + FarMenuItemEx items[6]; memset(items, 0, sizeof(items)); + SETITEM(Action_UninstallWait, MActionUninstallWait); + SETITEM(Action_Uninstall, MActionUninstall); + + if(nChkCount > 1) + items[Action_Uninstall].Flags |= MIF_DISABLE; + + SETITEM(Action_ModifyWait, MActionModifyWait); + SETITEM(Action_Modify, MActionModify); + + if(nChkCount > 1) + items[Action_Modify].Flags |= MIF_DISABLE; + else if(!p[Sel].CanModify) + { + items[Action_Modify].Flags |= MIF_DISABLE; + items[Action_ModifyWait].Flags |= MIF_DISABLE; + } + + SETITEM(Action_RepairWait, MActionRepairWait); + SETITEM(Action_Repair, MActionRepair); + + if(nChkCount > 1) + items[Action_Repair].Flags |= MIF_DISABLE; + else if(!p[Sel].CanRepair) + { + items[Action_Repair].Flags |= MIF_DISABLE; + items[Action_RepairWait].Flags |= MIF_DISABLE; + } + + intptr_t iRc; intptr_t BreakCode; struct FarKey BreakKeys[1]= {VK_F7,0}; -#else - int iRc; - int BreakCode; - int BreakKeys[2]= {VK_F7,0}; -#endif - TCHAR szMenuTitle[MAX_PATH]; - - if(nChkCount > 1) - StringCchPrintf(szMenuTitle, ARRAYSIZE(szMenuTitle), GetMsg(MMenuTopLineN), nChkCount); - else - StringCchCopy(szMenuTitle, ARRAYSIZE(szMenuTitle), GetMsg(MMenuTopLine)); - - while(true) - { -#ifdef FARAPI3 + + wchar_t szMenuTitle[MAX_PATH]; + + if(nChkCount > 1) + StringCchPrintf(szMenuTitle, ARRAYSIZE(szMenuTitle), GetMsg(MMenuTopLineN), nChkCount); + else + StringCchCopy(szMenuTitle, ARRAYSIZE(szMenuTitle), GetMsg(MMenuTopLine)); + + while(true) + { + iRc = Info.Menu(&MainGuid,&ActionMenu, -1,-1,0, FMENU_WRAPMODE, szMenuTitle, GetMsg(LowPriority ? MMenuBottomLine2 : MMenuBottomLine1), - _T("ActionMenu"), BreakKeys, &BreakCode, (struct FarMenuItem *)items, ARRAYSIZE(items)); -#else - iRc = Info.Menu(Info.ModuleNumber, -1,-1,0, FMENU_USEEXT|FMENU_WRAPMODE, szMenuTitle, - GetMsg(LowPriority ? MMenuBottomLine2 : MMenuBottomLine1), - _T("ActionMenu"), BreakKeys, &BreakCode, (struct FarMenuItem *)items, ARRAYSIZE(items)); -#endif - - if(iRc < 0) - return -1; - - if(BreakCode == 0) - { - LowPriority = !LowPriority; - - for(UINT i = 0; i < ARRAYSIZE(items); i++) - { - if(i == iRc) - items[i].Flags |= MIF_SELECTED; - else - items[i].Flags &= ~MIF_SELECTED; - } - } - else - { - Action = iRc; - break; - } - } - - if((Action & 0xFF) == Action_Menu) - return -1; // - - return Action; -} - -int ExecuteEntry(int Sel, int Action, bool LowPriority) -{ - if((Action & 0xFF) == Action_Menu) - { - if(EntryMenu(Sel, Action, LowPriority) < 0) - return -1; - - if((Action & 0xFF) == Action_Menu) - return -1; // - } - - int nWaitSucceeded = 0; - STARTUPINFO si; - PROCESS_INFORMATION pi; - HANDLE hScreen; //for SaveScreen/RestoreScreen - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - ZeroMemory(&pi, sizeof(pi)); - TCHAR cmd_line[MAX_PATH*2+1], cmd_file[MAX_PATH+1], cmd_parm[MAX_PATH*2+1]; - LPCTSTR pszString = NULL; - - if((Action == Action_ModifyWait) || (Action == Action_Modify)) - pszString = p[Sel].Keys[ModifyPath]; - //else if ((Action == Action_RepairWait) || (Action == Action_Repair)) - // pszString = NULL; - else if((Action == Action_UninstallWait) || (Action == Action_Uninstall)) - { - if(!p[Sel].WindowsInstaller) - pszString = p[Sel].Keys[UninstallString]; - } - - if(pszString && !*pszString) - pszString = NULL; - - if(p[Sel].WindowsInstaller && !(!Opt.ForceMsiUse && pszString)) - { - TCHAR szCode[6]; - - if((Action == Action_UninstallWait) || (Action == Action_Uninstall)) - StringCchCopy(szCode, ARRAYSIZE(szCode), _T(" /x ")); - else if((Action == Action_RepairWait) || (Action == Action_Repair)) - StringCchCopy(szCode, ARRAYSIZE(szCode), _T(" /fa ")); - else //if ((Action == Action_ModifyWait) || (Action == Action_Modify)) - StringCchCopy(szCode, ARRAYSIZE(szCode), _T(" /i ")); - - // CreateProcess - StringCchCopy(cmd_line, ARRAYSIZE(cmd_line), _T("msiexec")); - StringCchCat(cmd_line, ARRAYSIZE(cmd_line), szCode); - StringCchCat(cmd_line, ARRAYSIZE(cmd_line), p[Sel].SubKeyName); - - // ShellExecuteEx - if(LowPriority) - { - StringCchCopy(cmd_file, ARRAYSIZE(cmd_parm), _T("cmd")); - StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), _T("/c start /low ")); - StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), _T("msiexec")); - StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), szCode); - StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), p[Sel].SubKeyName); - } - else - { - StringCchCopy(cmd_file, ARRAYSIZE(cmd_file), _T("msiexec")); - StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), szCode); - StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), p[Sel].SubKeyName); - } - } - else - { - if(pszString == NULL) - return 0; - - // CreateProcess - StringCchCopy(cmd_line, ARRAYSIZE(cmd_line), pszString); - - // ShellExecuteEx - if(LowPriority) - { - StringCchCopy(cmd_file, ARRAYSIZE(cmd_parm), _T("cmd")); - StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), _T("/c start /low \"\" ")); - StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), pszString); - } - else - { - LPCTSTR psNextArg = NULL; - - if(FirstArg(pszString, cmd_file, &psNextArg) - && IsFilePath(cmd_file, true)) - { - StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), psNextArg); - } - else - { - #ifdef _DEBUG - IsFilePath(pszString, true); - #endif - StringCchCopy(cmd_file, ARRAYSIZE(cmd_file), pszString); - cmd_parm[0] = 0; - } - } - } - - hScreen = Info.SaveScreen(0,0,-1,-1); // , .. - BOOL ifCreate = FALSE, bElevationFailed = FALSE, bPriorityChanged = FALSE; - DWORD dwErr = 0; - - // MSI - if(!p[Sel].WindowsInstaller && Opt.UseElevation && !IsUserAdmin()) - { - // Required elevation - SHELLEXECUTEINFO sei = {sizeof(SHELLEXECUTEINFO)}; - sei.fMask = SEE_MASK_NOCLOSEPROCESS; - sei.lpVerb = _T("runas"); - sei.lpFile = cmd_file; - sei.lpParameters = cmd_parm; - sei.nShow = LowPriority ? SW_MINIMIZE : SW_SHOWNORMAL; - ifCreate = ShellExecuteEx(&sei); - - if(ifCreate) - pi.hProcess = sei.hProcess; - else - bElevationFailed = true; - } - - // Elevation - if(!ifCreate) - { - ifCreate = CreateProcess // Start the child process. - ( - NULL, // No module name (use command line). - cmd_line, // Command line. - NULL, // Process handle not inheritable. - NULL, // Thread handle not inheritable. - FALSE, // Set handle inheritance to FALSE. - LowPriority ? IDLE_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS, // Creation flags. - NULL, // Use parent's environment block. - NULL, // Use parent's starting directory. - &si, // Pointer to STARTUPINFO structure. - &pi // Pointer to PROCESS_INFORMATION structure. - ); - - if(ifCreate) - bPriorityChanged = TRUE; - } - - if(!ifCreate) //not Create - { - dwErr = GetLastError(); - - if((dwErr == 0x2E4) && !bElevationFailed) - { - // Required elevation - SHELLEXECUTEINFO sei = {sizeof(SHELLEXECUTEINFO)}; - sei.fMask = SEE_MASK_NOCLOSEPROCESS; - sei.lpVerb = _T("runas"); - sei.lpFile = cmd_file; - sei.lpParameters = cmd_parm; - sei.nShow = LowPriority ? SW_MINIMIZE : SW_SHOWNORMAL; - ifCreate = ShellExecuteEx(&sei); - - if(ifCreate) - pi.hProcess = sei.hProcess; - else - dwErr = GetLastError(); - } - - if(!ifCreate) //not Create - { - TCHAR szErrCode[32]; - const TCHAR *pszErrInfo = szErrCode; - - if(dwErr == 0x000004C7) - pszErrInfo = GetMsg(MCancelledByUser); - else - StringCchPrintf(szErrCode, ARRAYSIZE(szErrCode), _T("ErrorCode=0x%08X"), dwErr); - - if(hScreen) - Info.RestoreScreen(hScreen); - - DrawMessage(FMSG_WARNING, 1, "%s",GetMsg(MPlugIn),GetMsg(MRunProgErr),cmd_line,pszErrInfo,GetMsg(MBtnOk),NULL); - return -1; - } - } - - // -- , Elevation, Elevation - CreateProcess - //if (pi.hProcess && LowPriority && !bPriorityChanged) - //{ - // bPriorityChanged = SetPriorityClass(pi.hProcess, IDLE_PRIORITY_CLASS); - // dwErr = GetLastError(); - //} - TCHAR SaveTitle[MAX_PATH]; - GetConsoleTitle(SaveTitle,ARRAYSIZE(SaveTitle)); - SaveTitle[ARRAYSIZE(SaveTitle) - 1] = 0; - SetConsoleTitle(cmd_line); - - if(pi.hProcess) - { - // Wait until child process exits. - if((Action == Action_UninstallWait) - || (Action == Action_ModifyWait) - || (Action == Action_RepairWait)) - { - DrawMessage(0, 0, "%s", GetMsg(MPlugIn), GetMsg(MWaitingCompletion), cmd_line,NULL); - nWaitSucceeded = 1; - - while(true) - { - if(WaitForSingleObject(pi.hProcess, 500) == WAIT_OBJECT_0) - break; - - if(CheckForEsc()) - { - nWaitSucceeded = 0; - break; - } - } - } - - // Close process and thread handles. - CloseHandle(pi.hProcess); - } - - if(pi.hThread) - CloseHandle(pi.hThread); - - SetConsoleTitle(SaveTitle); - - if(hScreen) - { - Info.RestoreScreen(NULL); - Info.RestoreScreen(hScreen); - } - - return nWaitSucceeded; -} - -typedef WINADVAPI LSTATUS(APIENTRY *FRegDeleteKeyExA)(__in HKEY hKey, __in LPCSTR lpSubKey, __in REGSAM samDesired, __reserved DWORD Reserved); -typedef WINADVAPI LSTATUS(APIENTRY *FRegDeleteKeyExW)(__in HKEY hKey, __in LPCWSTR lpSubKey, __in REGSAM samDesired, __reserved DWORD Reserved); - -bool DeleteEntry(int Sel) -{ - HMODULE h_mod = LoadLibrary(_T("advapi32.dll")); - FRegDeleteKeyExA RegDeleteKeyExA = reinterpret_cast(GetProcAddress(h_mod, "RegDeleteKeyExA")); - FRegDeleteKeyExW RegDeleteKeyExW = reinterpret_cast(GetProcAddress(h_mod, "RegDeleteKeyExW")); - FreeLibrary(h_mod); - HKEY userKey; - LONG ret = RegOpenKeyEx(p[Sel].RegKey.Root, p[Sel].RegKey.Path, 0, DELETE | p[Sel].RegView, &userKey); - - if(ret != ERROR_SUCCESS) return false; - - if(RegDeleteKeyEx) - ret = RegDeleteKeyEx(userKey, p[Sel].SubKeyName, p[Sel].RegView, 0); - else - ret = RegDeleteKey(userKey, p[Sel].SubKeyName); - - RegCloseKey(userKey); - - if(ret != ERROR_SUCCESS) return false; - - return true; -} - -// -#ifdef FARAPI3 + L"ActionMenu", BreakKeys, &BreakCode, (struct FarMenuItem *)items, ARRAYSIZE(items)); + + if(iRc < 0) + return -1; + + if(BreakCode == 0) + { + LowPriority = !LowPriority; + + for(UINT i = 0; i < ARRAYSIZE(items); i++) + { + if(i == iRc) + items[i].Flags |= MIF_SELECTED; + else + items[i].Flags &= ~MIF_SELECTED; + } + } + else + { + Action = iRc; + break; + } + } + + if((Action & 0xFF) == Action_Menu) + return -1; // ошибка + + return Action; +} + +int ExecuteEntry(int Sel, int Action, bool LowPriority) +{ + if((Action & 0xFF) == Action_Menu) + { + if(EntryMenu(Sel, Action, LowPriority) < 0) + return -1; + + if((Action & 0xFF) == Action_Menu) + return -1; // ошибка + } + + int nWaitSucceeded = 0; + STARTUPINFO si; + PROCESS_INFORMATION pi; + HANDLE hScreen; //for SaveScreen/RestoreScreen + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + wchar_t cmd_line[MAX_PATH*2+1], cmd_file[MAX_PATH+1], cmd_parm[MAX_PATH*2+1]; + LPCTSTR pszString = NULL; + + if((Action == Action_ModifyWait) || (Action == Action_Modify)) + pszString = p[Sel].Keys[ModifyPath]; + //else if ((Action == Action_RepairWait) || (Action == Action_Repair)) + // pszString = NULL; + else if((Action == Action_UninstallWait) || (Action == Action_Uninstall)) + { + if(!p[Sel].WindowsInstaller) + pszString = p[Sel].Keys[UninstallString]; + } + + if(pszString && !*pszString) + pszString = NULL; + + if(p[Sel].WindowsInstaller && !(!Opt.ForceMsiUse && pszString)) + { + wchar_t szCode[6]; + + if((Action == Action_UninstallWait) || (Action == Action_Uninstall)) + StringCchCopy(szCode, ARRAYSIZE(szCode), L" /x "); + else if((Action == Action_RepairWait) || (Action == Action_Repair)) + StringCchCopy(szCode, ARRAYSIZE(szCode), L" /fa "); + else //if ((Action == Action_ModifyWait) || (Action == Action_Modify)) + StringCchCopy(szCode, ARRAYSIZE(szCode), L" /i "); + + // Для CreateProcess + StringCchCopy(cmd_line, ARRAYSIZE(cmd_line), L"msiexec"); + StringCchCat(cmd_line, ARRAYSIZE(cmd_line), szCode); + StringCchCat(cmd_line, ARRAYSIZE(cmd_line), p[Sel].SubKeyName); + + // Для ShellExecuteEx + if(LowPriority) + { + StringCchCopy(cmd_file, ARRAYSIZE(cmd_parm), L"cmd"); + StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), L"/c start /low "); + StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), L"msiexec"); + StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), szCode); + StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), p[Sel].SubKeyName); + } + else + { + StringCchCopy(cmd_file, ARRAYSIZE(cmd_file), L"msiexec"); + StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), szCode); + StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), p[Sel].SubKeyName); + } + } + else + { + if(pszString == NULL) + return 0; + + // Для CreateProcess + StringCchCopy(cmd_line, ARRAYSIZE(cmd_line), pszString); + + // Для ShellExecuteEx + if(LowPriority) + { + StringCchCopy(cmd_file, ARRAYSIZE(cmd_parm), L"cmd"); + StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), L"/c start /low \"\" "); + StringCchCat(cmd_parm, ARRAYSIZE(cmd_parm), pszString); + } + else + { + LPCTSTR psNextArg = NULL; + + if(FirstArg(pszString, cmd_file, &psNextArg) + && IsFilePath(cmd_file, true)) + { + StringCchCopy(cmd_parm, ARRAYSIZE(cmd_parm), psNextArg); + } + else + { + #ifdef _DEBUG + IsFilePath(pszString, true); + #endif + StringCchCopy(cmd_file, ARRAYSIZE(cmd_file), pszString); + cmd_parm[0] = 0; + } + } + } + + hScreen = Info.SaveScreen(0,0,-1,-1); //Это необходимо сделать, т.к. после запущенных программ нужно обновить окно ФАРа + BOOL ifCreate = FALSE, bElevationFailed = FALSE, bPriorityChanged = FALSE; + DWORD dwErr = 0; + + // MSI сам выполнит повышение прав когда потребуется + if(!p[Sel].WindowsInstaller && Opt.UseElevation && !IsUserAdmin()) + { + // Required elevation + SHELLEXECUTEINFO sei = {sizeof(SHELLEXECUTEINFO)}; + sei.fMask = SEE_MASK_NOCLOSEPROCESS; + sei.lpVerb = L"runas"; + sei.lpFile = cmd_file; + sei.lpParameters = cmd_parm; + sei.nShow = LowPriority ? SW_MINIMIZE : SW_SHOWNORMAL; + ifCreate = ShellExecuteEx(&sei); + + if(ifCreate) + pi.hProcess = sei.hProcess; + else + bElevationFailed = true; + } + + // Если Elevation не запускался + if(!ifCreate) + { + ifCreate = CreateProcess // Start the child process. + ( + NULL, // No module name (use command line). + cmd_line, // Command line. + NULL, // Process handle not inheritable. + NULL, // Thread handle not inheritable. + FALSE, // Set handle inheritance to FALSE. + LowPriority ? IDLE_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS, // Creation flags. + NULL, // Use parent's environment block. + NULL, // Use parent's starting directory. + &si, // Pointer to STARTUPINFO structure. + &pi // Pointer to PROCESS_INFORMATION structure. + ); + + if(ifCreate) + bPriorityChanged = TRUE; + } + + if(!ifCreate) //not Create + { + dwErr = GetLastError(); + + if((dwErr == 0x2E4) && !bElevationFailed) + { + // Required elevation + SHELLEXECUTEINFO sei = {sizeof(SHELLEXECUTEINFO)}; + sei.fMask = SEE_MASK_NOCLOSEPROCESS; + sei.lpVerb = L"runas"; + sei.lpFile = cmd_file; + sei.lpParameters = cmd_parm; + sei.nShow = LowPriority ? SW_MINIMIZE : SW_SHOWNORMAL; + ifCreate = ShellExecuteEx(&sei); + + if(ifCreate) + pi.hProcess = sei.hProcess; + else + dwErr = GetLastError(); + } + + if(!ifCreate) //not Create + { + wchar_t szErrCode[32]; + const wchar_t *pszErrInfo = szErrCode; + + if(dwErr == 0x000004C7) + pszErrInfo = GetMsg(MCancelledByUser); + else + StringCchPrintf(szErrCode, ARRAYSIZE(szErrCode), L"ErrorCode=0x%08X", dwErr); + + if(hScreen) + Info.RestoreScreen(hScreen); + + DrawMessage(FMSG_WARNING, 1, "%s",GetMsg(MPlugIn),GetMsg(MRunProgErr),cmd_line,pszErrInfo,GetMsg(MBtnOk),NULL); + return -1; + } + } + + // -- не может, если был сделан Elevation, а если Elevation не было - то уже в CreateProcess + //if (pi.hProcess && LowPriority && !bPriorityChanged) + //{ + // bPriorityChanged = SetPriorityClass(pi.hProcess, IDLE_PRIORITY_CLASS); + // dwErr = GetLastError(); + //} + wchar_t SaveTitle[MAX_PATH]; + GetConsoleTitle(SaveTitle,ARRAYSIZE(SaveTitle)); + SaveTitle[ARRAYSIZE(SaveTitle) - 1] = 0; + SetConsoleTitle(cmd_line); + + if(pi.hProcess) + { + // Wait until child process exits. + if((Action == Action_UninstallWait) + || (Action == Action_ModifyWait) + || (Action == Action_RepairWait)) + { + DrawMessage(0, 0, "%s", GetMsg(MPlugIn), GetMsg(MWaitingCompletion), cmd_line,NULL); + nWaitSucceeded = 1; + + while(true) + { + if(WaitForSingleObject(pi.hProcess, 500) == WAIT_OBJECT_0) + break; + + if(CheckForEsc()) + { + nWaitSucceeded = 0; + break; + } + } + } + + // Close process and thread handles. + CloseHandle(pi.hProcess); + } + + if(pi.hThread) + CloseHandle(pi.hThread); + + SetConsoleTitle(SaveTitle); + + if(hScreen) + { + Info.RestoreScreen(NULL); + Info.RestoreScreen(hScreen); + } + + return nWaitSucceeded; +} + +typedef WINADVAPI LSTATUS(APIENTRY *FRegDeleteKeyExA)(__in HKEY hKey, __in LPCSTR lpSubKey, __in REGSAM samDesired, __reserved DWORD Reserved); +typedef WINADVAPI LSTATUS(APIENTRY *FRegDeleteKeyExW)(__in HKEY hKey, __in LPCWSTR lpSubKey, __in REGSAM samDesired, __reserved DWORD Reserved); + +bool DeleteEntry(int Sel) +{ + HMODULE h_mod = LoadLibrary(L"advapi32.dll"); + FRegDeleteKeyExA RegDeleteKeyExA = reinterpret_cast(GetProcAddress(h_mod, "RegDeleteKeyExA")); + FRegDeleteKeyExW RegDeleteKeyExW = reinterpret_cast(GetProcAddress(h_mod, "RegDeleteKeyExW")); + FreeLibrary(h_mod); + HKEY userKey; + LONG ret = RegOpenKeyEx(p[Sel].RegKey.Root, p[Sel].RegKey.Path, 0, DELETE | p[Sel].RegView, &userKey); + + if(ret != ERROR_SUCCESS) return false; + + if(RegDeleteKeyEx) + ret = RegDeleteKeyEx(userKey, p[Sel].SubKeyName, p[Sel].RegView, 0); + else + ret = RegDeleteKey(userKey, p[Sel].SubKeyName); + + RegCloseKey(userKey); + + if(ret != ERROR_SUCCESS) return false; + + return true; +} + +//сравнить строки int WINAPI CompareEntries(const void* item1, const void* item2, void* userparam) -#else -int __cdecl CompareEntries(const void* item1, const void* item2) -#endif -{ - return FSF.LStricmp(reinterpret_cast(item1)->Keys[DisplayName], reinterpret_cast(item2)->Keys[DisplayName]); -} -// -#ifdef FARAPI3 +{ + return FSF.LStricmp(reinterpret_cast(item1)->Keys[DisplayName], reinterpret_cast(item2)->Keys[DisplayName]); +} +//сравнить даты int WINAPI CompareEntriesDate(const void* item1, const void* item2, void* userparam) -#else -int __cdecl CompareEntriesDate(const void* item1, const void* item2) -#endif -{ - if(reinterpret_cast(item1)->InstDateN < reinterpret_cast(item2)->InstDateN) - return 1; - - if(reinterpret_cast(item1)->InstDateN > reinterpret_cast(item2)->InstDateN) - return -1; - -#ifdef FARAPI3 +{ + if(reinterpret_cast(item1)->InstDateN < reinterpret_cast(item2)->InstDateN) + return 1; + + if(reinterpret_cast(item1)->InstDateN > reinterpret_cast(item2)->InstDateN) + return -1; + return CompareEntries(item1, item2, userparam); -#else - return CompareEntries(item1, item2); -#endif -} - -#define JUMPREALLOC 50 -void EnumKeys(RegKeyPath& RegKey, REGSAM RegView = 0) -{ - HKEY hKey; - - if(RegOpenKeyEx(RegKey.Root, RegKey.Path, 0, KEY_READ | RegView, &hKey) != ERROR_SUCCESS) - return; - - DWORD cSubKeys; - - if(RegQueryInfoKey(hKey,NULL,NULL,NULL,&cSubKeys,NULL,NULL,NULL,NULL,NULL,NULL,NULL) != ERROR_SUCCESS) - return; - - TCHAR Buf[MAX_PATH]; - - for(DWORD fEnumIndex=0; fEnumIndex= nRealCount) - { - nRealCount += JUMPREALLOC; - p = (KeyInfo *) realloc(p, sizeof(KeyInfo) * nRealCount); - } - - if(FillReg(p[nCount], Buf, RegKey, RegView)) - { -#ifdef FARAPI17 - CharToOem(p[nCount].Keys[DisplayName], p[nCount].Keys[DisplayName]); - CharToOem(p[nCount].Keys[UninstallString], p[nCount].Keys[UninstallString]); - CharToOem(p[nCount].Keys[ModifyPath], p[nCount].Keys[ModifyPath]); -#endif - nCount++; - } - } - - RegCloseKey(hKey); -} -#undef JUMPREALLOC - -typedef WINBASEAPI VOID (WINAPI *FGetNativeSystemInfo)(__out LPSYSTEM_INFO lpSystemInfo); - -#define EMPTYSTR _T(" ") -// -void UpDateInfo(void) -{ - HMODULE h_mod = LoadLibrary(_T("kernel32.dll")); - FGetNativeSystemInfo GetNativeSystemInfo = reinterpret_cast(GetProcAddress(h_mod, "GetNativeSystemInfo")); - FreeLibrary(h_mod); - bool is_os_x64 = false; - - if(GetNativeSystemInfo) - { - SYSTEM_INFO si; - GetNativeSystemInfo(&si); - is_os_x64 = si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; - } - - nCount = nRealCount = 0; - - for(int i=0; i= nRealCount) + { + nRealCount += JUMPREALLOC; + p = (KeyInfo *) realloc(p, sizeof(KeyInfo) * nRealCount); + } + + if(FillReg(p[nCount], Buf, RegKey, RegView)) + { + nCount++; + } + } + + RegCloseKey(hKey); +} +#undef JUMPREALLOC + +typedef WINBASEAPI VOID (WINAPI *FGetNativeSystemInfo)(__out LPSYSTEM_INFO lpSystemInfo); + +#define EMPTYSTR L" " +//Обновление информации +void UpDateInfo(void) +{ + HMODULE h_mod = LoadLibrary(L"kernel32.dll"); + FGetNativeSystemInfo GetNativeSystemInfo = reinterpret_cast(GetProcAddress(h_mod, "GetNativeSystemInfo")); + FreeLibrary(h_mod); + bool is_os_x64 = false; + + if(GetNativeSystemInfo) + { + SYSTEM_INFO si; + GetNativeSystemInfo(&si); + is_os_x64 = si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; + } + + nCount = nRealCount = 0; + + for(int i=0; i(FLI[i].Text); - - if(FirstChar[1] != FSF.LUpper(p[i].Keys[DisplayName][0])) - { - FirstChar[1] = FSF.LUpper(p[i].Keys[DisplayName][0]); - StringCchCopy(text, MaxSize, FirstChar); - } - else - StringCchCopy(text, MaxSize, EMPTYSTR); - - if(p[i].RegKey.Root == HKEY_LOCAL_MACHINE) - { - if(is_os_x64) - StringCchCat(text, MaxSize, (p[i].RegView == KEY_WOW64_64KEY) ? sx64 : sx86); - else - StringCchCat(text, MaxSize, sHKLM); - } - else - StringCchCat(text, MaxSize, sHKCU); - - StringCchCat(text, MaxSize, _T(" ")); - StringCchCat(text, MaxSize, p[i].InstDate); - StringCchCat(text, MaxSize, _T(" ")); - StringCchCat(text, MaxSize, (p[i].WindowsInstaller) ? _T("W") : _T(" ")); - StringCchCat(text, MaxSize, (p[i].CanModify) ? _T("M") : _T(" ")); - StringCchCat(text, MaxSize, (p[i].CanRepair) ? _T("R") : _T(" ")); - StringCchCat(text, MaxSize, (p[i].Hidden) ? _T("-") : _T(" ")); - StringCchCat(text, MaxSize, _T(" ")); - //if ((p[i].Keys[ModifyPath][0] == 0) && (p[i].Keys[UninstallString][0] == 0)) - //if (p[i].Hidden) - // StringCchCat(text, MaxSize, _T(" - ")); - //else - // StringCchCat(text, MaxSize, _T(" ")); - size_t nCurLen = _tcslen(text); - //StringCchCat(text, MaxSize, p[i].Keys[DisplayName]); - StringCchCopyN(text+nCurLen, MaxSize-nCurLen, p[i].Keys[DisplayName], MaxSize-nCurLen-1); - text[MaxSize-1] = 0; - } - - ListSize = nCount; -} -#undef EMPTYSTR - -//------------------------------------------------------------------- - -void ReadRegistry() -{ -#ifdef FARAPI3 + + const wchar_t* sx86 = GetMsg(MListHKLMx86); + const wchar_t* sx64 = GetMsg(MListHKLMx64); + const wchar_t* sHKLM = GetMsg(MListHKLM); + const wchar_t* sHKCU = GetMsg(MListHKCU); + //const wchar_t* sMSI = GetMsg(MListMSI); + //size_t nLen = _tcslen(sMSI); + //wchar_t* sMSI0 = (wchar_t*)malloc((nLen+1)*sizeof(wchar_t)); + //for (size_t n=0; n(FLI[i].Text); + + if(FirstChar[1] != FSF.LUpper(p[i].Keys[DisplayName][0])) + { + FirstChar[1] = FSF.LUpper(p[i].Keys[DisplayName][0]); + StringCchCopy(text, MaxSize, FirstChar); + } + else + StringCchCopy(text, MaxSize, EMPTYSTR); + + if(p[i].RegKey.Root == HKEY_LOCAL_MACHINE) + { + if(is_os_x64) + StringCchCat(text, MaxSize, (p[i].RegView == KEY_WOW64_64KEY) ? sx64 : sx86); + else + StringCchCat(text, MaxSize, sHKLM); + } + else + StringCchCat(text, MaxSize, sHKCU); + + StringCchCat(text, MaxSize, L" "); + StringCchCat(text, MaxSize, p[i].InstDate); + StringCchCat(text, MaxSize, L" "); + StringCchCat(text, MaxSize, (p[i].WindowsInstaller) ? L"W" : L" "); + StringCchCat(text, MaxSize, (p[i].CanModify) ? L"M" : L" "); + StringCchCat(text, MaxSize, (p[i].CanRepair) ? L"R" : L" "); + StringCchCat(text, MaxSize, (p[i].Hidden) ? L"-" : L" "); + StringCchCat(text, MaxSize, L" "); + //if ((p[i].Keys[ModifyPath][0] == 0) && (p[i].Keys[UninstallString][0] == 0)) + //if (p[i].Hidden) + // StringCchCat(text, MaxSize, L" - ")); + //else + // StringCchCat(text, MaxSize, L" ")); + size_t nCurLen = wcslen(text); + //StringCchCat(text, MaxSize, p[i].Keys[DisplayName]); + StringCchCopyN(text+nCurLen, MaxSize-nCurLen, p[i].Keys[DisplayName], MaxSize-nCurLen-1); + text[MaxSize-1] = 0; + } + + ListSize = nCount; +} +#undef EMPTYSTR + +//------------------------------------------------------------------- + +void ReadRegistry() +{ PluginSettings settings(MainGuid,Info.SettingsControl); Opt.WhereWork=settings.Get(0,L"WhereWork",3); @@ -1279,43 +1161,4 @@ void ReadRegistry() settings.Set(0,L"ForceMsiUse",Opt.ForceMsiUse); Opt.SortByDate = false; -#else - //TechInfo - if(GetRegKey(HKCU,_T(""),_T("WhereWork"),Opt.WhereWork,3)) - if((Opt.WhereWork<0) || (Opt.WhereWork>3)) - Opt.WhereWork=3; - - SetRegKey(HKCU,_T(""),_T("WhereWork"),(DWORD) Opt.WhereWork); - - if(GetRegKey(HKCU,_T(""),_T("EnterAction"),Opt.EnterAction,Action_Menu)) - if((Opt.EnterAction<0) || (Opt.EnterAction>Action_Menu)) - Opt.EnterAction = Action_Menu; - - SetRegKey(HKCU,_T(""),_T("EnterAction"),(DWORD) Opt.EnterAction); - - if(GetRegKey(HKCU,_T(""),_T("ShiftEnterAction"),Opt.ShiftEnterAction,Action_UninstallWait)) - if((Opt.ShiftEnterAction<0) || (Opt.ShiftEnterAction>Action_Menu)) - Opt.ShiftEnterAction = Action_Menu; - - SetRegKey(HKCU,_T(""),_T("ShiftEnterAction"),(DWORD) Opt.ShiftEnterAction); - - if(GetRegKey(HKCU,_T(""),_T("UseElevation"),Opt.UseElevation,1)) - if((Opt.UseElevation<0) || (Opt.UseElevation>1)) - Opt.UseElevation=1; - - SetRegKey(HKCU,_T(""),_T("UseElevation"),(DWORD) Opt.UseElevation); - - if(GetRegKey(HKCU,_T(""),_T("RunLowPriority"),Opt.RunLowPriority,0)) - if((Opt.RunLowPriority<0) || (Opt.RunLowPriority>1)) - Opt.RunLowPriority=0; - - SetRegKey(HKCU,_T(""),_T("RunLowPriority"),(DWORD) Opt.RunLowPriority); - - if(GetRegKey(HKCU,_T(""),_T("ForceMsiUse"),Opt.ForceMsiUse,0)) - if((Opt.ForceMsiUse<0) || (Opt.ForceMsiUse>1)) - Opt.ForceMsiUse=0; - - SetRegKey(HKCU,_T(""),_T("ForceMsiUse"),(DWORD) Opt.ForceMsiUse); - Opt.SortByDate = false; -#endif -} +} diff --git a/src/UnInstall.rc b/src/UnInstall.rc new file mode 100644 index 0000000..02ecb53 --- /dev/null +++ b/src/UnInstall.rc @@ -0,0 +1,37 @@ +#pragma code_page(65001) +#include +#include "version.hpp" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 + +#ifdef _DEBUG +| VS_FF_PRERELEASE | VS_FF_DEBUG +#endif + +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP + +FILEVERSION PLUGIN_VER_MAJOR,PLUGIN_VER_MINOR,PLUGIN_VER_PATCH,0 +PRODUCTVERSION PLUGIN_VER_MAJOR,PLUGIN_VER_MINOR,PLUGIN_VER_PATCH,0 + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "FileDescription", PLUGIN_DESC + VALUE "FileVersion", PLUGIN_VERSION + VALUE "LegalCopyright", PLUGIN_COPYRIGHT + VALUE "OriginalFilename", PLUGIN_FILENAME + VALUE "ProductName", PLUGIN_NAME + VALUE "ProductVersion", PLUGIN_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END diff --git a/UnInstall_Eng.hlf b/src/UnInstall_Eng.hlf similarity index 89% rename from UnInstall_Eng.hlf rename to src/UnInstall_Eng.hlf index c67ac9f..6bf5ad9 100644 --- a/UnInstall_Eng.hlf +++ b/src/UnInstall_Eng.hlf @@ -1,92 +1,92 @@ -.Language=English,English -.PluginContents=<(NAME)> -.Options CtrlStartPosChar=^ - -@Contents -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Contents# - - #Columns# - #1# #2# #3# #4# - Mx86 06.11.10 WMR- Microsoft .NET Framework 4 Multi-Targeting Pack - #Column 1# ^Registry place, where item information was found. - ^In x86 OS it is HKLM or HKCU, x64 OS - Mx86, Mx64, HKCU. - #Column 2# ^Program install date. - #Column 3# ^Flags. «W» - MSI, «M» - «Modify» allowed, «R» - repair, - ^«-» marks "hidden" elements. - #Column 4# ^Program name. - - - #Controls# - To add a symbol to the filter #Symbolical keys# - - Paste to filter from clipboard #Shift-Ins, Ctrl-V# - - Clear filter #Del# - - To remove last symbol of the filter #BackSpace# - - To remove record about uninstall of the program #F8# - - Viewing of the information about uninstall the program #F3# - - To update the list #Ctrl-R# - - Sort items (by name/by date) #F2# - - To choose item of a list #Alt-'highlighted letter'# - - Mark item for batch processing #Ins# or #RClick# - - To start processing #Enter or Shift-Enter# - Actions (Uninstall, Modify, Repair, Menu and Wait/Don't Wait) - are specified in ~Configuration~@Configuration@ - - Open Configuration dialog #Alt-Shift-F9# - - ~Configuration~@Configuration@ - ~Entry information~@UninstallEntry@ - ~New versions~@http://forum.farmanager.com/viewtopic.php?t=3529@ - ~Discussion~@http://forum.farmanager.com/viewtopic.php?t=3597@ - -@Configuration -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Configuration# - - #Show in the Editor#, #Show in the Viewer# - Allows plugin in Editor or Viewer. Plugin always allowed for panels. - - #Use elevation# - Request elevation (UAC) before starting non Windows Installer setup programs. - - #Start with low priority# - Try to start uninstall in process low priority mode. - - #Force use MsiExec# - Has effect for MSI only. When unchecked and command line specified obviuosly -in the registry - this command will be used instead of «msiexec /?{GUID}». - - #Enter# and #Shift-Enter# - You may choose one of the following actions: - * Uninstall (wait), Uninstall - Uninstall program - * Modify (wait), Modify - Modify (may be not available) - * Repair (wait), Repair - Repair (only for MSI) - * Menu - Choose action in run time - - ~Contents~@Contents@ - -@UninstallEntry -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Uninstall entry information# - - Use #PgUp#/#PgDn# to view previous/next program - - ~Contents~@Contents@ - -@ActionMenu -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Select action# - - #F7# change proirity of uninstall process - - ~Contents~@Contents@ +.Language=English,English +.PluginContents=UnInstall +.Options CtrlStartPosChar=^ + +@Contents +$^#UnInstall ${PLUGIN_VERSION}# +$^#Contents# + + #Columns# + #1# #2# #3# #4# + Mx86 06.11.10 WMR- Microsoft .NET Framework 4 Multi-Targeting Pack + #Column 1# ^Registry place, where item information was found. + ^In x86 OS it is HKLM or HKCU, x64 OS - Mx86, Mx64, HKCU. + #Column 2# ^Program install date. + #Column 3# ^Flags. «W» - MSI, «M» - «Modify» allowed, «R» - repair, + ^«-» marks "hidden" elements. + #Column 4# ^Program name. + + + #Controls# + To add a symbol to the filter #Symbolical keys# + + Paste to filter from clipboard #Shift-Ins, Ctrl-V# + + Clear filter #Del# + + To remove last symbol of the filter #BackSpace# + + To remove record about uninstall of the program #F8# + + Viewing of the information about uninstall the program #F3# + + To update the list #Ctrl-R# + + Sort items (by name/by date) #F2# + + To choose item of a list #Alt-'highlighted letter'# + + Mark item for batch processing #Ins# or #RClick# + + To start processing #Enter or Shift-Enter# + Actions (Uninstall, Modify, Repair, Menu and Wait/Don't Wait) + are specified in ~Configuration~@Configuration@ + + Open Configuration dialog #Alt-Shift-F9# + + ~Configuration~@Configuration@ + ~Entry information~@UninstallEntry@ + ~New versions~@http://forum.farmanager.com/viewtopic.php?t=3529@ + ~Discussion~@http://forum.farmanager.com/viewtopic.php?t=3597@ + +@Configuration +$^#UnInstall ${PLUGIN_VERSION}# +$^#Configuration# + + #Show in the Editor#, #Show in the Viewer# + Allows plugin in Editor or Viewer. Plugin always allowed for panels. + + #Use elevation# + Request elevation (UAC) before starting non Windows Installer setup programs. + + #Start with low priority# + Try to start uninstall in process low priority mode. + + #Force use MsiExec# + Has effect for MSI only. When unchecked and command line specified obviuosly +in the registry - this command will be used instead of «msiexec /?{GUID}». + + #Enter# and #Shift-Enter# + You may choose one of the following actions: + * Uninstall (wait), Uninstall - Uninstall program + * Modify (wait), Modify - Modify (may be not available) + * Repair (wait), Repair - Repair (only for MSI) + * Menu - Choose action in run time + + ~Contents~@Contents@ + +@UninstallEntry +$^#UnInstall ${PLUGIN_VERSION}# +$^#Uninstall entry information# + + Use #PgUp#/#PgDn# to view previous/next program + + ~Contents~@Contents@ + +@ActionMenu +$^#UnInstall ${PLUGIN_VERSION}# +$^#Select action# + + #F7# change proirity of uninstall process + + ~Contents~@Contents@ diff --git a/UnInstall_Eng.lng b/src/UnInstall_Eng.lng similarity index 95% rename from UnInstall_Eng.lng rename to src/UnInstall_Eng.lng index 19240da..71f1ba1 100644 --- a/UnInstall_Eng.lng +++ b/src/UnInstall_Eng.lng @@ -1,57 +1,57 @@ -.Language=English,English - -// Plugin title -"UnInstall" -// Buttons -"OK" -"Cancel" -// Waiting for UnInstall complete -"Waiting for the command completion" -// Configuration dialog -"Show in the &Editor" -"Show in the &Viewer" -"Enter: &wait for completion" -"&Use elevation" -"Start with &low priority" -"&Force use MsiExec" -"Ente&r: " -"Shif&t-Enter:" -"Uninstall (wait)" -"Uninstall" -"Modify (wait)" -"Modify" -"Repair (wait)" -"Repair" -"Menu" -// Entry info dialog title -"Uninstall Entry" -"Uninstall Entry (Windows Installer)" -// Entry info labels -"&Name:" -"Sub&key name:" -"&Install location:" -"&Modify command:" -"&Uninstall command:" -"&Publisher:" -"&Support information:" -"Product &updates:" -"&Comments:" -"&Version:" -"Install &date:" -// Menu's top and bottom lines -"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" -"Filter: [%s], Entries: [%d/%d]" -"{Normal priority} F7" -" {Low priority} F7" -"Select action" -"Action for %u items" -// Install location (registry) -"Mx86" -"Mx64" -"HKLM" -"HKCU" -// Error messages and confirmations -"Error of running program" -"Cancelled by user" -"Error of deleting uninstall info" -"UnInstall\nDo you wish to delete the uninstall entry?\n%s\nOk\nCancel" +.Language=English,English + +// Plugin title +"UnInstall" +// Buttons +"OK" +"Cancel" +// Waiting for UnInstall complete +"Waiting for the command completion" +// Configuration dialog +"Show in the &Editor" +"Show in the &Viewer" +"Enter: &wait for completion" +"&Use elevation" +"Start with &low priority" +"&Force use MsiExec" +"Ente&r: " +"Shif&t-Enter:" +"Uninstall (wait)" +"Uninstall" +"Modify (wait)" +"Modify" +"Repair (wait)" +"Repair" +"Menu" +// Entry info dialog title +"Uninstall Entry" +"Uninstall Entry (Windows Installer)" +// Entry info labels +"&Name:" +"Sub&key name:" +"&Install location:" +"&Modify command:" +"&Uninstall command:" +"&Publisher:" +"&Support information:" +"Product &updates:" +"&Comments:" +"&Version:" +"Install &date:" +// Menu's top and bottom lines +"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" +"Filter: [%s], Entries: [%d/%d]" +"{Normal priority} F7" +" {Low priority} F7" +"Select action" +"Action for %u items" +// Install location (registry) +"Mx86" +"Mx64" +"HKLM" +"HKCU" +// Error messages and confirmations +"Error of running program" +"Cancelled by user" +"Error of deleting uninstall info" +"UnInstall\nDo you wish to delete the uninstall entry?\n%s\nOk\nCancel" diff --git a/UnInstall_Rus.hlf b/src/UnInstall_Rus.hlf similarity index 93% rename from UnInstall_Rus.hlf rename to src/UnInstall_Rus.hlf index 217a384..06ff73e 100644 --- a/UnInstall_Rus.hlf +++ b/src/UnInstall_Rus.hlf @@ -1,94 +1,94 @@ -.Language=Russian,Russian -.PluginContents=Удаление программ -.Options CtrlStartPosChar=^ - -@Contents -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Содержание# - - #Колонки# - #1# #2# #3# #4# - Mx86 06.11.10 WMR- Microsoft .NET Framework 4 Multi-Targeting Pack - #Колонка 1# ^Место в реестре, где найдена запись о приложении. - ^В x86 ОС здесь может быть HKLM или HKCU, в x64 ОС - Mx86, Mx64, HKCU. - #Колонка 2# ^Дата установки программы. - #Колонка 3# ^Флаги. «W» - MSI, «M» - доступно «Изменение», «R» - восстановление, - ^«-» помечаются "скрытые" элементы. - #Колонка 4# ^Название программы. - - - #Управление# - - Добавить символ к фильтру #Символьные клавиши# - - Вставить в фильтр из буфера обмена #Shift-Ins, Ctrl-V# - - Очистить фильтр #Del# - - Удалить последний символ фильтра #BackSpace# - - Удалить запись об удалении программы #F8# - - Просмотр информации об удаляемой программе #F3# - - Обновить список #Ctrl-R# - - Изменить сортировку (по имени/по дате) #F2# - - Выбрать пункт списка #Alt-'подсвеченная буква'# - - Пометить пункт списка для пакетной обработки #Ins# или #RClick# - - Запустить программу-установщик #Enter or Shift-Enter# - Действие (Удаление, Измнение, Восстановление, Меню и ждать/не ждать) - указываются в ~настройке плагина~@Configuration@ - - Открыть диалог настроек плагина #Alt-Shift-F9# - - ~Настройка~@Configuration@ - ~Информация о программе~@UninstallEntry@ - ~Новые версии~@http://forum.farmanager.com/viewtopic.php?t=3529@ - ~Обсуждение~@http://forum.farmanager.com/viewtopic.php?t=3597@ - -@Configuration -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Настройка плагина# - - #Показывать в редакторе#, #Показывать в просмотрщике# - Разрешает вызов плагина из окна редактора или просмотрщика. Для панелей - разрешено всегда. - - #Повышать полномочия# - Запрашивать повышение полномочий (UAC) перед запуском #не# Windows Installer установщиков. - - #Запуск с низким приоритетом# - Пытаться запустить Uninstall с низким приоритетом. - - #Всегда использовать MsiExec# - Имеет эффект только для MSI инсталляторов. Если флажок выключен и в реестре -явно указана командная строка запуска, то она будет использована -вместо «msiexec /?{GUID}». - - #Enter# и #Shift-Enter# - Здесь можно выбрать один из следующих вариантов: - * Удаление (ждать), Удаление - выполнить Uninstall - * Изменить (ждать), Изменить - Modify (может быть не доступно для некторых программ) - * Восстановить (ждать), Восстановить - Repair (доступно только для MSI) - * Меню - Выбор действия через меню - - ~Содержание~@Contents@ - -@UninstallEntry -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Информация о программе# - - #PgUp#/#PgDn# перейти к предыдущей/следующей программе. - - ~Содержание~@Contents@ - -@ActionMenu -$^#<(NAME)> <(VER_MAJOR)>.<(VER_MINOR)>.<(VER_PATCH)># -$^#Выбор действия# - - #F7# сменить приоритет запускаемого процесса - - ~Содержание~@Contents@ +.Language=Russian,Russian +.PluginContents=Удаление программ +.Options CtrlStartPosChar=^ + +@Contents +$^UnInstall ${PLUGIN_VERSION}# +$^#Содержание# + + #Колонки# + #1# #2# #3# #4# + Mx86 06.11.10 WMR- Microsoft .NET Framework 4 Multi-Targeting Pack + #Колонка 1# ^Место в реестре, где найдена запись о приложении. + ^В x86 ОС здесь может быть HKLM или HKCU, в x64 ОС - Mx86, Mx64, HKCU. + #Колонка 2# ^Дата установки программы. + #Колонка 3# ^Флаги. «W» - MSI, «M» - доступно «Изменение», «R» - восстановление, + ^«-» помечаются "скрытые" элементы. + #Колонка 4# ^Название программы. + + + #Управление# + + Добавить символ к фильтру #Символьные клавиши# + + Вставить в фильтр из буфера обмена #Shift-Ins, Ctrl-V# + + Очистить фильтр #Del# + + Удалить последний символ фильтра #BackSpace# + + Удалить запись об удалении программы #F8# + + Просмотр информации об удаляемой программе #F3# + + Обновить список #Ctrl-R# + + Изменить сортировку (по имени/по дате) #F2# + + Выбрать пункт списка #Alt-'подсвеченная буква'# + + Пометить пункт списка для пакетной обработки #Ins# или #RClick# + + Запустить программу-установщик #Enter or Shift-Enter# + Действие (Удаление, Измнение, Восстановление, Меню и ждать/не ждать) + указываются в ~настройке плагина~@Configuration@ + + Открыть диалог настроек плагина #Alt-Shift-F9# + + ~Настройка~@Configuration@ + ~Информация о программе~@UninstallEntry@ + ~Новые версии~@http://forum.farmanager.com/viewtopic.php?t=3529@ + ~Обсуждение~@http://forum.farmanager.com/viewtopic.php?t=3597@ + +@Configuration +$^#UnInstall ${PLUGIN_VERSION}# +$^#Настройка плагина# + + #Показывать в редакторе#, #Показывать в просмотрщике# + Разрешает вызов плагина из окна редактора или просмотрщика. Для панелей - разрешено всегда. + + #Повышать полномочия# + Запрашивать повышение полномочий (UAC) перед запуском #не# Windows Installer установщиков. + + #Запуск с низким приоритетом# + Пытаться запустить Uninstall с низким приоритетом. + + #Всегда использовать MsiExec# + Имеет эффект только для MSI инсталляторов. Если флажок выключен и в реестре +явно указана командная строка запуска, то она будет использована +вместо «msiexec /?{GUID}». + + #Enter# и #Shift-Enter# + Здесь можно выбрать один из следующих вариантов: + * Удаление (ждать), Удаление - выполнить Uninstall + * Изменить (ждать), Изменить - Modify (может быть не доступно для некторых программ) + * Восстановить (ждать), Восстановить - Repair (доступно только для MSI) + * Меню - Выбор действия через меню + + ~Содержание~@Contents@ + +@UninstallEntry +$^#UnInstall ${PLUGIN_VERSION}# +$^#Информация о программе# + + #PgUp#/#PgDn# перейти к предыдущей/следующей программе. + + ~Содержание~@Contents@ + +@ActionMenu +$^#UnInstall ${PLUGIN_VERSION}# +$^#Выбор действия# + + #F7# сменить приоритет запускаемого процесса + + ~Содержание~@Contents@ diff --git a/UnInstall_Rus.lng b/src/UnInstall_Rus.lng similarity index 97% rename from UnInstall_Rus.lng rename to src/UnInstall_Rus.lng index 3db3510..76dd41d 100644 --- a/UnInstall_Rus.lng +++ b/src/UnInstall_Rus.lng @@ -1,57 +1,57 @@ -.Language=Russian,Russian (Русский) - -// Plugin title -"Удаление программ" -// Buttons -"OK" -"Отмена" -// Waiting for UnInstall complete -"Ожидание завершения команды" -// Configuration dialog -"Показывать в &редакторе" -"Показывать в &просмотрщике" -"Enter: &ожидать завершения" -"Повышать полномочи&я" -"Запуск с &низким приоритетом" -"&Всегда использовать MsiExec" -"Ente&r: " -"Shif&t-Enter:" -"Удаление (ждать)" -"Удаление" -"Изменить (ждать)" -"Изменить" -"Восстановить (ждать)" -"Восстановить" -"Меню" -// Entry info dialog title -"Запись о деинсталляции" -"Запись о деинсталляции (Windows Installer)" -// Entry info labels -"&Название:" -"К&люч в реестре:" -"&Расположение:" -"Команда для из&менения:" -"Команда для &деинсталляции:" -"&Издатель:" -"&Техническая поддержка:" -"&Обновления продукта:" -"&Комментарий:" -"&Версия:" -"Д&ата установки:" -// Menu's top and bottom lines -"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" -"Filter: [%s], Entries: [%d/%d]" -"{Normal priority} F7" -" {Low priority} F7" -"Выберите действие" -"Действие для %u элементов" -// Install location (registry) -"Mx86" -"Mx64" -"HKLM" -"HKCU" -// Error messages and confirmations -"Ошибка при запуске программы" -"Отменено пользователем" -"Ошибка при удалении информации о деустановке" -"Удаление программ\nВы действительно хотите удалить запись о программе?\n%s\nДа\nНет" +.Language=Russian,Russian (Русский) + +// Plugin title +"Удаление программ" +// Buttons +"OK" +"Отмена" +// Waiting for UnInstall complete +"Ожидание завершения команды" +// Configuration dialog +"Показывать в &редакторе" +"Показывать в &просмотрщике" +"Enter: &ожидать завершения" +"Повышать полномочи&я" +"Запуск с &низким приоритетом" +"&Всегда использовать MsiExec" +"Ente&r: " +"Shif&t-Enter:" +"Удаление (ждать)" +"Удаление" +"Изменить (ждать)" +"Изменить" +"Восстановить (ждать)" +"Восстановить" +"Меню" +// Entry info dialog title +"Запись о деинсталляции" +"Запись о деинсталляции (Windows Installer)" +// Entry info labels +"&Название:" +"К&люч в реестре:" +"&Расположение:" +"Команда для из&менения:" +"Команда для &деинсталляции:" +"&Издатель:" +"&Техническая поддержка:" +"&Обновления продукта:" +"&Комментарий:" +"&Версия:" +"Д&ата установки:" +// Menu's top and bottom lines +"[Shift-]Enter: run, F8: del entry, F2: sort, F3: info, Ctrl-R: update" +"Filter: [%s], Entries: [%d/%d]" +"{Normal priority} F7" +" {Low priority} F7" +"Выберите действие" +"Действие для %u элементов" +// Install location (registry) +"Mx86" +"Mx64" +"HKLM" +"HKCU" +// Error messages and confirmations +"Ошибка при запуске программы" +"Отменено пользователем" +"Ошибка при удалении информации о деустановке" +"Удаление программ\nВы действительно хотите удалить запись о программе?\n%s\nДа\nНет" diff --git a/guid.hpp b/src/guid.hpp similarity index 100% rename from guid.hpp rename to src/guid.hpp diff --git a/src/version.hpp b/src/version.hpp new file mode 100644 index 0000000..66ae066 --- /dev/null +++ b/src/version.hpp @@ -0,0 +1,20 @@ +#ifdef _WIN64 +#define PLATFORM " x64" +#elif defined _WIN32 +#define PLATFORM " x86" +#else +#define PLATFORM "" +#endif + +#define PLUGIN_VER_MAJOR 1 +#define PLUGIN_VER_MINOR 10 +#define PLUGIN_VER_PATCH 18 +#define PLUGIN_DESC L"UnInstall for Far Manager 3" PLATFORM +#define PLUGIN_NAME L"UnInstall" +#define PLUGIN_FILENAME L"UnInstall.dll" +#define PLUGIN_COPYRIGHT L"https://github.com/FarPlugins/UnInstall" + +#define STRINGIZE2(s) #s +#define STRINGIZE(s) STRINGIZE2(s) + +#define PLUGIN_VERSION STRINGIZE(PLUGIN_VER_MAJOR) "." STRINGIZE(PLUGIN_VER_MINOR) "." STRINGIZE(PLUGIN_VER_PATCH) diff --git a/tools/common.hpp b/tools/common.hpp deleted file mode 100644 index 279d4db..0000000 --- a/tools/common.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace std; - -#include - -#include "error.hpp" -#include "utils.hpp" -#include "sysutils.hpp" -#include "iniparse.hpp" - -#include "strutils.cpp" -#include "pathutils.cpp" -#include "sysutils.cpp" -#include "iniparse.cpp" - -#define BEGIN_ERROR_HANDLER try { -#define END_ERROR_HANDLER \ - } \ - catch (const Error& e) { \ - if (e.code != NO_ERROR) { \ - wstring sys_msg = get_system_message(e.code); \ - if (!sys_msg.empty()) \ - wcerr << sys_msg << endl; \ - } \ - for (list::const_iterator message = e.messages.begin(); message != e.messages.end(); message++) { \ - wcerr << *message << endl; \ - } \ - wcerr << extract_file_name(widen(e.file)) << L':' << e.line << endl; \ - } \ - catch (const exception& e) { \ - cerr << typeid(e).name() << ": " << e.what() << endl; \ - } \ - catch (...) { \ - cerr << "unknown error" << endl; \ - } - -#define CP_UTF16 1200 -wstring load_file(const wstring& file_name, unsigned* code_page = NULL) { - File file(get_full_path_name(file_name), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN); - Buffer buffer(file.size()); - unsigned size = file.read(buffer.data(), buffer.size()); - if ((size >= 2) && (buffer.data()[0] == '\xFF') && (buffer.data()[1] == '\xFE')) { - if (code_page) *code_page = CP_UTF16; - return wstring(reinterpret_cast(buffer.data() + 2), (buffer.size() - 2) / 2); - } - else if ((size >= 3) && (buffer.data()[0] == '\xEF') && (buffer.data()[1] == '\xBB') && (buffer.data()[2] == '\xBF')) { - if (code_page) *code_page = CP_UTF8; - return ansi_to_unicode(string(buffer.data() + 3, size - 3), CP_UTF8); - } - else { - if (code_page) *code_page = CP_ACP; - return ansi_to_unicode(string(buffer.data(), size), CP_ACP); - } -} - -void save_file(const wstring& file_name, const wstring& text, unsigned code_page = CP_ACP) { - File file(get_full_path_name(file_name), GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS, 0); - if (code_page == CP_UTF16) { - const char c_sig[] = { '\xFF', '\xFE' }; - file.write(c_sig, sizeof(c_sig)); - file.write(reinterpret_cast(text.data()), text.size() * 2); - } - else { - if (code_page == CP_UTF8) { - const char c_sig[] = { '\xEF', '\xBB', '\xBF' }; - file.write(c_sig, sizeof(c_sig)); - } - string data = unicode_to_ansi(text, code_page); - file.write(data.data(), data.size()); - } -} diff --git a/tools/convcp.cpp b/tools/convcp.cpp deleted file mode 100644 index faadcf8..0000000 --- a/tools/convcp.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "common.hpp" - -int wmain(int argc, wchar_t* argv[]) { - BEGIN_ERROR_HANDLER; - if (argc != 4) - FAIL_MSG(L"Usage: convcp in_file out_file codepage"); - unsigned code_page; - wstring text = load_file(argv[1]); - save_file(argv[2], text, str_to_int(argv[3])); - return 0; - END_ERROR_HANDLER; - return 1; -} diff --git a/tools/farver.cpp b/tools/farver.cpp deleted file mode 100644 index 82150cc..0000000 --- a/tools/farver.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "common.hpp" - -wstring extract_version_number(const wstring& text, const wstring& ver_name) { - size_t pos = text.find(ver_name); - CHECK(pos != wstring::npos); - pos += ver_name.size(); - while (pos < text.size() && (text[pos] == L' ' || text[pos] == L'\t')) - pos++; - size_t start_pos = pos; - while (pos < text.size() && text[pos] >= L'0' && text[pos] <= L'9') - pos++; - size_t end_pos = pos; - return text.substr(start_pos, end_pos - start_pos); -} - -int wmain(int argc, wchar_t* argv[]) { - BEGIN_ERROR_HANDLER; - if (argc != 3) - FAIL_MSG(L"Usage: farver "); - wstring text = load_file(argv[1]); - wstring result; - result += L"FAR_VER_MAJOR = " + extract_version_number(text, L"FARMANAGERVERSION_MAJOR") + L"\n"; - result += L"FAR_VER_MINOR = " + extract_version_number(text, L"FARMANAGERVERSION_MINOR") + L"\n"; - result += L"FAR_VER_BUILD = " + extract_version_number(text, L"FARMANAGERVERSION_BUILD") + L"\n"; - save_file(argv[2], result, CP_UTF8); - return 0; - END_ERROR_HANDLER; - return 1; -} diff --git a/tools/gendep.cpp b/tools/gendep.cpp deleted file mode 100644 index df11d55..0000000 --- a/tools/gendep.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "common.hpp" - -const wchar_t* c_ext_list[] = { - L"c", L"h", L"cpp", L"hpp", L"rc", -}; - -bool is_valid_ext(const wchar_t* file_name) { - const wchar_t* ext = wcsrchr(file_name, L'.'); - if (ext) ext++; - else ext = L""; - for (unsigned i = 0; i < ARRAYSIZE(c_ext_list); i++) { - if (_wcsicmp(ext, c_ext_list[i]) == 0) - return true; - } - return false; -} - -class Parser { -private: - const wstring& text; - size_t pos; - bool is_one_of(wchar_t ch, const wchar_t* char_set) { - const wchar_t* c = char_set; - while (*c && *c != ch) c++; - return *c == ch; - } - bool end() const { - return pos == text.size(); - } -public: - Parser(const wstring& text, size_t pos): text(text), pos(pos) { - } - void ws() { - while (!end() && is_one_of(text[pos], L" \t")) - pos++; - } - bool ch(wchar_t c) { - if (end() || text[pos] != c) return false; - pos++; - return true; - } - bool str(const wchar_t* str) { - while (!end() && *str && *str == text[pos]) { - pos++; - str++; - } - return *str == 0; - } - wstring extract(const wchar_t* end_chars) { - size_t start = pos; - while (!end() && !is_one_of(text[pos], end_chars)) - pos++; - return wstring(text.data() + start, pos - start); - } -}; - -bool is_include_directive(const wstring& text, size_t pos, wstring& file_name) { - Parser parser(text, pos); - parser.ws(); - if (!parser.ch(L'#')) return false; - parser.ws(); - if (!parser.str(L"include")) return false; - parser.ws(); - if (!parser.ch(L'"') && !parser.ch(L'<')) return false; - file_name = parser.extract(L"\">\n"); - if (!parser.ch(L'"') && !parser.ch(L'>')) return false; - return true; -} - -bool file_exists(const wstring& file_path) { - return GetFileAttributesW(long_path(get_full_path_name(file_path)).c_str()) != INVALID_FILE_ATTRIBUTES; -} - -void fix_slashes(wstring& path) { - for (size_t i = 0; i < path.size(); i++) { - if (path[i] == L'/') path[i] = L'\\'; - } -} - -list get_include_file_list(const wstring& file_path, const list& include_dirs) { - list file_list; - wstring text = load_file(file_path); - wstring inc_file; - size_t pos = 0; - while (true) { - if (is_include_directive(text, pos, inc_file)) { - fix_slashes(inc_file); - wstring inc_path = add_trailing_slash(extract_file_path(file_path)) + inc_file; - bool found = file_exists(inc_path); - for (list::const_iterator inc_dir = include_dirs.begin(); !found && inc_dir != include_dirs.end(); inc_dir++) { - inc_path = add_trailing_slash(*inc_dir) + inc_file; - found = file_exists(inc_path); - } - if (found) file_list.push_back(inc_path); - } - pos = text.find(L'\n', pos); - if (pos == wstring::npos) break; - else pos++; - } - return file_list; -} - -void process_file(wstring& output, set& file_set, const wstring& file_path, const list& include_dirs) { - if (file_set.count(file_path)) return; - file_set.insert(file_path); - list include_files = get_include_file_list(file_path, include_dirs); - if (!include_files.empty()) { - output.append(file_path).append(1, L':'); - for (list::const_iterator inc_file = include_files.begin(); inc_file != include_files.end(); inc_file++) { - output.append(1, L' ').append(*inc_file); - } - output.append(1, L'\n'); - } - for (list::const_iterator inc_file = include_files.begin(); inc_file != include_files.end(); inc_file++) { - process_file(output, file_set, *inc_file, include_dirs); - } -} - -#define CHECK_CMD(code) if (!(code)) FAIL_MSG(L"Usage: gendep [-I | ...]") -void parse_cmd_line(const list& params, list& source_dirs, list& include_dirs) { - source_dirs.assign(1, wstring()); - for (list::const_iterator param = params.begin(); param != params.end(); param++) { - if (substr_match(*param, 0, L"-I")) { - wstring inc_dir = param->substr(2); - CHECK_CMD(!inc_dir.empty()); - fix_slashes(inc_dir); - include_dirs.push_back(inc_dir); - } - else { - wstring src_dir = *param; - fix_slashes(src_dir); - source_dirs.push_back(src_dir); - } - } -} - -int wmain(int argc, wchar_t* argv[]) { - BEGIN_ERROR_HANDLER; - list params; - for (unsigned i = 1; i < argc; i++) params.push_back(argv[i]); - list source_dirs, include_dirs; - parse_cmd_line(params, source_dirs, include_dirs); - wstring output; - set file_set; - for (list::const_iterator src_dir = source_dirs.begin(); src_dir != source_dirs.end(); src_dir++) { - FileEnum files(get_full_path_name(src_dir->empty() ? L"." : *src_dir)); - while (files.next()) { - if (!files.data().is_dir() && is_valid_ext(files.data().cFileName)) { - process_file(output, file_set, add_trailing_slash(*src_dir) + files.data().cFileName, include_dirs); - } - } - } - cout << unicode_to_ansi(output, CP_ACP); - return 0; - END_ERROR_HANDLER; - return 1; -} diff --git a/tools/makefile b/tools/makefile deleted file mode 100644 index 193103c..0000000 --- a/tools/makefile +++ /dev/null @@ -1,9 +0,0 @@ -CPPFLAGS = -nologo -EHsc -I..\common user32.lib advapi32.lib - -build: - $(CPP) $(CPPFLAGS) gendep.cpp - $(CPP) $(CPPFLAGS) msgc.cpp - $(CPP) $(CPPFLAGS) preproc.cpp - $(CPP) $(CPPFLAGS) farver.cpp - $(CPP) $(CPPFLAGS) convcp.cpp - del /q *.obj diff --git a/tools/msgc.cpp b/tools/msgc.cpp deleted file mode 100644 index e1dd916..0000000 --- a/tools/msgc.cpp +++ /dev/null @@ -1,139 +0,0 @@ -#include "common.hpp" - -struct MsgPair { - wstring id; - wstring phrase; - bool operator==(const MsgPair& lp) const { - return id == lp.id; - } - bool operator<(const MsgPair& lp) const { - return id < lp.id; - } -}; - -struct MsgFile { - deque msg_list; - wstring lang_tag; - unsigned code_page; -}; - -#define CHECK_PARSE(code) if (!(code)) FAIL_MSG(L"Parse error at " + file_path + L":" + int_to_str(line_cnt + 1)) -MsgFile load_msg_file(const wstring& file_path) { - MsgFile msg_file; - wstring text = load_file(file_path, &msg_file.code_page); - MsgPair mp; - unsigned line_cnt = 0; - size_t pos_start = 0; - while (pos_start < text.size()) { - size_t pos_end = text.find(L'\n', pos_start); - if (pos_end == string::npos) pos_end = text.size(); - if (text[pos_start] == L'#') { - // skip comment - } - else if (strip(text.substr(pos_start, pos_end - pos_start)).size() == 0) { - // skip empty line - } - else { - size_t pos_sep = text.find(L'=', pos_start); - CHECK_PARSE((pos_sep != string::npos) && (pos_sep <= pos_end)); - mp.id = strip(text.substr(pos_start, pos_sep - pos_start)); - if (line_cnt == 0) { - // first line must be language tag - CHECK_PARSE(mp.id == L".Language"); - msg_file.lang_tag = strip(text.substr(pos_start, pos_end - pos_start)); - } - else { - // convert id - for (unsigned i = 0; i < mp.id.size(); i++) { - if (((mp.id[i] >= L'A') && (mp.id[i] <= L'Z')) || ((mp.id[i] >= L'0') && (mp.id[i] <= L'9')) || (mp.id[i] == L'_')) { - } - else if ((mp.id[i] >= L'a') && (mp.id[i] <= L'z')) { - mp.id[i] = mp.id[i] - L'a' + L'A'; - } - else if (mp.id[i] == L'.') { - mp.id[i] = L'_'; - } - else { - CHECK_PARSE(false); - } - } - mp.id.insert(0, L"MSG_"); - mp.phrase = L'"' + strip(text.substr(pos_sep + 1, pos_end - pos_sep - 1)) + L'"'; - msg_file.msg_list.push_back(mp); - } - } - pos_start = pos_end + 1; - line_cnt++; - } - - sort(msg_file.msg_list.begin(), msg_file.msg_list.end()); - return msg_file; -} - -struct FileNamePair { - wstring in; - wstring out; -}; - -#define CHECK_CMD(code) if (!(code)) FAIL_MSG(L"Usage: msgc -in msg_file [msg_file2 ...] -out header_file lng_file [lng_file2 ...]") -void parse_cmd_line(const deque& params, deque& files, wstring& header_file) { - CHECK_CMD(params.size()); - unsigned idx = 0; - CHECK_CMD(params[idx] == L"-in"); - idx++; - files.clear(); - FileNamePair fnp; - while ((idx < params.size()) && (params[idx] != L"-out")) { - fnp.in = params[idx]; - files.push_back(fnp); - idx++; - } - CHECK_CMD(files.size()); - CHECK_CMD(idx != params.size()); - idx++; - CHECK_CMD(idx != params.size()); - header_file = params[idx]; - idx++; - for (unsigned i = 0; i < files.size(); i++) { - CHECK_CMD(idx != params.size()); - files[i].out = params[idx]; - idx++; - } -} - -int wmain(int argc, wchar_t* argv[]) { - BEGIN_ERROR_HANDLER; - deque params; - for (int i = 1; i < argc; i++) { - params.push_back(argv[i]); - } - deque files; - wstring header_file; - parse_cmd_line(params, files, header_file); - // load message files - deque msgs; - for (unsigned i = 0; i < files.size(); i++) { - msgs.push_back(load_msg_file(files[i].in)); - if (i) { - if (msgs[i].msg_list != msgs[i - 1].msg_list) FAIL_MSG(L"Message files '" + files[i].in + L"' and '" + files[i - 1].in + L"' do not match"); - } - } - // create header file - wstring header_data; - for (unsigned i = 0; i < msgs[0].msg_list.size(); i++) { - header_data.append(L"#define " + msgs[0].msg_list[i].id + L" " + int_to_str(i) + L"\n"); - } - save_file(header_file, header_data, CP_ACP); - // create Far language files - wstring lng_data; - for (unsigned i = 0; i < msgs.size(); i++) { - lng_data = msgs[i].lang_tag + L'\n'; - for (unsigned j = 0; j < msgs[i].msg_list.size(); j++) { - lng_data += msgs[i].msg_list[j].phrase + L'\n'; - } - save_file(files[i].out, lng_data, msgs[i].code_page); - } - return 0; - END_ERROR_HANDLER; - return 1; -} diff --git a/tools/preproc.cpp b/tools/preproc.cpp deleted file mode 100644 index 1235181..0000000 --- a/tools/preproc.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "common.hpp" - -void search_and_replace(wstring& text, const wstring& name, const wstring& value) { - size_t pos = 0; - while (true) { - pos = text.find(name, pos); - if (pos == wstring::npos) break; - text.replace(pos, name.size(), value); - pos += value.size(); - } -} - -const wchar_t* prefix = L"<("; -const wchar_t* suffix = L")>"; - -int wmain(int argc, wchar_t* argv[]) { - BEGIN_ERROR_HANDLER; - if (argc != 4) - FAIL_MSG(L"Usage: preproc ini_file in_file out_file"); - unsigned code_page; - wstring text = load_file(argv[2], &code_page); - Ini::File ini_file; - ini_file.parse(load_file(argv[1])); - for (Ini::File::const_iterator section = ini_file.begin(); section != ini_file.end(); section++) { - for (Ini::Section::const_iterator item = section->second.begin(); item != section->second.end(); item++) { - search_and_replace(text, prefix + item->first + suffix, item->second); - } - } - save_file(argv[3], text, code_page); - return 0; - END_ERROR_HANDLER; - return 1; -} diff --git a/tools/vc.build.release.bat b/tools/vc.build.release.bat deleted file mode 100644 index 1269964..0000000 --- a/tools/vc.build.release.bat +++ /dev/null @@ -1,30 +0,0 @@ -@echo off - -if exist makefile set MAKEFILE=makefile - -if exist "%VS90COMNTOOLS%..\..\VC\BIN\vcvars32.bat" ( - call "%VS90COMNTOOLS%..\..\VC\BIN\vcvars32.bat" -) else ( - call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" -) - -set WIDE=1 -set IA64= -set AMD64= -set DEBUG= - -nmake /A /B /F %MAKEFILE% -rem nmake /F %MAKEFILE% -if errorlevel 1 goto end - -rem rem call "%VS90COMNTOOLS%..\..\VC\BIN\vcvarsx86_amd64.bat" -rem if exist "%VS90COMNTOOLS%..\..\VC\BIN\vcvarsx86_amd64.bat" ( -rem call "%VS90COMNTOOLS%..\..\VC\BIN\vcvarsx86_amd64.bat" -rem ) else ( -rem call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.bat" -rem ) -rem set AMD64=1 -rem nmake /A /B /F %MAKEFILE% -rem rem nmake /F %MAKEFILE% - -:end diff --git a/vc.build.release.bat b/vc.build.release.bat index 8f511b1..bb3b54f 100644 --- a/vc.build.release.bat +++ b/vc.build.release.bat @@ -1,35 +1,30 @@ @echo off -if exist makefile set MAKEFILE=makefile +mkdir bin -if exist "%VS100COMNTOOLS%..\..\VC\BIN\vcvars32.bat" ( - call "%VS100COMNTOOLS%..\..\VC\BIN\vcvars32.bat" +if exist "%VS160COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" ( + call "%VS160COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" x86 ) else ( - call "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat" + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86 ) -set WIDE=1 -set IA64= -set AMD64= -set CPU= -set PLATFORM= -set DEBUG= -set RELEASE=1 -set FAR3=1 +mkdir build +cd build +cmake .. -DCMAKE_INSTALL_PREFIX=../bin/x86 -G "CodeBlocks - NMake Makefiles" +cmake --build . --target install -nmake /A /B /F %MAKEFILE% -rem nmake /F %MAKEFILE% if errorlevel 1 goto end -if exist "%VS100COMNTOOLS%..\..\VC\BIN\x86_amd64\vcvarsx86_amd64.bat" ( - call "%VS100COMNTOOLS%..\..\VC\BIN\x86_amd64\vcvarsx86_amd64.bat" +cd .. +if exist "%VS160COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" ( + call "%VS160COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" x64 ) else ( - call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat" + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 ) -set AMD64=1 -set CPU=AMD64 -set PLATFORM=x64 -nmake /A /B /F %MAKEFILE% -rem nmake /F %MAKEFILE% +mkdir build64 +cd build64 +cmake .. -DCMAKE_INSTALL_PREFIX=../bin/x64 -G "CodeBlocks - NMake Makefiles" +cmake --build . --target install :end +echo See result in directory "bin"