Skip to content

Commit

Permalink
Raw Text is no longer open by default. It's now in the View menu.
Browse files Browse the repository at this point in the history
The Help window also reflects this change.
  • Loading branch information
98ahni committed Nov 26, 2024
1 parent ced9e64 commit 3db1102
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Source/Windows/Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HelpWindow::HelpWindow()
#define Keybind(key, text) ImGui::Text(key); ImGui::SameLine(); ImGui::SetCursorPosX(ImGui::GetCursorPosX() - DPI_SCALED(17)); ImGui::Bullet(); ImGui::SameLine(); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + DPI_SCALED(7)); ImGui::TextWrapped(text)
void HelpWindow::OnImGuiDraw()
{
ImGui::SetNextWindowSize({std::min(ImGui::GetContentRegionAvail().x * .85f, 500.f), ImGui::GetContentRegionAvail().y * .8f}, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize({std::min(MainWindow::SwapWidth * .85f, 500.f), std::min(MainWindow::SwapHeight * .8f, 400.f)}, ImGuiCond_Once);
Gui_Begin();
ImGui::PushFont(MainWindow::Font);
ImGui::Text("Using Resonate");
Expand Down Expand Up @@ -118,6 +118,7 @@ void HelpWindow::OnImGuiDraw()

StartTreeNode("Dealing with Raw Text");
ImGui::TextWrapped("The Raw Text view is meant to make changes to the lyrics before timing in case you don't have access to an extrnal text editor. "
"It can be opened from the View menu by selecting the option Raw Text. "
"It shows and allows you to edit the file that is readable by both ECHO and Resonate. Please note that if an effect value is changed it might not be recognized as a Resonate effect. "
"Changing the Resonate headers are not recommended as it may result in undefined behavior.");
EndTreeNode
Expand Down
8 changes: 5 additions & 3 deletions Source/Windows/RawText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ TextEditor::TextEditor()

void TextEditor::OnImGuiDraw()
{
if(ImGui::Begin(GetName().c_str(), 0, ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_HorizontalScrollbar | (Serialization::KaraokeDocument::Get().GetIsDirty() ? ImGuiWindowFlags_UnsavedDocument : 0)))
//if(ImGui::Begin(GetName().c_str(), 0, ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_HorizontalScrollbar | (Serialization::KaraokeDocument::Get().GetIsDirty() ? ImGuiWindowFlags_UnsavedDocument : 0)))
if(Gui_Begin(ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_HorizontalScrollbar | (Serialization::KaraokeDocument::Get().GetIsDirty() ? ImGuiWindowFlags_UnsavedDocument : 0)))
{
if(ImGui::InputTextMultiline("##RawText", &myRawText, ImGui::GetContentRegionAvail()) && myHasTakenFocus)
{
Expand All @@ -25,12 +26,13 @@ void TextEditor::OnImGuiDraw()
}
TouchInput_ReadyKeyboard();

if(!myHasTakenFocus)
if(!myHasTakenFocus || ImGui::IsWindowAppearing() || ImGui::IsItemActivated())
{
myRawText = Serialization::KaraokeDocument::Get().Serialize();
((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(true);
((TimingEditor*)WindowManager::GetWindow("Timing"))->SetInputUnsafe(false);
myHasTakenFocus = true;
}
myHasTakenFocus = true;
}
else
{
Expand Down
13 changes: 12 additions & 1 deletion Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,17 @@ void loop(void* window){
WindowManager::AddWindow<TouchControl>("Touch Control");
}
}
if(ImGui::MenuItem("Raw Text", 0, WindowManager::GetWindow("Raw Text") != nullptr))
{
if(WindowManager::GetWindow("Raw Text") != nullptr)
{
WindowManager::DestroyWindow(WindowManager::GetWindow("Raw Text"));
}
else
{
WindowManager::AddWindow<TextEditor>("Raw Text");
}
}
if(ImGui::MenuItem("Settings", 0, WindowManager::GetWindow("Settings") != nullptr))
{
if(WindowManager::GetWindow("Settings") != nullptr)
Expand Down Expand Up @@ -755,7 +766,7 @@ int main(){
}

WindowManager::Init();
WindowManager::AddWindow<TextEditor>("Raw Text");
//WindowManager::AddWindow<TextEditor>("Raw Text");
TimingEditor* timingEditor = WindowManager::AddWindow<TimingEditor>("Timing");
WindowManager::AddWindow<AudioPlayback>("Audio");
ImGui::SetWindowFocus("Timing");
Expand Down

0 comments on commit 3db1102

Please sign in to comment.