Merge pull request #878 from manongjohn/change_level_default

Change Default Level Type to Raster
This commit is contained in:
manongjohn 2022-01-28 16:44:46 -05:00 committed by GitHub
commit 0f36cd1b8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 128 additions and 117 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4306,9 +4306,9 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
m_styleChooser = new QStackedWidget(this);
m_styleChooser->addWidget(plainArea);
m_styleChooser->addWidget(m_textureOutsideArea);
m_styleChooser->addWidget(m_vectorOutsideArea);
m_styleChooser->addWidget(m_rasterOutsideArea);
m_styleChooser->addWidget(m_vectorOutsideArea);
m_styleChooser->addWidget(m_textureOutsideArea);
m_styleChooser->addWidget(settingsArea);
m_styleChooser->addWidget(makeChooserPageWithoutScrollBar(emptyPage));
m_styleChooser->setFocusPolicy(Qt::NoFocus);
@ -4703,9 +4703,9 @@ void StyleEditor::updateTabBar() {
m_styleBar->clearTabBar();
if (m_enabled && !m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) {
m_styleBar->addSimpleTab(tr("Color"));
m_styleBar->addSimpleTab(tr("Texture"));
m_styleBar->addSimpleTab(tr("Vector"));
m_styleBar->addSimpleTab(tr("Raster"));
m_styleBar->addSimpleTab(tr("Vector"));
m_styleBar->addSimpleTab(tr("Texture"));
m_styleBar->addSimpleTab(tr("Settings"));
} else if (m_enabled && m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab)
m_styleBar->addSimpleTab(tr("Color"));
@ -4820,14 +4820,14 @@ void StyleEditor::mousePressEvent(QMouseEvent *event) {
void StyleEditor::contextMenuEvent(QContextMenuEvent *event) {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StyleChooserPage *page;
if (tab == 1) // Textures tab
if (tab == StyleEditorTab::Texture) // Textures tab
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);
else if (tab == 3) // Raster tab
else if (tab == StyleEditorTab::Raster) // Raster tab
page = new MyPaintBrushStyleChooserPage(TFilePath(), QString(), this);
page->processContextMenuEvent(event);
@ -4858,14 +4858,15 @@ void StyleEditor::clearSelection() {
bool StyleEditor::isSelecting() {
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;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it;
@ -4881,13 +4882,14 @@ bool StyleEditor::isSelecting() {
bool StyleEditor::isSelectingFavorites() {
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);
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
return (m_vectorPages[0]->getSelection().size() > 0);
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
return (m_rasterPages[0]->getSelection().size() > 0);
return true;
@ -4897,16 +4899,17 @@ bool StyleEditor::isSelectingFavorites() {
bool StyleEditor::isSelectingFavoritesOnly() {
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;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
if (m_texturePages[0]->getSelection().size() == 0) return false;
pages = &m_texturePages;
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
if (m_vectorPages[0]->getSelection().size() == 0) return false;
pages = &m_vectorPages;
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
if (m_rasterPages[0]->getSelection().size() == 0) return false;
pages = &m_rasterPages;
}
@ -4924,16 +4927,17 @@ bool StyleEditor::isSelectingFavoritesOnly() {
bool StyleEditor::isSelectingNonFavoritesOnly() {
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;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
if (m_texturePages[0]->getSelection().size() >= 0) return false;
pages = &m_texturePages;
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
if (m_vectorPages[0]->getSelection().size() >= 0) return false;
pages = &m_vectorPages;
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
if (m_rasterPages[0]->getSelection().size() >= 0) return false;
pages = &m_rasterPages;
}
@ -5238,11 +5242,11 @@ void StyleEditor::onNewStyleClicked() { applyButtonClicked(); }
void StyleEditor::setPage(int index) {
if (!m_enabledFirstAndLastTab) {
if (index == 1)
if (index == StyleEditorTab::Texture)
m_texturePages[0]->loadItems();
else if (index == 2)
else if (index == StyleEditorTab::Vector)
m_vectorPages[0]->loadItems();
else if (index == 3)
else if (index == StyleEditorTab::Raster)
m_rasterPages[0]->loadItems();
m_styleChooser->setCurrentIndex(index);
return;
@ -5585,13 +5589,13 @@ void StyleEditor::onHideMenu() {
void StyleEditor::onPageChanged(int index) {
m_styleSetsButton->setDisabled(false);
switch (index) {
case 1: // Texture
case StyleEditorTab::Texture: // Texture
m_styleSetsButton->setMenu(m_textureMenu);
break;
case 2: // Vector
case StyleEditorTab::Vector: // Vector
m_styleSetsButton->setMenu(m_vectorMenu);
break;
case 3: // Raster
case StyleEditorTab::Raster: // Raster
m_styleSetsButton->setMenu(m_rasterMenu);
break;
default:
@ -5599,7 +5603,7 @@ void StyleEditor::onPageChanged(int index) {
break;
}
if (index < 1 || index > 3) return;
if (index < StyleEditorTab::Raster || index > StyleEditorTab::Texture) return;
onUpdateFavorites();
update();
@ -6373,14 +6377,16 @@ void StyleEditor::onExpandAllRasterSet() {
void StyleEditor::setUpdated(TFilePath setPath) {
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;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it;
@ -6397,7 +6403,7 @@ void StyleEditor::setUpdated(TFilePath setPath) {
void StyleEditor::onUpdateFavorites() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
int chipSize;
QPushButton *button;
@ -6405,20 +6411,20 @@ void StyleEditor::onUpdateFavorites() {
QMenu *menu;
StyleChooserPage *page;
int minChipCount = 2;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
chipSize = m_texturePages[0]->getChipCount();
button = m_textureButtons[0];
label = m_textureLabels[0];
page = m_texturePages[0];
menu = m_textureMenu;
minChipCount = 3;
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
chipSize = m_vectorPages[0]->getChipCount();
button = m_vectorButtons[0];
label = m_vectorLabels[0];
page = m_vectorPages[0];
menu = m_vectorMenu;
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
chipSize = m_rasterPages[0]->getChipCount();
button = m_rasterButtons[0];
label = m_rasterLabels[0];
@ -6453,14 +6459,14 @@ void StyleEditor::onUpdateFavorites() {
void StyleEditor::onRemoveSelectedStylesFromFavorites() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StyleChooserPage *page;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
page = m_texturePages[0];
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
page = m_vectorPages[0];
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
page = m_rasterPages[0];
page->removeSelectedStylesFromSet(page->getSelection());
@ -6472,17 +6478,17 @@ void StyleEditor::onRemoveSelectedStylesFromFavorites() {
void StyleEditor::onAddSelectedStylesToFavorites() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages;
TFilePath setPath;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
pages = &m_texturePages;
setPath = m_texturePages[0]->getStylesFolder();
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
pages = &m_vectorPages;
setPath = m_vectorPages[0]->getStylesFolder();
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
pages = &m_rasterPages;
setPath = m_rasterPages[0]->getStylesFolder();
}
@ -6501,14 +6507,14 @@ void StyleEditor::onAddSelectedStylesToFavorites() {
void StyleEditor::onAddSelectedStylesToPalette() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it;
@ -6524,17 +6530,17 @@ void StyleEditor::onAddSelectedStylesToPalette() {
void StyleEditor::onCopySelectedStylesToSet() {
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());
QString setName = action->data().toString();
std::vector<StyleChooserPage *> *pages;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
StyleChooserPage *dstPage = 0;
@ -6562,17 +6568,17 @@ void StyleEditor::onCopySelectedStylesToSet() {
void StyleEditor::onMoveSelectedStylesToSet() {
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());
QString setName = action->data().toString();
std::vector<StyleChooserPage *> *pages;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
StyleChooserPage *dstPage = 0;
@ -6601,7 +6607,7 @@ void StyleEditor::onMoveSelectedStylesToSet() {
void StyleEditor::onRemoveSelectedStyleFromSet() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
if (!isSelectingFavoritesOnly()) {
int ret = DVGui::MsgBox(
@ -6613,11 +6619,11 @@ void StyleEditor::onRemoveSelectedStyleFromSet() {
}
std::vector<StyleChooserPage *> *pages;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
std::vector<StyleChooserPage *>::iterator it;
@ -6633,14 +6639,15 @@ void StyleEditor::onRemoveSelectedStyleFromSet() {
TFilePath StyleEditor::getSetStyleFolder(QString setName) {
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;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
StyleChooserPage *dstPage = 0;
@ -6656,17 +6663,18 @@ TFilePath StyleEditor::getSetStyleFolder(QString setName) {
//-----------------------------------------------------------------------------
void StyleEditor::updatePage(int pageIndex) {
if (pageIndex < 1 || pageIndex > 3) return;
if (pageIndex < StyleEditorTab::Raster || pageIndex > StyleEditorTab::Texture)
return;
TFilePathSet fps;
std::vector<StyleChooserPage *> *pages;
if (pageIndex == 1) {
if (pageIndex == StyleEditorTab::Texture) {
fps = TStyleManager::instance()->getTextureStyleFolders();
pages = &m_texturePages;
} else if (pageIndex == 2) {
} else if (pageIndex == StyleEditorTab::Vector) {
fps = TStyleManager::instance()->getCustomStyleFolders();
pages = &m_vectorPages;
} else if (pageIndex == 3) {
} else if (pageIndex == StyleEditorTab::Raster) {
fps = TStyleManager::instance()->getBrushStyleFolders();
pages = &m_rasterPages;
}
@ -6693,14 +6701,14 @@ void StyleEditor::updatePage(int pageIndex) {
if (fp.isEmpty()) continue;
bool isFavorite = ToonzFolder::getMyFavoritesFolder().isAncestorOf(fp);
StylePageType pageType;
if (pageIndex == 1)
if (pageIndex == StyleEditorTab::Texture)
pageType = StylePageType::Texture;
else if (pageIndex == 2) {
else if (pageIndex == StyleEditorTab::Vector) {
pageType = StylePageType::VectorCustom;
if ((ToonzFolder::getLibraryFolder() + TFilePath("vector brushes"))
.isAncestorOf(fp))
pageType = StylePageType::VectorBrush;
} else if (pageIndex == 3)
} else if (pageIndex == StyleEditorTab::Raster)
pageType = StylePageType::Raster;
createNewStyleSet(pageType, *it, isFavorite);
@ -6711,15 +6719,15 @@ void StyleEditor::updatePage(int pageIndex) {
void StyleEditor::onAddNewStyleSet() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
StylePageType pageType;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pageType = StylePageType::Texture;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pageType = StylePageType::VectorCustom;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pageType = StylePageType::Raster;
NewStyleSetPopup *popup = new NewStyleSetPopup(pageType, this);
@ -6730,7 +6738,7 @@ void StyleEditor::onAddNewStyleSet() {
void StyleEditor::onScanStyleSetChanges() {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
TFilePath libPath = ToonzFolder::getLibraryFolder();
TFilePath favoritesLibPath =
@ -6740,20 +6748,20 @@ void StyleEditor::onScanStyleSetChanges() {
TFilePathSet fps;
std::vector<StyleChooserPage *> *pages;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
pages = &m_texturePages;
pageType = StylePageType::Texture;
fps.push_back(libPath + TFilePath("textures"));
fps.push_back(favoritesLibPath + TFilePath("textures"));
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
pages = &m_vectorPages;
pageType = StylePageType::VectorCustom;
fps.push_back(libPath + TFilePath("custom styles"));
fps.push_back(libPath + TFilePath("vector brushes"));
fps.push_back(favoritesLibPath + TFilePath("vector styles"));
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
pages = &m_rasterPages;
pageType = StylePageType::Raster;
@ -6807,7 +6815,7 @@ void StyleEditor::onScanStyleSetChanges() {
QStringList::iterator fpListIt;
for (fpListIt = fpList.begin(); fpListIt != fpList.end(); fpListIt++) {
TFilePath fp(*fpListIt);
if (tab == 2)
if (tab == StyleEditorTab::Vector)
pageType = (libPath + TFilePath("vector brushes")).isAncestorOf(fp)
? StylePageType::VectorBrush
: StylePageType::VectorCustom;
@ -6836,16 +6844,16 @@ void StyleEditor::createNewStyleSet(StylePageType pageType, TFilePath pagePath,
int pageIndex;
switch (pageType) {
case StylePageType::Texture:
pageIndex = 1;
pageIndex = StyleEditorTab::Texture;
break;
case StylePageType::VectorCustom:
pageIndex = 2;
pageIndex = StyleEditorTab::Vector;
break;
case StylePageType::VectorBrush:
pageIndex = 2;
pageIndex = StyleEditorTab::Vector;
break;
case StylePageType::Raster:
pageIndex = 3;
pageIndex = StyleEditorTab::Raster;
break;
}
@ -6884,14 +6892,14 @@ void StyleEditor::createNewStyleSet(StylePageType pageType, TFilePath pagePath,
void StyleEditor::removeStyleSet(StyleChooserPage *styleSetPage) {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<StyleChooserPage *> *pages;
if (tab == 1)
if (tab == StyleEditorTab::Texture)
pages = &m_texturePages;
else if (tab == 2)
else if (tab == StyleEditorTab::Vector)
pages = &m_vectorPages;
else if (tab == 3)
else if (tab == StyleEditorTab::Raster)
pages = &m_rasterPages;
int i = 1;
@ -6911,7 +6919,8 @@ void StyleEditor::removeStyleSet(StyleChooserPage *styleSetPage) {
//-----------------------------------------------------------------------------
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<ClickableLabel *> *labels;
@ -6919,19 +6928,19 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
QMenu *menu;
QScrollArea *outsideArea;
if (pageIndex == 1) {
if (pageIndex == StyleEditorTab::Texture) {
pages = &m_texturePages;
labels = &m_textureLabels;
buttons = &m_textureButtons;
menu = m_textureMenu;
outsideArea = m_textureOutsideArea;
} else if (pageIndex == 2) {
} else if (pageIndex == StyleEditorTab::Vector) {
pages = &m_vectorPages;
labels = &m_vectorLabels;
buttons = &m_vectorButtons;
menu = m_vectorMenu;
outsideArea = m_vectorOutsideArea;
} else if (pageIndex == 3) {
} else if (pageIndex == StyleEditorTab::Raster) {
pages = &m_rasterPages;
labels = &m_rasterLabels;
buttons = &m_rasterButtons;
@ -6950,11 +6959,11 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
QWidget *oldPage = outsideArea->takeWidget();
QFrame *newPageLayout;
if (pageIndex == 1)
if (pageIndex == StyleEditorTab::Texture)
newPageLayout = createTexturePage();
else if (pageIndex == 2)
else if (pageIndex == StyleEditorTab::Vector)
newPageLayout = createVectorPage();
else if (pageIndex == 3)
else if (pageIndex == StyleEditorTab::Raster)
newPageLayout = createRasterPage();
outsideArea->setWidget(makeChooserPageWithoutScrollBar(newPageLayout));
delete oldPage;
@ -6966,17 +6975,17 @@ void StyleEditor::removeStyleSetAtIndex(int index, int pageIndex) {
void StyleEditor::editStyleSetName(StyleChooserPage *styleSetPage) {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<ClickableLabel *> *labels;
QScrollArea *scrollArea;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
labels = &m_textureLabels;
scrollArea = m_textureArea;
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
labels = &m_vectorLabels;
scrollArea = m_vectorArea;
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
labels = &m_rasterLabels;
scrollArea = m_rasterArea;
}
@ -7007,17 +7016,17 @@ void StyleEditor::editStyleSetName(StyleChooserPage *styleSetPage) {
void StyleEditor::renameStyleSet(StyleChooserPage *styleSetPage,
QString newName) {
int tab = m_styleBar->currentIndex();
if (tab < 1 || tab > 3) return;
if (tab < StyleEditorTab::Raster || tab > StyleEditorTab::Texture) return;
std::vector<ClickableLabel *> *labels;
QMenu *menu;
if (tab == 1) {
if (tab == StyleEditorTab::Texture) {
labels = &m_textureLabels;
menu = m_textureMenu;
} else if (tab == 2) {
} else if (tab == StyleEditorTab::Vector) {
labels = &m_vectorLabels;
menu = m_vectorMenu;
} else if (tab == 3) {
} else if (tab == StyleEditorTab::Raster) {
labels = &m_rasterLabels;
menu = m_rasterMenu;
}
@ -7277,11 +7286,11 @@ void NewStyleSetPopup::createStyleSet() {
int pageIndex;
if (m_pageType == StylePageType::Texture)
pageIndex = 1;
pageIndex = StyleEditorTab::Texture;
else if (m_pageType == StylePageType::Raster)
pageIndex = 3;
pageIndex = StyleEditorTab::Raster;
else
pageIndex = 2;
pageIndex = StyleEditorTab::Vector;
TStyleEditorHandler::instance()->updateEditorPage(pageIndex, m_editor);
accept();