Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor enhancements #8903

Merged
merged 49 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7b358f5
make text boxes in schedule editor uneditable
babaissarkar May 21, 2024
35fbf68
Add various error/confirmation messages
babaissarkar May 21, 2024
28d90dc
editor: change Load Game to Load Game/Scenario
babaissarkar May 21, 2024
dc617fa
convert absolute paths to wesnoth style relative paths
babaissarkar May 21, 2024
ac82d22
Merge branch 'master' of https://github.com/babaissarkar/wesnoth into…
babaissarkar May 21, 2024
b833b32
make schedule name translatable and write textdomain
babaissarkar May 22, 2024
19d2e02
ask to copy file if outside wesnoth's directories
babaissarkar May 22, 2024
28367a8
rearrange include file alphabetically
babaissarkar May 22, 2024
9786fac
adjust if condition in to_asset_path
babaissarkar May 23, 2024
99eea6b
Add preview icon
babaissarkar May 23, 2024
de7abf8
Add preview buttons for image and sound
babaissarkar May 23, 2024
b7ab96b
add success indication
babaissarkar May 22, 2024
d575887
update menu items
babaissarkar May 23, 2024
6c3fb10
various string fixes
babaissarkar May 23, 2024
64f136c
open in add-on's scenario directory when saving scenario
babaissarkar May 23, 2024
d5fbdb6
use the settings icon as icon for preferences menu item
babaissarkar May 24, 2024
bfb8762
add new items to addon menu
babaissarkar May 24, 2024
f068395
Save Scenario As only shown for scenarios
babaissarkar May 25, 2024
b0ad433
implement select addon and open addon menu items, code cleanup
babaissarkar May 25, 2024
e6aacfe
redesigned file dialog with new icons
babaissarkar May 27, 2024
2d3dd19
add "Open External" button to file dialog
babaissarkar May 28, 2024
b28cfbb
Add functionality to "Loyal" checkbox (#8445)
babaissarkar May 28, 2024
ee87304
move to_asset_path to filesystem and fix image showing bug
babaissarkar May 28, 2024
320e38c
remove unused comment
babaissarkar May 28, 2024
b1d0a53
do not allow maps to be saved in scenario folder or vice versa
babaissarkar May 29, 2024
85962a0
remove unnecessary comment
babaissarkar May 29, 2024
5652d8d
adjust unit editor layout
babaissarkar May 29, 2024
452a31a
image scaling and selection code simplication
babaissarkar May 30, 2024
626cd54
rewritten unit type editor using tab_container
babaissarkar May 30, 2024
9c65d1e
check extension of saved file (#8911)
babaissarkar May 31, 2024
3cec1e6
whitespace fix
babaissarkar May 31, 2024
f205146
stop the files panel from shrinking too much
babaissarkar Jun 5, 2024
692924b
show warning the first time user tries to save scenario in map folder…
babaissarkar Jun 19, 2024
8eac378
filename validation in file dialog
babaissarkar Jun 20, 2024
da83c9a
change validation text and add padding
babaissarkar Jun 20, 2024
2e1c3f2
move unitlist to Units menu inside editor and disable Status Table wh…
babaissarkar Jun 21, 2024
1b1b23e
support multiple extension in filemanager
babaissarkar Jun 21, 2024
b3128ff
support .mask extension in Save Map As dialog
babaissarkar Jun 21, 2024
3164ce8
save temporary maps or scenarios inside USERDATA/editor when reloadin…
babaissarkar Jun 25, 2024
94df4d8
Merge branch 'master' into editor_enhancements
babaissarkar Jun 25, 2024
aa2b04a
rename 'name' -> 'save_path'
babaissarkar Jun 25, 2024
04eecaf
Merge branch 'editor_enhancements' of https://github.com/babaissarkar…
babaissarkar Jun 25, 2024
afe0cff
map context loaded from memory instead of temp files when reloading
babaissarkar Jun 27, 2024
44553ba
move undo/redo stack and new save_all_maps() method, switch to last u…
babaissarkar Jun 28, 2024
5b89dfa
use vector of context_ptr and swap it with current map context to sav…
babaissarkar Jun 28, 2024
faaefb6
code refactor
babaissarkar Jun 29, 2024
d9b6952
use std::make_unique and remove context_ptr alias
babaissarkar Jun 29, 2024
da2fb0e
more refactor
babaissarkar Jun 29, 2024
627ee09
increase file dialog width and fix segfault
babaissarkar Jun 29, 2024
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
19 changes: 14 additions & 5 deletions src/gui/dialogs/editor/custom_tod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
#include "gettext.hpp"
#include "gui/auxiliary/field.hpp"
#include "gui/dialogs/file_dialog.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/image.hpp"
#include "gui/widgets/label.hpp"
#include "gui/widgets/slider.hpp"
#include "gui/widgets/text_box.hpp"

#include <functional>
#include <boost/filesystem.hpp>

namespace gui2::dialogs
{
Expand Down Expand Up @@ -178,7 +180,7 @@ void custom_tod::select_file(const std::string& default_dir)
update_selected_tod_info();
}

std::string custom_tod::to_wesnoth_path(std::string abs_path, std::string asset_type)
std::string custom_tod::to_wesnoth_path(std::string abs_path, std::string asset_type, bool copy_if_outside)
babaissarkar marked this conversation as resolved.
Show resolved Hide resolved
{
std::string rel_path = "";
std::string core_asset_dir = filesystem::get_dir(game_config::path + "/data/core/" + asset_type);
Expand All @@ -197,12 +199,19 @@ std::string custom_tod::to_wesnoth_path(std::string abs_path, std::string asset_
} else if (is_in_addon_dir) {
rel_path = abs_path.erase(0, addon_asset_dir.size()+1);
CelticMinstrel marked this conversation as resolved.
Show resolved Hide resolved
} else {
// image outside wesnoth's directories
// copy to addon's images directory
// file outside, ask the user if they want to copy
const std::string& message
= _("File outside Wesnoth's data dirs. Do you wish to copy it in your add-on?");
babaissarkar marked this conversation as resolved.
Show resolved Hide resolved
bool status = gui2::show_message(_("Confirm"), message, message::yes_no_buttons) == gui2::retval::OK;

if (copy_if_outside && !addon_id_.empty() && status) {
std::string filename = boost::filesystem::path(abs_path).filename().string();
std::string asset_path = addon_asset_dir + "/" + filename;
rel_path = filename; // for example, inside images/ or sounds/, so wesnoth path same as filename
filesystem::copy_file(abs_path, asset_path);
}
}

PLAIN_LOG << rel_path;

return rel_path;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/editor/custom_tod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class custom_tod : public modal_dialog
void update_schedule();

/** Helper function to convert absolute path to wesnoth relative path */
std::string to_wesnoth_path(std::string abs_path, std::string asset_type);
std::string to_wesnoth_path(std::string abs_path, std::string asset_type, bool copy_if_outside = true);

/** ID of the current addon. The schedule file will be saved here. */
const std::string addon_id_;
Expand Down