From d5985a11ee388166bb3c6e1bfbf8383faa549995 Mon Sep 17 00:00:00 2001 From: dimkanovikov Date: Thu, 2 May 2024 07:32:04 +0300 Subject: [PATCH] Add ability to work with parentheticals in comic books --- .../content/settings/settings_manager.cpp | 1 + .../comic_book_text/comic_book_text.pro | 2 + .../comic_book_text/comic_book_text_view.cpp | 5 +- .../text/comic_book_text_edit.cpp | 9 +- .../text/handlers/dialog_handler.cpp | 83 ++++++ .../text/handlers/dialog_handler.h | 1 + .../handlers/key_press_handler_facade.cpp | 7 + .../text/handlers/parenthetical_handler.cpp | 251 ++++++++++++++++++ .../text/handlers/parenthetical_handler.h | 29 ++ .../text/handlers/standard_key_handler.cpp | 12 +- .../text/handlers/standard_key_handler.h | 6 +- .../text/handlers/dialog_handler.h | 6 +- .../text/handlers/parenthetical_handler.h | 6 +- .../screenplay_template_paragraphs_view.cpp | 1 + src/core/ui/settings/settings_view.cpp | 1 + .../data_layer/storage/settings_storage.cpp | 19 +- .../data_layer/storage/settings_storage.h | 3 + src/corelib/templates/comicbook/script_us | 1 + src/corelib/templates/comicbook/script_world | 1 + 19 files changed, 423 insertions(+), 21 deletions(-) create mode 100644 src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.cpp create mode 100644 src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.h diff --git a/src/core/management_layer/content/settings/settings_manager.cpp b/src/core/management_layer/content/settings/settings_manager.cpp index b5057cab8..63f292979 100644 --- a/src/core/management_layer/content/settings/settings_manager.cpp +++ b/src/core/management_layer/content/settings/settings_manager.cpp @@ -606,6 +606,7 @@ void SettingsManager::Implementation::loadShortcutsForComicBookSettings() blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::PanelHeading)); blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::Description)); blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::Character)); + blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::Parenthetical)); blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::Dialogue)); blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::InlineNote)); blocksJumpsModel->appendRow(blocksJumpsModelRow(TextParagraphType::UnformattedText)); diff --git a/src/core/management_layer/plugins/comic_book_text/comic_book_text.pro b/src/core/management_layer/plugins/comic_book_text/comic_book_text.pro index 8006943b4..8590ac54d 100644 --- a/src/core/management_layer/plugins/comic_book_text/comic_book_text.pro +++ b/src/core/management_layer/plugins/comic_book_text/comic_book_text.pro @@ -41,6 +41,7 @@ HEADERS += \ text/handlers/key_press_handler_facade.h \ text/handlers/page_handler.h \ text/handlers/panel_handler.h \ + text/handlers/parenthetical_handler.h \ text/handlers/pre_handler.h \ text/handlers/prepare_handler.h \ text/handlers/sequence_footer_handler.h \ @@ -63,6 +64,7 @@ SOURCES += \ text/handlers/key_press_handler_facade.cpp \ text/handlers/page_handler.cpp \ text/handlers/panel_handler.cpp \ + text/handlers/parenthetical_handler.cpp \ text/handlers/pre_handler.cpp \ text/handlers/prepare_handler.cpp \ text/handlers/sequence_footer_handler.cpp \ diff --git a/src/core/management_layer/plugins/comic_book_text/comic_book_text_view.cpp b/src/core/management_layer/plugins/comic_book_text/comic_book_text_view.cpp index 2852757a6..f155ed643 100644 --- a/src/core/management_layer/plugins/comic_book_text/comic_book_text_view.cpp +++ b/src/core/management_layer/plugins/comic_book_text/comic_book_text_view.cpp @@ -255,8 +255,9 @@ void ComicBookTextView::Implementation::reconfigureTemplate(bool _withModelReini const QVector types = { TextParagraphType::PageHeading, TextParagraphType::PanelHeading, TextParagraphType::Description, TextParagraphType::Character, - TextParagraphType::Dialogue, TextParagraphType::InlineNote, - TextParagraphType::UnformattedText, TextParagraphType::SequenceHeading, + TextParagraphType::Parenthetical, TextParagraphType::Dialogue, + TextParagraphType::InlineNote, TextParagraphType::UnformattedText, + TextParagraphType::SequenceHeading, }; for (const auto type : types) { if (!usedTemplate.paragraphStyle(type).isActive()) { diff --git a/src/core/management_layer/plugins/comic_book_text/text/comic_book_text_edit.cpp b/src/core/management_layer/plugins/comic_book_text/text/comic_book_text_edit.cpp index f678f8415..7937729c4 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/comic_book_text_edit.cpp +++ b/src/core/management_layer/plugins/comic_book_text/text/comic_book_text_edit.cpp @@ -369,9 +369,11 @@ void ComicBookTextEdit::addParagraph(BusinessLayer::TextParagraphType _type) d->document.setParagraphType(BusinessLayer::TextParagraphType::Dialogue, cursor); } // - // Если вставляется реплика, то разделяем страницу и ставим курсор во вторую колонку + // Если вставляется ремарка, или реплика, то разделяем страницу и ставим курсор во вторую + // колонку // - else if (_type == BusinessLayer::TextParagraphType::Dialogue) { + else if (_type == BusinessLayer::TextParagraphType::Parenthetical + || _type == BusinessLayer::TextParagraphType::Dialogue) { const auto cursorPosition = textCursor().position(); d->document.splitParagraph(textCursor()); auto cursor = textCursor(); @@ -447,7 +449,8 @@ void ComicBookTextEdit::setCurrentParagraphType(TextParagraphType _type) // На реплику // else if (d->comicBookTemplate().placeDialoguesInTable() - && _type == TextParagraphType::Dialogue) { + && (_type == TextParagraphType::Parenthetical + || _type == TextParagraphType::Dialogue)) { // // Если текущий блок не в таблице, то создаём её и текущий блок помещаем в неё как персонажа // diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.cpp b/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.cpp index 30afac554..414fcb98c 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.cpp +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.cpp @@ -3,6 +3,8 @@ #include "../comic_book_text_edit.h" #include +#include +#include #include #include @@ -183,4 +185,85 @@ void DialogHandler::handleBackspace(QKeyEvent* _event) StandardKeyHandler::handleBackspace(_event); } +void DialogHandler::handleOther(QKeyEvent* _event) +{ + // + // Получим необходимые значения + // + // ... курсор в текущем положении + QTextCursor cursor = editor()->textCursor(); + // ... блок текста в котором находится курсор + const QTextBlock currentBlock = cursor.block(); + // ... текст до курсора + const QString cursorBackwardText = currentBlock.text().left(cursor.positionInBlock()); + // ... текст после курсора + const QString cursorForwardText = currentBlock.text().mid(cursor.positionInBlock()); + // ... необходимо ли менять стиль при открытой скобке на ремарку + const bool needToCheckOpenBracket + = editor()->comicBookTemplate().paragraphStyle(TextParagraphType::Parenthetical).isActive() + && settingsValue(DataStorageLayer:: + kComponentsComicBookEditorUseOpenBracketInDialogueForParentheticalKey) + .toBool(); + + + // + // Обработка + // + if (needToCheckOpenBracket && cursorBackwardText.endsWith("(") && _event != nullptr + && _event->text() == "(") { + //! Если нажата открывающая скобка + + // + // Удалим лишнюю скобку + // + editor()->textCursor().deletePreviousChar(); + + if (cursorForwardText.isEmpty() && cursorBackwardText == "(") { + //! Если текст пуст + + // + // Cменить стиль на ремарку + // + editor()->setCurrentParagraphType(TextParagraphType::Parenthetical); + } else { + //! Если текст не пуст + + // + // Разрываем диалог ремаркой + // + + // + // ... оставляем пустой блок реплики + // + // если скобка нажата в начале строки, то делаем лишь один перевод строки + // + if (cursorBackwardText != "(") { + editor()->addParagraph(TextParagraphType::Dialogue); + } + // + // ... если после скобки нет текста, не добавляем новый параграф + // + if (!cursorForwardText.isEmpty()) { + editor()->addParagraph(TextParagraphType::Dialogue); + + // + // ... возвращаем курсор к пустому блоку + // + cursor = editor()->textCursor(); + cursor.movePosition(QTextCursor::PreviousBlock); + editor()->setTextCursorAndKeepScrollBars(cursor); + } + + // + // ... делаем блок под курсором ремаркой + // + editor()->setCurrentParagraphType(TextParagraphType::Parenthetical); + } + } else { + //! В противном случае, обрабатываем в базовом классе + + StandardKeyHandler::handleOther(_event); + } +} + } // namespace KeyProcessingLayer diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.h b/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.h index 47f56314d..97cb72845 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.h +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/dialog_handler.h @@ -21,6 +21,7 @@ class DialogHandler : public StandardKeyHandler void handleEnter(QKeyEvent* _event = nullptr) override; void handleTab(QKeyEvent* _event = nullptr) override; void handleBackspace(QKeyEvent* _event = nullptr) override; + void handleOther(QKeyEvent* _event = nullptr) override; /** @} */ }; diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/key_press_handler_facade.cpp b/src/core/management_layer/plugins/comic_book_text/text/handlers/key_press_handler_facade.cpp index ce0129c26..a3c84692f 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/handlers/key_press_handler_facade.cpp +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/key_press_handler_facade.cpp @@ -7,6 +7,7 @@ #include "inline_note_handler.h" #include "page_handler.h" #include "panel_handler.h" +#include "parenthetical_handler.h" #include "pre_handler.h" #include "prepare_handler.h" #include "sequence_footer_handler.h" @@ -38,6 +39,7 @@ class KeyPressHandlerFacade::Implementation QScopedPointer panelHandler; QScopedPointer actionHandler; QScopedPointer characterHandler; + QScopedPointer parentheticalHandler; QScopedPointer dialogHandler; QScopedPointer inlineNoteHandler; QScopedPointer sequenceHeadingHandler; @@ -54,6 +56,7 @@ KeyPressHandlerFacade::Implementation::Implementation(Ui::ComicBookTextEdit* _ed , panelHandler(new PanelHandler(_editor)) , actionHandler(new DescriptionHandler(_editor)) , characterHandler(new CharacterHandler(_editor)) + , parentheticalHandler(new ParentheticalHandler(_editor)) , dialogHandler(new DialogHandler(_editor)) , inlineNoteHandler(new InlineNoteHandler(_editor)) , sequenceHeadingHandler(new SequenceHeadingHandler(_editor)) @@ -154,6 +157,10 @@ AbstractKeyHandler* KeyPressHandlerFacade::handlerFor(TextParagraphType _type) return d->characterHandler.data(); } + case TextParagraphType::Parenthetical: { + return d->parentheticalHandler.data(); + } + case TextParagraphType::Dialogue: { return d->dialogHandler.data(); } diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.cpp b/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.cpp new file mode 100644 index 000000000..0a264fa0f --- /dev/null +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.cpp @@ -0,0 +1,251 @@ +#include "parenthetical_handler.h" + +#include "../comic_book_text_edit.h" + +#include +#include + +#include +#include + +using BusinessLayer::TextParagraphType; +using Ui::ComicBookTextEdit; + + +namespace KeyProcessingLayer { + +ParentheticalHandler::ParentheticalHandler(ComicBookTextEdit* _editor) + : StandardKeyHandler(_editor) +{ +} + +void ParentheticalHandler::handleEnter(QKeyEvent*) +{ + // + // Получим необходимые значения + // + // ... курсор в текущем положении + QTextCursor cursor = editor()->textCursor(); + // ... блок текста в котором находится курсор + QTextBlock currentBlock = cursor.block(); + // ... текст до курсора + QString cursorBackwardText = currentBlock.text().left(cursor.positionInBlock()); + // ... текст после курсора + QString cursorForwardText = currentBlock.text().mid(cursor.positionInBlock()); + // ... префикс и постфикс стиля + const auto& style + = editor()->comicBookTemplate().paragraphStyle(TextParagraphType::Parenthetical); + QString stylePrefix = style.prefix(); + QString stylePostfix = style.postfix(); + + + // + // Обработка + // + if (editor()->isCompleterVisible()) { + //! Если открыт подстановщик + + // + // Ни чего не делаем + // + } else { + //! Подстановщик закрыт + + if (cursor.hasSelection()) { + //! Есть выделение + + // + // Удаляем всё, но оставляем стилем блока текущий + // + editor()->addParagraph(TextParagraphType::Parenthetical); + } else { + //! Нет выделения + + if ((cursorBackwardText.isEmpty() && cursorForwardText.isEmpty()) + || (cursorBackwardText + cursorForwardText == stylePrefix + stylePostfix)) { + //! Текст пуст + + // + // Ни чего не делаем + // + editor()->setCurrentParagraphType(changeForEnter(TextParagraphType::Parenthetical)); + } else { + //! Текст не пуст + + if (cursorBackwardText.isEmpty() || cursorBackwardText == stylePrefix) { + //! В начале блока + + // + // Ни чего не делаем + // + } else if (cursorForwardText.isEmpty() || cursorForwardText == stylePostfix) { + //! В конце блока + + // + // Перейдём к блоку реплики + // + cursor.movePosition(QTextCursor::EndOfBlock); + editor()->setTextCursor(cursor); + editor()->addParagraph(jumpForEnter(TextParagraphType::Parenthetical)); + } else { + //! Внутри блока + + // + // Переместим обрамление в правильное место + // + cursor.movePosition(QTextCursor::EndOfBlock); + if (cursorForwardText.endsWith(stylePostfix)) { + for (int deleteReplays = stylePostfix.length(); deleteReplays > 0; + --deleteReplays) { + cursor.deletePreviousChar(); + } + } + cursor = editor()->textCursor(); + + // + // Перейдём к блоку реплики + // + editor()->setTextCursor(cursor); + editor()->addParagraph(TextParagraphType::Dialogue); + } + } + } + } +} + +void ParentheticalHandler::handleTab(QKeyEvent*) +{ + // + // Получим необходимые значения + // + // ... курсор в текущем положении + QTextCursor cursor = editor()->textCursor(); + // ... блок текста в котором находится курсор + QTextBlock currentBlock = cursor.block(); + // ... текст до курсора + QString cursorBackwardText = currentBlock.text().left(cursor.positionInBlock()); + // ... текст после курсора + QString cursorForwardText = currentBlock.text().mid(cursor.positionInBlock()); + // ... префикс и постфикс стиля + const auto& style + = editor()->comicBookTemplate().paragraphStyle(TextParagraphType::Parenthetical); + QString stylePrefix = style.prefix(); + QString stylePostfix = style.postfix(); + + + // + // Обработка + // + if (editor()->isCompleterVisible()) { + //! Если открыт подстановщик + + // + // Ни чего не делаем + // + } else { + //! Подстановщик закрыт + + if (cursor.hasSelection()) { + //! Есть выделение + + // + // Ни чего не делаем + // + } else { + //! Нет выделения + + if ((cursorBackwardText.isEmpty() && cursorForwardText.isEmpty()) + || (cursorBackwardText + cursorForwardText == stylePrefix + stylePostfix)) { + //! Текст пуст + + // + // Меняем стиль на реплику + // + editor()->setCurrentParagraphType(changeForTab(TextParagraphType::Parenthetical)); + } else { + //! Текст не пуст + + if (cursorBackwardText.isEmpty() || cursorBackwardText == stylePrefix) { + //! В начале блока + + // + // Ни чего не делаем + // + } else if (cursorForwardText.isEmpty() || cursorForwardText == stylePostfix) { + //! В конце блока + + // + // Вставляем блок реплики + // + cursor.movePosition(QTextCursor::EndOfBlock); + editor()->setTextCursor(cursor); + editor()->addParagraph(jumpForTab(TextParagraphType::Parenthetical)); + } else { + //! Внутри блока + + // + // Ни чего не делаем + // + } + } + } + } +} + +void ParentheticalHandler::handleOther(QKeyEvent* _event) +{ + // + // Получим необходимые значения + // + // ... курсор в текущем положении + QTextCursor cursor = editor()->textCursor(); + // ... блок текста в котором находится курсор + QTextBlock currentBlock = cursor.block(); + // ... текст до курсора + QString cursorBackwardText = currentBlock.text().left(cursor.positionInBlock()); + // ... текст после курсора + QString cursorForwardText = currentBlock.text().mid(cursor.positionInBlock()); + + // + // Была нажата открывающая скобка + // + if (_event != 0 && _event->text() == "(") { + // + // Удаляем введённую скобку + // + cursor.deletePreviousChar(); + + // + // BUG: Если курсор в начале документа, то не прорисовывается текст + // + } + // + // Была нажата закрывающая скобка + // + else if (_event != 0 && _event->text() == ")") { + // + // Во всех случаях удаляем введённую скобку + // + cursor.deletePreviousChar(); + + // + // Если в блоке, в котором есть текст + // + if (!currentBlock.text().isEmpty()) { + // + // Переходим к блоку реплики + // + cursor.movePosition(QTextCursor::EndOfBlock); + editor()->setTextCursor(cursor); + editor()->addParagraph(TextParagraphType::Dialogue); + } + } + // + // В противном случае, обрабатываем в базовом классе + // + else { + StandardKeyHandler::handleOther(_event); + } +} + +} // namespace KeyProcessingLayer diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.h b/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.h new file mode 100644 index 000000000..27c5bf5e2 --- /dev/null +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/parenthetical_handler.h @@ -0,0 +1,29 @@ +#pragma once + +#include "standard_key_handler.h" + +#include + + +namespace KeyProcessingLayer { + +/** + * @brief Класс выполняющий обработку нажатия клавиш в блоке ремарки + */ +class ParentheticalHandler : public StandardKeyHandler +{ +public: + explicit ParentheticalHandler(Ui::ComicBookTextEdit* _editor); + +protected: + /** + * @brief Реализация интерфейса AbstractKeyHandler + */ + /** @{ */ + void handleEnter(QKeyEvent* _event = nullptr) override; + void handleTab(QKeyEvent* _event = nullptr) override; + void handleOther(QKeyEvent* _event = nullptr) override; + /** @} */ +}; + +} // namespace KeyProcessingLayer diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.cpp b/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.cpp index e470a4496..e0efe0c1d 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.cpp +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.cpp @@ -63,12 +63,20 @@ TextParagraphType StandardKeyHandler::jumpForEnter(TextParagraphType _blockType) TextParagraphType StandardKeyHandler::changeForTab(TextParagraphType _blockType) { - return actionFor(kTab, kChange, _blockType); + auto nextBlockType = actionFor(kTab, kChange, _blockType); + if (!editor()->comicBookTemplate().paragraphStyle(nextBlockType).isActive()) { + nextBlockType = actionFor(kTab, kChange, nextBlockType); + } + return nextBlockType; } TextParagraphType StandardKeyHandler::changeForEnter(TextParagraphType _blockType) { - return actionFor(kEnter, kChange, _blockType); + auto nextBlockType = actionFor(kEnter, kChange, _blockType); + if (!editor()->comicBookTemplate().paragraphStyle(nextBlockType).isActive()) { + nextBlockType = actionFor(kEnter, kChange, nextBlockType); + } + return nextBlockType; } void StandardKeyHandler::handleDelete(QKeyEvent* _event) diff --git a/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.h b/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.h index d95178a5b..ee9a7fb2b 100644 --- a/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.h +++ b/src/core/management_layer/plugins/comic_book_text/text/handlers/standard_key_handler.h @@ -27,10 +27,8 @@ class StandardKeyHandler : public AbstractKeyHandler static BusinessLayer::TextParagraphType jumpForTab(BusinessLayer::TextParagraphType _blockType); static BusinessLayer::TextParagraphType jumpForEnter( BusinessLayer::TextParagraphType _blockType); - static BusinessLayer::TextParagraphType changeForTab( - BusinessLayer::TextParagraphType _blockType); - static BusinessLayer::TextParagraphType changeForEnter( - BusinessLayer::TextParagraphType _blockType); + BusinessLayer::TextParagraphType changeForTab(BusinessLayer::TextParagraphType _blockType); + BusinessLayer::TextParagraphType changeForEnter(BusinessLayer::TextParagraphType _blockType); /** @} */ /** diff --git a/src/core/management_layer/plugins/screenplay_text/text/handlers/dialog_handler.h b/src/core/management_layer/plugins/screenplay_text/text/handlers/dialog_handler.h index a56a626b0..96751c5e2 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/handlers/dialog_handler.h +++ b/src/core/management_layer/plugins/screenplay_text/text/handlers/dialog_handler.h @@ -18,9 +18,9 @@ class DialogHandler : public StandardKeyHandler * @brief Реализация интерфейса AbstractKeyHandler */ /** @{ */ - void handleEnter(QKeyEvent* _event = 0); - void handleTab(QKeyEvent* _event = 0); - void handleOther(QKeyEvent* _event); + void handleEnter(QKeyEvent* _event = nullptr) override; + void handleTab(QKeyEvent* _event = nullptr) override; + void handleOther(QKeyEvent* _event = nullptr) override; /** @} */ }; diff --git a/src/core/management_layer/plugins/screenplay_text/text/handlers/parenthetical_handler.h b/src/core/management_layer/plugins/screenplay_text/text/handlers/parenthetical_handler.h index 95c6a1816..2d2cf63d2 100644 --- a/src/core/management_layer/plugins/screenplay_text/text/handlers/parenthetical_handler.h +++ b/src/core/management_layer/plugins/screenplay_text/text/handlers/parenthetical_handler.h @@ -20,9 +20,9 @@ class ParentheticalHandler : public StandardKeyHandler * @brief Реализация интерфейса AbstractKeyHandler */ /** @{ */ - void handleEnter(QKeyEvent* _event = 0); - void handleTab(QKeyEvent* _event = 0); - void handleOther(QKeyEvent* _event = 0); + void handleEnter(QKeyEvent* _event = nullptr) override; + void handleTab(QKeyEvent* _event = nullptr) override; + void handleOther(QKeyEvent* _event = nullptr) override; /** @} */ }; diff --git a/src/core/ui/settings/screenplay_template/screenplay_template_paragraphs_view.cpp b/src/core/ui/settings/screenplay_template/screenplay_template_paragraphs_view.cpp index b283d227f..cdb83b59b 100644 --- a/src/core/ui/settings/screenplay_template/screenplay_template_paragraphs_view.cpp +++ b/src/core/ui/settings/screenplay_template/screenplay_template_paragraphs_view.cpp @@ -486,6 +486,7 @@ void ScreenplayTemplateParagraphsView::configureTemplateFor(Domain::DocumentObje BusinessLayer::TextParagraphType::PanelHeading, BusinessLayer::TextParagraphType::Description, BusinessLayer::TextParagraphType::Character, + BusinessLayer::TextParagraphType::Parenthetical, BusinessLayer::TextParagraphType::Dialogue, BusinessLayer::TextParagraphType::InlineNote, BusinessLayer::TextParagraphType::UnformattedText, diff --git a/src/core/ui/settings/settings_view.cpp b/src/core/ui/settings/settings_view.cpp index 34e0394da..7e74c54ff 100644 --- a/src/core/ui/settings/settings_view.cpp +++ b/src/core/ui/settings/settings_view.cpp @@ -162,6 +162,7 @@ QStringListModel* buildComicBookParagraphTypesModel(QObject* _parent, TextParagraphType::PanelHeading, TextParagraphType::Description, TextParagraphType::Character, + TextParagraphType::Parenthetical, TextParagraphType::Dialogue, TextParagraphType::InlineNote, TextParagraphType::UnformattedText, diff --git a/src/corelib/data_layer/storage/settings_storage.cpp b/src/corelib/data_layer/storage/settings_storage.cpp index 01e46d663..9e0e3491f 100644 --- a/src/corelib/data_layer/storage/settings_storage.cpp +++ b/src/corelib/data_layer/storage/settings_storage.cpp @@ -633,11 +633,15 @@ SettingsStorage::Implementation::Implementation() addComicBookEditorStylesJumpByEnter(TextParagraphType::Description, TextParagraphType::Description); addComicBookEditorStylesJumpByTab(TextParagraphType::Character, - TextParagraphType::Dialogue); + TextParagraphType::Parenthetical); addComicBookEditorStylesJumpByEnter(TextParagraphType::Character, TextParagraphType::Dialogue); + addComicBookEditorStylesJumpByTab(TextParagraphType::Parenthetical, + TextParagraphType::Dialogue); + addComicBookEditorStylesJumpByEnter(TextParagraphType::Parenthetical, + TextParagraphType::Dialogue); addComicBookEditorStylesJumpByTab(TextParagraphType::Dialogue, - TextParagraphType::Character); + TextParagraphType::Parenthetical); addComicBookEditorStylesJumpByEnter(TextParagraphType::Dialogue, TextParagraphType::Description); addComicBookEditorStylesJumpByTab(TextParagraphType::InlineNote, @@ -674,8 +678,12 @@ SettingsStorage::Implementation::Implementation() TextParagraphType::Description); addComicBookEditorStylesChangeByEnter(TextParagraphType::Character, TextParagraphType::Description); + addComicBookEditorStylesChangeByTab(TextParagraphType::Parenthetical, + TextParagraphType::Dialogue); + addComicBookEditorStylesChangeByEnter(TextParagraphType::Parenthetical, + TextParagraphType::Parenthetical); addComicBookEditorStylesChangeByTab(TextParagraphType::Dialogue, - TextParagraphType::Character); + TextParagraphType::Parenthetical); addComicBookEditorStylesChangeByEnter(TextParagraphType::Dialogue, TextParagraphType::Description); addComicBookEditorStylesChangeByTab(TextParagraphType::InlineNote, @@ -695,7 +703,8 @@ SettingsStorage::Implementation::Implementation() addShortcut(BusinessLayer::TextParagraphType::PanelHeading, "Ctrl+2"); addShortcut(BusinessLayer::TextParagraphType::Description, "Ctrl+3"); addShortcut(BusinessLayer::TextParagraphType::Character, "Ctrl+4"); - addShortcut(BusinessLayer::TextParagraphType::Dialogue, "Ctrl+5"); + addShortcut(BusinessLayer::TextParagraphType::Parenthetical, "Ctrl+5"); + addShortcut(BusinessLayer::TextParagraphType::Dialogue, "Ctrl+6"); addShortcut(BusinessLayer::TextParagraphType::InlineNote, "Ctrl+Shift+0"); // defaultValues.insert(kComponentsComicBookAvailableKey, true); @@ -709,6 +718,8 @@ SettingsStorage::Implementation::Implementation() defaultValues.insert(kComponentsComicBookEditorShowHintsForTertiaryItemsKey, false); defaultValues.insert(kComponentsComicBookEditorShowCharacterSuggestionsInEmptyBlockKey, false); + defaultValues.insert(kComponentsComicBookEditorUseOpenBracketInDialogueForParentheticalKey, + true); // // Параметры навигатора сценария // diff --git a/src/corelib/data_layer/storage/settings_storage.h b/src/corelib/data_layer/storage/settings_storage.h index 69e9f8405..d469e5eaa 100644 --- a/src/corelib/data_layer/storage/settings_storage.h +++ b/src/corelib/data_layer/storage/settings_storage.h @@ -329,6 +329,9 @@ const QString kComponentsComicBookEditorShowHintsForTertiaryItemsKey = kComponentsComicBookEditorKey + QStringLiteral("/show-hints-for-tertiary-items"); const QString kComponentsComicBookEditorShowCharacterSuggestionsInEmptyBlockKey = kComponentsComicBookEditorKey + QStringLiteral("/show-characters-hints-in-empty-blocks"); +const QString kComponentsComicBookEditorUseOpenBracketInDialogueForParentheticalKey + = kComponentsComicBookEditorKey + + QStringLiteral("/use-open-bracket-in-dialogue-for-parenthetical"); const QString kComponentsComicBookEditorShortcutsKey = kComponentsComicBookEditorKey + QStringLiteral("/shortcuts"); // ... навигатор diff --git a/src/corelib/templates/comicbook/script_us b/src/corelib/templates/comicbook/script_us index 4300528f2..31d34bde4 100644 --- a/src/corelib/templates/comicbook/script_us +++ b/src/corelib/templates/comicbook/script_us @@ -62,6 +62,7 @@ + diff --git a/src/corelib/templates/comicbook/script_world b/src/corelib/templates/comicbook/script_world index 87d8acf3a..2368fd3fa 100644 --- a/src/corelib/templates/comicbook/script_world +++ b/src/corelib/templates/comicbook/script_world @@ -66,6 +66,7 @@ +