Skip to content

Commit

Permalink
* EDIT:[LE] Переделал проп текста
Browse files Browse the repository at this point in the history
  • Loading branch information
BearIvan committed Jun 10, 2022
1 parent 49f244a commit 1b5260b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 57 deletions.
10 changes: 1 addition & 9 deletions Source/Editors/XrEProps/Tree/Properties/UIPropertiesForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ void UIPropertiesForm::DrawEditText()
if (ImGui::BeginPopupContextItem("EditText", 0))
{
R_ASSERT(m_EditTextValueData);
ImGui::PopStyleVar(3);

ImGui::BeginGroup();
if (ImGui::Button("Ok"))
Expand Down Expand Up @@ -299,13 +298,10 @@ void UIPropertiesForm::DrawEditText()
if (ImGui::Button("Clear")) { m_EditTextValueData[0] = 0; }
ImGui::EndGroup();
if(m_EditTextValueData)
ImGui::InputTextMultiline("", m_EditTextValueData, m_EditTextValueDataSize, ImVec2(500, 200) ,ImGuiInputTextFlags_CallbackResize, [](ImGuiInputTextCallbackData* data)->int {return reinterpret_cast<UIPropertiesForm*>(data->UserData)->DrawEditText_Callback(data); }, reinterpret_cast<void*>(this));
ImGui::InputTextMultiline("##text", m_EditTextValueData, m_EditTextValueDataSize, ImVec2(500, 200) ,ImGuiInputTextFlags_CallbackResize, [](ImGuiInputTextCallbackData* data)->int {return reinterpret_cast<UIPropertiesForm*>(data->UserData)->DrawEditText_Callback(data); }, reinterpret_cast<void*>(this));


ImGui::EndPopup();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1));
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 5);
}
}

Expand All @@ -324,7 +320,6 @@ void UIPropertiesForm::DrawEditGameType()
R_ASSERT(m_EditGameTypeValue);

bool test = false;
ImGui::PopStyleVar(3);
{
ImGui::BeginGroup();
{
Expand Down Expand Up @@ -383,9 +378,6 @@ void UIPropertiesForm::DrawEditGameType()
ImGui::EndGroup();
}
ImGui::EndPopup();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1));
ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, 5);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -441,26 +441,17 @@ void UIPropertiesItem::DrawProp()
{
CTextValue* V = dynamic_cast<CTextValue*>(PItem->GetFrontValue()); R_ASSERT(V);
{
char text[20];
xr_string str = PItem->GetDrawText();
int i = 0;
for (int a = 0; i < std::min(size_t(16), str.size()); i++, a++)
string128 Str;
xr_string Source = PItem->GetDrawText();
strncpy_s(Str, Source.c_str(), sizeof(string128) - 4);
if (Source.size()>128&& strrchr(Str, '\n'))
{
if (str[a] == '\n')
a++;
if (str[a] == '\t')
a++;
if (str[a] == '\r')
a++;
text[i] = str[a];
strrchr(Str, '\n')[0] = 0;
}
if(str.size()>16||str.size()==0)
for (; i < std::min(size_t(16), str.size()) + 3; i++)
xr_strcat(Str, "...");
if (ImGui::Button(Str, ImVec2(-1, 0)))
{
text[i] = '.';
}
text[i] = 0;
ImGui::Text(text);
}
if (ImGui::OpenPopupOnItemClick2("EditText", 0))
{
Expand All @@ -479,26 +470,17 @@ void UIPropertiesItem::DrawProp()
{
RTextValue* V = dynamic_cast<RTextValue*>(PItem->GetFrontValue()); R_ASSERT(V);
{
char text[20];
xr_string str = PItem->GetDrawText();
int i = 0;
for (int a = 0; i < std::min(size_t(16), str.size()); i++, a++)
string128 Str;
xr_string Source = PItem->GetDrawText();
strncpy_s(Str, Source.c_str(), sizeof(string128) - 4);
if (Source.size() > 128 && strrchr(Str, '\n'))
{
if (str[a] == '\n')
a++;
if (str[a] == '\t')
a++;
if (str[a] == '\r')
a++;
text[i] = str[a];
strrchr(Str, '\n')[0] = 0;
}
if (str.size() > 16 || str.size() == 0)
for (; i < std::min(size_t(16), str.size()) + 3; i++)
xr_strcat(Str, "...");
if (ImGui::Button(Str, ImVec2(-1, 0)))
{
text[i] = '.';
}
text[i] = 0;
ImGui::Text(text);
}
if (ImGui::OpenPopupOnItemClick2("EditText", 0))
{
Expand All @@ -515,26 +497,17 @@ void UIPropertiesItem::DrawProp()
{
STextValue* V = dynamic_cast<STextValue*>(PItem->GetFrontValue()); R_ASSERT(V);
{
char text[20];
xr_string str = PItem->GetDrawText();
int i = 0;
for (int a = 0; i < std::min(size_t(16), str.size()); i++, a++)
string128 Str;
xr_string Source = PItem->GetDrawText();
strncpy_s(Str, Source.c_str(), sizeof(string128) - 4);
if (Source.size() > 128 && strrchr(Str, '\n'))
{
if (str[a] == '\n')
a++;
if (str[a] == '\t')
a++;
if (str[a] == '\r')
a++;
text[i] = str[a];
strrchr(Str, '\n')[0] = 0;
}
if (str.size() > 16 || str.size() == 0)
for (; i < std::min(size_t(16), str.size()) + 3; i++)
xr_strcat(Str, "...");
if (ImGui::Button(Str, ImVec2(-1, 0)))
{
text[i] = '.';
}
text[i] = 0;
ImGui::Text(text);
}
if (ImGui::OpenPopupOnItemClick2("EditText", 0))
{
Expand Down

0 comments on commit 1b5260b

Please sign in to comment.