2026-05-11 23:06:39 +03:00
|
|
|
/*
|
|
|
|
|
* InfiniPaint
|
|
|
|
|
* Copyright (C) 2025-2026 Yousef Khadadeh
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-20 16:38:51 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include <Helpers/Serializers.hpp>
|
|
|
|
|
#include <cereal/types/string.hpp>
|
|
|
|
|
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>
|
2025-12-23 17:17:33 +03:00
|
|
|
#include "../GUIStuff/Elements/TreeListing.hpp"
|
2025-12-20 16:38:51 +03:00
|
|
|
#include "BookmarkListItem.hpp"
|
2026-01-01 22:46:02 +03:00
|
|
|
#include <Helpers/VersionNumber.hpp>
|
2025-12-20 16:38:51 +03:00
|
|
|
|
|
|
|
|
class World;
|
|
|
|
|
|
|
|
|
|
class BookmarkManager {
|
|
|
|
|
public:
|
|
|
|
|
BookmarkManager(World& w);
|
2026-01-01 22:46:02 +03:00
|
|
|
void server_init_no_file();
|
2026-04-09 12:00:36 +03:00
|
|
|
void read_create_message(cereal::PortableBinaryInputArchive& a);
|
2025-12-20 16:38:51 +03:00
|
|
|
void scale_up(const WorldScalar& scaleUpAmount);
|
2026-04-07 16:57:11 +03:00
|
|
|
void setup_list_gui();
|
2025-12-23 17:17:33 +03:00
|
|
|
void refresh_gui_data();
|
2026-01-01 22:46:02 +03:00
|
|
|
void save_file(cereal::PortableBinaryOutputArchive& a) const;
|
|
|
|
|
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version);
|
2025-12-20 16:38:51 +03:00
|
|
|
|
|
|
|
|
NetworkingObjects::NetObjOwnerPtr<BookmarkListItem> bookmarkListRoot;
|
|
|
|
|
private:
|
2026-04-06 20:16:25 +03:00
|
|
|
NetworkingObjects::NetObjTemporaryPtr<BookmarkListItem> get_bookmark_parent_from_obj_index(const GUIStuff::TreeListingObjIndexList& objIndex);
|
|
|
|
|
NetworkingObjects::NetObjTemporaryPtr<BookmarkListItem> get_bookmark_from_obj_index(const GUIStuff::TreeListingObjIndexList& objIndex);
|
2026-01-03 13:35:24 +03:00
|
|
|
std::pair<NetworkingObjects::NetObjID, NetworkingObjects::NetObjOrderedListIterator<BookmarkListItem>> create_in_proper_position(BookmarkListItem* newItem);
|
|
|
|
|
std::optional<std::pair<NetworkingObjects::NetObjID, NetworkingObjects::NetObjOrderedListIterator<BookmarkListItem>>> try_to_create_in_proper_position(BookmarkListItem* newItem);
|
|
|
|
|
NetworkingObjects::NetObjOrderedListIterator<BookmarkListItem> create_bookmark(BookmarkListItem* newItem);
|
2026-04-06 20:16:25 +03:00
|
|
|
void remove_bookmark(const GUIStuff::TreeListingObjIndexList& objIndex);
|
2026-01-03 13:35:24 +03:00
|
|
|
|
2025-12-23 17:17:33 +03:00
|
|
|
std::string nameToEdit;
|
|
|
|
|
std::string nameForNew;
|
|
|
|
|
|
2026-04-06 20:16:25 +03:00
|
|
|
std::set<GUIStuff::TreeListingObjIndexList> selectedBookmarkIndices;
|
|
|
|
|
|
2026-04-09 16:30:28 +03:00
|
|
|
NetworkingObjects::NetObjWeakPtr<BookmarkListItem> editingBookmark;
|
2026-04-06 20:16:25 +03:00
|
|
|
std::optional<std::string> editingBookmarkOldName;
|
2026-01-03 13:35:24 +03:00
|
|
|
|
|
|
|
|
void editing_bookmark_check();
|
|
|
|
|
|
2026-01-01 22:46:02 +03:00
|
|
|
friend class BookmarkListItem;
|
|
|
|
|
|
2025-12-20 16:38:51 +03:00
|
|
|
World& world;
|
|
|
|
|
};
|