mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/acemod/ACE3
This commit is contained in:
commit
697656da92
BIN
ace_clipboard.dll
Normal file
BIN
ace_clipboard.dll
Normal file
Binary file not shown.
@ -37,3 +37,7 @@ class ACE_Settings {
|
||||
values[] = {"$str_medium", "$str_large", "$str_very_large"};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Extensions {
|
||||
extensions[] += {"ace_clipboard"};
|
||||
};
|
||||
|
@ -55,13 +55,26 @@ class %1 {
|
||||
force = 1;
|
||||
};", _name, _value, format['"%1"', _typeName]];
|
||||
|
||||
//clipboard seems to be getting cuttoff, so do a backup dump to rpt:
|
||||
diag_log text _compiledConfigEntry;
|
||||
|
||||
_compiledConfig = _compiledConfig + _compiledConfigEntry;
|
||||
};
|
||||
} forEach EGVAR(common,settings);
|
||||
|
||||
copyToClipboard format["%1",_compiledConfig];
|
||||
FUNC(clipboardExport) = {
|
||||
private["_chunks"];
|
||||
_chunks = [];
|
||||
|
||||
_chunks = [_this select 0, ";"] call CBA_fnc_split;
|
||||
|
||||
{
|
||||
private["_chunk"];
|
||||
_chunk = _x + ";";
|
||||
"ace_clipboard" callExtension format["%1", _chunk];
|
||||
} forEach _chunks;
|
||||
|
||||
"ace_clipboard" callExtension "--COMPLETE--";
|
||||
};
|
||||
[_compiledConfig] call FUNC(clipboardExport);
|
||||
|
||||
["STR_ACE_OptionsMenu_settingsExported"] call EFUNC(common,displayTextStructured);
|
||||
|
||||
|
||||
|
@ -56,6 +56,7 @@ set(GLOBAL_SOURCES ${GLOBAL_RC})
|
||||
# Add extensions to build here
|
||||
add_subdirectory(fcs)
|
||||
add_subdirectory(break_line)
|
||||
add_subdirectory(clipboard)
|
||||
add_subdirectory(advanced_ballistics)
|
||||
|
||||
message("Build Type: ${CMAKE_BUILD_TYPE}")
|
12
extensions/clipboard/CMakeLists.txt
Normal file
12
extensions/clipboard/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
set(ACE_EXTENSION_NAME "ace_clipboard")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES})
|
||||
target_link_libraries(${ACE_EXTENSION_NAME} ace_common)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||
endif()
|
87
extensions/clipboard/ace_clipboard.cpp
Normal file
87
extensions/clipboard/ace_clipboard.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* ace_clipboard.cpp
|
||||
*
|
||||
* Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit.
|
||||
*
|
||||
* Takes:
|
||||
* Localized string as string
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
#include "ace_common.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
std::string gClipboardData;
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||
std::string cur_input(function);
|
||||
std::string result;
|
||||
|
||||
if (cur_input.length() < 1)
|
||||
return;
|
||||
|
||||
if (!strcmp(function, "version")) {
|
||||
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
if (!strcmp(function, "--COMPLETE--")) {
|
||||
HGLOBAL hClipboardData = GlobalAlloc(GMEM_FIXED, gClipboardData.length() + 1);
|
||||
if (!hClipboardData) {
|
||||
result = "GlobalAlloc() failed, GetLastError=" + GetLastError();
|
||||
gClipboardData = "";
|
||||
return;
|
||||
}
|
||||
|
||||
char *pClipboardData = (char *)GlobalLock(hClipboardData);
|
||||
if (!pClipboardData) {
|
||||
result = "GlobalLock() failed, GetLastError=" + GetLastError();
|
||||
gClipboardData = "";
|
||||
return;
|
||||
}
|
||||
memcpy(pClipboardData, gClipboardData.c_str(), gClipboardData.length());
|
||||
pClipboardData[gClipboardData.length() + 1] = 0x00;
|
||||
|
||||
GlobalUnlock(hClipboardData);
|
||||
|
||||
if (!OpenClipboard(NULL)) {
|
||||
result = "OpenClipboard() failed, GetLastError=" + GetLastError();
|
||||
}
|
||||
else {
|
||||
if (!EmptyClipboard()) {
|
||||
result = "OpenClipboard() failed, GetLastError=" + GetLastError();
|
||||
}
|
||||
else {
|
||||
if (!SetClipboardData(CF_TEXT, hClipboardData)) {
|
||||
result = "SetClipboardData() failed, GetLastError=" + GetLastError();
|
||||
}
|
||||
else {
|
||||
if (!CloseClipboard()) {
|
||||
result = "CloseClipboard() failed, GetLastError=" + GetLastError();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gClipboardData = "";
|
||||
} else {
|
||||
gClipboardData = gClipboardData + cur_input;
|
||||
}
|
||||
|
||||
end:
|
||||
if(result.length() > 1)
|
||||
memcpy(output, result.c_str(), result.length()+1);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user