Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ImguiMapEditor/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ void Application::wireCallbacks() {
.edit_towns = &dialogs_.edit_towns,
.map_properties = &dialogs_.map_properties,
// Search components
.quick_search = ui_.search_controller->getQuickSearchPopup(),
.advanced_search = ui_.search_controller->getAdvancedSearchDialog(),
.search_results = ui_.search_controller->getSearchResultsWidget(),
.search_controller = ui_.search_controller.get(),
Expand Down Expand Up @@ -367,7 +366,6 @@ void Application::render() {
.ribbon = ui_.ribbon_controller.get(),
.file_panel = ui_.file_panel_ptr,
.main_window = ui_.main_window.get(),
.quick_search_popup = ui_.search_controller->getQuickSearchPopup(),
.advanced_search_dialog =
ui_.search_controller->getAdvancedSearchDialog(),
.search_results_widget = ui_.search_controller->getSearchResultsWidget(),
Expand Down
29 changes: 6 additions & 23 deletions ImguiMapEditor/Application/CallbackMediator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "UI/Map/MapPanel.h"
#include "UI/PreferencesDialog.h"
#include "UI/Ribbon/Panels/FilePanel.h"
#include "UI/Widgets/QuickSearchPopup.h"
#include "UI/Widgets/SearchResultsWidget.h"
#include "UI/Windows/BrowseTile/BrowseTileWindow.h"
#include "UI/Windows/IngameBoxWindow.h"
Expand Down Expand Up @@ -366,11 +365,8 @@ void CallbackMediator::wireMenuCallbacks(Context &ctx) {
});

// Search menu callbacks
ctx.menu_bar->setQuickFindCallback(
[ctx]() { if (ctx.quick_search) ctx.quick_search->open(); });

ctx.menu_bar->setFindItemsCallback(
[ctx]() { ctx.view_settings->show_search_results = true; });
[ctx]() { if (ctx.advanced_search) ctx.advanced_search->open(); });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Consolidating quick search and advanced search into a single unified dialog simplifies the UI and keyboard shortcuts for the user.


ctx.menu_bar->setFindUniqueCallback(
[ctx]() {
Expand Down Expand Up @@ -537,29 +533,16 @@ void CallbackMediator::wireCleanupCallbacks(Context &ctx) {
}

void CallbackMediator::wireSearchCallbacks(Context &ctx) {
// Wire Ctrl+F quick search callback
if (ctx.hotkey && ctx.quick_search) {
// Wire Ctrl+F to open Advanced Search dialog
if (ctx.hotkey && ctx.advanced_search) {
ctx.hotkey->setQuickSearchCallback(
[qs = ctx.quick_search]() { qs->open(); });
[as = ctx.advanced_search]() { as->open(); });
}

// Wire Ctrl+Shift+F to toggle Search Results Widget (not Advanced Search)
// Wire Ctrl+Shift+F to toggle Search Results Widget
if (ctx.hotkey && ctx.view_settings) {
ctx.hotkey->setAdvancedSearchCallback(
[vs = ctx.view_settings]() { vs->show_search_results = true; });
}

// Wire QuickSearch selection callback
if (ctx.quick_search) {
ctx.quick_search->setSelectCallback(
[](uint16_t server_id, bool is_creature) {
spdlog::info("QuickSearch selected: {} (ID: {})",
is_creature ? "creature" : "item", server_id);
Presentation::showInfo(std::string("Selected ") +
(is_creature ? "creature" : "item") +
" ID: " + std::to_string(server_id),
2000);
});
[vs = ctx.view_settings]() { vs->show_search_results = !vs->show_search_results; });
}

// Wire SearchResultsWidget navigate callback
Expand Down
3 changes: 0 additions & 3 deletions ImguiMapEditor/Application/CallbackMediator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class MapOperationHandler;
class HotkeyController;
class MapInputController;
class EditorSession;
class ItemPickerService;
class MapSearchService;
class SearchController;
} // namespace AppLogic
Expand Down Expand Up @@ -64,7 +63,6 @@ class PreferencesDialog;
class EditTownsDialog;
class MapPropertiesDialog;
class ConfirmationDialog;
class QuickSearchPopup;
class AdvancedSearchDialog;
class SearchResultsWidget;

Expand Down Expand Up @@ -134,7 +132,6 @@ class CallbackMediator {
UI::MapPropertiesDialog *map_properties = nullptr;

// Search components
UI::QuickSearchPopup *quick_search = nullptr;
UI::AdvancedSearchDialog *advanced_search = nullptr;
UI::SearchResultsWidget *search_results = nullptr;
AppLogic::SearchController *search_controller = nullptr;
Expand Down
8 changes: 1 addition & 7 deletions ImguiMapEditor/Application/Frame/RenderOrchestrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "UI/Panels/BrushSizePanel.h"
#include "UI/Ribbon/Panels/FilePanel.h"
#include "UI/Ribbon/RibbonController.h"
#include "UI/Widgets/QuickSearchPopup.h"
#include "UI/Widgets/SearchResultsWidget.h"
#include "UI/Widgets/TilesetWidget.h"
#include "UI/Windows/BrowseTile/BrowseTileWindow.h"
Expand Down Expand Up @@ -195,12 +194,7 @@ void RenderOrchestrator::renderDialogs(Context &ctx) {
ctx.rendering_manager, // Pass rendering_manager instead of renderer
&dialogs.cleanup_confirm});

// Quick Search popup (Ctrl+F)
if (ctx.quick_search_popup) {
ctx.quick_search_popup->render();
}

// Advanced Search dialog (Ctrl+Shift+F)
// Advanced Search dialog (Ctrl+F)
if (ctx.advanced_search_dialog) {
ctx.advanced_search_dialog->render();
}
Expand Down
2 changes: 0 additions & 2 deletions ImguiMapEditor/Application/Frame/RenderOrchestrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class MapPanel;
class MinimapWindow;
class BrowseTileWindow;
class TilesetWidget;
class QuickSearchPopup;
class AdvancedSearchDialog;
class SearchResultsWidget;
class StartupDialog;
Expand Down Expand Up @@ -99,7 +98,6 @@ class RenderOrchestrator {
UI::Ribbon::RibbonController *ribbon = nullptr;
UI::Ribbon::FilePanel *file_panel = nullptr;
Presentation::MainWindow *main_window = nullptr;
UI::QuickSearchPopup *quick_search_popup = nullptr;
UI::AdvancedSearchDialog *advanced_search_dialog = nullptr;
UI::SearchResultsWidget *search_results_widget = nullptr;
UI::TilesetWidget *tileset_widget = nullptr;
Expand Down
2 changes: 0 additions & 2 deletions ImguiMapEditor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ set(SERVICES_SOURCES
Services/Map/MapCleanupService.cpp
Services/Map/MapSearchService.cpp
Services/ClipboardService.cpp
Services/ItemPickerService.cpp
Services/MapMergeService.cpp
Services/SessionWiringService.cpp
Services/SettingsRegistry.cpp
Expand Down Expand Up @@ -296,7 +295,6 @@ set(UI_SOURCES
UI/Ribbon/RibbonController.cpp
UI/Widgets/Properties/PropertyPanelRenderer.cpp
UI/Widgets/Properties/PropertyWidgets.cpp
UI/Widgets/QuickSearchPopup.cpp
UI/Widgets/SearchResultsWidget.cpp
UI/Widgets/TilesetWidget.cpp
UI/Widgets/TilesetGridWidget.cpp
Expand Down
14 changes: 1 addition & 13 deletions ImguiMapEditor/Controllers/SearchController.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "Controllers/SearchController.h"
#include "Services/ClientDataService.h"
#include "Services/SpriteManager.h"
#include "UI/Widgets/QuickSearchPopup.h"
#include "UI/Dialogs/AdvancedSearchDialog.h"
#include "UI/Widgets/SearchResultsWidget.h"
#include "Domain/ChunkedMap.h"
Expand All @@ -24,13 +23,11 @@ static void sortResultsByName(std::vector<Domain::Search::MapSearchResult>& resu
}

SearchController::SearchController()
: quick_search_popup_(std::make_unique<UI::QuickSearchPopup>()),
advanced_search_dialog_(std::make_unique<UI::AdvancedSearchDialog>()),
: advanced_search_dialog_(std::make_unique<UI::AdvancedSearchDialog>()),
search_results_widget_(std::make_unique<UI::SearchResultsWidget>()) {}

SearchController::~SearchController() = default;

UI::QuickSearchPopup* SearchController::getQuickSearchPopup() const { return quick_search_popup_.get(); }
UI::AdvancedSearchDialog* SearchController::getAdvancedSearchDialog() const { return advanced_search_dialog_.get(); }
UI::SearchResultsWidget* SearchController::getSearchResultsWidget() const { return search_results_widget_.get(); }

Expand Down Expand Up @@ -61,12 +58,6 @@ void SearchController::onMapLoaded(

if (!client_data) return;

if (!item_picker_service_ || current_client_data_ != client_data) {
item_picker_service_ = std::make_unique<AppLogic::ItemPickerService>(client_data);
quick_search_popup_->setItemPickerService(item_picker_service_.get());
advanced_search_dialog_->setItemPickerService(item_picker_service_.get());
}

if (!map_search_service_) {
map_search_service_ = std::make_unique<Services::MapSearchService>();
search_results_widget_->setMapSearchService(map_search_service_.get());
Expand All @@ -80,9 +71,6 @@ void SearchController::onMapLoaded(
search_results_widget_->setClientData(client_data);
search_results_widget_->setSpriteManager(sprite_manager);

quick_search_popup_->setSpriteManager(sprite_manager);
quick_search_popup_->setClientDataService(client_data);

advanced_search_dialog_->setClientDataService(client_data);
advanced_search_dialog_->setSpriteManager(sprite_manager);

Expand Down
5 changes: 0 additions & 5 deletions ImguiMapEditor/Controllers/SearchController.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include "Services/ItemPickerService.h"
#include "Services/Map/MapSearchService.h"
#include "Services/ViewSettings.h"
#include <future>
Expand All @@ -14,7 +13,6 @@ namespace Search { struct MapSearchResult; }
}

namespace UI {
class QuickSearchPopup;
class AdvancedSearchDialog;
class SearchResultsWidget;
}
Expand Down Expand Up @@ -88,20 +86,17 @@ class SearchController {
void forgetSessionMap(const Domain::ChunkedMap* map);

// Accessors for UI components (needed for rendering and callbacks)
UI::QuickSearchPopup* getQuickSearchPopup() const;
UI::AdvancedSearchDialog* getAdvancedSearchDialog() const;
UI::SearchResultsWidget* getSearchResultsWidget() const;

private:
template<typename F> void launchAsync(F&& searchFn);

// UI Components (unique_ptr to allow forward declarations in header)
std::unique_ptr<UI::QuickSearchPopup> quick_search_popup_;
std::unique_ptr<UI::AdvancedSearchDialog> advanced_search_dialog_;
std::unique_ptr<UI::SearchResultsWidget> search_results_widget_;

// Services
std::unique_ptr<AppLogic::ItemPickerService> item_picker_service_;
std::unique_ptr<Services::MapSearchService> map_search_service_;

// State tracking
Expand Down
11 changes: 2 additions & 9 deletions ImguiMapEditor/Presentation/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,19 +224,12 @@ void MenuBar::renderSearchMenu() {
if (ImGui::BeginMenu("Search")) {
bool has_session = tab_manager_ && tab_manager_->getActiveSession();

if (ImGui::MenuItem(ICON_FA_MAGNIFYING_GLASS " Quick Find", formatShortcut(QUICK_SEARCH).c_str())) {
if (on_quick_find_)
on_quick_find_();
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Quick catalog search for items and creatures");

if (ImGui::MenuItem(ICON_FA_MAGNIFYING_GLASS_PLUS " Find Items...", formatShortcut(ADVANCED_SEARCH).c_str())) {
if (ImGui::MenuItem(ICON_FA_MAGNIFYING_GLASS_PLUS " Find Items...", formatShortcut(QUICK_SEARCH).c_str())) {
if (on_find_items_)
on_find_items_();
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Advanced search with type and property filters");
ImGui::SetTooltip("Search for items and creatures with filters");

ImGui::Separator();

Expand Down
2 changes: 0 additions & 2 deletions ImguiMapEditor/Presentation/MenuBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class MenuBar {
void setConvertToClientIdCallback(ActionCallback cb) { on_convert_to_client_id_ = std::move(cb); }

// Search menu callbacks
void setQuickFindCallback(ActionCallback cb) { on_quick_find_ = std::move(cb); }
void setFindItemsCallback(ActionCallback cb) { on_find_items_ = std::move(cb); }
void setFindUniqueCallback(ActionCallback cb) { on_find_unique_ = std::move(cb); }
void setFindActionCallback(ActionCallback cb) { on_find_action_ = std::move(cb); }
Expand Down Expand Up @@ -122,7 +121,6 @@ class MenuBar {
ActionCallback on_convert_to_server_id_;
ActionCallback on_convert_to_client_id_;

ActionCallback on_quick_find_;
ActionCallback on_find_items_;
ActionCallback on_find_unique_;
ActionCallback on_find_action_;
Expand Down
114 changes: 0 additions & 114 deletions ImguiMapEditor/Services/ItemPickerService.cpp

This file was deleted.

Loading
Loading