|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/paletteviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/keyframenavigator.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/trepetitionguard.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvdialog.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvscrollwidget.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/studiopaletteviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "palettedata.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/palettecmd.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/studiopalettecmd.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/sceneproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/studiopalette.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tframehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tconvert.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qvboxlayout></qvboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbar></qtoolbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qscrollarea></qscrollarea>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmouseevent></qmouseevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmenubar></qmenubar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbutton></qtoolbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qurl></qurl>
|
|
Toshihiro Shimizu |
890ddd |
#include <qapplication></qapplication>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdrag></qdrag>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace PaletteViewerGUI;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \class PaletteViewer
|
|
Toshihiro Shimizu |
890ddd |
\brief The PaletteViewer class provides an object to view and manage palette view.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
This object allows to show and manage palette; it's possible distinguish three
|
|
Toshihiro Shimizu |
890ddd |
view type, class can show: current level palette, current studio palette or
|
|
Toshihiro Shimizu |
890ddd |
current cleanup palette, using setPalette() to set palette viewer.
|
|
Toshihiro Shimizu |
890ddd |
The object is composed of a vertical layout with three widget:
|
|
Toshihiro Shimizu |
890ddd |
\li a tab bar \b PaletteViewerGUI::TabBar in which are displayed palette page
|
|
Toshihiro Shimizu |
890ddd |
\b createTabBar();
|
|
Toshihiro Shimizu |
890ddd |
\li a central frame \b PaletteViewerGUI::PageViewer in which are displayed
|
|
Toshihiro Shimizu |
890ddd |
all style of current page in palette
|
|
Toshihiro Shimizu |
890ddd |
\li a button bar, \b createToolBar(), \b createPaletteToolBar()
|
|
Toshihiro Shimizu |
890ddd |
and \b createSavePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
A collection of method allows you to manage this object and its interaction
|
|
Toshihiro Shimizu |
890ddd |
with palette.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
/*! \fn const TPaletteP PaletteViewer::&getPalette() const
|
|
Toshihiro Shimizu |
890ddd |
Return current viewer palette.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
/*! \fn void PaletteViewer::createToolBar()
|
|
Toshihiro Shimizu |
890ddd |
Create down button bar.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
/*! \fn void PaletteViewer::updateToolBar()
|
|
Toshihiro Shimizu |
890ddd |
Update button bar.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
PaletteViewer::PaletteViewer(QWidget *parent, PaletteViewType viewType, bool hasSaveToolBar, bool hasPageCommand, bool hasPasteColors)
|
|
Toshihiro Shimizu |
890ddd |
: QFrame(parent), m_tabBarContainer(0), m_pagesBar(0), m_paletteToolBar(0), m_savePaletteToolBar(0), m_pageViewer(0), m_pageViewerScrollArea(0), m_indexPageToDelete(-1), m_viewType(viewType), m_frameHandle(0), m_paletteHandle(0), m_changeStyleCommand(0), m_xsheetHandle(0), m_hasSavePaletteToolbar(hasSaveToolBar), m_hasPageCommand(hasPageCommand), m_isSaveActionEnabled(true), m_lockPaletteAction(0), m_lockPaletteToolButton(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("OnePixelMarginFrame");
|
|
Toshihiro Shimizu |
890ddd |
setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
createTabBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Create pageView
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea = new QScrollArea();
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea->setWidgetResizable(true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer = new PageViewer(m_pageViewerScrollArea, m_viewType, hasPasteColors);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea->setWidget(m_pageViewer);
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setPageViewer(m_pageViewer);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Create toolbar. It is an horizontal layout with three internal toolbar.
|
|
Toshihiro Shimizu |
890ddd |
DvScrollWidget *toolbarScrollWidget = new DvScrollWidget;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
toolbarScrollWidget->setObjectName("ToolBarContainer"); // Toonz's qss files are instructed to leave a
|
|
Toshihiro Shimizu |
890ddd |
// 1px grey margin on top for scroll buttons
|
|
Toshihiro Shimizu |
890ddd |
QWidget *toolBarWidget = new QWidget; // children of this parent name.
|
|
Toshihiro Shimizu |
890ddd |
toolbarScrollWidget->setWidget(toolBarWidget);
|
|
Toshihiro Shimizu |
890ddd |
toolBarWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
|
Toshihiro Shimizu |
890ddd |
toolBarWidget->setFixedHeight(22);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar = new QToolBar(toolBarWidget);
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar = new QToolBar(toolBarWidget);
|
|
Toshihiro Shimizu |
890ddd |
createToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
|
|
Toshihiro Shimizu |
890ddd |
toolBarLayout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
toolBarLayout->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
toolBarLayout->addWidget(m_savePaletteToolBar, 0, Qt::AlignRight);
|
|
Toshihiro Shimizu |
890ddd |
toolBarLayout->addWidget(m_paletteToolBar, 0, Qt::AlignRight);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
toolBarWidget->setLayout(toolBarLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// This widget is used to set the background color of the tabBar
|
|
Toshihiro Shimizu |
890ddd |
// using the styleSheet.
|
|
Toshihiro Shimizu |
890ddd |
// It is also used to take 6px on the left before the tabBar
|
|
Toshihiro Shimizu |
890ddd |
// and to draw the two lines on the bottom size
|
|
Toshihiro Shimizu |
890ddd |
m_tabBarContainer = new TabBarContainter(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
// To add 6px (on the left) before the TabBar
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *hLayout = new QHBoxLayout;
|
|
Toshihiro Shimizu |
890ddd |
hLayout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
//hLayout->setAlignment(Qt::AlignLeft);
|
|
Toshihiro Shimizu |
890ddd |
//hLayout->addSpacing(6);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
hLayout->addWidget(m_pagesBar, 0);
|
|
Toshihiro Shimizu |
890ddd |
hLayout->addStretch(1);
|
|
Toshihiro Shimizu |
890ddd |
hLayout->addWidget(toolbarScrollWidget, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_tabBarContainer->setLayout(hLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// To align this panel with the style Editor
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->addWidget(m_tabBarContainer, 0);
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->addWidget(m_pageViewerScrollArea, 1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
setLayout(mainLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_pagesBar, SIGNAL(currentChanged(int)), this, SLOT(setPageView(int)));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_pagesBar, SIGNAL(movePage(int, int)), this, SLOT(movePage(int, int)));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_pageViewer, SIGNAL(changeWindowTitleSignal()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
changeWindowTitle();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setAcceptDrops(true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PaletteViewer::~PaletteViewer()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_changeStyleCommand;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setPaletteHandle(TPaletteHandle *paletteHandle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_paletteHandle == paletteHandle)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool ret = true;
|
|
Toshihiro Shimizu |
890ddd |
if (m_paletteHandle)
|
|
shun_iwasawa |
94146e |
ret = ret && disconnect(m_paletteHandle,0,this,0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteHandle = paletteHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_paletteHandle && isVisible()) {
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(paletteSwitched()), this, SLOT(onPaletteSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(paletteChanged()), this, SLOT(onPaletteChanged()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(paletteChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(paletteTitleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
ret = ret && connect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType != CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
m_keyFrameButton->setPaletteHandle(m_paletteHandle);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setPaletteHandle(m_paletteHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setPageView(0);
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setFrameHandle(TFrameHandle *frameHandle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_frameHandle = frameHandle;
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType != CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
m_keyFrameButton->setFrameHandle(m_frameHandle);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setFrameHandle(m_frameHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setXsheetHandle(TXsheetHandle *xsheetHandle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_xsheetHandle = xsheetHandle;
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setXsheetHandle(m_xsheetHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*!for clearing level cache after "paste style" command called from style selection
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setLevelHandle(TXshLevelHandle *levelHandle)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setLevelHandle(levelHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette *PaletteViewer::getPalette()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_paletteHandle)
|
|
Toshihiro Shimizu |
890ddd |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
return m_paletteHandle->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::updateView()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
changeWindowTitle();
|
|
Toshihiro Shimizu |
890ddd |
setPageView(0);
|
|
Toshihiro Shimizu |
890ddd |
clearStyleSelection();
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
updateSavePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::enableSaveAction(bool enable)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_savePaletteToolBar)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
QList<qaction *=""> actions;</qaction>
|
|
Toshihiro Shimizu |
890ddd |
actions = m_savePaletteToolBar->actions();
|
|
Toshihiro Shimizu |
890ddd |
enable = !getPalette() ? false : enable;
|
|
Toshihiro Shimizu |
890ddd |
m_isSaveActionEnabled = enable;
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < actions.count() - 1; i++) {
|
|
Toshihiro Shimizu |
890ddd |
QAction *act = actions[i];
|
|
Toshihiro Shimizu |
890ddd |
if (act->text() == tr("&Save Palette As") || act->text() == tr("&Save Palette"))
|
|
Toshihiro Shimizu |
890ddd |
act->setEnabled(enable);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Create tab bar to select palette page.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::createTabBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar = new PaletteTabBar(this, m_hasPageCommand);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_pagesBar, SIGNAL(tabTextChanged(int)), this, SLOT(onTabTextChanged(int)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!getPalette())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Create right part of button bar.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::createPaletteToolBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->clear();
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->setIconSize(QSize(23, 20));
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->setLayoutDirection(Qt::RightToLeft);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Lock button to avoid editing the palette by mistake
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == LEVEL_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
QIcon lockIcon = createQIconOnOffPNG("lockpalette");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton = new QToolButton(this);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setIcon(lockIcon);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setCheckable(true);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setObjectName("PaletteLockButton");
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setToolTip(tr("Lock Palette"));
|
|
Toshihiro Shimizu |
890ddd |
if (getPalette()) {
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setChecked(getPalette()->isLocked());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_lockPaletteToolButton, SIGNAL(clicked(bool)), this, SLOT(setIsLocked(bool)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addWidget(m_lockPaletteToolButton);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} else if (m_viewType == STUDIO_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
QToolButton *toolButton = new QToolButton(this);
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setPopupMode(QToolButton::InstantPopup);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QIcon lockIcon = createQIconOnOffPNG("lockpalette");
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setIcon(lockIcon);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setObjectName("PaletteLockButton");
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setToolTip(tr("Lock Palette"));
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setCheckable(true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QMenu *lockMenu = new QMenu(toolButton);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction = new QAction(tr("&Lock Palette"), toolButton);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction->setCheckable(true);
|
|
Toshihiro Shimizu |
890ddd |
lockMenu->addAction(m_lockPaletteAction);
|
|
Toshihiro Shimizu |
890ddd |
toolButton->setMenu(lockMenu);
|
|
Toshihiro Shimizu |
890ddd |
if (getPalette()) {
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction->setChecked(getPalette()->isLocked());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_lockPaletteAction, SIGNAL(triggered(bool)), this, SLOT(setIsLocked(bool)));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_lockPaletteAction, SIGNAL(toggled(bool)), toolButton, SLOT(setChecked(bool)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addWidget(toolButton);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Attenzione: alcune modifiche sono state fatte a livello di stylesheet
|
|
Toshihiro Shimizu |
890ddd |
QToolButton *viewModeButton = new QToolButton(this);
|
|
Toshihiro Shimizu |
890ddd |
viewModeButton->setPopupMode(QToolButton::InstantPopup);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QIcon viewModeIcon = createQIconPNG("options");
|
|
Toshihiro Shimizu |
890ddd |
viewModeButton->setIcon(viewModeIcon);
|
|
Toshihiro Shimizu |
890ddd |
QMenu *viewMode = new QMenu(QString("Options"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->setToolTip(tr("Options"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QActionGroup *viewModeGroup = new QActionGroup(viewMode);
|
|
Toshihiro Shimizu |
890ddd |
connect(viewModeGroup, SIGNAL(triggered(QAction *)), this, SLOT(onViewMode(QAction *)));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *smallThumbAct = new QAction(tr("&Small Thumbnails View"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
smallThumbAct->setData(PageViewer::SmallChips);
|
|
Toshihiro Shimizu |
890ddd |
QAction *mediumThumbAct = new QAction(tr("&Medium Thumbnails View"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
mediumThumbAct->setData(PageViewer::MediumChips);
|
|
Toshihiro Shimizu |
890ddd |
QAction *largeThumbAct = new QAction(tr("&Large Thumbnails View"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
largeThumbAct->setData(PageViewer::LargeChips);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *listAct = new QAction(tr("&List View"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
listAct->setData(PageViewer::List);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
viewModeGroup->addAction(smallThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewModeGroup->addAction(mediumThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewModeGroup->addAction(largeThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewModeGroup->addAction(listAct);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *styleDisplayAct = new QAction(tr("Style Name"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
styleDisplayAct->setData(PageViewer::Style);
|
|
Toshihiro Shimizu |
890ddd |
QAction *originalDisplayAct = new QAction(tr("StudioPalette Name"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
originalDisplayAct->setData(PageViewer::Original);
|
|
Toshihiro Shimizu |
890ddd |
QAction *bothDisplayAct = new QAction(tr("Both Names"), viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
bothDisplayAct->setData(PageViewer::StyleAndOriginal);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QActionGroup *nameDisplayModeGroup = new QActionGroup(viewMode);
|
|
Toshihiro Shimizu |
890ddd |
connect(nameDisplayModeGroup, SIGNAL(triggered(QAction *)), this, SLOT(onNameDisplayMode(QAction *)));
|
|
Toshihiro Shimizu |
890ddd |
nameDisplayModeGroup->addAction(styleDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
nameDisplayModeGroup->addAction(originalDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
nameDisplayModeGroup->addAction(bothDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(smallThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewModeGroup->addAction(mediumThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(largeThumbAct);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(listAct);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(styleDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(originalDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
viewMode->addAction(bothDisplayAct);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
viewModeButton->setMenu(viewMode);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Attenzione: avendo invertito la direzione devo aggiungere gli oggetti al contrario
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addWidget(viewModeButton);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_hasPageCommand) {
|
|
Toshihiro Shimizu |
890ddd |
QAction *addPage;
|
|
Toshihiro Shimizu |
890ddd |
QIcon addPageIcon = createQIconPNG("newpage");
|
|
Toshihiro Shimizu |
890ddd |
addPage = new QAction(addPageIcon, tr("&New Page"), m_paletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
connect(addPage, SIGNAL(triggered()), this, SLOT(addNewPage()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addAction(addPage);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QIcon newColorIcon = createQIconPNG("newstyle");
|
|
Toshihiro Shimizu |
890ddd |
QAction *addColor = new QAction(newColorIcon, tr("&New Style"), m_paletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
connect(addColor, SIGNAL(triggered()), this, SLOT(addNewColor()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addAction(addColor);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//KeyFrame button
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType != CLEANUP_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
m_keyFrameButton = new PaletteKeyframeNavigator(m_paletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addWidget(m_keyFrameButton);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteToolBar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
m_keyFrameButton->setSelection(m_pageViewer->getSelection());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Create left part of button bar; insert different actions in according to
|
|
Toshihiro Shimizu |
890ddd |
current viewer palette type.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::createSavePaletteToolBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->clear();
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->setIconSize(QSize(22, 20));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_hasSavePaletteToolbar || m_viewType == CLEANUP_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->hide();
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//save palette as
|
|
Toshihiro Shimizu |
890ddd |
QIcon saveAsPaletteIcon = createQIconOnOffPNG("savepaletteas", false);
|
|
Toshihiro Shimizu |
890ddd |
QAction *saveAsPalette = new QAction(saveAsPaletteIcon, tr("&Save Palette As"), m_savePaletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
//overwrite palette
|
|
Toshihiro Shimizu |
890ddd |
QIcon savePaletteIcon = createQIconOnOffPNG("savepalette", false);
|
|
Toshihiro Shimizu |
890ddd |
QAction *savePalette = new QAction(savePaletteIcon, tr("&Save Palette"), m_savePaletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == STUDIO_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
connect(savePalette, SIGNAL(triggered()), this, SLOT(saveStudioPalette()));
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->addAction(savePalette);
|
|
Toshihiro Shimizu |
890ddd |
} else if (m_viewType == LEVEL_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
//save load palette
|
|
Toshihiro Shimizu |
890ddd |
PaletteIconWidget *movePalette = new PaletteIconWidget(m_savePaletteToolBar);
|
|
Toshihiro Shimizu |
890ddd |
connect(movePalette, SIGNAL(startDrag()), this, SLOT(startDragDrop()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QAction *act = m_savePaletteToolBar->addWidget(movePalette);
|
|
Toshihiro Shimizu |
890ddd |
act->setText(tr("&Move Palette"));
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//save palette as
|
|
Toshihiro Shimizu |
890ddd |
connect(saveAsPalette, SIGNAL(triggered()),
|
|
Toshihiro Shimizu |
890ddd |
CommandManager::instance()->getAction("MI_SavePaletteAs"), SIGNAL(triggered()));
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->addAction(saveAsPalette);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//overwrite palette
|
|
Toshihiro Shimizu |
890ddd |
connect(savePalette, SIGNAL(triggered()),
|
|
Toshihiro Shimizu |
890ddd |
CommandManager::instance()->getAction("MI_OverwritePalette"), SIGNAL(triggered()));
|
|
Toshihiro Shimizu |
890ddd |
m_savePaletteToolBar->addAction(savePalette);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
updateSavePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Update page tab bar adding or removing tab in accord with viewer palette.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::updateTabBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int tabCount = m_pagesBar->count();
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Se ci sono tab li butto
|
|
Toshihiro Shimizu |
890ddd |
for (i = tabCount - 1; i >= 0; i--)
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->removeTab(i);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QIcon tabIcon(":Resources/palette_tabicon.png");
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setIconSize(QSize(20, 15));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Aggiungo i tab in funzione delle pagine di m_palette
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < palette->getPageCount(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = palette->getPage(i);
|
|
Toshihiro Shimizu |
890ddd |
wstring ws = page->getName();
|
|
Toshihiro Shimizu |
890ddd |
QString pageName = QString::fromStdWString(ws);
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->addTab(tabIcon, pageName);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Update right button bar, enable its action if current viewer palette is empty.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::updatePaletteToolBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_paletteToolBar)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
QList<qaction *=""> actions;</qaction>
|
|
Toshihiro Shimizu |
890ddd |
actions = m_paletteToolBar->actions();
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
bool enable = !palette ? false : true;
|
|
Toshihiro Shimizu |
890ddd |
bool enableNewStyleAct = enable;
|
|
Toshihiro Shimizu |
890ddd |
//limit the number of cleanup styles to 7
|
|
Toshihiro Shimizu |
890ddd |
if (palette && palette->isCleanupPalette())
|
|
Toshihiro Shimizu |
890ddd |
enableNewStyleAct = (palette->getStyleInPagesCount() < 8);
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType != CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
m_keyFrameButton->setEnabled(enable);
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < actions.count(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
QAction *act = actions[i];
|
|
Toshihiro Shimizu |
890ddd |
if (act->text() == tr("&New Style")) {
|
|
Toshihiro Shimizu |
890ddd |
act->setEnabled(enableNewStyleAct);
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
act->setEnabled(enable);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Update left button bar, enable its action if current viewer palette is empty.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::updateSavePaletteToolBar()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_savePaletteToolBar)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
QList<qaction *=""> actions;</qaction>
|
|
Toshihiro Shimizu |
890ddd |
actions = m_savePaletteToolBar->actions();
|
|
Toshihiro Shimizu |
890ddd |
bool enable = !getPalette() ? false : true;
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < actions.count(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
QAction *act = actions[i];
|
|
Toshihiro Shimizu |
890ddd |
if (act->text() == tr("&Save Palette As") ||
|
|
Toshihiro Shimizu |
890ddd |
act->text() == tr("&Save Palette") ||
|
|
Toshihiro Shimizu |
890ddd |
act->text() == tr("&Palette Gizmo"))
|
|
Toshihiro Shimizu |
890ddd |
act->setEnabled(enable);
|
|
Toshihiro Shimizu |
890ddd |
else if (m_viewType != STUDIO_PALETTE && i == 0) //move action
|
|
Toshihiro Shimizu |
890ddd |
actions[i]->setVisible(enable);
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
actions[i]->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Resize the widget and its child.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::resizeEvent(QResizeEvent *event)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QWidget::resizeEvent(event);
|
|
Toshihiro Shimizu |
890ddd |
if (m_pageViewer)
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->computeSize();
|
|
Toshihiro Shimizu |
890ddd |
if (m_pagesBar)
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setMaximumWidth(width() - 12);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setChangeStyleCommand(ChangeStyleCommand *changeStyleCommand)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_changeStyleCommand)
|
|
Toshihiro Shimizu |
890ddd |
delete m_changeStyleCommand;
|
|
Toshihiro Shimizu |
890ddd |
m_changeStyleCommand = changeStyleCommand;
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setChangeStyleCommand(m_changeStyleCommand);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Create and open the Right-click menu.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::contextMenuEvent(QContextMenuEvent *event)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_indexPageToDelete = -1;
|
|
Toshihiro Shimizu |
890ddd |
QPoint pos = event->pos();
|
|
Toshihiro Shimizu |
890ddd |
if (!getPalette() || !m_tabBarContainer->geometry().contains(pos))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QMenu *menu = new QMenu(this);
|
|
Toshihiro Shimizu |
890ddd |
if (m_hasPageCommand) {
|
|
Toshihiro Shimizu |
890ddd |
QAction *newPage = menu->addAction(tr("New Page"));
|
|
Toshihiro Shimizu |
890ddd |
connect(newPage, SIGNAL(triggered()), SLOT(addNewPage()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_pagesBar->geometry().contains(pos)) {
|
|
Toshihiro Shimizu |
890ddd |
int tabIndex = m_pagesBar->tabAt(pos);
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = getPalette()->getPage(tabIndex);
|
|
Toshihiro Shimizu |
890ddd |
if (page) {
|
|
Toshihiro Shimizu |
890ddd |
bool canRemovePage = true;
|
|
Toshihiro Shimizu |
890ddd |
if (page->getStyleId(0) == 0 || page->getStyleId(1) == 1)
|
|
Toshihiro Shimizu |
890ddd |
canRemovePage = false;
|
|
Toshihiro Shimizu |
890ddd |
if (canRemovePage) {
|
|
Toshihiro Shimizu |
890ddd |
m_indexPageToDelete = tabIndex;
|
|
Toshihiro Shimizu |
890ddd |
QAction *deletePage = menu->addAction(tr("Delete Page"));
|
|
Toshihiro Shimizu |
890ddd |
connect(deletePage, SIGNAL(triggered()), SLOT(deletePage()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == LEVEL_PALETTE && m_isSaveActionEnabled) {
|
|
Toshihiro Shimizu |
890ddd |
menu->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
menu->addAction(CommandManager::instance()->getAction("MI_OverwritePalette"));
|
|
Toshihiro Shimizu |
890ddd |
menu->addAction(CommandManager::instance()->getAction("MI_SavePaletteAs"));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
menu->exec(event->globalPos());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::showEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
onPaletteSwitched();
|
|
Toshihiro Shimizu |
890ddd |
changeWindowTitle();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_paletteHandle)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(paletteSwitched()), this, SLOT(onPaletteSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(paletteChanged()), this, SLOT(onPaletteChanged()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(paletteTitleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_frameHandle)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
//Connessione necessaria per aggiornare lo stile in caso di palette animate.
|
|
Toshihiro Shimizu |
890ddd |
connect(m_frameHandle, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::hideEvent(QHideEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(paletteSwitched()), this, SLOT(onPaletteSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(paletteChanged()), this, SLOT(onPaletteChanged()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(paletteTitleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(colorStyleSwitched()), this, SLOT(onColorStyleSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(colorStyleChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_paletteHandle, SIGNAL(paletteDirtyFlagChanged()), this, SLOT(changeWindowTitle()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_frameHandle)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
disconnect(m_frameHandle, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! If currente palette viewer exist verify event data, if is a PaletteData or
|
|
Toshihiro Shimizu |
890ddd |
has urls accept event.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::dragEnterEvent(QDragEnterEvent *event)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette || m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const QMimeData *mimeData = event->mimeData();
|
|
Toshihiro Shimizu |
890ddd |
const PaletteData *paletteData = dynamic_cast<const *="" palettedata="">(mimeData);</const>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (paletteData) {
|
|
Toshihiro Shimizu |
890ddd |
// Sto "draggando" stili.
|
|
Toshihiro Shimizu |
890ddd |
if (paletteData->hasStyleIndeces()) {
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->createDropPage();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette)
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setCurrentIndex(palette->getPageCount() - 1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
// Accetto l'evento
|
|
Toshihiro Shimizu |
890ddd |
event->acceptProposedAction();
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!acceptResourceDrop(mimeData->urls()))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
QList<qurl> urls = mimeData->urls();</qurl>
|
|
Toshihiro Shimizu |
890ddd |
int count = urls.size();
|
|
Toshihiro Shimizu |
890ddd |
if (count == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
//Accetto l'evento solo se ho tutte palette.
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < count; i++) {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath path(urls[i].toLocalFile().toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
if (!path.getType().empty() && path.getType() != "tpl")
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
event->acceptProposedAction();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Execute drop event.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::dropEvent(QDropEvent *event)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
const QMimeData *mimeData = event->mimeData();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QPoint tollBarPos = m_savePaletteToolBar->mapFrom(this, event->pos());
|
|
Toshihiro Shimizu |
890ddd |
QAction *currentAction = m_savePaletteToolBar->actionAt(tollBarPos);
|
|
Toshihiro Shimizu |
890ddd |
bool loadPalette = currentAction && currentAction->text() == QString(tr("&Move Palette"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// ho i path delle palette
|
|
Toshihiro Shimizu |
890ddd |
if (mimeData->hasUrls()) {
|
|
Toshihiro Shimizu |
890ddd |
QList<qurl> urls = mimeData->urls();</qurl>
|
|
Toshihiro Shimizu |
890ddd |
int count = urls.size();
|
|
Toshihiro Shimizu |
890ddd |
if (count == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < count; i++) {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath path(urls[i].toLocalFile().toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
if (!path.getType().empty() && path.getType() != "tpl")
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
if (loadPalette && i == 0) {
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheetHandle) {
|
|
Toshihiro Shimizu |
890ddd |
TPalette *newPalette = StudioPalette::instance()->getPalette(path, false);
|
|
Toshihiro Shimizu |
890ddd |
if (!newPalette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
int ret = DVGui::eraseStylesInDemand(getPalette(), m_xsheetHandle, newPalette);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteCmd::loadIntoCurrentPalette(m_paletteHandle, path);
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteCmd::mergeIntoCurrentPalette(m_paletteHandle, path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (loadPalette) {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath refImagePath = StudioPalette::instance()->getPalette(path, true)->getRefImgPath();
|
|
Toshihiro Shimizu |
890ddd |
if (!refImagePath.isEmpty() && getPalette()->getRefImgPath().isEmpty()) {
|
|
Toshihiro Shimizu |
890ddd |
getPalette()->setRefImgPath(refImagePath);
|
|
Toshihiro Shimizu |
890ddd |
m_paletteHandle->notifyPaletteChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
event->acceptProposedAction();
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const PaletteData *paletteData = dynamic_cast<const *="" palettedata="">(mimeData);</const>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!paletteData)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
// Sto inserendo stili
|
|
Toshihiro Shimizu |
890ddd |
if (paletteData->hasStyleIndeces()) {
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->drop(-1, mimeData);
|
|
Toshihiro Shimizu |
890ddd |
event->acceptProposedAction();
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
// Ho la palette da inserire
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = paletteData->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (getPalette() == palette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
if (loadPalette) {
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheetHandle) {
|
|
Toshihiro Shimizu |
890ddd |
int ret = DVGui::eraseStylesInDemand(getPalette(), m_xsheetHandle, palette);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteCmd::loadIntoCurrentPalette(m_paletteHandle, palette);
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteCmd::mergeIntoCurrentPalette(m_paletteHandle, palette);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Start drag and drop; if current page exist set drag and drop event data.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::startDragDrop()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRepetitionGuard guard;
|
|
Toshihiro Shimizu |
890ddd |
if (!guard.hasLock())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(m_viewType != STUDIO_PALETTE && m_viewType != CLEANUP_PALETTE);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QDrag *drag = new QDrag(this);
|
|
Toshihiro Shimizu |
890ddd |
PaletteData *paletteData = new PaletteData();
|
|
Toshihiro Shimizu |
890ddd |
paletteData->setPalette(palette);
|
|
Toshihiro Shimizu |
890ddd |
drag->setMimeData(paletteData);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::clearStyleSelection()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->clearSelection();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Set current view page to \b currentIndexPage
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setPageView(int currentIndexPage)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = palette ? palette->getPage(currentIndexPage) : 0;
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setPage(page);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! If current palette viewer is not empty create emit a signal to create new
|
|
Toshihiro Shimizu |
890ddd |
palette page.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::addNewPage()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (palette) {
|
|
Toshihiro Shimizu |
890ddd |
if (palette->isLocked())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
PaletteCmd::addPage(m_paletteHandle);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Create a new style in current page view of current palette viewer emit a signal
|
|
Toshihiro Shimizu |
890ddd |
to create a new style.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::addNewColor()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!getPalette() || getPalette()->isLocked())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = m_pageViewer->getPage();
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
Toshihiro Shimizu |
890ddd |
PaletteCmd::createStyle(m_paletteHandle, page);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->computeSize();
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Emit a signal to delete a page of current palette viewer.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::deletePage()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette || palette->isLocked())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_xsheetHandle) {
|
|
Toshihiro Shimizu |
890ddd |
vector<int> styleIds;</int>
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = palette->getPage(m_indexPageToDelete);
|
|
Toshihiro Shimizu |
890ddd |
if (!page)
|
|
Toshihiro Shimizu |
890ddd |
return; //La pagina dovrebbe esserci sempre
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < page->getStyleCount(); i++)
|
|
Toshihiro Shimizu |
890ddd |
styleIds.push_back(page->getStyleId(i));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int ret = DVGui::eraseStylesInDemand(palette, styleIds, m_xsheetHandle);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PaletteCmd::destroyPage(m_paletteHandle, m_indexPageToDelete);
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
palette->setDirtyFlag(true);
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! If current palette view is studio palette and palette has a global name
|
|
Toshihiro Shimizu |
890ddd |
save current viewer palette in studio palette.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::saveStudioPalette()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#ifdef BRAVODEMO
|
|
Toshihiro Shimizu |
890ddd |
DVGui::featureNotAvelaible();
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
StudioPalette *sp = StudioPalette::instance();
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette) {
|
|
Toshihiro Shimizu |
890ddd |
DVGui::MsgBox(DVGui::WARNING, "No current palette");
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
wstring gname = palette->getGlobalName();
|
|
Toshihiro Shimizu |
890ddd |
if (gname.empty()) {
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteViewer *parentSPV = qobject_cast<studiopaletteviewer *="">(parentWidget());</studiopaletteviewer>
|
|
Toshihiro Shimizu |
890ddd |
if (!parentSPV) {
|
|
Toshihiro Shimizu |
890ddd |
DVGui::MsgBox(DVGui::WARNING, "No GlobalName");
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
TFilePath palettePath = parentSPV->getCurrentItemPath();
|
|
Toshihiro Shimizu |
890ddd |
if (palettePath.isEmpty())
|
|
Toshihiro Shimizu |
890ddd |
DVGui::MsgBox(DVGui::WARNING, "No GlobalName, No Filepath");
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
QString question;
|
|
Toshihiro Shimizu |
890ddd |
question = "Do you want to overwrite current palette to " + toQString(palettePath) + " ?";
|
|
Toshihiro Shimizu |
890ddd |
int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"), QObject::tr("Don't Overwrite"), 0);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 2 || ret == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
StudioPalette::instance()->save(palettePath, palette);
|
|
Toshihiro Shimizu |
890ddd |
palette->setDirtyFlag(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath fp = sp->getPalettePath(gname);
|
|
Toshihiro Shimizu |
890ddd |
if (fp != TFilePath()) {
|
|
Toshihiro Shimizu |
890ddd |
QString question;
|
|
Toshihiro Shimizu |
890ddd |
question = "Do you want to overwrite current studio palette to " + toQString(fp) + " ?";
|
|
Toshihiro Shimizu |
890ddd |
int ret = DVGui::MsgBox(question, tr("Overwrite"), tr("Don't Overwrite"), 0);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 2 || ret == 0)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
sp->setPalette(fp, getPalette(), false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
question = "Do you want to update all linked styles in current scene ?";
|
|
Toshihiro Shimizu |
890ddd |
ret = DVGui::MsgBox(question, tr("Update"), tr("Don't Update"), 0);
|
|
Toshihiro Shimizu |
890ddd |
if (ret == 1)
|
|
Toshihiro Shimizu |
890ddd |
StudioPaletteCmd::updateAllLinkedStyles(m_paletteHandle, m_xsheetHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
palette->setDirtyFlag(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_paletteHandle->notifyPaletteChanged();
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! If current color switched update current page view.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onColorStyleSwitched()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// se non c'e' palette, pageviewer p pagina corrente esco (non dovrebbe succedere mai)
|
|
Toshihiro Shimizu |
890ddd |
if (!palette || !m_pageViewer)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
int styleIndex = m_paletteHandle->getStyleIndex();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setPageView(m_pagesBar->currentIndex());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette::Page *page = m_pageViewer->getPage();
|
|
Toshihiro Shimizu |
890ddd |
if (!page)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// faccio in modo che la pagina che contiene il colore selezionato diventi corrente
|
|
Toshihiro Shimizu |
890ddd |
int indexInPage = page->search(styleIndex);
|
|
Toshihiro Shimizu |
890ddd |
if (indexInPage == -1) {
|
|
Toshihiro Shimizu |
890ddd |
if (!palette->getStylePage(styleIndex))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
int pageIndex = palette->getStylePage(styleIndex)->getIndex();
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setCurrentIndex(pageIndex);
|
|
Toshihiro Shimizu |
890ddd |
indexInPage = m_pageViewer->getPage()->search(styleIndex);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QRect colorStyleRect = m_pageViewer->getItemRect(indexInPage);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewerScrollArea->ensureVisible(
|
|
Toshihiro Shimizu |
890ddd |
colorStyleRect.center().x(),
|
|
Toshihiro Shimizu |
890ddd |
colorStyleRect.center().y(),
|
|
Toshihiro Shimizu |
890ddd |
colorStyleRect.size().width() / 2 + 4,
|
|
Toshihiro Shimizu |
890ddd |
colorStyleRect.size().height() / 2 + 4);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Update view. Remember current page bar index.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onPaletteChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int index = m_pagesBar->currentIndex();
|
|
Toshihiro Shimizu |
890ddd |
updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setCurrentIndex(index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->update();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
updatePaletteToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
changeWindowTitle();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onPaletteSwitched()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
updateView();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// update GUI according to the "lock" property
|
|
Toshihiro Shimizu |
890ddd |
if (getPalette() && m_viewType != CLEANUP_PALETTE && (m_lockPaletteAction || m_lockPaletteToolButton)) {
|
|
Toshihiro Shimizu |
890ddd |
if (m_lockPaletteAction) {
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction->setEnabled(true);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction->setChecked(getPalette()->isLocked());
|
|
Toshihiro Shimizu |
890ddd |
} else if (m_lockPaletteToolButton) {
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setEnabled(true);
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setChecked(getPalette()->isLocked());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//update commands
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->updateCommandLocks();
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
if (m_lockPaletteAction)
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteAction->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
else if (m_lockPaletteToolButton)
|
|
Toshihiro Shimizu |
890ddd |
m_lockPaletteToolButton->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onFrameSwitched()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (!palette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
palette->setFrame(m_frameHandle->getFrameIndex());
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Set a new name to palette page of index \b tabIndex.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onTabTextChanged(int tabIndex)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_paletteHandle)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
QString newName = m_pagesBar->tabText(tabIndex);
|
|
Toshihiro Shimizu |
890ddd |
PaletteCmd::renamePalettePage(m_paletteHandle, tabIndex, newName.toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Change page style view mode.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onViewMode(QAction *action)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int viewMode = action->data().toInt();
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setViewMode((PageViewer::ViewMode)viewMode);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Change name display mode on the style chips
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::onNameDisplayMode(QAction *action)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int nameDisplayMode = action->data().toInt();
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->setNameDisplayMode((PageViewer::NameDisplayMode)nameDisplayMode);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! If current view type is LEVEL_PALETTE add to window title current level
|
|
Toshihiro Shimizu |
890ddd |
name and current frame.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::changeWindowTitle()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QString name = tr("Palette");
|
|
Toshihiro Shimizu |
890ddd |
QWidget *titleOwner;
|
|
Toshihiro Shimizu |
890ddd |
TPalette *palette = getPalette();
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == LEVEL_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
name = tr("Level Palette: ");
|
|
Toshihiro Shimizu |
890ddd |
if (palette) {
|
|
Toshihiro Shimizu |
890ddd |
name = name + QString::fromStdWString(palette->getPaletteName());
|
|
Toshihiro Shimizu |
890ddd |
if (palette->getDirtyFlag())
|
|
Toshihiro Shimizu |
890ddd |
name += QString(" *");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
titleOwner = parentWidget();
|
|
Toshihiro Shimizu |
890ddd |
} else if (m_viewType == CLEANUP_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
name = tr("Cleanup Palette");
|
|
Toshihiro Shimizu |
890ddd |
titleOwner = parentWidget();
|
|
Toshihiro Shimizu |
890ddd |
} else if (m_viewType == STUDIO_PALETTE) {
|
|
Toshihiro Shimizu |
890ddd |
name = QString();
|
|
Toshihiro Shimizu |
890ddd |
if (palette) {
|
|
Toshihiro Shimizu |
890ddd |
if (palette->getDirtyFlag()) {
|
|
Toshihiro Shimizu |
890ddd |
name = QString("* ");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
name = name + QString::fromStdWString(palette->getPaletteName()) + QString(" : ");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
name += tr("Studio Palette");
|
|
Toshihiro Shimizu |
890ddd |
titleOwner = parentWidget()->parentWidget();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//add color model name, if exists
|
|
Toshihiro Shimizu |
890ddd |
TFilePath refImagePath = (palette) ? palette->getRefImgPath() : TFilePath();
|
|
Toshihiro Shimizu |
890ddd |
if (!refImagePath.isEmpty()) {
|
|
Toshihiro Shimizu |
890ddd |
QString cmName = tr(" (Color Model: ") + QString::fromStdWString(refImagePath.getWideName()) + tr(")");
|
|
Toshihiro Shimizu |
890ddd |
name += cmName;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
titleOwner->setWindowTitle(name);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Move palette view page from \b srcIndex page index to \b dstIndex page index.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::movePage(int srcIndex, int dstIndex)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
PaletteCmd::movePalettePage(m_paletteHandle, srcIndex, dstIndex);
|
|
Toshihiro Shimizu |
890ddd |
m_pagesBar->setCurrentIndex(dstIndex);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! Process when the lock button toggled
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void PaletteViewer::setIsLocked(bool lock)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewType == CLEANUP_PALETTE)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
getPalette()->setIsLocked(lock);
|
|
Toshihiro Shimizu |
890ddd |
getPalette()->setDirtyFlag(true);
|
|
Toshihiro Shimizu |
890ddd |
m_pageViewer->updateCommandLocks();
|
|
Toshihiro Shimizu |
890ddd |
//notify for updating the style editor
|
|
Toshihiro Shimizu |
890ddd |
m_paletteHandle->notifyPaletteLockChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|