|
@@ -4,14 +4,14 @@
|
|
|
#include "shortcutApi/shortcutApi.h"
|
|
#include "shortcutApi/shortcutApi.h"
|
|
|
#include <editShortcuts/editShortcuts.h>
|
|
#include <editShortcuts/editShortcuts.h>
|
|
|
|
|
|
|
|
-#define DOCK_MAIN_WINDOW_SHORTCUT "Dock main window"
|
|
|
|
|
|
|
+#define DOCK_MAIN_WINDOW_SHORTCUT ICON_FK_EYE_SLASH " Hide main window"
|
|
|
#define LOGS_SHORTCUT "Logs window"
|
|
#define LOGS_SHORTCUT "Logs window"
|
|
|
#define EDIT_SHORTCUTS "Edit shortcuts window"
|
|
#define EDIT_SHORTCUTS "Edit shortcuts window"
|
|
|
|
|
|
|
|
void pika::Editor::init(pika::ShortcutManager &shortcutManager)
|
|
void pika::Editor::init(pika::ShortcutManager &shortcutManager)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- shortcutManager.registerShortcut(DOCK_MAIN_WINDOW_SHORTCUT, "Ctrl+Alt+D", &optionsFlags.dockMainWindow);
|
|
|
|
|
|
|
+ shortcutManager.registerShortcut(DOCK_MAIN_WINDOW_SHORTCUT, "Ctrl+Alt+D", &optionsFlags.hideMainWindow);
|
|
|
shortcutManager.registerShortcut(LOGS_SHORTCUT, "Ctrl+L", &windowFlags.logsWindow);
|
|
shortcutManager.registerShortcut(LOGS_SHORTCUT, "Ctrl+L", &windowFlags.logsWindow);
|
|
|
shortcutManager.registerShortcut(EDIT_SHORTCUTS, "", &windowFlags.editShortcutsWindow);
|
|
shortcutManager.registerShortcut(EDIT_SHORTCUTS, "", &windowFlags.editShortcutsWindow);
|
|
|
|
|
|
|
@@ -27,100 +27,124 @@ void pika::Editor::update(const pika::Input &input,
|
|
|
pika::ShortcutManager &shortcutManager, pika::LogManager &logs)
|
|
pika::ShortcutManager &shortcutManager, pika::LogManager &logs)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
-#pragma region docking space init
|
|
|
|
|
- ImGuiWindowFlags mainWindowFlags = ImGuiWindowFlags_MenuBar;
|
|
|
|
|
- if (optionsFlags.dockMainWindow)
|
|
|
|
|
|
|
+#pragma region push notification if hide window
|
|
|
|
|
+
|
|
|
|
|
+ if (lastHideWindowState == 0 && optionsFlags.hideMainWindow)
|
|
|
{
|
|
{
|
|
|
- mainWindowFlags = ImGuiWindowFlags_MenuBar |
|
|
|
|
|
- ImGuiWindowFlags_NoResize |
|
|
|
|
|
- ImGuiWindowFlags_NoMove |
|
|
|
|
|
- ImGuiWindowFlags_NoCollapse |
|
|
|
|
|
- ImGuiWindowFlags_NoBringToFrontOnFocus |
|
|
|
|
|
- ImGuiWindowFlags_NoBackground |
|
|
|
|
|
- ImGuiWindowFlags_NoTitleBar;
|
|
|
|
|
-
|
|
|
|
|
- ImVec2 vWindowSize = ImGui::GetMainViewport()->Size;
|
|
|
|
|
- ImVec2 vPos0 = ImGui::GetMainViewport()->Pos;
|
|
|
|
|
- ImGui::SetNextWindowPos(ImVec2((float)vPos0.x, (float)vPos0.y), ImGuiCond_Always);
|
|
|
|
|
- ImGui::SetNextWindowSize(ImVec2((float)vWindowSize.x, (float)vWindowSize.y), 0);
|
|
|
|
|
|
|
+ std::string message = "Press ";
|
|
|
|
|
+ message += shortcutManager.getShortcut(DOCK_MAIN_WINDOW_SHORTCUT);
|
|
|
|
|
+ message += " to restore the main window.";
|
|
|
|
|
+
|
|
|
|
|
+ pushNotificationManager.pushNotification(message.c_str());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ lastHideWindowState = optionsFlags.hideMainWindow;
|
|
|
#pragma endregion
|
|
#pragma endregion
|
|
|
|
|
|
|
|
-#pragma region main editor window
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- //ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.2f, 0.2f, 0.3f, 1.0f));
|
|
|
|
|
-
|
|
|
|
|
- //todo imgui push pop id for main window
|
|
|
|
|
- if (ImGui::Begin(
|
|
|
|
|
- "Main window",
|
|
|
|
|
- /*p_open=*/nullptr,
|
|
|
|
|
- mainWindowFlags
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ if (!optionsFlags.hideMainWindow)
|
|
|
{
|
|
{
|
|
|
- //ImGui::PopStyleColor();
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- if (optionsFlags.dockMainWindow)
|
|
|
|
|
|
|
+#pragma region docking space init
|
|
|
|
|
+ ImGuiWindowFlags mainWindowFlags = ImGuiWindowFlags_MenuBar;
|
|
|
|
|
+ //if (optionsFlags.hideMainWindow)
|
|
|
{
|
|
{
|
|
|
- static const ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None;
|
|
|
|
|
- ImGuiID dockSpace = ImGui::GetID("MainWindowDockspace");
|
|
|
|
|
- ImGui::DockSpace(dockSpace, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
|
|
|
|
|
|
+ mainWindowFlags = ImGuiWindowFlags_MenuBar |
|
|
|
|
|
+ ImGuiWindowFlags_NoResize |
|
|
|
|
|
+ ImGuiWindowFlags_NoMove |
|
|
|
|
|
+ ImGuiWindowFlags_NoCollapse |
|
|
|
|
|
+ ImGuiWindowFlags_NoBringToFrontOnFocus |
|
|
|
|
|
+ ImGuiWindowFlags_NoBackground |
|
|
|
|
|
+ ImGuiWindowFlags_NoTitleBar;
|
|
|
|
|
+
|
|
|
|
|
+ ImVec2 vWindowSize = ImGui::GetMainViewport()->Size;
|
|
|
|
|
+ ImVec2 vPos0 = ImGui::GetMainViewport()->Pos;
|
|
|
|
|
+ ImGui::SetNextWindowPos(ImVec2((float)vPos0.x, (float)vPos0.y), ImGuiCond_Always);
|
|
|
|
|
+ ImGui::SetNextWindowSize(ImVec2((float)vWindowSize.x, (float)vWindowSize.y), 0);
|
|
|
}
|
|
}
|
|
|
|
|
+#pragma endregion
|
|
|
|
|
|
|
|
- #pragma region menu
|
|
|
|
|
- if (ImGui::BeginMenuBar())
|
|
|
|
|
- {
|
|
|
|
|
|
|
+#pragma region main editor window
|
|
|
|
|
|
|
|
- if (ImGui::BeginMenu("Open..."))
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ //ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.2f, 0.2f, 0.3f, 1.0f));
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //todo imgui push pop id for main window
|
|
|
|
|
+ if (ImGui::Begin(
|
|
|
|
|
+ "Main window",
|
|
|
|
|
+ /*p_open=*/nullptr,
|
|
|
|
|
+ mainWindowFlags
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ {
|
|
|
|
|
+ //ImGui::PopStyleColor();
|
|
|
|
|
|
|
|
- ImGui::Text("menu text");
|
|
|
|
|
|
|
|
|
|
- ImGui::EndMenu();
|
|
|
|
|
|
|
+ //if (optionsFlags.dockMainWindow)
|
|
|
|
|
+ {
|
|
|
|
|
+ static const ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_None;
|
|
|
|
|
+ ImGuiID dockSpace = ImGui::GetID("MainWindowDockspace");
|
|
|
|
|
+ ImGui::DockSpace(dockSpace, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (ImGui::BeginMenu("Options"))
|
|
|
|
|
|
|
+ #pragma region menu
|
|
|
|
|
+ if (ImGui::BeginMenuBar())
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ if (ImGui::BeginMenu("Open..."))
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
- ImGui::MenuItem(ICON_FK_WINDOW_RESTORE " " DOCK_MAIN_WINDOW_SHORTCUT,
|
|
|
|
|
- shortcutManager.getShortcut(DOCK_MAIN_WINDOW_SHORTCUT), &optionsFlags.dockMainWindow);
|
|
|
|
|
|
|
+ ImGui::Text("menu text");
|
|
|
|
|
|
|
|
- ImGui::EndMenu();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ImGui::EndMenu();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (ImGui::BeginMenu(ICON_FK_WINDOW_MAXIMIZE " Windows"))
|
|
|
|
|
- {
|
|
|
|
|
- ImGui::MenuItem(pika::LogWindow::ICON_NAME,
|
|
|
|
|
- shortcutManager.getShortcut(LOGS_SHORTCUT), &windowFlags.logsWindow);
|
|
|
|
|
|
|
+ if (ImGui::BeginMenu("Options"))
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
|
|
|
|
|
- ImGui::EndMenu();
|
|
|
|
|
|
|
+ ImGui::MenuItem(DOCK_MAIN_WINDOW_SHORTCUT,
|
|
|
|
|
+ shortcutManager.getShortcut(DOCK_MAIN_WINDOW_SHORTCUT), &optionsFlags.hideMainWindow);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ImGui::EndMenu();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ImGui::BeginMenu(ICON_FK_WINDOW_MAXIMIZE " Windows"))
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::MenuItem(pika::LogWindow::ICON_NAME,
|
|
|
|
|
+ shortcutManager.getShortcut(LOGS_SHORTCUT), &windowFlags.logsWindow);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ ImGui::EndMenu();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ImGui::BeginMenu(ICON_FK_COG " Settings"))
|
|
|
|
|
+ {
|
|
|
|
|
+ ImGui::MenuItem(pika::EditShortcutsWindow::ICON_NAME,
|
|
|
|
|
+ shortcutManager.getShortcut(EDIT_SHORTCUTS), &windowFlags.editShortcutsWindow);
|
|
|
|
|
|
|
|
- if (ImGui::BeginMenu(ICON_FK_COG " Settings"))
|
|
|
|
|
- {
|
|
|
|
|
- ImGui::MenuItem(pika::EditShortcutsWindow::ICON_NAME ,
|
|
|
|
|
- shortcutManager.getShortcut(EDIT_SHORTCUTS), &windowFlags.editShortcutsWindow);
|
|
|
|
|
|
|
|
|
|
|
|
+ ImGui::EndMenu();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- ImGui::EndMenu();
|
|
|
|
|
|
|
+ ImGui::EndMenuBar();
|
|
|
}
|
|
}
|
|
|
|
|
+ #pragma endregion
|
|
|
|
|
|
|
|
- ImGui::EndMenuBar();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ //ImGui::PopStyleColor();
|
|
|
|
|
+ }
|
|
|
|
|
+ ImGui::End();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#pragma endregion
|
|
#pragma endregion
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- //ImGui::PopStyleColor();
|
|
|
|
|
- }
|
|
|
|
|
- ImGui::End();
|
|
|
|
|
-#pragma endregion
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#pragma region log window
|
|
#pragma region log window
|
|
|
|
|
|