Added menu item 'Toggle Edit in Place' (with small modification) (#306)

* Added menu item 'Toggle Edit in Place'.

This readds the ability to edit Sub-XSheets in place. The menu item has to be
added to the menu of a room, before it can be used.

* small modification
This commit is contained in:
shun-iwasawa 2016-05-17 17:46:32 +09:00 committed by Shinya Kitaoka
parent 14c02ece7f
commit c6c5ac3d45
5 changed files with 29 additions and 0 deletions

View file

@ -23,6 +23,7 @@
<command>MI_LoadSubSceneFile</command>
<command>MI_CloneChild</command>
<command>MI_ExplodeChild</command>
<command>MI_ToggleEditInPlace</command>
</menu>
<menu title="Levels">
<command>MI_LoadLevel</command>

View file

@ -33,5 +33,6 @@
#define MI_CloseChild "MI_CloseChild"
#define MI_Collapse "MI_Collapse"
#define MI_ExplodeChild "MI_ExplodeChild"
#define MI_ToggleEditInPlace "MI_ToggleEditInPlace"
#endif

View file

@ -1685,6 +1685,7 @@ void MainWindow::defineActions()
createMenuXsheetAction(MI_CloseChild, tr("&Close Sub-xsheet"), "");
createMenuXsheetAction(MI_ExplodeChild, tr("Explode Sub-xsheet"), "");
createMenuXsheetAction(MI_Collapse, tr("Collapse"), "");
createMenuXsheetAction(MI_ToggleEditInPlace, tr("Toggle Edit in Place"), "");
createMenuXsheetAction(MI_SaveSubxsheetAs, tr("&Save Sub-xsheet As..."), "");
createMenuXsheetAction(MI_Resequence, tr("Resequence"), "");
createMenuXsheetAction(MI_CloneChild, tr("Clone Sub-xsheet"), "");

View file

@ -876,6 +876,7 @@ QMenuBar* StackedMenuBar::createXsheetMenuBar()
addMenuItem(subxsheetMenu, MI_OpenChild);
addMenuItem(subxsheetMenu, MI_CloseChild);
addMenuItem(subxsheetMenu, MI_Collapse);
addMenuItem(subxsheetMenu, MI_ToggleEditInPlace);
addMenuItem(subxsheetMenu, MI_Resequence);
addMenuItem(subxsheetMenu, MI_SaveSubxsheetAs);
addMenuItem(subxsheetMenu, MI_LoadSubSceneFile);

View file

@ -1091,6 +1091,20 @@ void closeSubXsheet(int dlevel)
//=============================================================================
void toggleEditInPlace()
{
TApp *app = TApp::instance();
ToonzScene *scene = app->getCurrentScene()->getScene();
int ancestorCount = scene->getChildStack()->getAncestorCount();
if (ancestorCount == 0)
return;
scene->getChildStack()->setEditInPlace(!scene->getChildStack()->getEditInPlace());
/*- Notify the change in order to update the viewer -*/
app->instance()->getCurrentXsheet()->notifyXsheetChanged();
}
//=============================================================================
void bringPegbarsInsideChildXsheet(TXsheet *xsh, TXsheet *childXsh)
{
// retrieve all pegbars used from copied columns
@ -2155,6 +2169,17 @@ public:
void execute() { closeSubXsheet(1); }
} closeChildCommand;
//=============================================================================
// ToggleEditInPlaceCommand
//-----------------------------------------------------------------------------
class ToggleEditInPlaceCommand : public MenuItemHandler
{
public:
ToggleEditInPlaceCommand() : MenuItemHandler(MI_ToggleEditInPlace) {}
void execute() { toggleEditInPlace(); }
} toggleEditInPlaceCommand;
//=============================================================================
// collapseColumns
//-----------------------------------------------------------------------------