mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-29 07:32:25 +00:00
Dhewm3SettingsMenu: Add button to copy current style to clipboard as C++
This commit is contained in:
parent
99b65a3edf
commit
894aa67a8f
3 changed files with 18 additions and 0 deletions
|
@ -1602,6 +1602,11 @@ static void DrawOtherOptionsMenu()
|
|||
}
|
||||
AddTooltip( "Writes the current style settings (incl. colors) as userstyle" );
|
||||
|
||||
if ( ImGui::Button( "Copy style code to clipboard" ) ) {
|
||||
D3::ImGuiHooks::CopyCurrentStyle();
|
||||
}
|
||||
AddTooltip( "Generates C++ code for the current style settings (incl. colors) and copies it into the clipboard" );
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if ( ImGui::Button( "Show ImGui Demo" ) ) {
|
||||
|
|
|
@ -39,6 +39,10 @@ namespace DG {
|
|||
// style to a sane default before calling that function.
|
||||
// returns true on success, false if opening the file failed
|
||||
extern bool ReadImGuiStyle( ImGuiStyle& style, const char* filename );
|
||||
|
||||
// generate C++ code that replicates the given style into a text buffer
|
||||
// (that you can either write to a file or set the clipboard from or whatever)
|
||||
extern ImGuiTextBuffer WriteImGuiStyleToCode( const ImGuiStyle& s );
|
||||
} //namespace DG
|
||||
|
||||
namespace D3 {
|
||||
|
@ -522,4 +526,10 @@ bool WriteUserStyle()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CopyCurrentStyle()
|
||||
{
|
||||
ImGuiTextBuffer buf = DG::WriteImGuiStyleToCode( ImGui::GetStyle() );
|
||||
Sys_SetClipboardData( buf.c_str() );
|
||||
}
|
||||
|
||||
}} //namespace D3::ImGuiHooks
|
||||
|
|
|
@ -77,6 +77,9 @@ extern void SetUserStyleColors();
|
|||
// write current style settings (incl. colors) as userStyle
|
||||
extern bool WriteUserStyle();
|
||||
|
||||
// copy current style to clipboard
|
||||
extern void CopyCurrentStyle();
|
||||
|
||||
#else // IMGUI_DISABLE - just stub out everything
|
||||
|
||||
inline bool IsImguiEnabled()
|
||||
|
|
Loading…
Reference in a new issue