|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "sceneviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "sceneviewercontextmenu.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Toonz includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tapp.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "menubarcommandids.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "onionskinmaskgui.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzTools includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/toolhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/toolcommandids.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/strokeselection.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/menubarcommand.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/viewcommandids.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/selection.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/imageutils.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheethandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcolumnhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tframehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tobjecthandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjecttree.h"
|
|
Jeremy Bullock |
aeafbe |
#include "toonz/tscenehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshcolumn.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjectspline.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tstageobjectid.h"
|
|
shun-iwasawa |
0c0a0a |
#include "toonz/preferences.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qmenu></qmenu>
|
|
Toshihiro Shimizu |
890ddd |
#include <qcontextmenuevent></qcontextmenuevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qsignalmapper></qsignalmapper>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ccd505 |
static void addShowHideStageObjectCmd(QMenu *menu, const TStageObjectId &id,
|
|
Campbell Barton |
ccd505 |
bool isShow) {
|
|
Shinya Kitaoka |
120a6e |
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
|
Shinya Kitaoka |
120a6e |
TStageObject *pegbar = xsh->getStageObject(id);
|
|
Shinya Kitaoka |
120a6e |
QString cmdStr;
|
|
Shinya Kitaoka |
120a6e |
if (id.isCamera())
|
|
Shinya Kitaoka |
120a6e |
cmdStr = (isShow ? "Show " : "Hide ") +
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdString(pegbar->getName());
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
cmdStr = (isShow ? "Show Column" : "Hide Column") +
|
|
Shinya Kitaoka |
120a6e |
QString::fromStdString(pegbar->getName());
|
|
Shinya Kitaoka |
120a6e |
QAction *showHideAction = new QAction(cmdStr, menu);
|
|
Shinya Kitaoka |
120a6e |
showHideAction->setData((int)id.getCode());
|
|
Shinya Kitaoka |
120a6e |
menu->addAction(showHideAction);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ccd505 |
static void onShowHideSelectObject(QAction *action) {
|
|
Shinya Kitaoka |
120a6e |
TApp *app = TApp::instance();
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId id;
|
|
Shinya Kitaoka |
120a6e |
id.setCode(action->data().toInt());
|
|
Shinya Kitaoka |
120a6e |
if (id == TStageObjectId::NoneId) return;
|
|
Shinya Kitaoka |
120a6e |
if (action->text().startsWith("Show ") ||
|
|
Shinya Kitaoka |
120a6e |
action->text().startsWith("Hide ")) {
|
|
Shinya Kitaoka |
120a6e |
if (id.isColumn()) {
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentXsheet()
|
|
Shinya Kitaoka |
120a6e |
->getXsheet()
|
|
Shinya Kitaoka |
120a6e |
->getColumn(id.getIndex())
|
|
Shinya Kitaoka |
120a6e |
->setCamstandVisible(action->text().startsWith("Show "));
|
|
Shinya Kitaoka |
120a6e |
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (action->text().startsWith("Select ")) {
|
|
Shinya Kitaoka |
120a6e |
if (id.isColumn()) {
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentColumn()->setColumnIndex(id.getIndex());
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentObject()->setObjectId(id);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentObject()->setObjectId(id);
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentTool()->setTool(T_Edit);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ccd505 |
static int addShowHideStageObjectCmds(const std::vector<int> &columnIndexes,</int>
|
|
Shinya Kitaoka |
120a6e |
QMenu *menu, bool isShow) {
|
|
Shinya Kitaoka |
120a6e |
int ii, columnIndex = -1;
|
|
Shinya Kitaoka |
120a6e |
bool flag = true;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
for (ii = columnIndexes.size() - 1; ii >= 0; ii--) {
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId id = TStageObjectId::ColumnId(columnIndexes[ii]);
|
|
Shinya Kitaoka |
120a6e |
TXshColumn *col =
|
|
Shinya Kitaoka |
120a6e |
TApp::instance()->getCurrentXsheet()->getXsheet()->getColumn(
|
|
Shinya Kitaoka |
120a6e |
columnIndexes[ii]);
|
|
Shinya Kitaoka |
120a6e |
if (!col) continue;
|
|
Shinya Kitaoka |
120a6e |
if (!isShow && col->isCamstandVisible()) {
|
|
Shinya Kitaoka |
120a6e |
if (columnIndex == -1) columnIndex = columnIndexes[ii];
|
|
Shinya Kitaoka |
120a6e |
if (flag) {
|
|
Shinya Kitaoka |
120a6e |
menu->addSeparator();
|
|
Shinya Kitaoka |
120a6e |
flag = false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
addShowHideStageObjectCmd(menu, id, false);
|
|
Shinya Kitaoka |
120a6e |
} else if (isShow && !col->isCamstandVisible()) {
|
|
Shinya Kitaoka |
120a6e |
if (flag) {
|
|
Shinya Kitaoka |
120a6e |
menu->addSeparator();
|
|
Shinya Kitaoka |
120a6e |
flag = false;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
addShowHideStageObjectCmd(menu, id, true);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
return columnIndex;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
|
|
Shinya Kitaoka |
120a6e |
: QMenu(parent), m_viewer(parent), m_groupIndexToBeEntered(-1) {
|
|
Shinya Kitaoka |
120a6e |
TApp *app = TApp::instance();
|
|
Shinya Kitaoka |
120a6e |
bool isEditingLevel = app->getCurrentFrame()->isEditingLevel();
|
|
Shinya Kitaoka |
120a6e |
bool ret = true;
|
|
Shinya Kitaoka |
120a6e |
QAction *action = 0;
|
|
Shinya Kitaoka |
120a6e |
CommandManager *commandManager = CommandManager::instance();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- サブカメラの消去 -*/
|
|
Shinya Kitaoka |
120a6e |
if (parent->isEditPreviewSubcamera()) {
|
|
Shinya Kitaoka |
120a6e |
action = addAction(tr("Reset Subcamera"));
|
|
Shinya Kitaoka |
120a6e |
ret =
|
|
Shinya Kitaoka |
120a6e |
ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(doDeleteSubCamera()));
|
|
Shinya Kitaoka |
120a6e |
addSeparator();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// tool
|
|
Shinya Kitaoka |
120a6e |
TTool *tool = app->getCurrentTool()->getTool();
|
|
Shinya Kitaoka |
120a6e |
if (tool && tool->isEnabled()) tool->addContextMenuItems(this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// fullscreen
|
|
Shinya Kitaoka |
120a6e |
if (ImageUtils::FullScreenWidget *fsWidget =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<imageutils::fullscreenwidget *="">(</imageutils::fullscreenwidget>
|
|
Shinya Kitaoka |
120a6e |
m_viewer->parentWidget())) {
|
|
Shinya Kitaoka |
120a6e |
bool isFullScreen = (fsWidget->windowState() & Qt::WindowFullScreen) != 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
action =
|
|
Shinya Kitaoka |
120a6e |
commandManager->createAction(V_ShowHideFullScreen, this, !isFullScreen);
|
|
Shinya Kitaoka |
120a6e |
addAction(action);
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), fsWidget,
|
|
Shinya Kitaoka |
120a6e |
SLOT(toggleFullScreen()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// swap compared
|
|
Shinya Kitaoka |
120a6e |
if (parent->canSwapCompared()) {
|
|
Shinya Kitaoka |
120a6e |
action = addAction(tr("Swap Compared Images"));
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(swapCompared()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// reset
|
|
Shinya Kitaoka |
120a6e |
action = commandManager->createAction(V_ZoomReset, this);
|
|
Shinya Kitaoka |
120a6e |
addAction(action);
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(resetSceneViewer()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (!isEditingLevel) {
|
|
Shinya Kitaoka |
120a6e |
// fit camera
|
|
Shinya Kitaoka |
120a6e |
action = commandManager->createAction(V_ZoomFit, this);
|
|
Shinya Kitaoka |
120a6e |
addAction(action);
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(fitToCamera()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// actual pixel size
|
|
Shinya Kitaoka |
120a6e |
action = commandManager->createAction(V_ActualPixelSize, this);
|
|
Shinya Kitaoka |
120a6e |
addAction(action);
|
|
Shinya Kitaoka |
120a6e |
ret =
|
|
Shinya Kitaoka |
120a6e |
ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(setActualPixelSize()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// onion skin
|
|
Shinya Kitaoka |
120a6e |
if (Preferences::instance()->isOnionSkinEnabled() &&
|
|
Shinya Kitaoka |
120a6e |
!parent->isPreviewEnabled())
|
|
Shinya Kitaoka |
120a6e |
OnioniSkinMaskGUI::addOnionSkinCommand(this);
|
|
Shinya Kitaoka |
120a6e |
|
|
Jeremy Bullock |
4f05fc |
// Zero Thick
|
|
Jeremy Bullock |
c3ae24 |
if (!parent->isPreviewEnabled())
|
|
Jeremy Bullock |
c3ae24 |
ZeroThickToggleGui::addZeroThickCommand(this);
|
|
Jeremy Bullock |
c3ae24 |
|
|
Shinya Kitaoka |
120a6e |
// preview
|
|
Shinya Kitaoka |
120a6e |
if (parent->isPreviewEnabled()) {
|
|
Shinya Kitaoka |
120a6e |
addSeparator();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// save previewed frames
|
|
Shinya Kitaoka |
120a6e |
action = addAction(tr("Save Previewed Frames"));
|
|
Shinya Kitaoka |
120a6e |
action->setShortcut(QKeySequence(
|
|
Shinya Kitaoka |
120a6e |
CommandManager::instance()->getKeyFromId(MI_SavePreviewedFrames)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), this,
|
|
Shinya Kitaoka |
120a6e |
SLOT(savePreviewedFrames()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// regenerate preview
|
|
Shinya Kitaoka |
120a6e |
action = addAction(tr("Regenerate Preview"));
|
|
Shinya Kitaoka |
120a6e |
action->setShortcut(QKeySequence(
|
|
Shinya Kitaoka |
120a6e |
CommandManager::instance()->getKeyFromId(MI_RegeneratePreview)));
|
|
Shinya Kitaoka |
120a6e |
ret =
|
|
Shinya Kitaoka |
120a6e |
ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()), SLOT(regeneratePreview()));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// regenerate frame preview
|
|
Shinya Kitaoka |
120a6e |
action = addAction(tr("Regenerate Frame Preview"));
|
|
Shinya Kitaoka |
120a6e |
action->setShortcut(QKeySequence(
|
|
Shinya Kitaoka |
120a6e |
CommandManager::instance()->getKeyFromId(MI_RegenerateFramePr)));
|
|
Shinya Kitaoka |
120a6e |
ret = ret &&
|
|
Shinya Kitaoka |
120a6e |
parent->connect(action, SIGNAL(triggered()),
|
|
Shinya Kitaoka |
120a6e |
SLOT(regeneratePreviewFrame()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
SceneViewerContextMenu::~SceneViewerContextMenu() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::addEnterGroupCommands(const TPointD &pos) {
|
|
Shinya Kitaoka |
120a6e |
bool ret = true;
|
|
Shinya Kitaoka |
120a6e |
TVectorImageP vi = (TVectorImageP)TTool::getImage(false);
|
|
Shinya Kitaoka |
120a6e |
if (!vi) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (vi->isInsideGroup() > 0) {
|
|
Shinya Kitaoka |
120a6e |
addAction(CommandManager::instance()->getAction(MI_ExitGroup));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
StrokeSelection *ss =
|
|
Shinya Kitaoka |
120a6e |
dynamic_cast<strokeselection *="">(TSelection::getCurrent());</strokeselection>
|
|
Shinya Kitaoka |
120a6e |
if (!ss) return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < vi->getStrokeCount(); i++)
|
|
Shinya Kitaoka |
120a6e |
if (ss->isSelected(i) && vi->canEnterGroup(i)) {
|
|
Shinya Kitaoka |
120a6e |
m_groupIndexToBeEntered = i;
|
|
Shinya Kitaoka |
120a6e |
addAction(CommandManager::instance()->getAction(MI_EnterGroup));
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(ret);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
ccd505 |
static QString getName(TStageObject *obj) {
|
|
Shinya Kitaoka |
120a6e |
return QString::fromStdString(obj->getFullName());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::addShowHideCommand(QMenu *menu,
|
|
Shinya Kitaoka |
120a6e |
TXshColumn *column) {
|
|
Shinya Kitaoka |
120a6e |
bool isHidden = !column->isCamstandVisible();
|
|
Shinya Kitaoka |
120a6e |
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
|
Shinya Kitaoka |
120a6e |
TStageObject *stageObject =
|
|
Shinya Kitaoka |
120a6e |
xsh->getStageObject(TStageObjectId::ColumnId(column->getIndex()));
|
|
Xelloss |
6a7ff2 |
QString text = (isHidden ? tr("Show ") : tr("Hide ")) + getName(stageObject);
|
|
Shinya Kitaoka |
120a6e |
QAction *action = new QAction(text, this);
|
|
Shinya Kitaoka |
120a6e |
action->setData(column->getIndex());
|
|
Shinya Kitaoka |
120a6e |
connect(action, SIGNAL(triggered()), this, SLOT(onShowHide()));
|
|
Shinya Kitaoka |
120a6e |
menu->addAction(action);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::addSelectCommand(QMenu *menu,
|
|
Shinya Kitaoka |
120a6e |
const TStageObjectId &id) {
|
|
Shinya Kitaoka |
120a6e |
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
|
Shinya Kitaoka |
120a6e |
TStageObject *stageObject = xsh->getStageObject(id);
|
|
Shinya Kitaoka |
120a6e |
if (!stageObject) return;
|
|
Shinya Kitaoka |
120a6e |
QString text = getName(stageObject);
|
|
Xelloss |
6a7ff2 |
if (menu == this) text = tr("Select ") + text;
|
|
Shinya Kitaoka |
120a6e |
QAction *action = new QAction(text, this);
|
|
Shinya Kitaoka |
120a6e |
action->setData(id.getCode());
|
|
Shinya Kitaoka |
120a6e |
connect(action, SIGNAL(triggered()), this, SLOT(onSetCurrent()));
|
|
Shinya Kitaoka |
120a6e |
menu->addAction(action);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::addLevelCommands(std::vector<int> &indices) {</int>
|
|
Shinya Kitaoka |
120a6e |
addSeparator();
|
|
Shinya Kitaoka |
120a6e |
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId currentId =
|
|
Shinya Kitaoka |
120a6e |
TApp::instance()->getCurrentObject()->getObjectId();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- Xsheet内の、空でないColumnを登録 -*/
|
|
Shinya Kitaoka |
120a6e |
std::vector<txshcolumn *=""> columns;</txshcolumn>
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < (int)indices.size(); i++) {
|
|
Shinya Kitaoka |
120a6e |
if (xsh->isColumnEmpty(indices[i])) continue;
|
|
Shinya Kitaoka |
120a6e |
TXshColumn *column = xsh->getColumn(indices[i]);
|
|
Shinya Kitaoka |
120a6e |
if (column) {
|
|
Shinya Kitaoka |
120a6e |
columns.push_back(column);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (!columns.empty()) {
|
|
Shinya Kitaoka |
120a6e |
// show/hide
|
|
Shinya Kitaoka |
120a6e |
if (columns.size() > 1) {
|
|
Xelloss |
6a7ff2 |
QMenu *subMenu = addMenu(tr("Show / Hide"));
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < (int)columns.size(); i++)
|
|
Shinya Kitaoka |
120a6e |
addShowHideCommand(subMenu, columns[i]);
|
|
Shinya Kitaoka |
120a6e |
} else
|
|
Shinya Kitaoka |
120a6e |
addShowHideCommand(this, columns[0]);
|
|
Shinya Kitaoka |
120a6e |
addSeparator();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// selection
|
|
Shinya Kitaoka |
120a6e |
/*
|
|
Shinya Kitaoka |
120a6e |
if(selectableColumns.size()==1)
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
addSelectCommand(this,
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId::ColumnId(selectableColumns[0]->getIndex()));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
else
|
|
Shinya Kitaoka |
120a6e |
*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- Scene内の全Objectを選択可能にする --*/
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId id;
|
|
Shinya Kitaoka |
120a6e |
QMenu *cameraMenu = addMenu(tr("Select Camera"));
|
|
Shinya Kitaoka |
120a6e |
QMenu *pegbarMenu = addMenu(tr("Select Pegbar"));
|
|
Shinya Kitaoka |
120a6e |
QMenu *columnMenu = addMenu(tr("Select Column"));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool flag = false;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < xsh->getStageObjectTree()->getStageObjectCount(); i++) {
|
|
Shinya Kitaoka |
120a6e |
id = xsh->getStageObjectTree()->getStageObject(i)->getId();
|
|
Shinya Kitaoka |
120a6e |
if (id.isColumn()) {
|
|
Shinya Kitaoka |
120a6e |
int columnIndex = id.getIndex();
|
|
Shinya Kitaoka |
120a6e |
if (xsh->isColumnEmpty(columnIndex))
|
|
Shinya Kitaoka |
120a6e |
continue;
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
addSelectCommand(columnMenu, id);
|
|
Shinya Kitaoka |
120a6e |
flag = true;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} else if (id.isTable())
|
|
Shinya Kitaoka |
120a6e |
addSelectCommand(this, id);
|
|
Shinya Kitaoka |
120a6e |
else if (id.isCamera())
|
|
Shinya Kitaoka |
120a6e |
addSelectCommand(cameraMenu, id);
|
|
Shinya Kitaoka |
120a6e |
else if (id.isPegbar())
|
|
Shinya Kitaoka |
120a6e |
addSelectCommand(pegbarMenu, id);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- カラムがひとつも無かったらDisable -*/
|
|
Shinya Kitaoka |
120a6e |
if (!flag) columnMenu->setEnabled(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::enterVectorImageGroup() {
|
|
Shinya Kitaoka |
120a6e |
if (m_groupIndexToBeEntered == -1) return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TVectorImageP vi =
|
|
Shinya Kitaoka |
120a6e |
(TVectorImageP)TTool::getImage(false); // getCurrentImage();
|
|
Shinya Kitaoka |
120a6e |
if (!vi) return;
|
|
Shinya Kitaoka |
120a6e |
vi->enterGroup(m_groupIndexToBeEntered);
|
|
Shinya Kitaoka |
120a6e |
TSelection *selection = TSelection::getCurrent();
|
|
Shinya Kitaoka |
120a6e |
if (selection) selection->selectNone();
|
|
Shinya Kitaoka |
120a6e |
m_viewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::exitVectorImageGroup() {
|
|
Shinya Kitaoka |
120a6e |
TVectorImageP vi =
|
|
Shinya Kitaoka |
120a6e |
(TVectorImageP)TTool::getImage(false); // getCurrentImage();
|
|
Shinya Kitaoka |
120a6e |
if (!vi) return;
|
|
Shinya Kitaoka |
120a6e |
vi->exitGroup();
|
|
Shinya Kitaoka |
120a6e |
m_viewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::onShowHide() {
|
|
Shinya Kitaoka |
120a6e |
int columnIndex = qobject_cast<qaction *="">(sender())->data().toInt();</qaction>
|
|
Shinya Kitaoka |
120a6e |
TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();
|
|
Shinya Kitaoka |
120a6e |
TXshColumn *column = xsheetHandle->getXsheet()->getColumn(columnIndex);
|
|
Shinya Kitaoka |
120a6e |
if (column) {
|
|
Shinya Kitaoka |
120a6e |
column->setCamstandVisible(!column->isCamstandVisible());
|
|
Shinya Kitaoka |
120a6e |
xsheetHandle->notifyXsheetChanged();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::onSetCurrent() {
|
|
Shinya Kitaoka |
120a6e |
TStageObjectId id;
|
|
Shinya Kitaoka |
120a6e |
id.setCode(qobject_cast<qaction *="">(sender())->data().toUInt());</qaction>
|
|
Shinya Kitaoka |
120a6e |
TApp *app = TApp::instance();
|
|
Shinya Kitaoka |
120a6e |
if (id.isColumn()) {
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentColumn()->setColumnIndex(id.getIndex());
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentObject()->setObjectId(id);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentObject()->setObjectId(id);
|
|
Shinya Kitaoka |
120a6e |
app->getCurrentTool()->setTool(T_Edit);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void SceneViewerContextMenu::savePreviewedFrames() {
|
|
Shinya Kitaoka |
120a6e |
Previewer::instance(m_viewer->getPreviewMode() ==
|
|
Shinya Kitaoka |
120a6e |
SceneViewer::SUBCAMERA_PREVIEW)
|
|
Shinya Kitaoka |
120a6e |
->saveRenderedFrames();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
class ZeroThickToggle : public MenuItemHandler {
|
|
Jeremy Bullock |
aeafbe |
public:
|
|
Jeremy Bullock |
aeafbe |
ZeroThickToggle() : MenuItemHandler(MI_ZeroThick) {}
|
|
Jeremy Bullock |
aeafbe |
void execute() {
|
|
Jeremy Bullock |
aeafbe |
QAction *action = CommandManager::instance()->getAction(MI_ZeroThick);
|
|
Jeremy Bullock |
aeafbe |
if (!action)
|
|
Jeremy Bullock |
aeafbe |
return;
|
|
Jeremy Bullock |
aeafbe |
bool checked = action->isChecked();
|
|
Jeremy Bullock |
aeafbe |
enableZeroThick(checked);
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
static void enableZeroThick(bool enable = true) {
|
|
Jeremy Bullock |
aeafbe |
Preferences::instance()->setShow0ThickLines(enable);
|
|
Jeremy Bullock |
aeafbe |
TApp::instance()->getCurrentScene()->notifySceneChanged();
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
} ZeroThickToggle;
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
void ZeroThickToggleGui::addZeroThickCommand(QMenu *menu) {
|
|
Jeremy Bullock |
aeafbe |
static ZeroThickToggleHandler switcher;
|
|
Jeremy Bullock |
aeafbe |
if (Preferences::instance()->getShow0ThickLines()) {
|
|
Jeremy Bullock |
aeafbe |
QAction *hideZeroThick = menu->addAction(QString(QObject::tr("Hide Zero Thickness Lines")));
|
|
Jeremy Bullock |
aeafbe |
menu->connect(hideZeroThick, SIGNAL(triggered()),
|
|
Jeremy Bullock |
aeafbe |
&switcher, SLOT(deactivate()));
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
else {
|
|
Jeremy Bullock |
aeafbe |
QAction *showZeroThick = menu->addAction(QString(QObject::tr("Show Zero Thickness Lines")));
|
|
Jeremy Bullock |
aeafbe |
menu->connect(showZeroThick, SIGNAL(triggered()),
|
|
Jeremy Bullock |
aeafbe |
&switcher, SLOT(activate()));
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
void ZeroThickToggleGui::ZeroThickToggleHandler::activate() {
|
|
Jeremy Bullock |
aeafbe |
ZeroThickToggle::enableZeroThick(true);
|
|
Jeremy Bullock |
aeafbe |
}
|
|
Jeremy Bullock |
aeafbe |
|
|
Jeremy Bullock |
aeafbe |
void ZeroThickToggleGui::ZeroThickToggleHandler::deactivate() {
|
|
Jeremy Bullock |
aeafbe |
ZeroThickToggle::enableZeroThick(false);
|
|
Jeremy Bullock |
aeafbe |
}
|