mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Improved windows titles management
Display filename (no path) before APP_NAME, clean APP_TITLE when no file, bugs fixed.
This commit is contained in:
10
Mixer.cpp
10
Mixer.cpp
@@ -54,7 +54,7 @@ static void saveSession(const std::string& filename, Session *session)
|
||||
// set session filename
|
||||
session->setFilename(filename);
|
||||
// cosmetics saved ok
|
||||
Rendering::manager().setMainWindowTitle(filename);
|
||||
Rendering::manager().setMainWindowTitle(SystemToolkit::filename(filename));
|
||||
Settings::application.recentSessions.push(filename);
|
||||
Log::Notify("Session %s saved.", filename.c_str());
|
||||
|
||||
@@ -144,8 +144,12 @@ void Mixer::update()
|
||||
swap();
|
||||
++View::need_deep_update_;
|
||||
// inform new session filename
|
||||
Rendering::manager().setMainWindowTitle(session_->filename());
|
||||
Settings::application.recentSessions.push(session_->filename());
|
||||
if (session_->filename().empty()) {
|
||||
Rendering::manager().setMainWindowTitle(Settings::application.windows[0].name);
|
||||
} else {
|
||||
Rendering::manager().setMainWindowTitle(SystemToolkit::filename(session_->filename()));
|
||||
Settings::application.recentSessions.push(session_->filename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -488,9 +488,11 @@ RenderingWindow::~RenderingWindow()
|
||||
|
||||
void RenderingWindow::setTitle(const std::string &title)
|
||||
{
|
||||
std::string fulltitle = Settings::application.windows[index_].name;
|
||||
if ( !title.empty() )
|
||||
fulltitle = std::string(APP_NAME) + " -- " + title;
|
||||
std::string fulltitle;
|
||||
if ( title.empty() )
|
||||
fulltitle = Settings::application.windows[index_].name;
|
||||
else
|
||||
fulltitle = title + std::string(" - " APP_NAME);
|
||||
|
||||
glfwSetWindowTitle(window_, fulltitle.c_str());
|
||||
}
|
||||
|
||||
@@ -39,13 +39,12 @@ void Settings::Save()
|
||||
{
|
||||
XMLElement *windowsNode = xmlDoc.NewElement( "Windows" );
|
||||
|
||||
for (int i = 0; i < application.windows.size(); i++)
|
||||
for (int i = 0; i < application.windows.size(); ++i)
|
||||
{
|
||||
const Settings::WindowConfig& w = application.windows[i];
|
||||
|
||||
XMLElement *window = xmlDoc.NewElement( "Window" );
|
||||
window->SetAttribute("id", i);
|
||||
window->SetAttribute("name", w.name.c_str());
|
||||
window->SetAttribute("x", w.x);
|
||||
window->SetAttribute("y", w.y);
|
||||
window->SetAttribute("w", w.w);
|
||||
@@ -334,16 +333,18 @@ void Settings::Load()
|
||||
for( ; windowNode ; windowNode=windowNode->NextSiblingElement())
|
||||
{
|
||||
Settings::WindowConfig w;
|
||||
w.name = std::string(windowNode->Attribute("name"));
|
||||
windowNode->QueryIntAttribute("x", &w.x); // If this fails, original value is left as-is
|
||||
windowNode->QueryIntAttribute("y", &w.y);
|
||||
windowNode->QueryIntAttribute("w", &w.w);
|
||||
windowNode->QueryIntAttribute("h", &w.h);
|
||||
windowNode->QueryBoolAttribute("f", &w.fullscreen);
|
||||
w.monitor = std::string(windowNode->Attribute("m"));
|
||||
const char *text = windowNode->Attribute("m");
|
||||
if (text)
|
||||
w.monitor = std::string(text);
|
||||
|
||||
int i = 0;
|
||||
windowNode->QueryIntAttribute("id", &i);
|
||||
w.name = application.windows[i].name; // keep only original name
|
||||
application.windows[i] = w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,10 +225,10 @@ struct Application
|
||||
current_workspace= 1;
|
||||
brush = glm::vec3(0.5f, 0.1f, 0.f);
|
||||
windows = std::vector<WindowConfig>(3);
|
||||
windows[0].name = APP_NAME APP_TITLE;
|
||||
windows[0].name = APP_TITLE;
|
||||
windows[0].w = 1600;
|
||||
windows[0].h = 900;
|
||||
windows[1].name = APP_NAME " -- Output";
|
||||
windows[1].name = "Output " APP_TITLE;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -1715,7 +1715,7 @@ void UserInterface::RenderMetrics(bool *p_open, int* p_corner, int *p_mode)
|
||||
void UserInterface::RenderAbout(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(1000, 20), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("About " APP_NAME APP_TITLE, p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||
if (!ImGui::Begin("About " APP_TITLE, p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user