From a21b0609215bae0fa2f0a60cc1dc9eb4d91a3b1a Mon Sep 17 00:00:00 2001 From: manongjohn Date: Jun 20 2018 03:09:22 +0000 Subject: Timeline UI Update (#1990) * Timeline Display Updates and other fixes --- diff --git a/stuff/config/qss/Blue/Blue.qss b/stuff/config/qss/Blue/Blue.qss index 3bfcd12..5d13b02 100644 --- a/stuff/config/qss/Blue/Blue.qss +++ b/stuff/config/qss/Blue/Blue.qss @@ -1715,6 +1715,9 @@ XsheetViewer { qproperty-MeshColumnColor: #684D86; qproperty-MeshColumnBorderColor: #BA92EF; qproperty-SelectedMeshColumnColor: #82689e; + qproperty-SoundTextColumnColor: #c8c8c8; + qproperty-SoundTextColumnBorderColor: #8c8c8c; + qproperty-SelectedSoundTextColumnColor: #e2e2e2; qproperty-SoundColumnColor: #657456; qproperty-SoundColumnBorderColor: #A0AF7D; qproperty-SelectedSoundColumnColor: #7e8b72; @@ -1759,8 +1762,11 @@ XsheetViewer { qproperty-TimelineConfigButtonBgColor: rgba(255, 255, 255, 0); qproperty-TimelineConfigButtonImage: url('../Default/imgs/white/timeline_config.svg'); qproperty-LayerHeaderPreviewImage: url('../Default/imgs/white/layer_header_prev_eye.svg'); + qproperty-LayerHeaderPreviewOverImage: url('../Default/imgs/white/layer_header_prev_eye_over.svg'); qproperty-LayerHeaderCamstandImage: url('../Default/imgs/white/layer_header_table_view.svg'); + qproperty-LayerHeaderCamstandOverImage: url('../Default/imgs/white/layer_header_table_view_over.svg'); qproperty-LayerHeaderLockImage: url('../Default/imgs/white/lock_on.svg'); + qproperty-LayerHeaderLockOverImage: url('../Default/imgs/white/lock_on_over.svg'); } /* XSheet Toolbar ----------------------------------------------------------------------------- */ diff --git a/stuff/config/qss/Dark/Dark.qss b/stuff/config/qss/Dark/Dark.qss index dcb7d46..d7677ce 100644 --- a/stuff/config/qss/Dark/Dark.qss +++ b/stuff/config/qss/Dark/Dark.qss @@ -1715,6 +1715,9 @@ XsheetViewer { qproperty-MeshColumnColor: #684D86; qproperty-MeshColumnBorderColor: #BA92EF; qproperty-SelectedMeshColumnColor: #82689e; + qproperty-SoundTextColumnColor: #c8c8c8; + qproperty-SoundTextColumnBorderColor: #8c8c8c; + qproperty-SelectedSoundTextColumnColor: #e2e2e2; qproperty-SoundColumnColor: #657456; qproperty-SoundColumnBorderColor: #A0AF7D; qproperty-SelectedSoundColumnColor: #7e8b72; @@ -1759,8 +1762,11 @@ XsheetViewer { qproperty-TimelineConfigButtonBgColor: rgba(255, 255, 255, 0); qproperty-TimelineConfigButtonImage: url('../Default/imgs/white/timeline_config.svg'); qproperty-LayerHeaderPreviewImage: url('../Default/imgs/white/layer_header_prev_eye.svg'); + qproperty-LayerHeaderPreviewOverImage: url('../Default/imgs/white/layer_header_prev_eye_over.svg'); qproperty-LayerHeaderCamstandImage: url('../Default/imgs/white/layer_header_table_view.svg'); + qproperty-LayerHeaderCamstandOverImage: url('../Default/imgs/white/layer_header_table_view_over.svg'); qproperty-LayerHeaderLockImage: url('../Default/imgs/white/lock_on.svg'); + qproperty-LayerHeaderLockOverImage: url('../Default/imgs/white/lock_on_over.svg'); } /* XSheet Toolbar ----------------------------------------------------------------------------- */ diff --git a/stuff/config/qss/Default/Default.qss b/stuff/config/qss/Default/Default.qss index 2bf819b..9e00571 100644 --- a/stuff/config/qss/Default/Default.qss +++ b/stuff/config/qss/Default/Default.qss @@ -1715,6 +1715,9 @@ XsheetViewer { qproperty-MeshColumnColor: #684D86; qproperty-MeshColumnBorderColor: #BA92EF; qproperty-SelectedMeshColumnColor: #82689e; + qproperty-SoundTextColumnColor: #c8c8c8; + qproperty-SoundTextColumnBorderColor: #8c8c8c; + qproperty-SelectedSoundTextColumnColor: #e2e2e2; qproperty-SoundColumnColor: #657456; qproperty-SoundColumnBorderColor: #A0AF7D; qproperty-SelectedSoundColumnColor: #7e8b72; @@ -1759,8 +1762,11 @@ XsheetViewer { qproperty-TimelineConfigButtonBgColor: rgba(255, 255, 255, 0); qproperty-TimelineConfigButtonImage: url('imgs/white/timeline_config.svg'); qproperty-LayerHeaderPreviewImage: url('imgs/white/layer_header_prev_eye.svg'); + qproperty-LayerHeaderPreviewOverImage: url('imgs/white/layer_header_prev_eye_over.svg'); qproperty-LayerHeaderCamstandImage: url('imgs/white/layer_header_table_view.svg'); + qproperty-LayerHeaderCamstandOverImage: url('imgs/white/layer_header_table_view_over.svg'); qproperty-LayerHeaderLockImage: url('imgs/white/lock_on.svg'); + qproperty-LayerHeaderLockOverImage: url('imgs/white/lock_on_over.svg'); } /* XSheet Toolbar ----------------------------------------------------------------------------- */ diff --git a/stuff/config/qss/Default/imgs/black/layer_header_prev_eye_over.svg b/stuff/config/qss/Default/imgs/black/layer_header_prev_eye_over.svg new file mode 100644 index 0000000..a7cabdc --- /dev/null +++ b/stuff/config/qss/Default/imgs/black/layer_header_prev_eye_over.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/stuff/config/qss/Default/imgs/black/layer_header_table_view_over.svg b/stuff/config/qss/Default/imgs/black/layer_header_table_view_over.svg new file mode 100644 index 0000000..fc9c7c0 --- /dev/null +++ b/stuff/config/qss/Default/imgs/black/layer_header_table_view_over.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/stuff/config/qss/Default/imgs/black/lock_on_over.svg b/stuff/config/qss/Default/imgs/black/lock_on_over.svg new file mode 100644 index 0000000..dc79c66 --- /dev/null +++ b/stuff/config/qss/Default/imgs/black/lock_on_over.svg @@ -0,0 +1,67 @@ + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/stuff/config/qss/Default/imgs/white/layer_header_prev_eye_over.svg b/stuff/config/qss/Default/imgs/white/layer_header_prev_eye_over.svg new file mode 100644 index 0000000..a7cabdc --- /dev/null +++ b/stuff/config/qss/Default/imgs/white/layer_header_prev_eye_over.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/stuff/config/qss/Default/imgs/white/layer_header_table_view_over.svg b/stuff/config/qss/Default/imgs/white/layer_header_table_view_over.svg new file mode 100644 index 0000000..fc9c7c0 --- /dev/null +++ b/stuff/config/qss/Default/imgs/white/layer_header_table_view_over.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/stuff/config/qss/Default/imgs/white/lock_on_over.svg b/stuff/config/qss/Default/imgs/white/lock_on_over.svg new file mode 100644 index 0000000..dc79c66 --- /dev/null +++ b/stuff/config/qss/Default/imgs/white/lock_on_over.svg @@ -0,0 +1,67 @@ + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/stuff/config/qss/Default/less/Default.less b/stuff/config/qss/Default/less/Default.less index 48a4676..90824cc 100644 --- a/stuff/config/qss/Default/less/Default.less +++ b/stuff/config/qss/Default/less/Default.less @@ -361,6 +361,10 @@ @xsheet-MeshColumnBorder-color: #BA92EF; @xsheet-SelectedMeshColumn-color: lighten(desaturate(@xsheet-MeshColumn-color, 5), 10); +@xsheet-SoundTextColumn-color: #c8c8c8; +@xsheet-SoundTextColumnBorder-color: #8c8c8c; +@xsheet-SelectedSoundTextColumn-color: lighten(desaturate(@xsheet-SoundTextColumn-color, 5), 10); + @xsheet-SoundColumn-color: #657456; @xsheet-SoundColumnBorder-color: #A0AF7D; @xsheet-SelectedSoundColumn-color: lighten(desaturate(@xsheet-SoundColumn-color, 5), 10); @@ -419,9 +423,11 @@ @timeline-ConfigButtonImage: 'timeline_config.svg'; @layerheader-PreviewImage: 'layer_header_prev_eye.svg'; +@layerheader-PreviewOverImage: 'layer_header_prev_eye_over.svg'; @layerheader-CamstandImage: 'layer_header_table_view.svg'; +@layerheader-CamstandOverImage: 'layer_header_table_view_over.svg'; @layerheader-LockImage: 'lock_on.svg'; - +@layerheader-LockOverImage: 'lock_on_over.svg'; // ----------------------------------------------------------------------------- // Function Editor // ----------------------------------------------------------------------------- diff --git a/stuff/config/qss/Default/less/layouts/xsheet.less b/stuff/config/qss/Default/less/layouts/xsheet.less index 1b59c1f..a616d97 100644 --- a/stuff/config/qss/Default/less/layouts/xsheet.less +++ b/stuff/config/qss/Default/less/layouts/xsheet.less @@ -98,6 +98,10 @@ XsheetViewer { qproperty-MeshColumnBorderColor: @xsheet-MeshColumnBorder-color; qproperty-SelectedMeshColumnColor: @xsheet-SelectedMeshColumn-color; + qproperty-SoundTextColumnColor: @xsheet-SoundTextColumn-color; + qproperty-SoundTextColumnBorderColor: @xsheet-SoundTextColumnBorder-color; + qproperty-SelectedSoundTextColumnColor: @xsheet-SelectedSoundTextColumn-color; + qproperty-SoundColumnColor: @xsheet-SoundColumn-color; qproperty-SoundColumnBorderColor: @xsheet-SoundColumnBorder-color; qproperty-SelectedSoundColumnColor: @xsheet-SelectedSoundColumn-color; @@ -154,8 +158,11 @@ XsheetViewer { qproperty-TimelineConfigButtonImage: url('@{img-url}/@{timeline-ConfigButtonImage}'); qproperty-LayerHeaderPreviewImage: url('@{img-url}/@{layerheader-PreviewImage}'); + qproperty-LayerHeaderPreviewOverImage: url('@{img-url}/@{layerheader-PreviewOverImage}'); qproperty-LayerHeaderCamstandImage: url('@{img-url}/@{layerheader-CamstandImage}'); + qproperty-LayerHeaderCamstandOverImage: url('@{img-url}/@{layerheader-CamstandOverImage}'); qproperty-LayerHeaderLockImage: url('@{img-url}/@{layerheader-LockImage}'); + qproperty-LayerHeaderLockOverImage: url('@{img-url}/@{layerheader-LockOverImage}'); } /* XSheet Toolbar diff --git a/stuff/config/qss/Light/Light.qss b/stuff/config/qss/Light/Light.qss index 1d2c175..efea9e7 100644 --- a/stuff/config/qss/Light/Light.qss +++ b/stuff/config/qss/Light/Light.qss @@ -1716,6 +1716,9 @@ XsheetViewer { qproperty-MeshColumnColor: #ac78d4; qproperty-MeshColumnBorderColor: #6b418c; qproperty-SelectedMeshColumnColor: #c3a2dd; + qproperty-SoundTextColumnColor: #c8c8c8; + qproperty-SoundTextColumnBorderColor: #8c8c8c; + qproperty-SelectedSoundTextColumnColor: #e2e2e2; qproperty-SoundColumnColor: #acba82; qproperty-SoundColumnBorderColor: #656b51; qproperty-SelectedSoundColumnColor: #c0c9a6; @@ -1760,8 +1763,11 @@ XsheetViewer { qproperty-TimelineConfigButtonBgColor: rgba(255, 255, 255, 0); qproperty-TimelineConfigButtonImage: url('../Default/imgs/black/timeline_config.svg'); qproperty-LayerHeaderPreviewImage: url('../Default/imgs/black/layer_header_prev_eye.svg'); + qproperty-LayerHeaderPreviewOverImage: url('../Default/imgs/black/layer_header_prev_eye_over.svg'); qproperty-LayerHeaderCamstandImage: url('../Default/imgs/black/layer_header_table_view.svg'); + qproperty-LayerHeaderCamstandOverImage: url('../Default/imgs/black/layer_header_table_view_over.svg'); qproperty-LayerHeaderLockImage: url('../Default/imgs/black/lock_on.svg'); + qproperty-LayerHeaderLockOverImage: url('../Default/imgs/black/lock_on_over.svg'); } /* XSheet Toolbar ----------------------------------------------------------------------------- */ diff --git a/stuff/profiles/layouts/menubar.xml b/stuff/profiles/layouts/menubar.xml index 3c2d93c..78ff09e 100644 --- a/stuff/profiles/layouts/menubar.xml +++ b/stuff/profiles/layouts/menubar.xml @@ -88,6 +88,7 @@ MI_OpenStyleControl MI_OpenLevelView MI_OpenXshView + MI_OpenTimelineView diff --git a/stuff/profiles/layouts/rooms/Default/layouts.txt b/stuff/profiles/layouts/rooms/Default/layouts.txt index f66b692..473b7c8 100644 --- a/stuff/profiles/layouts/rooms/Default/layouts.txt +++ b/stuff/profiles/layouts/rooms/Default/layouts.txt @@ -1,6 +1,7 @@ room1.ini room2.ini room3.ini +room9.ini room4.ini room5.ini room6.ini diff --git a/stuff/profiles/layouts/rooms/Default/menubar_template.xml b/stuff/profiles/layouts/rooms/Default/menubar_template.xml index 271c58b..06dafa4 100644 --- a/stuff/profiles/layouts/rooms/Default/menubar_template.xml +++ b/stuff/profiles/layouts/rooms/Default/menubar_template.xml @@ -241,6 +241,7 @@ MI_OpenLevelView MI_OpenComboViewer MI_OpenXshView + MI_OpenTimelineView MI_OpenHistoryPanel MI_AudioRecording diff --git a/stuff/profiles/layouts/rooms/Default/room9.ini b/stuff/profiles/layouts/rooms/Default/room9.ini new file mode 100644 index 0000000..9f9cd43 --- /dev/null +++ b/stuff/profiles/layouts/rooms/Default/room9.ini @@ -0,0 +1,23 @@ +[room] +hierarchy="-1 1 [ 5 [ [ 0 6 ] 4 3 1 ] 2 ] " +pane_0\name=StyleEditor +name=Timeline +pane_0\geometry=@Rect(0 30 238 487) +pane_0\isVertical=true +pane_0\visibleParts=15 +pane_0\splitterState=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\0\xa4\0\0\0\xd6\x1\xff\xff\xff\xff\x1\0\0\0\x2\0) +pane_1\name=FilmStrip +pane_1\geometry=@Rect(1660 30 260 681) +pane_2\name=Timeline +pane_2\geometry=@Rect(0 715 1920 278) +pane_2\orientation=LeftToRight +pane_2\frameZoomFactor=100 +pane_3\name=SceneViewer +pane_3\geometry=@Rect(281 30 1375 681) +pane_4\name=ToolBar +pane_4\geometry=@Rect(242 30 35 681) +pane_5\name=ToolOptions +pane_5\geometry=@Rect(0 0 1920 26) +pane_6\name=LevelPalette +pane_6\geometry=@Rect(0 521 238 190) +pane_6\viewtype=0 diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.h index 050a236..05b934e 100644 --- a/toonz/sources/include/orientation.h +++ b/toonz/sources/include/orientation.h @@ -109,15 +109,16 @@ enum class PredefinedRect { FILTER_COLOR, //! where to show layer's filter color CONFIG_AREA, //! clickable area larger than the config icon, containing it CONFIG, //! the config icon itself - FRAME_DOT, //! Cell's frame indicator - FRAME_INDICATOR, //! Row # indicator + FRAME_MARKER_AREA, //! Cell's frame indicator + FRAME_INDICATOR, //! Row # indicator ZOOM_SLIDER_AREA, ZOOM_SLIDER, ZOOM_IN_AREA, ZOOM_IN, ZOOM_OUT_AREA, ZOOM_OUT, - LAYER_FOOTER_PANEL + LAYER_FOOTER_PANEL, + PREVIEW_FRAME_AREA }; enum class PredefinedLine { LOCKED, //! dotted vertical line when cell is locked @@ -144,7 +145,8 @@ enum class PredefinedPath { END_PLAY_RANGE, VOLUME_SLIDER_TRACK, //! slider track VOLUME_SLIDER_HEAD, //! slider head - TIME_INDICATOR_HEAD //! current time indicator head + TIME_INDICATOR_HEAD, //! current time indicator head + FRAME_MARKER_DIAMOND }; enum class PredefinedPoint { KEY_HIDDEN, //! move extender handle that much if key icons are disabled diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 5d42c9b..5d8aacc 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -456,6 +456,11 @@ public: void setLoadedXsheetLayout(std::string layout); QString getLoadedXsheetLayout() const { return m_loadedXsheetLayout; } + void setCurrentColumnData(const TPixel ¤tColumnColor); + void getCurrentColumnData(TPixel ¤tColumnColor) const { + currentColumnColor = m_currentColumnColor; + } + // Animation tab void setKeyframeType(int s); @@ -697,6 +702,8 @@ private: QString m_cursorBrushStyle; bool m_cursorOutlineEnabled = false; + TPixel32 m_currentColumnColor; + private: Preferences(); ~Preferences(); diff --git a/toonz/sources/include/toonzqt/spreadsheetviewer.h b/toonz/sources/include/toonzqt/spreadsheetviewer.h index de65335..0490a62 100644 --- a/toonz/sources/include/toonzqt/spreadsheetviewer.h +++ b/toonz/sources/include/toonzqt/spreadsheetviewer.h @@ -420,7 +420,7 @@ public: return getSelectedCells().contains(QPoint(col, row)); } void setMarkRow(int distance, int offset) { - m_markRowDistance = distance > 0 ? distance : 6; + m_markRowDistance = distance; // distance > 0 ? distance : 6; m_markRowOffset = offset; } void getMarkRow(int &distance, int &offset) const { @@ -428,7 +428,8 @@ public: offset = m_markRowOffset; } int isMarkRow(int row) const { - return (row - m_markRowOffset) % m_markRowDistance == 0; + return m_markRowDistance > 0 && + ((row - m_markRowOffset) % m_markRowDistance) == 0; } void setFrameHandle(TFrameHandle *frameHandle); diff --git a/toonz/sources/toonz/Resources/newmemo.svg b/toonz/sources/toonz/Resources/newmemo.svg index 3388f47..62fb06c 100644 --- a/toonz/sources/toonz/Resources/newmemo.svg +++ b/toonz/sources/toonz/Resources/newmemo.svg @@ -1,23 +1,90 @@ - + - - \ No newline at end of file diff --git a/toonz/sources/toonz/Resources/newmemo_disabled.svg b/toonz/sources/toonz/Resources/newmemo_disabled.svg index f707bac..6189b09 100644 --- a/toonz/sources/toonz/Resources/newmemo_disabled.svg +++ b/toonz/sources/toonz/Resources/newmemo_disabled.svg @@ -1,23 +1,91 @@ - + - - \ No newline at end of file diff --git a/toonz/sources/toonz/Resources/timeline2xsheet.svg b/toonz/sources/toonz/Resources/timeline2xsheet.svg new file mode 100644 index 0000000..502f0f7 --- /dev/null +++ b/toonz/sources/toonz/Resources/timeline2xsheet.svg @@ -0,0 +1,197 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonz/Resources/xsheet2timeline.svg b/toonz/sources/toonz/Resources/xsheet2timeline.svg new file mode 100644 index 0000000..eacdda1 --- /dev/null +++ b/toonz/sources/toonz/Resources/xsheet2timeline.svg @@ -0,0 +1,198 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonz/layerheaderpanel.cpp b/toonz/sources/toonz/layerheaderpanel.cpp index ea630d4..429f096 100644 --- a/toonz/sources/toonz/layerheaderpanel.cpp +++ b/toonz/sources/toonz/layerheaderpanel.cpp @@ -67,12 +67,19 @@ void LayerHeaderPanel::paintEvent(QPaintEvent *event) { QRect rect = QRect(QPoint(0, 0), size()); p.fillRect(rect.adjusted(0, 0, -3, 0), slightlyLighter); - drawIcon(p, PredefinedRect::EYE, boost::none, - m_viewer->getLayerHeaderPreviewImage()); - drawIcon(p, PredefinedRect::PREVIEW_LAYER, boost::none, - m_viewer->getLayerHeaderCamstandImage()); - drawIcon(p, PredefinedRect::LOCK, boost::none, - m_viewer->getLayerHeaderLockImage()); + QImage preview = (m_buttonHighlighted == PreviewButton + ? m_viewer->getLayerHeaderPreviewOverImage() + : m_viewer->getLayerHeaderPreviewImage()); + QImage camstand = (m_buttonHighlighted == CamstandButton + ? m_viewer->getLayerHeaderCamstandOverImage() + : m_viewer->getLayerHeaderCamstandImage()); + QImage lock = (m_buttonHighlighted == LockButton + ? m_viewer->getLayerHeaderLockOverImage() + : m_viewer->getLayerHeaderLockImage()); + + drawIcon(p, PredefinedRect::EYE, boost::none, preview); + drawIcon(p, PredefinedRect::PREVIEW_LAYER, boost::none, camstand); + drawIcon(p, PredefinedRect::LOCK, boost::none, lock); QRect numberRect = o->rect(PredefinedRect::LAYER_NUMBER); @@ -126,6 +133,17 @@ void LayerHeaderPanel::showOrHide(const Orientation *o) { } //----------------------------------------------------------------------------- +void LayerHeaderPanel::enterEvent(QEvent *) { + m_buttonHighlighted = NoButton; + + update(); +} + +void LayerHeaderPanel::leaveEvent(QEvent *) { + m_buttonHighlighted = NoButton; + + update(); +} void LayerHeaderPanel::mousePressEvent(QMouseEvent *event) { const Orientation *o = Orientations::leftToRight(); @@ -156,19 +174,23 @@ void LayerHeaderPanel::mousePressEvent(QMouseEvent *event) { void LayerHeaderPanel::mouseMoveEvent(QMouseEvent *event) { const Orientation *o = Orientations::leftToRight(); - QPoint pos = event->pos(); + QPoint pos = event->pos(); + m_buttonHighlighted = NoButton; // preview button if (o->rect(PredefinedRect::EYE_AREA).contains(pos)) { - m_tooltip = tr("Preview Visbility Toggle All"); + m_tooltip = tr("Preview Visbility Toggle All"); + m_buttonHighlighted = PreviewButton; } // camstand button else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(pos)) { - m_tooltip = tr("Camera Stand Visibility Toggle All"); + m_tooltip = tr("Camera Stand Visibility Toggle All"); + m_buttonHighlighted = CamstandButton; } // lock button else if (o->rect(PredefinedRect::LOCK).contains(pos)) { - m_tooltip = tr("Lock Toggle All"); + m_tooltip = tr("Lock Toggle All"); + m_buttonHighlighted = LockButton; } else { m_tooltip = tr(""); } diff --git a/toonz/sources/toonz/layerheaderpanel.h b/toonz/sources/toonz/layerheaderpanel.h index aa699bd..70adb6f 100644 --- a/toonz/sources/toonz/layerheaderpanel.h +++ b/toonz/sources/toonz/layerheaderpanel.h @@ -18,9 +18,12 @@ class LayerHeaderPanel final : public QWidget { enum { ToggleAllTransparency = 1, ToggleAllPreviewVisible, ToggleAllLock }; + enum { NoButton, PreviewButton, CamstandButton, LockButton }; + int m_doOnRelease; QString m_tooltip; QPoint m_pos; + int m_buttonHighlighted; private: XsheetViewer *m_viewer; @@ -43,6 +46,8 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; + void enterEvent(QEvent *); + void leaveEvent(QEvent *); bool event(QEvent *event) override; private: diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index e20bfdc..9388982 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -2036,6 +2036,7 @@ void MainWindow::defineActions() { createMenuWindowsAction(MI_OpenLineTestView, tr("&LineTest Viewer"), ""); #endif createMenuWindowsAction(MI_OpenXshView, tr("&Xsheet"), ""); + createMenuWindowsAction(MI_OpenTimelineView, tr("&Timeline"), ""); // createAction(MI_TestAnimation, "Test Animation", "Ctrl+Return"); // createAction(MI_Export, "Export", "Ctrl+E"); @@ -2415,9 +2416,9 @@ RecentFiles::~RecentFiles() {} void RecentFiles::addFilePath(QString path, FileType fileType) { QList files = - (fileType == Scene) - ? m_recentScenes - : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; + (fileType == Scene) ? m_recentScenes : (fileType == Level) + ? m_recentLevels + : m_recentFlipbookImages; int i; for (i = 0; i < files.size(); i++) if (files.at(i) == path) files.removeAt(i); @@ -2542,9 +2543,9 @@ void RecentFiles::saveRecentFiles() { QList RecentFiles::getFilesNameList(FileType fileType) { QList files = - (fileType == Scene) - ? m_recentScenes - : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; + (fileType == Scene) ? m_recentScenes : (fileType == Level) + ? m_recentLevels + : m_recentFlipbookImages; QList names; int i; for (i = 0; i < files.size(); i++) { @@ -2571,9 +2572,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) { menu->setEnabled(false); else { CommandId clearActionId = - (fileType == Scene) - ? MI_ClearRecentScene - : (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage; + (fileType == Scene) ? MI_ClearRecentScene : (fileType == Level) + ? MI_ClearRecentLevel + : MI_ClearRecentImage; menu->setActions(names); menu->addSeparator(); QAction *clearAction = CommandManager::instance()->getAction(clearActionId); diff --git a/toonz/sources/toonz/menubar.cpp b/toonz/sources/toonz/menubar.cpp index a353626..9248905 100644 --- a/toonz/sources/toonz/menubar.cpp +++ b/toonz/sources/toonz/menubar.cpp @@ -423,6 +423,7 @@ QMenuBar *StackedMenuBar::createCleanupMenuBar() { addMenuItem(windowsMenu, MI_OpenStyleControl); addMenuItem(windowsMenu, MI_OpenComboViewer); addMenuItem(windowsMenu, MI_OpenXshView); + addMenuItem(windowsMenu, MI_OpenTimelineView); windowsMenu->addSeparator(); QMenu *otherWindowsMenu = windowsMenu->addMenu(tr("Other Windows")); { @@ -593,6 +594,7 @@ QMenuBar *StackedMenuBar::createPltEditMenuBar() { addMenuItem(windowsMenu, MI_OpenLevelView); addMenuItem(windowsMenu, MI_OpenComboViewer); addMenuItem(windowsMenu, MI_OpenXshView); + addMenuItem(windowsMenu, MI_OpenTimelineView); windowsMenu->addSeparator(); QMenu *otherWindowsMenu = windowsMenu->addMenu(tr("Other Windows")); { @@ -765,6 +767,7 @@ QMenuBar *StackedMenuBar::createInknPaintMenuBar() { addMenuItem(windowsMenu, MI_OpenStudioPalette); addMenuItem(windowsMenu, MI_OpenComboViewer); addMenuItem(windowsMenu, MI_OpenXshView); + addMenuItem(windowsMenu, MI_OpenTimelineView); addMenuItem(windowsMenu, MI_OpenColorModel); addMenuItem(windowsMenu, MI_OpenFileBrowser); addMenuItem(windowsMenu, MI_OpenFilmStrip); @@ -947,6 +950,7 @@ QMenuBar *StackedMenuBar::createXsheetMenuBar() { addMenuItem(windowsMenu, MI_OpenFilmStrip); addMenuItem(windowsMenu, MI_OpenLevelView); addMenuItem(windowsMenu, MI_OpenXshView); + addMenuItem(windowsMenu, MI_OpenTimelineView); windowsMenu->addSeparator(); QMenu *otherWindowsMenu = windowsMenu->addMenu(tr("Other Windows")); { @@ -1362,6 +1366,7 @@ QMenuBar *StackedMenuBar::createFullMenuBar() { addMenuItem(windowsMenu, MI_OpenLevelView); addMenuItem(windowsMenu, MI_OpenComboViewer); addMenuItem(windowsMenu, MI_OpenXshView); + addMenuItem(windowsMenu, MI_OpenTimelineView); addMenuItem(windowsMenu, MI_OpenHistoryPanel); addMenuItem(windowsMenu, MI_AudioRecording); windowsMenu->addSeparator(); diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index 9b2bf5d..09ec119 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -108,6 +108,7 @@ #define MI_Binarize "MI_Binarize" #define MI_LinesFade "MI_LinesFade" #define MI_OpenXshView "MI_OpenXshView" +#define MI_OpenTimelineView "MI_OpenTimelineView" #define MI_OpenMessage "MI_OpenMessage" #define MI_OpenTest "MI_OpenTest" #define MI_OpenTasks "MI_OpenTasks" @@ -228,6 +229,7 @@ #define MI_OpenFunctionEditor "MI_OpenFunctionEditor" #define MI_OpenLevelView "MI_OpenLevelView" #define MI_OpenXshView "MI_OpenXshView" +#define MI_OpenTimelineView "MI_OpenTimelineView" #define MI_OpenCleanupSettings "MI_OpenCleanupSettings" #define MI_ResetRoomLayout "MI_ResetRoomLayout" #define MI_MaximizePanel "MI_MaximizePanel" diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index f029b46..5808025 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1193,6 +1193,14 @@ void PreferencesPopup::onCursorOutlineChanged(int index) { m_pref->enableCursorOutline(index == Qt::Checked); } +//--------------------------------------------------------------------------------------- + +void PreferencesPopup::onCurrentColumnDataChanged(const TPixel32 &, + bool isDragging) { + if (isDragging) return; + m_pref->setCurrentColumnData(m_currentColumnColor->getColor()); +} + //********************************************************************************** // PrefencesPopup's constructor //********************************************************************************** @@ -1456,6 +1464,10 @@ PreferencesPopup::PreferencesPopup() new QLabel(tr("* Changes will take effect the next time you run Toonz")); note_xsheet->setStyleSheet("font-size: 10px; font: italic;"); + TPixel32 currectColumnColor; + m_pref->getCurrentColumnData(currectColumnColor); + m_currentColumnColor = new ColorField(this, false, currectColumnColor); + //--- Animation ------------------------------ categoryList->addItem(tr("Animation")); @@ -2411,6 +2423,10 @@ PreferencesPopup::PreferencesPopup() xsheetFrameLay->addWidget(showColumnNumbersCB, 12, 0, 1, 2); xsheetFrameLay->addWidget(m_syncLevelRenumberWithXsheet, 13, 0, 1, 2); xsheetFrameLay->addWidget(showCurrentTimelineCB, 14, 0, 1, 2); + + xsheetFrameLay->addWidget(new QLabel(tr("Current Column Color:")), 15, + 0, Qt::AlignRight | Qt::AlignVCenter); + xsheetFrameLay->addWidget(m_currentColumnColor, 15, 1); } xsheetFrameLay->setColumnStretch(0, 0); xsheetFrameLay->setColumnStretch(1, 0); @@ -2849,6 +2865,11 @@ PreferencesPopup::PreferencesPopup() ret = ret && connect(m_xsheetLayout, SIGNAL(currentIndexChanged(int)), this, SLOT(onXsheetLayoutChanged(int))); + ret = + ret && connect(m_currentColumnColor, + SIGNAL(colorChanged(const TPixel32 &, bool)), + SLOT(onCurrentColumnDataChanged(const TPixel32 &, bool))); + //--- Animation ---------------------- ret = ret && connect(m_keyframeType, SIGNAL(currentIndexChanged(int)), SLOT(onKeyframeTypeChanged(int))); diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index 566dad4..474e230 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -89,6 +89,8 @@ private: QGroupBox *m_autoSaveGroup, *m_showXSheetToolbar, *m_colorCalibration; + DVGui::ColorField *m_currentColumnColor; + private: // QWidget* create(const QString& lbl, bool def, const char* slot); void rebuildFormatsList(); @@ -211,6 +213,7 @@ private slots: void onCursorBrushTypeChanged(int index); void onCursorBrushStyleChanged(int index); void onCursorOutlineChanged(int); + void onCurrentColumnDataChanged(const TPixel32 &, bool isDragging); }; //********************************************************************************** diff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrc index 083e9c3..13c887d 100644 --- a/toonz/sources/toonz/toonz.qrc +++ b/toonz/sources/toonz/toonz.qrc @@ -463,5 +463,7 @@ Resources/colorchiporder_leftup.svg Resources/colorchiporder_lowleft.svg Resources/colorchiporder_upleft.svg + Resources/timeline2xsheet.svg + Resources/xsheet2timeline.svg diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp index aa5bd6d..6092c3c 100644 --- a/toonz/sources/toonz/tpanels.cpp +++ b/toonz/sources/toonz/tpanels.cpp @@ -101,6 +101,21 @@ public: } xsheetViewerFactory; //============================================================================= +// XsheetViewer - Timeline mode +//----------------------------------------------------------------------------- + +class TimelineViewerFactory final : public TPanelFactory { +public: + TimelineViewerFactory() : TPanelFactory("Timeline") {} + void initialize(TPanel *panel) override { + panel->setWidget(new XsheetViewer(panel)); + XsheetViewer *xsh = (XsheetViewer *)panel->widget(); + xsh->flipOrientation(); + panel->resize(500, 300); + } +} timelineViewerFactory; + +//============================================================================= // SchematicSceneViewer //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index a934b26..43186cf 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -1046,6 +1046,46 @@ void CellArea::setDragTool(DragTool *dragTool) { //----------------------------------------------------------------------------- +void CellArea::drawFrameSeparator(QPainter &p, int row, int col, + bool emptyFrame, bool heldFrame) { + const Orientation *o = m_viewer->orientation(); + int layerAxis = m_viewer->columnToLayerAxis(col); + + NumberRange layerAxisRange(layerAxis + 1, + m_viewer->columnToLayerAxis(col + 1)); + if (!o->isVerticalTimeline()) { + int adjY = o->cellHeight() - 1; + layerAxisRange = NumberRange(layerAxis + 1, layerAxis + adjY); + } + + // marker interval every 6 frames + int distance, offset; + TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( + distance, offset); + // if (distance == 0) distance = 6; + + bool isAfterMarkers = + distance > 0 && ((row - offset) % distance) == 0 && row != 0; + QColor color = isAfterMarkers ? m_viewer->getMarkerLineColor() + : m_viewer->getLightLineColor(); + + int frameAxis = m_viewer->rowToFrameAxis(row); + QLine horizontalLine = m_viewer->orientation()->horizontalLine( + frameAxis, + layerAxisRange.adjusted((o->isVerticalTimeline() ? 0 : -1), 0)); + if (heldFrame) { + int x = horizontalLine.x1(); + int y = horizontalLine.y2() - 1; + horizontalLine.setP1(QPoint(x, y)); + color.setAlpha(150); + } else if (!o->isVerticalTimeline() && !isAfterMarkers && emptyFrame) + color.setAlpha(100); + p.setPen(color); + p.drawLine(horizontalLine); +} + +//----------------------------------------------------------------------------- + void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) { TXsheet *xsh = m_viewer->getXsheet(); const Orientation *o = m_viewer->orientation(); @@ -1072,12 +1112,6 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) { drawSelectionBackground(p); - // marker interval every 6 frames - int distance, offset; - TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( - distance, offset); - if (distance == 0) distance = 6; - int currentRow = m_viewer->getCurrentRow(); int col, row; @@ -1134,36 +1168,10 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) { isReference = false; } - NumberRange layerAxisRange(layerAxis + 1, - m_viewer->columnToLayerAxis(col + 1)); - if (!m_viewer->orientation()->isVerticalTimeline()) { - int adjY = m_viewer->orientation()->cellHeight() - 1; - layerAxisRange = NumberRange(layerAxis + 1, layerAxis + adjY); - } - - // draw vertical line - if (layerAxis > 0) { - p.setPen(m_viewer->getVerticalLineColor()); - QLine verticalLine = - m_viewer->orientation()->verticalLine(layerAxis, frameSide); - p.drawLine(verticalLine); - } - // for each frame for (row = r0; row <= r1; row++) { - // draw horizontal lines - // hide top-most marker line - QColor color = ((row - offset) % distance == 0 && row != 0) - ? m_viewer->getMarkerLineColor() - : m_viewer->getLightLineColor(); - - p.setPen(color); - int frameAxis = m_viewer->rowToFrameAxis(row); - QLine horizontalLine = - m_viewer->orientation()->horizontalLine(frameAxis, layerAxisRange); - p.drawLine(horizontalLine); - if (!isColumn) { + drawFrameSeparator(p, row, col, true); if (TApp::instance()->getCurrentFrame()->isEditingScene() && !m_viewer->orientation()->isVerticalTimeline() && row == m_viewer->getCurrentRow() && @@ -1191,6 +1199,14 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) { else drawLevelCell(p, row, col, isReference); } + + // draw vertical line + if (layerAxis > 0) { + p.setPen(m_viewer->getVerticalLineColor()); + QLine verticalLine = + m_viewer->orientation()->verticalLine(layerAxis, frameSide); + p.drawLine(verticalLine); + } } drawExtenderHandles(p); @@ -1307,7 +1323,7 @@ void CellArea::drawExtenderHandles(QPainter &p) { int distance, offset; TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( distance, offset); - if (distance == 0) distance = 6; + // if (distance == 0) distance = 6; QPoint xyRadius = o->point(PredefinedPoint::EXTENDER_XY_RADIUS); @@ -1318,7 +1334,7 @@ void CellArea::drawExtenderHandles(QPainter &p) { p.setPen(Qt::black); p.setBrush(SmartTabColor); p.drawRoundRect(m_levelExtenderRect, xyRadius.x(), xyRadius.y()); - QColor color = ((selRow1 + 1 - offset) % distance != 0) + QColor color = (distance > 0 && ((selRow1 + 1 - offset) % distance) != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor(); p.setPen(color); @@ -1334,7 +1350,7 @@ void CellArea::drawExtenderHandles(QPainter &p) { p.setPen(Qt::black); p.setBrush(SmartTabColor); p.drawRoundRect(m_upperLevelExtenderRect, xyRadius.x(), xyRadius.y()); - QColor color = ((selRow0 - offset) % distance != 0) + QColor color = (distance > 0 && ((selRow0 - offset) % distance) != 0) ? m_viewer->getLightLineColor() : m_viewer->getMarkerLineColor(); p.setPen(color); @@ -1360,16 +1376,26 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) { xy.setX(xy.x() + 1); } + TXshCell nextCell; + nextCell = + m_viewer->getXsheet()->getCell(row + 1, col); // cell in next frame + int frameAdj = m_viewer->getFrameZoomAdjustment(); int frameZoomF = m_viewer->getFrameZoomFactor(); QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y)); cellRect.adjust(0, 0, -frameAdj, 0); - QRect rect = cellRect.adjusted(1, 1, 0, 0); + QRect rect = cellRect.adjusted( + 1, 1, + (!m_viewer->orientation()->isVerticalTimeline() && !nextCell.isEmpty() + ? 2 + : 0), + 0); int maxNumFrame = soundColumn->getMaxFrame() + 1; int startFrame = soundColumn->getFirstRow(); TXshCell cell = soundColumn->getCell(row); if (soundColumn->isCellEmpty(row) || cell.isEmpty() || row > maxNumFrame || row < startFrame) { + drawFrameSeparator(p, row, col, true); if (TApp::instance()->getCurrentFrame()->isEditingScene() && !m_viewer->orientation()->isVerticalTimeline() && row == m_viewer->getCurrentRow() && @@ -1378,6 +1404,8 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) { return; } + if (o->isVerticalTimeline() || !row) drawFrameSeparator(p, row, col, false); + TXshSoundLevelP soundLevel = cell.getSoundLevel(); int r0, r1; @@ -1472,7 +1500,7 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) { QLine stroke = o->horizontalLine(i, previewBounds.adjusted(-1, -1)); p.drawLine(stroke); } - if (i != begin) { + if (!o->isVerticalTimeline() || i != begin) { // "audio track" in the middle of the column p.setPen(m_viewer->getSoundColumnTrackColor()); QLine minLine = o->horizontalLine(i, NumberRange(lastMin, min)); @@ -1512,11 +1540,12 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) { int distance, markerOffset; TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( distance, markerOffset); + // if (distance == 0) distance = 6; bool isAfterMarkers = - (row - markerOffset) % distance == 0 && distance != 0 && row != 0; + distance > 0 && ((row - markerOffset) % distance) == 0 && row != 0; // draw marker interval - if (isAfterMarkers) { + if (o->isVerticalTimeline() && isAfterMarkers) { p.setPen(m_viewer->getMarkerLineColor()); p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy)); } @@ -1580,15 +1609,25 @@ void CellArea::drawCurrentTimeIndicator(QPainter &p, const QPoint &xy, p.drawLine(cellMid, cellTop, cellMid, cellBottom); } -void CellArea::drawFrameDot(QPainter &p, const QPoint &xy, bool isValid) { - int frameAdj = m_viewer->getFrameZoomAdjustment(); - QRect dotRect = - m_viewer->orientation()->rect(PredefinedRect::FRAME_DOT).translated(xy); - p.setPen(Qt::black); - p.setBrush(isValid ? QColor(230, 100, 100) : m_viewer->getTextColor()); +void CellArea::drawFrameMarker(QPainter &p, const QPoint &xy, QColor color, + bool isKeyFrame) { + QColor outlineColor = Qt::black; + int frameAdj = m_viewer->getFrameZoomAdjustment(); + QRect dotRect = m_viewer->orientation() + ->rect(PredefinedRect::FRAME_MARKER_AREA) + .translated(xy); dotRect.adjust(-frameAdj / 2, 0, -frameAdj / 2, 0); - p.drawEllipse(dotRect); - p.setBrush(Qt::NoBrush); + + if (isKeyFrame) + m_viewer->drawPredefinedPath(p, PredefinedPath::FRAME_MARKER_DIAMOND, + dotRect.adjusted(1, 1, 1, 1).center(), color, + outlineColor); + else { + p.setPen(outlineColor); + p.setBrush(color); + p.drawEllipse(dotRect); + p.setBrush(Qt::NoBrush); + } } //----------------------------------------------------------------------------- @@ -1607,6 +1646,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame + bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); + QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); int x = xy.x(); int y = xy.y(); @@ -1619,6 +1660,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { // nothing to draw if (cell.isEmpty() && prevCell.isEmpty()) { + drawFrameSeparator(p, row, col, true); + if (TApp::instance()->getCurrentFrame()->isEditingScene() && !m_viewer->orientation()->isVerticalTimeline() && row == m_viewer->getCurrentRow() && @@ -1626,13 +1669,23 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { drawCurrentTimeIndicator(p, xy); return; } + + bool heldFrame = (!o->isVerticalTimeline() && sameLevel && + prevCell.m_frameId == cell.m_frameId); + drawFrameSeparator(p, row, col, false, heldFrame); + TXshCell nextCell; nextCell = xsh->getCell(row + 1, col); // cell in next frame int frameAdj = m_viewer->getFrameZoomAdjustment(); QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y)); cellRect.adjust(0, 0, -frameAdj, 0); - QRect rect = cellRect.adjusted(1, 1, 0, 0); + QRect rect = cellRect.adjusted( + 1, 1, + (!m_viewer->orientation()->isVerticalTimeline() && !nextCell.isEmpty() + ? 2 + : 0), + 0); if (cell.isEmpty()) { // it means previous is not empty // diagonal cross meaning end of level QColor levelEndColor = m_viewer->getTextColor(); @@ -1700,16 +1753,15 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { drawLockedDottedLine(p, xsh->getColumn(col)->isLocked(), xy, cellColor); - bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); - int distance, offset; TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( distance, offset); + // if (distance == 0) distance = 6; bool isAfterMarkers = - (row - offset) % distance == 0 && distance != 0 && row != 0; + distance > 0 && ((row - offset) % distance) == 0 && row != 0; // draw marker interval - if (isAfterMarkers) { + if (o->isVerticalTimeline() && isAfterMarkers) { p.setPen(m_viewer->getMarkerLineColor()); p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy)); } @@ -1733,9 +1785,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { TXshChildLevel *cl = cell.getChildLevel(); if (cl && cell.getFrameId().getNumber() - 1 >= cl->getFrameCount()) isRed = true; - p.setPen( + QColor penColor = isRed ? QColor(230, 100, 100) // m_viewer->getSelectedColumnTextColor() - : m_viewer->getTextColor()); + : m_viewer->getTextColor(); + p.setPen(penColor); QString fontName = Preferences::instance()->getInterfaceFont(); if (fontName == "") { @@ -1756,6 +1809,8 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { // draw continue line QString fnum; if (sameLevel && prevCell.m_frameId == cell.m_frameId) { + if (!o->isVerticalTimeline()) return; + // not on line marker PredefinedLine which = Preferences::instance()->isLevelNameOnEachMarkerEnabled() @@ -1769,7 +1824,11 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) { // draw frame number else { if (m_viewer->getFrameZoomFactor() <= 50) { - drawFrameDot(p, QPoint(x, y), isRed); + // Lets not draw normal marker if there is a keyframe here + TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col)); + if (pegbar->isKeyframe(row)) return; + + drawFrameMarker(p, QPoint(x, y), (isRed ? Qt::red : Qt::black)); return; } @@ -1825,6 +1884,9 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame // nothing to draw + + bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); + QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); int x = xy.x(); int y = xy.y(); @@ -1836,6 +1898,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { } if (cell.isEmpty() && prevCell.isEmpty()) { + drawFrameSeparator(p, row, col, true); if (TApp::instance()->getCurrentFrame()->isEditingScene() && !m_viewer->orientation()->isVerticalTimeline() && row == m_viewer->getCurrentRow() && @@ -1844,13 +1907,23 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { return; } + + bool heldFrame = (!o->isVerticalTimeline() && sameLevel && + prevCell.m_frameId == cell.m_frameId); + drawFrameSeparator(p, row, col, false, heldFrame); + TXshCell nextCell; nextCell = xsh->getCell(row + 1, col); int frameAdj = m_viewer->getFrameZoomAdjustment(); QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y)); cellRect.adjust(0, 0, -frameAdj, 0); - QRect rect = cellRect.adjusted(1, 1, 0, 0); + QRect rect = cellRect.adjusted( + 1, 1, + (!m_viewer->orientation()->isVerticalTimeline() && !nextCell.isEmpty() + ? 2 + : 0), + 0); if (cell.isEmpty()) { // diagonal cross meaning end of level QColor levelEndColor = m_viewer->getTextColor(); levelEndColor.setAlphaF(0.3); @@ -1888,18 +1961,19 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { drawEndOfDragHandle(p, isLastRow, xy, cellColor); drawLockedDottedLine(p, xsh->getColumn(col)->isLocked(), xy, cellColor); - bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); TFrameId fid = cell.m_frameId; if (fid.getNumber() - 1 < 0) return; + int distance, offset; TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( distance, offset); + // if (distance == 0) distance = 6; bool isAfterMarkers = - (row - offset) % distance == 0 && distance != 0 && row != 0; + distance > 0 && ((row - offset) % distance) == 0 && row != 0; // draw marker interval - if (isAfterMarkers) { + if (o->isVerticalTimeline() && isAfterMarkers) { p.setPen(m_viewer->getMarkerLineColor()); p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy)); } @@ -1925,6 +1999,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { // if the same level & same fId with the previous cell, // draw continue line if (sameLevel && prevCell.m_frameId == cell.m_frameId) { + if (!o->isVerticalTimeline()) return; // not on line marker PredefinedLine which = Preferences::instance()->isLevelNameOnEachMarkerEnabled() @@ -1969,6 +2044,19 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, if (row > 0) prevCell = xsh->getCell(row - 1, col); TXshCell nextCell = xsh->getCell(row + 1, col); + bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); + + int distance, offset; + TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( + distance, offset); + // if (distance == 0) distance = 6; + bool isAfterMarkers = + distance > 0 && ((row - offset) % distance) == 0 && row != 0; + + bool isRed = false; + TXshPaletteLevel *pl = cell.getPaletteLevel(); + if (pl && !pl->getPalette()) isRed = true; + QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); int x = xy.x(); int y = xy.y(); @@ -1978,7 +2066,9 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, else xy.setX(xy.x() + 1); } + if (cell.isEmpty() && prevCell.isEmpty()) { + drawFrameSeparator(p, row, col, true); if (TApp::instance()->getCurrentFrame()->isEditingScene() && !m_viewer->orientation()->isVerticalTimeline() && row == m_viewer->getCurrentRow() && @@ -1988,10 +2078,19 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, return; } + bool heldFrame = (!o->isVerticalTimeline() && !isAfterMarkers && sameLevel && + prevCell.m_frameId == cell.m_frameId); + drawFrameSeparator(p, row, col, false, heldFrame); + int frameAdj = m_viewer->getFrameZoomAdjustment(); QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y)); cellRect.adjust(0, 0, -frameAdj, 0); - QRect rect = cellRect.adjusted(1, 1, 0, 0); + QRect rect = cellRect.adjusted( + 1, 1, + (!m_viewer->orientation()->isVerticalTimeline() && !nextCell.isEmpty() + ? 2 + : 0), + 0); if (cell.isEmpty()) { // this means the former is not empty QColor levelEndColor = m_viewer->getTextColor(); levelEndColor.setAlphaF(0.3); @@ -2033,15 +2132,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, drawEndOfDragHandle(p, isLastRow, xy, cellColor); drawLockedDottedLine(p, xsh->getColumn(col)->isLocked(), xy, cellColor); - bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); - - int distance, offset; - TApp::instance()->getCurrentScene()->getScene()->getProperties()->getMarkers( - distance, offset); - if (distance == 0) distance = 6; - bool isAfterMarkers = (row - offset) % distance == 0 && row != 0; - - if (isAfterMarkers) { + if (o->isVerticalTimeline() && isAfterMarkers) { p.setPen(m_viewer->getMarkerLineColor()); p.drawLine(o->line(PredefinedLine::SEE_MARKER_THROUGH).translated(xy)); } @@ -2049,6 +2140,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, if (sameLevel && prevCell.m_frameId == cell.m_frameId && !isAfterMarkers) { // cell equal to previous one (not on marker line): // do not write anything and draw a vertical line + if (!o->isVerticalTimeline()) return; QPen oldPen = p.pen(); p.setPen(QPen(m_viewer->getTextColor(), 1)); QLine continueLine = o->line(PredefinedLine::CONTINUE_LEVEL).translated(xy); @@ -2056,6 +2148,14 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, p.drawLine(continueLine); p.setPen(oldPen); } else { + if (m_viewer->getFrameZoomFactor() <= 50) { + // Lets not draw normal marker if there is a keyframe here + TStageObject *pegbar = xsh->getStageObject(m_viewer->getObjectId(col)); + if (pegbar->isKeyframe(row)) return; + drawFrameMarker(p, QPoint(x, y), (isRed ? Qt::red : Qt::black)); + return; + } + TFrameId fid = cell.m_frameId; std::wstring levelName = cell.m_level->getName(); @@ -2075,12 +2175,10 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, } nameRect.adjust(0, 0, -frameAdj, 0); - bool isRed = false; - TXshPaletteLevel *pl = cell.getPaletteLevel(); - if (pl && !pl->getPalette()) isRed = true; - p.setPen( + QColor penColor = isRed ? QColor(230, 100, 100) // m_viewer->getSelectedColumnTextColor() - : m_viewer->getTextColor()); + : m_viewer->getTextColor(); + p.setPen(penColor); // il nome va scritto se e' diverso dalla cella precedente oppure se // siamo su una marker line QString fontName = Preferences::instance()->getInterfaceFont(); @@ -2135,11 +2233,12 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col, void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { const Orientation *o = m_viewer->orientation(); int r0, r1, c0, c1; // range of visible rows and columns - CellRange visible = m_viewer->xyRectToRange(toBeUpdated); - r0 = visible.from().frame(); - r1 = visible.to().frame(); - c0 = visible.from().layer(); - c1 = visible.to().layer(); + CellRange visible = m_viewer->xyRectToRange(toBeUpdated); + QColor keyFrameColor = Qt::white, outline = Qt::black; + r0 = visible.from().frame(); + r1 = visible.to().frame(); + c0 = visible.from().layer(); + c1 = visible.to().layer(); static QPixmap selectedKey = svgToPixmap(":Resources/selected_key.svg"); static QPixmap key = svgToPixmap(":Resources/key.svg"); @@ -2183,16 +2282,20 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { handleRow1)) { QPoint topLeft = m_viewer->positionToXY(CellPosition(handleRow0, col)); + if (!o->isVerticalTimeline() && + m_viewer->getFrameZoomFactor() <= 50) + topLeft.setY(topLeft.y() - 1); m_viewer->drawPredefinedPath(p, PredefinedPath::BEGIN_EASE_TRIANGLE, topLeft + QPoint(-frameAdj / 2, 0), - m_viewer->getLightLineColor(), - m_viewer->getTextColor()); + keyFrameColor, outline); topLeft = m_viewer->positionToXY(CellPosition(handleRow1, col)); + if (!o->isVerticalTimeline() && + m_viewer->getFrameZoomFactor() <= 50) + topLeft.setY(topLeft.y() - 1); m_viewer->drawPredefinedPath(p, PredefinedPath::END_EASE_TRIANGLE, topLeft + QPoint(-frameAdj / 2, 0), - m_viewer->getLightLineColor(), - m_viewer->getTextColor()); + keyFrameColor, outline); } } // skip to next segment @@ -2208,11 +2311,27 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) { for (row = row0; row <= row1; row++) { p.setPen(m_viewer->getTextColor()); if (pegbar->isKeyframe(row)) { - QPoint target = - keyRect.translated(m_viewer->positionToXY(CellPosition(row, col))) - .topLeft(); - if (m_viewer->getKeyframeSelection() && - m_viewer->getKeyframeSelection()->isSelected(row, col)) { + QPoint xy = m_viewer->positionToXY(CellPosition(row, col)); + QPoint target = keyRect.translated(xy).topLeft(); + if (!o->isVerticalTimeline() && m_viewer->getFrameZoomFactor() <= 50) { + QColor color = Qt::white; + int x = xy.x(); + int y = xy.y(); + if (row == 0) { + if (o->isVerticalTimeline()) + xy.setY(xy.y() + 1); + else + xy.setX(xy.x() + 1); + } + + if (m_viewer->getKeyframeSelection() && + m_viewer->getKeyframeSelection()->isSelected(row, col)) + color = QColor(85, 157, 255); + + drawFrameMarker(p, QPoint(x, y), color, true); + + } else if (m_viewer->getKeyframeSelection() && + m_viewer->getKeyframeSelection()->isSelected(row, col)) { // keyframe selected p.drawPixmap(target, selectedKey); } else { @@ -2274,7 +2393,13 @@ void CellArea::drawKeyframeLine(QPainter &p, int col, QPoint end = keyRect.center() + m_viewer->positionToXY(CellPosition(rows.to(), col)); - p.setPen(m_viewer->getTextColor()); + if (!m_viewer->orientation()->isVerticalTimeline() && + m_viewer->getFrameZoomFactor() <= 50) { + begin.setY(begin.y() - 1); + end.setY(end.y() - 1); + } + + p.setPen(Qt::white); p.drawLine(QLine(begin, end)); } @@ -2373,8 +2498,6 @@ void CellArea::paintEvent(QPaintEvent *event) { drawKeyframe(p, toBeUpdated); drawNotes(p, toBeUpdated); - if (getDragTool()) getDragTool()->drawCellsArea(p); - // focus cell border int frameAdj = m_viewer->getFrameZoomAdjustment(); int row = m_viewer->getCurrentRow(); @@ -2383,10 +2506,14 @@ void CellArea::paintEvent(QPaintEvent *event) { QRect rect = m_viewer->orientation() ->rect(PredefinedRect::CELL) .translated(xy) - .adjusted(1, 1, -1 - frameAdj, -1); + .adjusted(0, 0, -1 - frameAdj, 0); p.setPen(Qt::black); p.setBrush(Qt::NoBrush); - p.drawRect(rect); + for (int i = 0; i < 2; i++) // thick border within cell + p.drawRect(QRect(rect.topLeft() + QPoint(i, i), + rect.size() - QSize(2 * i, 2 * i))); + + if (getDragTool()) getDragTool()->drawCellsArea(p); } //----------------------------------------------------------------------------- @@ -2485,11 +2612,18 @@ void CellArea::mousePressEvent(QMouseEvent *event) { (k1 > k0 || k0 == row) && k0 <= row && row <= k1 + 1; - bool isKeyFrameArea = isKeyframeFrame && - o->rect(PredefinedRect::KEYFRAME_AREA) - .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0) - .contains(mouseInCell) && - row < k1 + 1; + bool isKeyFrameArea = + isKeyframeFrame && + ((o->isVerticalTimeline() && + o->rect(PredefinedRect::KEYFRAME_AREA) + .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0) + .contains(mouseInCell)) + + || (!o->isVerticalTimeline() && + o->rect(PredefinedRect::FRAME_MARKER_AREA) + .adjusted(-frameAdj / 2, 0, -frameAdj / 2, 0) + .contains(mouseInCell))) && + row < k1 + 1; bool accept = false; if (isKeyFrameArea) { // They are in the keyframe selection diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.h index 41b9d61..a552fa6 100644 --- a/toonz/sources/toonz/xshcellviewer.h +++ b/toonz/sources/toonz/xshcellviewer.h @@ -88,6 +88,8 @@ class CellArea final : public QWidget { void drawLockedDottedLine(QPainter &p, bool isLocked, const QPoint &xy, const QColor &cellColor) const; + void drawFrameSeparator(QPainter &p, int row, int col, bool emptyFrame, + bool heldFrame = false); void drawLevelCell(QPainter &p, int row, int col, bool isReference = false); void drawSoundTextCell(QPainter &p, int row, int col); void drawSoundCell(QPainter &p, int row, int col, bool isReference = false); @@ -101,7 +103,8 @@ class CellArea final : public QWidget { void drawCurrentTimeIndicator(QPainter &p, const QPoint &xy, bool isFolded = false); - void drawFrameDot(QPainter &p, const QPoint &xy, bool isValid); + void drawFrameMarker(QPainter &p, const QPoint &xy, QColor color, + bool isKeyFrame = false); // Restistusce true bool getEaseHandles(int r0, int r1, double e0, double e1, int &rh0, int &rh1); diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index 46b0f9c..13416e9 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -689,7 +689,7 @@ void ColumnArea::DrawHeader::drawEye() const { // preview visible toggle p.setPen(m_viewer->getVerticalLineColor()); - if (column->getPaletteColumn() || column->getSoundTextColumn()) { + if (column->getSoundTextColumn()) { if (o->flag(PredefinedFlag::EYE_AREA_BORDER)) p.drawRect(prevViewRect); return; } @@ -1827,7 +1827,7 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { // preview button else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) && event->button() == Qt::LeftButton) { - if (column->getPaletteColumn() || column->getSoundTextColumn()) { + if (column->getSoundTextColumn()) { // do nothing } else { m_doOnRelease = diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp index bc9744a..c1340f7 100644 --- a/toonz/sources/toonz/xsheetviewer.cpp +++ b/toonz/sources/toonz/xsheetviewer.cpp @@ -100,8 +100,9 @@ void XsheetViewer::getCellTypeAndColors(int <ype, QColor &cellColor, sideColor = m_soundColumnBorderColor; break; case SND_TXT_XSHLEVEL: - cellColor = XsheetGUI::SoundTextColumnColor; - sideColor = XsheetGUI::SoundTextColumnBorderColor; + cellColor = (isSelected) ? getSelectedSoundTextColumnColor() + : getSoundTextColumnColor(); + sideColor = getSoundTextColumnBorderColor(); break; case MESH_XSHLEVEL: cellColor = @@ -718,10 +719,10 @@ void XsheetViewer::updateAreeSize() { : o->foldedCellSize())); } } - if (viewArea.right() < areaFilled.x()) viewArea.setRight(areaFilled.x()); - if (viewArea.bottom() < areaFilled.y() || - (!o->isVerticalTimeline() && viewArea.bottom() != areaFilled.y())) - viewArea.setBottom(areaFilled.y()); + if (viewArea.width() < areaFilled.x()) viewArea.setWidth(areaFilled.x()); + if (viewArea.height() < areaFilled.y() || + (!o->isVerticalTimeline() && viewArea.height() != areaFilled.y())) + viewArea.setHeight(areaFilled.y()); NumberRange allLayer = o->layerSide(viewArea); NumberRange allFrame = o->frameSide(viewArea); @@ -1099,7 +1100,7 @@ void XsheetViewer::wheelEvent(QWheelEvent *event) { return; } - int markerDistance = 6, markerOffset = 0; + int markerDistance = 0, markerOffset = 0; TApp::instance() ->getCurrentScene() ->getScene() @@ -1750,9 +1751,22 @@ void XsheetViewer::zoomOnFrame(int frame, int factor) { m_rowArea->update(); } +QColor XsheetViewer::getSelectedColumnTextColor() const { + // get colors + TPixel currentColumnPixel; + Preferences::instance()->getCurrentColumnData(currentColumnPixel); + QColor currentColumnColor((int)currentColumnPixel.r, + (int)currentColumnPixel.g, + (int)currentColumnPixel.b, 255); + return currentColumnColor; +} + //============================================================================= // XSheetViewerCommand //----------------------------------------------------------------------------- OpenFloatingPanel openXsheetViewerCommand(MI_OpenXshView, "Xsheet", QObject::tr("Xsheet")); + +OpenFloatingPanel openTimelineViewerCommand(MI_OpenTimelineView, "Timeline", + QObject::tr("Timeline")); diff --git a/toonz/sources/toonz/xsheetviewer.h b/toonz/sources/toonz/xsheetviewer.h index b269774..04bf863 100644 --- a/toonz/sources/toonz/xsheetviewer.h +++ b/toonz/sources/toonz/xsheetviewer.h @@ -325,6 +325,18 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { setMeshColumnBorderColor) Q_PROPERTY(QColor SelectedMeshColumnColor READ getSelectedMeshColumnColor WRITE setSelectedMeshColumnColor) + // SoundText column + QColor m_soundTextColumnColor; + QColor m_soundTextColumnBorderColor; + QColor m_selectedSoundTextColumnColor; + Q_PROPERTY(QColor SoundTextColumnColor READ getSoundTextColumnColor WRITE + setSoundTextColumnColor) + Q_PROPERTY( + QColor SoundTextColumnBorderColor READ getSoundTextColumnBorderColor WRITE + setSoundTextColumnBorderColor) + Q_PROPERTY( + QColor SelectedSoundTextColumnColor READ getSelectedSoundTextColumnColor + WRITE setSelectedSoundTextColumnColor) // Sound column QColor m_soundColumnColor; QColor m_soundColumnBorderColor; @@ -478,14 +490,25 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { WRITE setTimelineConfigButtonImage) // Layer Header icons QImage m_layerHeaderPreviewImage; + QImage m_layerHeaderPreviewOverImage; QImage m_layerHeaderCamstandImage; + QImage m_layerHeaderCamstandOverImage; QImage m_layerHeaderLockImage; + QImage m_layerHeaderLockOverImage; Q_PROPERTY(QImage LayerHeaderPreviewImage READ getLayerHeaderPreviewImage WRITE setLayerHeaderPreviewImage) + Q_PROPERTY( + QImage LayerHeaderPreviewOverImage READ getLayerHeaderPreviewOverImage + WRITE setLayerHeaderPreviewOverImage) Q_PROPERTY(QImage LayerHeaderCamstandImage READ getLayerHeaderCamstandImage WRITE setLayerHeaderCamstandImage) + Q_PROPERTY( + QImage LayerHeaderCamstandOverImage READ getLayerHeaderCamstandOverImage + WRITE setLayerHeaderCamstandOverImage) Q_PROPERTY(QImage LayerHeaderLockImage READ getLayerHeaderLockImage WRITE setLayerHeaderLockImage) + Q_PROPERTY(QImage LayerHeaderLockOverImage READ getLayerHeaderLockOverImage + WRITE setLayerHeaderLockOverImage) XsheetScrollArea *m_cellScrollArea; XsheetScrollArea *m_columnScrollArea; @@ -704,9 +727,8 @@ public: void setSelectedColumnTextColor(const QColor &color) { m_selectedColumnTextColor = color; } - QColor getSelectedColumnTextColor() const { - return m_selectedColumnTextColor; - } + QColor getSelectedColumnTextColor() const; + // Cell void setEmptyCellColor(const QColor &color) { m_emptyCellColor = color; } QColor getEmptyCellColor() const { return m_emptyCellColor; } @@ -837,6 +859,23 @@ public: QColor getSelectedMeshColumnColor() const { return m_selectedMeshColumnColor; } + // SoundText column + void setSoundTextColumnColor(const QColor &color) { + m_soundTextColumnColor = color; + } + void setSoundTextColumnBorderColor(const QColor &color) { + m_soundTextColumnBorderColor = color; + } + void setSelectedSoundTextColumnColor(const QColor &color) { + m_selectedSoundTextColumnColor = color; + } + QColor getSoundTextColumnColor() const { return m_soundTextColumnColor; } + QColor getSoundTextColumnBorderColor() const { + return m_soundTextColumnBorderColor; + } + QColor getSelectedSoundTextColumnColor() const { + return m_selectedSoundTextColumnColor; + } // Sound column QColor getSoundColumnHlColor() const { return m_soundColumnHlColor; } QColor getSoundColumnTrackColor() const { return m_soundColumnTrackColor; } @@ -1060,19 +1099,37 @@ public: void setLayerHeaderPreviewImage(const QImage &image) { m_layerHeaderPreviewImage = image; } + void setLayerHeaderPreviewOverImage(const QImage &image) { + m_layerHeaderPreviewOverImage = image; + } void setLayerHeaderCamstandImage(const QImage &image) { m_layerHeaderCamstandImage = image; } + void setLayerHeaderCamstandOverImage(const QImage &image) { + m_layerHeaderCamstandOverImage = image; + } void setLayerHeaderLockImage(const QImage &image) { m_layerHeaderLockImage = image; } + void setLayerHeaderLockOverImage(const QImage &image) { + m_layerHeaderLockOverImage = image; + } QImage getLayerHeaderPreviewImage() const { return m_layerHeaderPreviewImage; } + QImage getLayerHeaderPreviewOverImage() const { + return m_layerHeaderPreviewOverImage; + } QImage getLayerHeaderCamstandImage() const { return m_layerHeaderCamstandImage; } + QImage getLayerHeaderCamstandOverImage() const { + return m_layerHeaderCamstandOverImage; + } QImage getLayerHeaderLockImage() const { return m_layerHeaderLockImage; } + QImage getLayerHeaderLockOverImage() const { + return m_layerHeaderLockOverImage; + } void getButton(int &btype, QColor &bgColor, QImage &iconImage, bool isTimeline = false); diff --git a/toonz/sources/toonz/xshnoteviewer.cpp b/toonz/sources/toonz/xshnoteviewer.cpp index b1c52da..313ff76 100644 --- a/toonz/sources/toonz/xshnoteviewer.cpp +++ b/toonz/sources/toonz/xshnoteviewer.cpp @@ -465,8 +465,7 @@ NoteArea::NoteArea(XsheetViewer *parent, Qt::WFlags flags) setFrameStyle(QFrame::StyledPanel); setObjectName("cornerWidget"); - m_flipOrientationButton = - new QPushButton(m_viewer->orientation()->caption(), this); + m_flipOrientationButton = new QPushButton(this); m_noteButton = new QToolButton(this); m_precNoteButton = new QToolButton(this); m_nextNoteButton = new QToolButton(this); @@ -475,33 +474,42 @@ NoteArea::NoteArea(XsheetViewer *parent, Qt::WFlags flags) //----- - m_flipOrientationButton->setObjectName("PushButton_NoPadding"); + m_flipOrientationButton->setObjectName("flipOrientationButton"); m_flipOrientationButton->setFocusPolicy(Qt::FocusPolicy::NoFocus); m_flipOrientationButton->setFixedSize(QSize(70, 23)); + m_flipOrientationButton->setIconSize(QSize(40, 20)); + QIcon flipOrientationIcon; + flipOrientationIcon.addFile(QString(":Resources/xsheet2timeline.svg"), + QSize(), QIcon::Normal); + m_flipOrientationButton->setIcon(flipOrientationIcon); + m_flipOrientationButton->setToolTip(tr("Toggle Xsheet/Timeline")); m_noteButton->setObjectName("ToolbarToolButton"); - m_noteButton->setFixedSize(44, 26); - m_noteButton->setIconSize(QSize(38, 20)); + m_noteButton->setFixedSize(34, 25); + m_noteButton->setIconSize(QSize(30, 20)); QIcon addNoteIcon = createQIcon("newmemo"); addNoteIcon.addFile(QString(":Resources/newmemo_disabled.svg"), QSize(), QIcon::Disabled); m_noteButton->setIcon(addNoteIcon); + m_noteButton->setToolTip(tr("Add New Memo")); m_precNoteButton->setObjectName("ToolbarToolButton"); - m_precNoteButton->setFixedSize(22, 22); + m_precNoteButton->setFixedSize(18, 25); m_precNoteButton->setIconSize(QSize(17, 17)); QIcon precNoteIcon = createQIcon("prevkey"); precNoteIcon.addFile(QString(":Resources/prevkey_disabled.svg"), QSize(), QIcon::Disabled); m_precNoteButton->setIcon(precNoteIcon); + m_precNoteButton->setToolTip(tr("Previous Memo")); m_nextNoteButton->setObjectName("ToolbarToolButton"); - m_nextNoteButton->setFixedSize(22, 22); + m_nextNoteButton->setFixedSize(18, 25); m_nextNoteButton->setIconSize(QSize(17, 17)); QIcon nextNoteIcon = createQIcon("nextkey"); nextNoteIcon.addFile(QString(":Resources/nextkey_disabled.svg"), QSize(), QIcon::Disabled); m_nextNoteButton->setIcon(nextNoteIcon); + m_nextNoteButton->setToolTip(tr("Next Memo")); QStringList frameDisplayStyles; frameDisplayStyles << tr("Frame") << tr("Sec Frame") << tr("6sec Sheet") @@ -557,11 +565,6 @@ void NoteArea::createLayout() { setFixedSize(rect.size()); - if (o->isVerticalTimeline()) - m_noteButton->setFixedSize(44, 26); - else - m_noteButton->setFixedSize(44, 22); - // has two elements: main layout and header panel QVBoxLayout *panelLayout = new QVBoxLayout(); panelLayout->setMargin(1); @@ -578,16 +581,13 @@ void NoteArea::createLayout() { mainLayout->addStretch(1); - mainLayout->addWidget(m_noteButton, 0, centerAlign); - QHBoxLayout *buttonsLayout = new QHBoxLayout(); buttonsLayout->setMargin(0); buttonsLayout->setSpacing(0); { - buttonsLayout->addStretch(1); buttonsLayout->addWidget(m_precNoteButton, 0); + buttonsLayout->addWidget(m_noteButton, 0, centerAlign); buttonsLayout->addWidget(m_nextNoteButton, 0); - buttonsLayout->addStretch(1); } mainLayout->addLayout(buttonsLayout, 0); @@ -627,7 +627,15 @@ void NoteArea::updateButtons() { void NoteArea::flipOrientation() { m_viewer->flipOrientation(); } void NoteArea::onXsheetOrientationChanged(const Orientation *newOrientation) { - m_flipOrientationButton->setText(newOrientation->caption()); + // m_flipOrientationButton->setText(newOrientation->caption()); + + QIcon flipOrientationIcon; + QString iconFile = newOrientation->isVerticalTimeline() + ? QString(":Resources/xsheet2timeline.svg") + : QString(":Resources/timeline2xsheet.svg"); + flipOrientationIcon.addFile(iconFile, QSize(), QIcon::Normal); + m_flipOrientationButton->setIcon(flipOrientationIcon); + removeLayout(); createLayout(); } diff --git a/toonz/sources/toonz/xshrowviewer.cpp b/toonz/sources/toonz/xshrowviewer.cpp index 1eaa75c..99145d2 100644 --- a/toonz/sources/toonz/xshrowviewer.cpp +++ b/toonz/sources/toonz/xshrowviewer.cpp @@ -108,7 +108,7 @@ void RowArea::drawRows(QPainter &p, int r0, int r1) { distance, offset); // default value - if (distance == 0) distance = 6; + // if (distance == 0) distance = 6; QRect visibleRect = visibleRegion().boundingRect(); @@ -124,30 +124,19 @@ void RowArea::drawRows(QPainter &p, int r0, int r1) { int frameAxis = m_viewer->rowToFrameAxis(r); //--- draw horizontal line - QColor color = ((r - offset) % distance == 0 && r != 0) - ? m_viewer->getMarkerLineColor() - : m_viewer->getLightLineColor(); + bool isAfterMarkers = + (distance > 0 && ((r - offset) % distance) == 0 && r != 0); + QColor color = isAfterMarkers ? m_viewer->getMarkerLineColor() + : m_viewer->getLightLineColor(); p.setPen(color); QLine horizontalLine = o->horizontalLine(frameAxis, layerSide); - p.drawLine(horizontalLine); - - if (!o->isVerticalTimeline() && m_viewer->getFrameZoomFactor() <= 50) { - QPoint basePoint = m_viewer->positionToXY(CellPosition(r, 0)); - if (!o->isVerticalTimeline()) basePoint.setY(0); - QRect indRect = - o->rect(PredefinedRect::FRAME_INDICATOR).translated(basePoint); - indRect.adjust(-frameAdj / 2, 0, -frameAdj / 2, 0); - QColor useColor; - if (playR0 <= r && r <= playR1) { - useColor = ((r - m_r0) % step == 0) - ? m_viewer->getPreviewFrameTextColor() - : m_viewer->getTextColor(); - } - // not in preview range - else - useColor = m_viewer->getTextColor(); - p.fillRect(indRect, useColor); + if (!o->isVerticalTimeline()) { + int x = horizontalLine.x1(); + int y = horizontalLine.y2() - (isAfterMarkers ? 6 : 3); + horizontalLine.setP1(QPoint(x, y)); + if (!isAfterMarkers) p.setPen(m_viewer->getTextColor()); } + p.drawLine(horizontalLine); } int z = 0; @@ -205,7 +194,7 @@ void RowArea::drawRows(QPainter &p, int r0, int r1) { case XsheetViewer::Frame: { if (!o->isVerticalTimeline() && m_viewer->getFrameZoomFactor() <= 50 && - r > 0 && (r + 1) % 5) + r > 0 && (r + 1) % (distance > 0 ? distance : 5)) break; QString number = QString::number(r + 1); p.drawText(labelRect, align, number); @@ -275,6 +264,43 @@ void RowArea::drawRows(QPainter &p, int r0, int r1) { } //----------------------------------------------------------------------------- +void RowArea::drawPlayRangeBackground(QPainter &p, int r0, int r1) { + if (!XsheetGUI::isPlayRangeEnabled()) return; + + const Orientation *o = m_viewer->orientation(); + TXsheet *xsh = m_viewer->getXsheet(); + int frameAdj = m_viewer->getFrameZoomAdjustment(); + QRect playRangeRect = o->rect(PredefinedRect::PLAY_RANGE); + + int playR0, playR1, step; + XsheetGUI::getPlayRange(playR0, playR1, step); + + for (int r = r0; r <= r1; r++) { + if (!(playR0 <= r && r <= playR1) && ((r - m_r0) % step == 0)) continue; + + QPoint basePoint = m_viewer->positionToXY(CellPosition(r, 0)); + if (!o->isVerticalTimeline()) basePoint.setY(0); + + QRect previewBoxRect = o->rect(PredefinedRect::PREVIEW_FRAME_AREA) + .adjusted(0, 0, -frameAdj, 0) + .translated(basePoint); + p.fillRect(previewBoxRect, m_viewer->getNotEmptyColumnColor()); + + if (!o->isVerticalTimeline()) { + if (r == playR0) { + QLine horizontalLine(previewBoxRect.topLeft(), + previewBoxRect.bottomLeft()); + p.setPen(m_viewer->getLightLineColor()); + p.drawLine(horizontalLine); + } else if (r == playR1) { + QLine horizontalLine(previewBoxRect.topRight(), + previewBoxRect.bottomRight()); + p.setPen(m_viewer->getLightLineColor()); + p.drawLine(horizontalLine); + } + } + } +} void RowArea::drawPlayRange(QPainter &p, int r0, int r1) { bool playRangeEnabled = XsheetGUI::isPlayRangeEnabled(); @@ -297,8 +323,6 @@ void RowArea::drawPlayRange(QPainter &p, int r0, int r1) { QColor ArrowColor = (playRangeEnabled) ? QColor(255, 255, 255) : grey150; p.setBrush(QBrush(ArrowColor)); - int topOrLeftCol = - m_viewer->orientation()->isVerticalTimeline() ? 0 : xsh->getColumnCount(); if (m_r0 > r0 - 1 && r1 + 1 > m_r0) { QPoint topLeft = m_viewer->positionToXY(CellPosition(m_r0, 0)); if (!m_viewer->orientation()->isVerticalTimeline()) topLeft.setY(0); @@ -350,15 +374,19 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { QColor frontColor((int)frontPixel.r, (int)frontPixel.g, (int)frontPixel.b, 128); QColor backColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b, 128); + QColor frontDotColor((int)frontPixel.r, (int)frontPixel.g, (int)frontPixel.b); + QColor backDotColor((int)backPixel.r, (int)backPixel.g, (int)backPixel.b); + QPen frontPen, backPen; // If the onion skin is disabled, draw dash line instead. - if (osMask.isEnabled()) - p.setPen(Qt::red); - else { - QPen currentPen = p.pen(); - currentPen.setStyle(Qt::DashLine); - currentPen.setColor(QColor(128, 128, 128, 255)); - p.setPen(currentPen); + if (osMask.isEnabled()) { + frontPen.setColor(frontDotColor); + backPen.setColor(backDotColor); + } else { + frontPen.setStyle(Qt::DashLine); + frontPen.setColor(QColor(128, 128, 128)); + backPen.setStyle(Qt::DashLine); + backPen.setColor(QColor(128, 128, 128)); } QRect onionRect = m_viewer->orientation()->rect(PredefinedRect::ONION); @@ -388,6 +416,7 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { (frameAdj / 2); QLine verticalLine = m_viewer->orientation()->verticalLine( layerAxis, NumberRange(fromFrameAxis, toFrameAxis)); + p.setPen(backPen); if (m_viewer->orientation()->isVerticalTimeline()) p.drawLine(verticalLine.x1(), verticalLine.y1() + 5, verticalLine.x2(), verticalLine.y2() - 9); @@ -404,12 +433,13 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { onionCenter_frame - (frameAdj / 2); QLine verticalLine = m_viewer->orientation()->verticalLine( layerAxis, NumberRange(fromFrameAxis, toFrameAxis)); + p.setPen(frontPen); if (m_viewer->orientation()->isVerticalTimeline()) p.drawLine(verticalLine.x1(), verticalLine.y1() + 10, verticalLine.x2(), verticalLine.y2() - 5); else p.drawLine(verticalLine.x1() + 10, verticalLine.y1(), - verticalLine.x2() - 5, verticalLine.y2()); + verticalLine.x2() - 3, verticalLine.y2()); } // Draw onion skin main handle QPoint handleTopLeft = m_viewer->positionToXY(CellPosition(currentRow, 0)); @@ -419,21 +449,23 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { int angle180 = 16 * 180; int turn = m_viewer->orientation()->dimension(PredefinedDimension::ONION_TURN) * 16; + p.setPen(backDotColor); p.setBrush(QBrush(backColor)); p.drawChord(handleRect, turn, angle180); + p.setPen(frontDotColor); p.setBrush(QBrush(frontColor)); p.drawChord(handleRect, turn + angle180, angle180); // draw onion skin dots - p.setPen(Qt::red); for (int i = 0; i < mosCount; i++) { // mos : frame offset from the current frame int mos = osMask.getMos(i); // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Mos && currentRow + mos == m_row) continue; + p.setPen(mos < 0 ? backDotColor : frontDotColor); if (osMask.isEnabled()) - p.setBrush(mos < 0 ? backColor : frontColor); + p.setBrush(mos < 0 ? backDotColor : frontDotColor); else p.setBrush(Qt::NoBrush); QPoint topLeft = m_viewer->positionToXY(CellPosition(currentRow + mos, 0)); @@ -452,6 +484,7 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { // skip drawing if the frame is under the mouse cursor if (m_showOnionToSet == Fos && fos == m_row) continue; + p.setPen(QColor(0, 255, 255, 128)); if (osMask.isEnabled()) p.setBrush(QBrush(QColor(0, 255, 255, 128))); else @@ -467,7 +500,7 @@ void RowArea::drawOnionSkinSelection(QPainter &p) { //-- onion placement hint under mouse if (m_showOnionToSet != None) { - p.setPen(QColor(255, 128, 0)); + p.setPen(QColor(255, 255, 0)); p.setBrush(QBrush(QColor(255, 255, 0))); QPoint topLeft = m_viewer->positionToXY(CellPosition(m_row, 0)); if (!m_viewer->orientation()->isVerticalTimeline()) topLeft.setY(0); @@ -625,6 +658,8 @@ void RowArea::paintEvent(QPaintEvent *event) { // fill background p.fillRect(toBeUpdated, m_viewer->getBGColor()); + drawPlayRangeBackground(p, r0, r1); + if (TApp::instance()->getCurrentFrame()->isEditingScene()) // current frame drawCurrentRowGadget(p, r0, r1); diff --git a/toonz/sources/toonz/xshrowviewer.h b/toonz/sources/toonz/xshrowviewer.h index 507d408..d7af6f7 100644 --- a/toonz/sources/toonz/xshrowviewer.h +++ b/toonz/sources/toonz/xshrowviewer.h @@ -44,6 +44,7 @@ class RowArea final : public QWidget { bool m_isPanning; void drawRows(QPainter &p, int r0, int r1); + void drawPlayRangeBackground(QPainter &p, int r0, int r1); void drawPlayRange(QPainter &p, int r0, int r1); void drawCurrentRowGadget(QPainter &p, int r0, int r1); void drawOnionSkinSelection(QPainter &p); diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp index fb337e6..b307f6a 100644 --- a/toonz/sources/toonzlib/orientation.cpp +++ b/toonz/sources/toonzlib/orientation.cpp @@ -17,8 +17,7 @@ const int PLAY_MARKER_SIZE = 10; const int ONION_SIZE = 19; const int ONION_DOT_SIZE = 8; const int PINNED_SIZE = 10; -const int FRAME_DOT_SIZE = 8; -const int FRAME_IND_SIZE = 3; +const int FRAME_MARKER_SIZE = 4; const int FOLDED_CELL_SIZE = 9; } @@ -305,7 +304,7 @@ TopToBottomOrientation::TopToBottomOrientation() { PredefinedRect::END_SOUND_EDIT, QRect(CELL_DRAG_WIDTH, CELL_HEIGHT - 2, CELL_WIDTH - CELL_DRAG_WIDTH, 2)); addRect(PredefinedRect::LOOP_ICON, QRect(keyRect.left(), 0, 10, 11)); - addRect(PredefinedRect::FRAME_DOT, QRect(0, 0, -1, -1)); // hide + addRect(PredefinedRect::FRAME_MARKER_AREA, QRect(0, 0, -1, -1)); // hide // Note viewer addRect( @@ -344,7 +343,9 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect(PredefinedRect::PINNED_CENTER_KEY, QRect((FRAME_HEADER_WIDTH - PINNED_SIZE) / 2, (CELL_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE)); - addRect(PredefinedRect::FRAME_INDICATOR, QRect(0, 0, -1, -1)); // hide + addRect( + PredefinedRect::PREVIEW_FRAME_AREA, + QRect(PLAY_RANGE_X, 0, (FRAME_HEADER_WIDTH - PLAY_RANGE_X), CELL_HEIGHT)); // Column viewer addRect(PredefinedRect::LAYER_HEADER, @@ -902,10 +903,10 @@ LeftToRightOrientation::LeftToRightOrientation() { QRect(CELL_WIDTH - 2, CELL_DRAG_HEIGHT, 2, CELL_HEIGHT - CELL_DRAG_HEIGHT)); addRect(PredefinedRect::LOOP_ICON, QRect(0, keyRect.top(), 10, 11)); - addRect( - PredefinedRect::FRAME_DOT, - QRect((CELL_WIDTH - FRAME_DOT_SIZE) / 2 - 1, - CELL_HEIGHT - FRAME_DOT_SIZE - 6, FRAME_DOT_SIZE, FRAME_DOT_SIZE)); + QRect frameMarker((CELL_WIDTH - FRAME_MARKER_SIZE) / 2 - 1, + CELL_HEIGHT - FRAME_MARKER_SIZE - 6, FRAME_MARKER_SIZE, + FRAME_MARKER_SIZE); + addRect(PredefinedRect::FRAME_MARKER_AREA, frameMarker); // Notes viewer addRect( @@ -948,10 +949,9 @@ LeftToRightOrientation::LeftToRightOrientation() { PredefinedRect::PINNED_CENTER_KEY, QRect((CELL_WIDTH - PINNED_SIZE) / 2, (FRAME_HEADER_HEIGHT - PINNED_SIZE) / 2, PINNED_SIZE, PINNED_SIZE)); - addRect(PredefinedRect::FRAME_INDICATOR, - QRect((CELL_WIDTH - FRAME_IND_SIZE) / 2, - FRAME_HEADER_HEIGHT - FRAME_IND_SIZE, FRAME_IND_SIZE, - FRAME_IND_SIZE)); + addRect( + PredefinedRect::PREVIEW_FRAME_AREA, + QRect(0, PLAY_RANGE_Y, CELL_WIDTH, (FRAME_HEADER_HEIGHT - PLAY_RANGE_Y))); // Column viewer addRect(PredefinedRect::LAYER_HEADER, @@ -959,8 +959,8 @@ LeftToRightOrientation::LeftToRightOrientation() { addRect( PredefinedRect::FOLDED_LAYER_HEADER, QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 2, FOLDED_LAYER_HEADER_HEIGHT)); - QRect columnName(ICONS_WIDTH + 2, 1, - LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT - 1); + QRect columnName(ICONS_WIDTH + 1, 0, + LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT); addRect(PredefinedRect::RENAME_COLUMN, columnName); QRect eye(1, 0, ICON_WIDTH, ICON_HEIGHT); addRect(PredefinedRect::EYE_AREA, eye); @@ -1019,9 +1019,9 @@ LeftToRightOrientation::LeftToRightOrientation() { // Flags addFlag(PredefinedFlag::DRAG_LAYER_BORDER, false); addFlag(PredefinedFlag::DRAG_LAYER_VISIBLE, true); - addFlag(PredefinedFlag::LAYER_NAME_BORDER, false); + addFlag(PredefinedFlag::LAYER_NAME_BORDER, true); addFlag(PredefinedFlag::LAYER_NAME_VISIBLE, true); - addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, false); + addFlag(PredefinedFlag::LAYER_NUMBER_BORDER, true); addFlag(PredefinedFlag::LAYER_NUMBER_VISIBLE, true); addFlag(PredefinedFlag::EYE_AREA_BORDER, true); addFlag(PredefinedFlag::EYE_AREA_VISIBLE, true); @@ -1043,7 +1043,7 @@ LeftToRightOrientation::LeftToRightOrientation() { // Lines // addLine(PredefinedLine::LOCKED, - verticalLine(CELL_DRAG_HEIGHT / 2, NumberRange(0, CELL_WIDTH))); + verticalLine((CELL_DRAG_HEIGHT + 1) / 2, NumberRange(0, CELL_WIDTH))); addLine(PredefinedLine::SEE_MARKER_THROUGH, horizontalLine(0, NumberRange(0, CELL_DRAG_HEIGHT))); addLine(PredefinedLine::CONTINUE_LEVEL, @@ -1076,6 +1076,13 @@ LeftToRightOrientation::LeftToRightOrientation() { corner.lineTo(QPointF(CELL_WIDTH, 0)); addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner); + QPainterPath diamond(QPointF(0, -4)); + diamond.lineTo(4, 0); + diamond.lineTo(0, 4); + diamond.lineTo(-4, 0); + diamond.lineTo(0, -4); + addPath(PredefinedPath::FRAME_MARKER_DIAMOND, diamond); + QPainterPath fromTriangle(QPointF(EASE_TRIANGLE_SIZE / 2, 0)); fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, EASE_TRIANGLE_SIZE)); fromTriangle.lineTo(QPointF(-EASE_TRIANGLE_SIZE / 2, -EASE_TRIANGLE_SIZE)); @@ -1101,7 +1108,7 @@ LeftToRightOrientation::LeftToRightOrientation() { playTo.lineTo(QPointF(-PLAY_MARKER_SIZE, 0)); playTo.lineTo(QPointF(0, PLAY_MARKER_SIZE)); playTo.lineTo(QPointF(0, 0)); - playTo.translate(CELL_WIDTH - 1, PLAY_RANGE_Y); + playTo.translate(CELL_WIDTH - 2, PLAY_RANGE_Y); addPath(PredefinedPath::END_PLAY_RANGE, playTo); QPainterPath track(QPointF(0, 0)); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index c48f822..85a0b1a 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -341,7 +341,8 @@ Preferences::Preferences() , m_enableAutoStretch(true) , m_cursorBrushType("Small") , m_cursorBrushStyle("Default") - , m_cursorOutlineEnabled(true) { + , m_cursorOutlineEnabled(true) + , m_currentColumnColor(TPixel::Black) { TCamera camera; m_defLevelType = PLI_XSHLEVEL; m_defLevelWidth = camera.getSize().lx; @@ -703,6 +704,12 @@ Preferences::Preferences() setCursorBrushStyle(m_cursorBrushStyle.toStdString()); getValue(*m_settings, "cursorOutlineEnabled", m_cursorOutlineEnabled); + + r = 255, g = 0, b = 0; + getValue(*m_settings, "currentColumnColor.r", r); + getValue(*m_settings, "currentColumnColor.g", g); + getValue(*m_settings, "currentColumnColor.b", b); + m_currentColumnColor = TPixel32(r, g, b); } //----------------------------------------------------------------- @@ -1708,3 +1715,13 @@ void Preferences::enableCursorOutline(bool on) { m_cursorOutlineEnabled = on; m_settings->setValue("cursorOutlineEnabled", on ? "1" : "0"); } + +void Preferences::setCurrentColumnData(const TPixel ¤tColumnColor) { + m_currentColumnColor = currentColumnColor; + m_settings->setValue("currentColumnColor.r", + QString::number(currentColumnColor.r)); + m_settings->setValue("currentColumnColor.g", + QString::number(currentColumnColor.g)); + m_settings->setValue("currentColumnColor.b", + QString::number(currentColumnColor.b)); +}