Tidying up

This commit is contained in:
ocornut 2015-07-30 22:49:10 -06:00
parent 040f3950a3
commit abf823c6f6
3 changed files with 5 additions and 14 deletions

View File

@ -468,7 +468,6 @@
#include "imgui.h" #include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_FUNCTIONS
#include "imgui_internal.h" #include "imgui_internal.h"
#include <ctype.h> // toupper, isprint #include <ctype.h> // toupper, isprint
@ -5798,8 +5797,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
SetActiveID(id, window); SetActiveID(id, window);
FocusWindow(window); FocusWindow(window);
const bool is_ctrl_down = g.IO.KeyCtrl; if (tab_focus_requested || g.IO.KeyCtrl)
if (tab_focus_requested || is_ctrl_down)
{ {
start_text_input = true; start_text_input = true;
g.ScalarAsInputTextId = 0; g.ScalarAsInputTextId = 0;

View File

@ -14,9 +14,8 @@
#include "imgui.h" #include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_FUNCTIONS
#include "imgui_internal.h" #include "imgui_internal.h"
#include <stdio.h> // vsnprintf, sscanf, printf #include <stdio.h> // vsnprintf, sscanf, printf
#include <new> // new (ptr) #include <new> // new (ptr)
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)

View File

@ -3,16 +3,12 @@
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! // You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
// Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) // Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
// #define IMGUI_ENABLE_MATH_OPERATORS // #define IMGUI_DEFINE_MATH_OPERATORS
// Implement maths functions:
// #define IMGUI_ENABLE_MATH_FUNCTIONS
#pragma once #pragma once
#include <stdio.h> // FILE* #include <stdio.h> // FILE*
#ifdef IMGUI_DEFINE_MATH_FUNCTIONS
#include <math.h> // sqrtf() #include <math.h> // sqrtf()
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Forward Declarations // Forward Declarations
@ -35,7 +31,7 @@ typedef int ImGuiLayoutType; // enum ImGuiLayoutType_
typedef int ImGuiButtonFlags; // enum ImGuiButtonFlags_ typedef int ImGuiButtonFlags; // enum ImGuiButtonFlags_
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// STB libraries implementation // STB libraries
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
namespace ImGuiStb namespace ImGuiStb
@ -113,7 +109,6 @@ static inline ImVec2& operator/=(ImVec2& lhs, const float rhs)
static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); } static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); }
#endif #endif
#ifdef IMGUI_DEFINE_MATH_FUNCTIONS
static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; } static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; }
static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; } static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }
static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; } static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }
@ -129,10 +124,9 @@ static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t)
static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; } static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; }
static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; } static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; }
static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; } static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; }
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Declarations // Types
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
enum ImGuiButtonFlags_ enum ImGuiButtonFlags_