Change Default Level Type to Raster

This commit is contained in:
manongjohn 2022-01-23 09:54:00 -05:00
parent 3bcec4f4b5
commit 98eb79b7b4
7 changed files with 128 additions and 117 deletions

View file

@ -1,8 +1,8 @@
<commandbar> <commandbar>
<command>MI_NewVectorLevel</command>
<command>MI_NewToonzRasterLevel</command>
<command>MI_NewRasterLevel</command> <command>MI_NewRasterLevel</command>
<command>MI_NewToonzRasterLevel</command>
<command>MI_NewVectorLevel</command>
<separator/> <separator/>
<command>MI_Reframe1</command> <command>MI_Reframe1</command>
<command>MI_Reframe2</command> <command>MI_Reframe2</command>

View file

@ -5,9 +5,9 @@
<command>MI_ToggleAutoStretch</command> <command>MI_ToggleAutoStretch</command>
<command>MI_ToggleImplicitHold</command> <command>MI_ToggleImplicitHold</command>
<separator/> <separator/>
<command>MI_NewVectorLevel</command>
<command>MI_NewToonzRasterLevel</command>
<command>MI_NewRasterLevel</command> <command>MI_NewRasterLevel</command>
<command>MI_NewToonzRasterLevel</command>
<command>MI_NewVectorLevel</command>
<separator/> <separator/>
<command>MI_Reframe1</command> <command>MI_Reframe1</command>
<command>MI_Reframe2</command> <command>MI_Reframe2</command>

View file

@ -787,6 +787,8 @@ private slots:
// StyleEditor // StyleEditor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
enum StyleEditorTab { Color = 0, Raster, Vector, Texture, Settings };
class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings { class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
Q_OBJECT Q_OBJECT
TApplication *m_app; TApplication *m_app;

View file

@ -189,9 +189,9 @@ LevelCreatePopup::LevelCreatePopup()
QRegExp rx("[^\\\\/:?*.\"<>|]+"); QRegExp rx("[^\\\\/:?*.\"<>|]+");
m_nameFld->setValidator(new QRegExpValidator(rx, this)); m_nameFld->setValidator(new QRegExpValidator(rx, this));
m_levelTypeOm->addItem(tr("Vector Level"), (int)PLI_XSHLEVEL);
m_levelTypeOm->addItem(tr("Smart Raster Level"), (int)TZP_XSHLEVEL);
m_levelTypeOm->addItem(tr("Raster Level"), (int)OVL_XSHLEVEL); m_levelTypeOm->addItem(tr("Raster Level"), (int)OVL_XSHLEVEL);
m_levelTypeOm->addItem(tr("Smart Raster Level"), (int)TZP_XSHLEVEL);
m_levelTypeOm->addItem(tr("Vector Level"), (int)PLI_XSHLEVEL);
if (Preferences::instance()->getUnits() == "pixel") { if (Preferences::instance()->getUnits() == "pixel") {
m_widthFld->setMeasure("camera.lx"); m_widthFld->setMeasure("camera.lx");

View file

@ -440,9 +440,9 @@ void TopBar::loadMenubar() {
{ {
addMenuItem(newMenu, MI_NewLevel); addMenuItem(newMenu, MI_NewLevel);
newMenu->addSeparator(); newMenu->addSeparator();
addMenuItem(newMenu, MI_NewRasterLevel);
addMenuItem(newMenu, MI_NewToonzRasterLevel); addMenuItem(newMenu, MI_NewToonzRasterLevel);
addMenuItem(newMenu, MI_NewVectorLevel); addMenuItem(newMenu, MI_NewVectorLevel);
addMenuItem(newMenu, MI_NewRasterLevel);
addMenuItem(newMenu, MI_NewNoteLevel); addMenuItem(newMenu, MI_NewNoteLevel);
} }
addMenuItem(levelMenu, MI_LoadLevel); addMenuItem(levelMenu, MI_LoadLevel);

View file

@ -501,7 +501,7 @@ void Preferences::definePreferenceItems() {
// Drawing // Drawing
define(scanLevelType, "scanLevelType", QMetaType::QString, "tif"); define(scanLevelType, "scanLevelType", QMetaType::QString, "tif");
define(DefLevelType, "DefLevelType", QMetaType::Int, TZP_XSHLEVEL); define(DefLevelType, "DefLevelType", QMetaType::Int, OVL_XSHLEVEL);
define(newLevelSizeToCameraSizeEnabled, "newLevelSizeToCameraSizeEnabled", define(newLevelSizeToCameraSizeEnabled, "newLevelSizeToCameraSizeEnabled",
QMetaType::Bool, true); QMetaType::Bool, true);
define(DefLevelWidth, "DefLevelWidth", QMetaType::Double, define(DefLevelWidth, "DefLevelWidth", QMetaType::Double,

View file

@ -4106,9 +4106,9 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
m_styleChooser = new QStackedWidget(this); m_styleChooser = new QStackedWidget(this);
m_styleChooser->addWidget(plainArea); m_styleChooser->addWidget(plainArea);
m_styleChooser->addWidget(m_textureOutsideArea);
m_styleChooser->addWidget(m_vectorOutsideArea);
m_styleChooser->addWidget(m_rasterOutsideArea); m_styleChooser->addWidget(m_rasterOutsideArea);
m_styleChooser->addWidget(m_vectorOutsideArea);
m_styleChooser->addWidget(m_textureOutsideArea);
m_styleChooser->addWidget(settingsArea); m_styleChooser->addWidget(settingsArea);
m_styleChooser->addWidget(makeChooserPageWithoutScrollBar(emptyPage)); m_styleChooser->addWidget(makeChooserPageWithoutScrollBar(emptyPage));
m_styleChooser->setFocusPolicy(Qt::NoFocus); m_styleChooser->setFocusPolicy(Qt::NoFocus);
@ -4480,9 +4480,9 @@ void StyleEditor::updateTabBar() {
m_styleBar->clearTabBar(); m_styleBar->clearTabBar();
if (m_enabled && !m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) { if (m_enabled && !m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) {
m_styleBar->addSimpleTab(tr("Color")); m_styleBar->addSimpleTab(tr("Color"));
m_styleBar->addSimpleTab(tr("Texture"));
m_styleBar->addSimpleTab(tr("Vector"));
m_styleBar->addSimpleTab(tr("Raster")); m_styleBar->addSimpleTab(tr("Raster"));
m_styleBar->addSimpleTab(tr("Vector"));
m_styleBar->addSimpleTab(tr("Texture"));
m_styleBar->addSimpleTab(tr("Settings")); m_styleBar->addSimpleTab(tr("Settings"));
} else if (m_enabled && m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) } else if (m_enabled && m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab)
m_styleBar->addSimpleTab(tr("Color")); m_styleBar->addSimpleTab(tr("Color"));
@ -4596,14 +4596,14 @@ void StyleEditor::mousePressEvent(QMouseEvent *event) {
void StyleEditor::contextMenuEvent(QContextMenuEvent *event) { void StyleEditor::contextMenuEvent(QContextMenuEvent *event) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StyleChooserPage *page; StyleChooserPage *page;
if (tab == 1) // Textures tab if (tab == StyleEditorTab::Texture) // Textures tab
page = new TextureStyleChooserPage(TFilePath(), QString(), this); page = new TextureStyleChooserPage(TFilePath(), QString(), this);
else if (tab == 2) // Vector tab else if (tab == StyleEditorTab::Vector) // Vector tab
page = new CustomStyleChooserPage(TFilePath(), QString(), this); page = new CustomStyleChooserPage(TFilePath(), QString(), this);
else if (tab == 3) // Raster tab else if (tab == StyleEditorTab::Raster) // Raster tab
page = new MyPaintBrushStyleChooserPage(TFilePath(), QString(), this); page = new MyPaintBrushStyleChooserPage(TFilePath(), QString(), this);
page->processContextMenuEvent(event); page->processContextMenuEvent(event);
@ -4634,14 +4634,15 @@ void StyleEditor::clearSelection() {
bool StyleEditor::isSelecting() { bool StyleEditor::isSelecting() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return false; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture)
return false;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it; std::vector<StyleChooserPage *>::iterator it;
@ -4657,13 +4658,14 @@ bool StyleEditor::isSelecting() {
bool StyleEditor::isSelectingFavorites() { bool StyleEditor::isSelectingFavorites() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return false; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture)
return false;
if (tab == 1) if (tab == StyleEditorTab::Texture)
return (m_texturePages[0]->getSelection().size() > 0); return (m_texturePages[0]->getSelection().size() > 0);
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
return (m_vectorPages[0]->getSelection().size() > 0); return (m_vectorPages[0]->getSelection().size() > 0);
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
return (m_rasterPages[0]->getSelection().size() > 0); return (m_rasterPages[0]->getSelection().size() > 0);
return true; return true;
@ -4673,16 +4675,17 @@ bool StyleEditor::isSelectingFavorites() {
bool StyleEditor::isSelectingFavoritesOnly() { bool StyleEditor::isSelectingFavoritesOnly() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return false; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture)
return false;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
if (m_texturePages[0]->getSelection().size() == 0) return false; if (m_texturePages[0]->getSelection().size() == 0) return false;
pages = &m_texturePages; pages = &m_texturePages;
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
if (m_vectorPages[0]->getSelection().size() == 0) return false; if (m_vectorPages[0]->getSelection().size() == 0) return false;
pages = &m_vectorPages; pages = &m_vectorPages;
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
if (m_rasterPages[0]->getSelection().size() == 0) return false; if (m_rasterPages[0]->getSelection().size() == 0) return false;
pages = &m_rasterPages; pages = &m_rasterPages;
} }
@ -4700,16 +4703,17 @@ bool StyleEditor::isSelectingFavoritesOnly() {
bool StyleEditor::isSelectingNonFavoritesOnly() { bool StyleEditor::isSelectingNonFavoritesOnly() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return false; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture)
return false;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
if (m_texturePages[0]->getSelection().size() >= 0) return false; if (m_texturePages[0]->getSelection().size() >= 0) return false;
pages = &m_texturePages; pages = &m_texturePages;
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
if (m_vectorPages[0]->getSelection().size() >= 0) return false; if (m_vectorPages[0]->getSelection().size() >= 0) return false;
pages = &m_vectorPages; pages = &m_vectorPages;
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
if (m_rasterPages[0]->getSelection().size() >= 0) return false; if (m_rasterPages[0]->getSelection().size() >= 0) return false;
pages = &m_rasterPages; pages = &m_rasterPages;
} }
@ -5006,11 +5010,11 @@ void StyleEditor::onOldStyleClicked(const TColorStyle &) {
void StyleEditor::setPage(int index) { void StyleEditor::setPage(int index) {
if (!m_enabledFirstAndLastTab) { if (!m_enabledFirstAndLastTab) {
if (index == 1) if (index == StyleEditorTab::Texture)
m_texturePages[0]->loadItems(); m_texturePages[0]->loadItems();
else if (index == 2) else if (index == StyleEditorTab::Vector)
m_vectorPages[0]->loadItems(); m_vectorPages[0]->loadItems();
else if (index == 3) else if (index == StyleEditorTab::Raster)
m_rasterPages[0]->loadItems(); m_rasterPages[0]->loadItems();
m_styleChooser->setCurrentIndex(index); m_styleChooser->setCurrentIndex(index);
return; return;
@ -5331,13 +5335,13 @@ void StyleEditor::onHideMenu() {
void StyleEditor::onPageChanged(int index) { void StyleEditor::onPageChanged(int index) {
m_styleSetsButton->setDisabled(false); m_styleSetsButton->setDisabled(false);
switch (index) { switch (index) {
case 1: // Texture case StyleEditorTab::Texture: // Texture
m_styleSetsButton->setMenu(m_textureMenu); m_styleSetsButton->setMenu(m_textureMenu);
break; break;
case 2: // Vector case StyleEditorTab::Vector: // Vector
m_styleSetsButton->setMenu(m_vectorMenu); m_styleSetsButton->setMenu(m_vectorMenu);
break; break;
case 3: // Raster case StyleEditorTab::Raster: // Raster
m_styleSetsButton->setMenu(m_rasterMenu); m_styleSetsButton->setMenu(m_rasterMenu);
break; break;
default: default:
@ -5345,7 +5349,7 @@ void StyleEditor::onPageChanged(int index) {
break; break;
} }
if (index < 1 || index > 3) return; if (index < StyleEditorTab::Raster || index > StyleEditorTab::Texture) return;
onUpdateFavorites(); onUpdateFavorites();
update(); update();
@ -6126,14 +6130,16 @@ void StyleEditor::onExpandAllRasterSet() {
void StyleEditor::setUpdated(TFilePath setPath) { void StyleEditor::setUpdated(TFilePath setPath) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3 || setPath.isEmpty()) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture ||
setPath.isEmpty())
return;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it; std::vector<StyleChooserPage *>::iterator it;
@ -6150,7 +6156,7 @@ void StyleEditor::setUpdated(TFilePath setPath) {
void StyleEditor::onUpdateFavorites() { void StyleEditor::onUpdateFavorites() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
int chipSize; int chipSize;
QPushButton *button; QPushButton *button;
@ -6158,20 +6164,20 @@ void StyleEditor::onUpdateFavorites() {
QMenu *menu; QMenu *menu;
StyleChooserPage *page; StyleChooserPage *page;
int minChipCount = 2; int minChipCount = 2;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
chipSize = m_texturePages[0]->getChipCount(); chipSize = m_texturePages[0]->getChipCount();
button = m_textureButtons[0]; button = m_textureButtons[0];
label = m_textureLabels[0]; label = m_textureLabels[0];
page = m_texturePages[0]; page = m_texturePages[0];
menu = m_textureMenu; menu = m_textureMenu;
minChipCount = 3; minChipCount = 3;
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
chipSize = m_vectorPages[0]->getChipCount(); chipSize = m_vectorPages[0]->getChipCount();
button = m_vectorButtons[0]; button = m_vectorButtons[0];
label = m_vectorLabels[0]; label = m_vectorLabels[0];
page = m_vectorPages[0]; page = m_vectorPages[0];
menu = m_vectorMenu; menu = m_vectorMenu;
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
chipSize = m_rasterPages[0]->getChipCount(); chipSize = m_rasterPages[0]->getChipCount();
button = m_rasterButtons[0]; button = m_rasterButtons[0];
label = m_rasterLabels[0]; label = m_rasterLabels[0];
@ -6206,14 +6212,14 @@ void StyleEditor::onUpdateFavorites() {
void StyleEditor::onRemoveSelectedStylesFromFavorites() { void StyleEditor::onRemoveSelectedStylesFromFavorites() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StyleChooserPage *page; StyleChooserPage *page;
if (tab == 1) if (tab == StyleEditorTab::Texture)
page = m_texturePages[0]; page = m_texturePages[0];
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
page = m_vectorPages[0]; page = m_vectorPages[0];
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
page = m_rasterPages[0]; page = m_rasterPages[0];
page->removeSelectedStylesFromSet(page->getSelection()); page->removeSelectedStylesFromSet(page->getSelection());
@ -6225,17 +6231,17 @@ void StyleEditor::onRemoveSelectedStylesFromFavorites() {
void StyleEditor::onAddSelectedStylesToFavorites() { void StyleEditor::onAddSelectedStylesToFavorites() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
TFilePath setPath; TFilePath setPath;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
pages = &m_texturePages; pages = &m_texturePages;
setPath = m_texturePages[0]->getStylesFolder(); setPath = m_texturePages[0]->getStylesFolder();
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
pages = &m_vectorPages; pages = &m_vectorPages;
setPath = m_vectorPages[0]->getStylesFolder(); setPath = m_vectorPages[0]->getStylesFolder();
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
pages = &m_rasterPages; pages = &m_rasterPages;
setPath = m_rasterPages[0]->getStylesFolder(); setPath = m_rasterPages[0]->getStylesFolder();
} }
@ -6254,14 +6260,14 @@ void StyleEditor::onAddSelectedStylesToFavorites() {
void StyleEditor::onAddSelectedStylesToPalette() { void StyleEditor::onAddSelectedStylesToPalette() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it; std::vector<StyleChooserPage *>::iterator it;
@ -6277,17 +6283,17 @@ void StyleEditor::onAddSelectedStylesToPalette() {
void StyleEditor::onCopySelectedStylesToSet() { void StyleEditor::onCopySelectedStylesToSet() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
QAction *action = dynamic_cast<QAction *>(sender()); QAction *action = dynamic_cast<QAction *>(sender());
QString setName = action->data().toString(); QString setName = action->data().toString();
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
StyleChooserPage *dstPage = 0; StyleChooserPage *dstPage = 0;
@ -6315,17 +6321,17 @@ void StyleEditor::onCopySelectedStylesToSet() {
void StyleEditor::onMoveSelectedStylesToSet() { void StyleEditor::onMoveSelectedStylesToSet() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
QAction *action = dynamic_cast<QAction *>(sender()); QAction *action = dynamic_cast<QAction *>(sender());
QString setName = action->data().toString(); QString setName = action->data().toString();
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
StyleChooserPage *dstPage = 0; StyleChooserPage *dstPage = 0;
@ -6354,7 +6360,7 @@ void StyleEditor::onMoveSelectedStylesToSet() {
void StyleEditor::onRemoveSelectedStyleFromSet() { void StyleEditor::onRemoveSelectedStyleFromSet() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
if (!isSelectingFavoritesOnly()) { if (!isSelectingFavoritesOnly()) {
int ret = DVGui::MsgBox( int ret = DVGui::MsgBox(
@ -6366,11 +6372,11 @@ void StyleEditor::onRemoveSelectedStyleFromSet() {
} }
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it; std::vector<StyleChooserPage *>::iterator it;
@ -6386,14 +6392,15 @@ void StyleEditor::onRemoveSelectedStyleFromSet() {
TFilePath StyleEditor::getSetStyleFolder(QString setName) { TFilePath StyleEditor::getSetStyleFolder(QString setName) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return TFilePath(); if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture)
return TFilePath();
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
StyleChooserPage *dstPage = 0; StyleChooserPage *dstPage = 0;
@ -6409,17 +6416,18 @@ TFilePath StyleEditor::getSetStyleFolder(QString setName) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StyleEditor::updatePage(int pageIndex) { void StyleEditor::updatePage(int pageIndex) {
if (pageIndex < 1 || pageIndex > 3) return; if (pageIndex < StyleEditorTab::Raster || pageIndex > StyleEditorTab::Texture)
return;
TFilePathSet fps; TFilePathSet fps;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (pageIndex == 1) { if (pageIndex == StyleEditorTab::Texture) {
fps = TStyleManager::instance()->getTextureStyleFolders(); fps = TStyleManager::instance()->getTextureStyleFolders();
pages = &m_texturePages; pages = &m_texturePages;
} else if (pageIndex == 2) { } else if (pageIndex == StyleEditorTab::Vector) {
fps = TStyleManager::instance()->getCustomStyleFolders(); fps = TStyleManager::instance()->getCustomStyleFolders();
pages = &m_vectorPages; pages = &m_vectorPages;
} else if (pageIndex == 3) { } else if (pageIndex == StyleEditorTab::Raster) {
fps = TStyleManager::instance()->getBrushStyleFolders(); fps = TStyleManager::instance()->getBrushStyleFolders();
pages = &m_rasterPages; pages = &m_rasterPages;
} }
@ -6446,14 +6454,14 @@ void StyleEditor::updatePage(int pageIndex) {
if (fp.isEmpty()) continue; if (fp.isEmpty()) continue;
bool isFavorite = ToonzFolder::getMyFavoritesFolder().isAncestorOf(fp); bool isFavorite = ToonzFolder::getMyFavoritesFolder().isAncestorOf(fp);
StylePageType pageType; StylePageType pageType;
if (pageIndex == 1) if (pageIndex == StyleEditorTab::Texture)
pageType = StylePageType::Texture; pageType = StylePageType::Texture;
else if (pageIndex == 2) { else if (pageIndex == StyleEditorTab::Vector) {
pageType = StylePageType::VectorCustom; pageType = StylePageType::VectorCustom;
if ((ToonzFolder::getLibraryFolder() + TFilePath("vector brushes")) if ((ToonzFolder::getLibraryFolder() + TFilePath("vector brushes"))
.isAncestorOf(fp)) .isAncestorOf(fp))
pageType = StylePageType::VectorBrush; pageType = StylePageType::VectorBrush;
} else if (pageIndex == 3) } else if (pageIndex == StyleEditorTab::Raster)
pageType = StylePageType::Raster; pageType = StylePageType::Raster;
createNewStyleSet(pageType, *it, isFavorite); createNewStyleSet(pageType, *it, isFavorite);
@ -6464,15 +6472,15 @@ void StyleEditor::updatePage(int pageIndex) {
void StyleEditor::onAddNewStyleSet() { void StyleEditor::onAddNewStyleSet() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StylePageType pageType; StylePageType pageType;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pageType = StylePageType::Texture; pageType = StylePageType::Texture;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pageType = StylePageType::VectorCustom; pageType = StylePageType::VectorCustom;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pageType = StylePageType::Raster; pageType = StylePageType::Raster;
NewStyleSetPopup *popup = new NewStyleSetPopup(pageType, this); NewStyleSetPopup *popup = new NewStyleSetPopup(pageType, this);
@ -6483,7 +6491,7 @@ void StyleEditor::onAddNewStyleSet() {
void StyleEditor::onScanStyleSetChanges() { void StyleEditor::onScanStyleSetChanges() {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
TFilePath libPath = ToonzFolder::getLibraryFolder(); TFilePath libPath = ToonzFolder::getLibraryFolder();
TFilePath favoritesLibPath = TFilePath favoritesLibPath =
@ -6493,20 +6501,20 @@ void StyleEditor::onScanStyleSetChanges() {
TFilePathSet fps; TFilePathSet fps;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
pages = &m_texturePages; pages = &m_texturePages;
pageType = StylePageType::Texture; pageType = StylePageType::Texture;
fps.push_back(libPath + TFilePath("textures")); fps.push_back(libPath + TFilePath("textures"));
fps.push_back(favoritesLibPath + TFilePath("textures")); fps.push_back(favoritesLibPath + TFilePath("textures"));
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
pages = &m_vectorPages; pages = &m_vectorPages;
pageType = StylePageType::VectorCustom; pageType = StylePageType::VectorCustom;
fps.push_back(libPath + TFilePath("custom styles")); fps.push_back(libPath + TFilePath("custom styles"));
fps.push_back(libPath + TFilePath("vector brushes")); fps.push_back(libPath + TFilePath("vector brushes"));
fps.push_back(favoritesLibPath + TFilePath("vector styles")); fps.push_back(favoritesLibPath + TFilePath("vector styles"));
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
pages = &m_rasterPages; pages = &m_rasterPages;
pageType = StylePageType::Raster; pageType = StylePageType::Raster;
@ -6560,7 +6568,7 @@ void StyleEditor::onScanStyleSetChanges() {
QStringList::iterator fpListIt; QStringList::iterator fpListIt;
for (fpListIt = fpList.begin(); fpListIt != fpList.end(); fpListIt++) { for (fpListIt = fpList.begin(); fpListIt != fpList.end(); fpListIt++) {
TFilePath fp(*fpListIt); TFilePath fp(*fpListIt);
if (tab == 2) if (tab == StyleEditorTab::Vector)
pageType = (libPath + TFilePath("vector brushes")).isAncestorOf(fp) pageType = (libPath + TFilePath("vector brushes")).isAncestorOf(fp)
? StylePageType::VectorBrush ? StylePageType::VectorBrush
: StylePageType::VectorCustom; : StylePageType::VectorCustom;
@ -6589,16 +6597,16 @@ void StyleEditor::createNewStyleSet(StylePageType pageType, TFilePath pagePath,
int pageIndex; int pageIndex;
switch (pageType) { switch (pageType) {
case StylePageType::Texture: case StylePageType::Texture:
pageIndex = 1; pageIndex = StyleEditorTab::Texture;
break; break;
case StylePageType::VectorCustom: case StylePageType::VectorCustom:
pageIndex = 2; pageIndex = StyleEditorTab::Vector;
break; break;
case StylePageType::VectorBrush: case StylePageType::VectorBrush:
pageIndex = 2; pageIndex = StyleEditorTab::Vector;
break; break;
case StylePageType::Raster: case StylePageType::Raster:
pageIndex = 3; pageIndex = StyleEditorTab::Raster;
break; break;
} }
@ -6637,14 +6645,14 @@ void StyleEditor::createNewStyleSet(StylePageType pageType, TFilePath pagePath,
void StyleEditor::removeStyleSet(StyleChooserPage *styleSetPage) { void StyleEditor::removeStyleSet(StyleChooserPage *styleSetPage) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
if (tab == 1) if (tab == StyleEditorTab::Texture)
pages = &m_texturePages; pages = &m_texturePages;
else if (tab == 2) else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages; pages = &m_vectorPages;
else if (tab == 3) else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages; pages = &m_rasterPages;
int i = 1; int i = 1;
@ -6664,7 +6672,8 @@ void StyleEditor::removeStyleSet(StyleChooserPage *styleSetPage) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) { void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
if (pageIndex < 1 || pageIndex > 3) return; if (pageIndex < StyleEditorTab::Raster || pageIndex > StyleEditorTab::Texture)
return;
std::vector<StyleChooserPage *> *pages; std::vector<StyleChooserPage *> *pages;
std::vector<ClickableLabel *> *labels; std::vector<ClickableLabel *> *labels;
@ -6672,19 +6681,19 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
QMenu *menu; QMenu *menu;
QScrollArea *outsideArea; QScrollArea *outsideArea;
if (pageIndex == 1) { if (pageIndex == StyleEditorTab::Texture) {
pages = &m_texturePages; pages = &m_texturePages;
labels = &m_textureLabels; labels = &m_textureLabels;
buttons = &m_textureButtons; buttons = &m_textureButtons;
menu = m_textureMenu; menu = m_textureMenu;
outsideArea = m_textureOutsideArea; outsideArea = m_textureOutsideArea;
} else if (pageIndex == 2) { } else if (pageIndex == StyleEditorTab::Vector) {
pages = &m_vectorPages; pages = &m_vectorPages;
labels = &m_vectorLabels; labels = &m_vectorLabels;
buttons = &m_vectorButtons; buttons = &m_vectorButtons;
menu = m_vectorMenu; menu = m_vectorMenu;
outsideArea = m_vectorOutsideArea; outsideArea = m_vectorOutsideArea;
} else if (pageIndex == 3) { } else if (pageIndex == StyleEditorTab::Raster) {
pages = &m_rasterPages; pages = &m_rasterPages;
labels = &m_rasterLabels; labels = &m_rasterLabels;
buttons = &m_rasterButtons; buttons = &m_rasterButtons;
@ -6703,11 +6712,11 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
QWidget *oldPage = outsideArea->takeWidget(); QWidget *oldPage = outsideArea->takeWidget();
QFrame *newPageLayout; QFrame *newPageLayout;
if (pageIndex == 1) if (pageIndex == StyleEditorTab::Texture)
newPageLayout = createTexturePage(); newPageLayout = createTexturePage();
else if (pageIndex == 2) else if (pageIndex == StyleEditorTab::Vector)
newPageLayout = createVectorPage(); newPageLayout = createVectorPage();
else if (pageIndex == 3) else if (pageIndex == StyleEditorTab::Raster)
newPageLayout = createRasterPage(); newPageLayout = createRasterPage();
outsideArea->setWidget(makeChooserPageWithoutScrollBar(newPageLayout)); outsideArea->setWidget(makeChooserPageWithoutScrollBar(newPageLayout));
delete oldPage; delete oldPage;
@ -6719,17 +6728,17 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
void StyleEditor::editStyleSetName(StyleChooserPage *styleSetPage) { void StyleEditor::editStyleSetName(StyleChooserPage *styleSetPage) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<ClickableLabel *> *labels; std::vector<ClickableLabel *> *labels;
QScrollArea *scrollArea; QScrollArea *scrollArea;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
labels = &m_textureLabels; labels = &m_textureLabels;
scrollArea = m_textureArea; scrollArea = m_textureArea;
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
labels = &m_vectorLabels; labels = &m_vectorLabels;
scrollArea = m_vectorArea; scrollArea = m_vectorArea;
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
labels = &m_rasterLabels; labels = &m_rasterLabels;
scrollArea = m_rasterArea; scrollArea = m_rasterArea;
} }
@ -6760,17 +6769,17 @@ void StyleEditor::editStyleSetName(StyleChooserPage *styleSetPage) {
void StyleEditor::renameStyleSet(StyleChooserPage *styleSetPage, void StyleEditor::renameStyleSet(StyleChooserPage *styleSetPage,
QString newName) { QString newName) {
int tab = m_styleBar->currentIndex(); int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return; if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<ClickableLabel *> *labels; std::vector<ClickableLabel *> *labels;
QMenu *menu; QMenu *menu;
if (tab == 1) { if (tab == StyleEditorTab::Texture) {
labels = &m_textureLabels; labels = &m_textureLabels;
menu = m_textureMenu; menu = m_textureMenu;
} else if (tab == 2) { } else if (tab == StyleEditorTab::Vector) {
labels = &m_vectorLabels; labels = &m_vectorLabels;
menu = m_vectorMenu; menu = m_vectorMenu;
} else if (tab == 3) { } else if (tab == StyleEditorTab::Raster) {
labels = &m_rasterLabels; labels = &m_rasterLabels;
menu = m_rasterMenu; menu = m_rasterMenu;
} }
@ -7030,11 +7039,11 @@ void NewStyleSetPopup::createStyleSet() {
int pageIndex; int pageIndex;
if (m_pageType == StylePageType::Texture) if (m_pageType == StylePageType::Texture)
pageIndex = 1; pageIndex = StyleEditorTab::Texture;
else if (m_pageType == StylePageType::Raster) else if (m_pageType == StylePageType::Raster)
pageIndex = 3; pageIndex = StyleEditorTab::Raster;
else else
pageIndex = 2; pageIndex = StyleEditorTab::Vector;
TStyleEditorHandler::instance()->updateEditorPage(pageIndex, m_editor); TStyleEditorHandler::instance()->updateEditorPage(pageIndex, m_editor);
accept(); accept();