tahoma2d/toonz/sources/include/toonzqt/paletteviewergui.h

380 lines
11 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef PALETTEVIEWERGUI_H
#define PALETTEVIEWERGUI_H
// TnzQt includes
#include "toonzqt/selection.h"
#include "toonzqt/lineedit.h"
// TnzCore includes
#include "tpalette.h"
// Qt includes
#include <QFrame>
#include <QTabBar>
#include <QShortcut>
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//==============================================================
// Forward declarations
class TXsheetHandle;
class TFrameHandle;
class TPaletteHandle;
class TXshLevelHandle;
class TStyleSelection;
class TabBarContainter;
class ChangeStyleCommand;
class QMimeData;
class StyleNameEditor;
//==============================================================
//****************************************************************************
// PaletteViewerGUI namespace
//****************************************************************************
/*!
\brief Contains classes pertaining the GUI of a Toonz Palette Viewer.
*/
2016-06-15 18:43:10 +12:00
namespace PaletteViewerGUI {
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
enum PaletteViewType //! Possible palette contents of a Palette Viewer.
{ LEVEL_PALETTE, //!< Content palette is from a level.
CLEANUP_PALETTE, //!< Content palette is from cleanup settings.
STUDIO_PALETTE //!< Content palette is from a Studio Palette panel.
2016-03-19 06:57:51 +13:00
};
//****************************************************************************
// PageViewer declaration
//****************************************************************************
class DVAPI PageViewer final : public QFrame, public TSelection::View {
2016-06-15 18:43:10 +12:00
Q_OBJECT
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
QColor m_textColor; // text color used for list view
Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor)
2016-03-19 06:57:51 +13:00
UI update and Icons from Konero (#126) * add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix travis-install (#3389) * Fix assert debug crash in flipconsole.cpp Fix crash when using the viewer controls in the console (debug) * Redraw Audio Waveform Fills the waveform rather than outlines it. * Update .gitignore * fix undo data when drawing arc and mutliarc * fix overwriting raster drawing palette (#3387) * mode sensitive fx settings * Create New Style Command Button (#3394) * Create New Style Command Button This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz. Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com> * Update paletteviewergui.cpp Made changes to the PR per request by Shun. * Fixed a space within the code that wasn't suppose to be there. Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> * tahoma license (#3396) * new style button optional * fix loading pegbars (removing updateKeyframes) * periodic random expression * add fx in linear color space this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd. in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories. * fractal noise iwa fx * skip unnecessary icon invalidation * fix frame range fill with tablet * stop function editor to open by dbl clicking key * Expanding the radius of the rotation handle. This just changes when the cursor transforms into the rotation tool. (cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39) * fix vector img patern stroke style * Update Stylesheets - Support the new icon sizes - XSheet and Timeline significantly redesigned - Lots of margin fixes and refactoring - Remove deprecated icons, as some icons are moved into binary - New Light theme * New Icons - Redesigns almost every icon as symbolic - Adds icons for most commands * Add Option for Icon Themes - Adds option for icon themes - Removes useless label from Preferences category list * Update Icon Functions - Adds themePath() boolean - Adds function for recoloring black pixels in pixmaps to any color - Rebuilds createQIcon to use fromTheme() and recolorPixmap() - Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon - Removes a grey horizontal line drawn above the console play bar in the viewer * Set Default Icon Theme and Paths - Sets search paths for icons for use with QIcon::fromTheme() - Sets default start icon theme on first install - Sets flag for displaying icons in menus, so we can selectively hide them * Set Icons for Commands - Sets icons for the commands - Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16 - Selectively allows icons to display for Tools in menus * Change Icon Sizes, General Fixes and Stylesheet Additions - Change icon sizes to new size - Remove margin around FX Editor window - Remove white line under color sliders in Style Editor - Make keyframe icons uniform and color stylable in the stylesheets - Removes deprecated stylesheet strings - Redesign GUI for palette list view - Make tree list header sort row stylable - Remove black lines from scrollbars in New Project window - Remove margin around combobox in Level Strip - Alter how some lines are drawn in the Timeline to fix some alpha issues - Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility - Make text always viewable in the FPS field in console bar - Increase size of radio buttons in Cleanup Settings - Increase size of switches in motion path nodes - Remove unessesary "Layer" label in Timeline and other rects - Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more - Moves some external stylesheet icons into binary * Make TPanelTitleBar Icon States Stylable - Makes icon states for TPanelTitleBar buttons stylable in stylesheets * Travis Fixes * Swap Startup Popup Logos They were in the wrong folders * Revert "Swap Startup Popup Logos" This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d. * Fix Startup Popup Logo It wasn't switching * Feedback Changes - Change render visualization to clapboard - Fix text contrast on levels in XSheet * Make Cell Selection More Clear * Darken Light Theme and Tint Empty Cell Selection * Fix missing icons * Fix memo button * Bring back colors * Hide Motion Tab * Fix Play Range Area (Light) Make play range area more visible * Vector Column Color Co-authored-by: pojienie <pojienie@gmail.com> Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp> Co-authored-by: Rodney <rodney.baker@gmail.com> Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Co-authored-by: Kite <konero@users.noreply.github.com> Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
2020-09-01 06:51:22 +12:00
// list view chip separator color
QColor m_separatorColor;
Q_PROPERTY(
QColor SeparatorColor READ getSeparatorColor WRITE setSeparatorColor)
// selected chip border color
QColor m_selectedBorderColor;
Q_PROPERTY(QColor SelectedBorderColor READ getSelectedBorderColor WRITE
setSelectedBorderColor)
// numpad shortcut key style
QColor m_numpadShortcutBgColor; // bg
Q_PROPERTY(QColor NumpadShortcutBgColor READ getNumpadShortcutBgColor WRITE
setNumpadShortcutBgColor)
QColor m_numpadShortcutBorderColor; // border
Q_PROPERTY(QColor NumpadShortcutBorderColor READ getNumpadShortcutBorderColor
WRITE setNumpadShortcutBorderColor)
// list view current cell color
QColor m_currentCellColor;
Q_PROPERTY(QColor CurrentCellColor READ getCurrentCellColor WRITE
setCurrentCellColor)
// list view selected cell color
QColor m_selectedCellColor;
Q_PROPERTY(QColor SelectedCellColor READ getSelectedCellColor WRITE
setSelectedCellColor)
// list view numpad shortcut border color
QColor m_listNumpadShortcutBorderColor;
Q_PROPERTY(
QColor ListNumpadShortcutBorderColor READ getListNumpadShortcutBorderColor
WRITE setListNumpadShortcutBorderColor)
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
enum ViewMode //! Possible view modes for a Palette Viewer.
{ SmallChips, //!< Small icons.
MediumChips, //!< Medium icons.
LargeChips, //!< Large icons with style names.
List, //!< Top-down list of all icons.
SmallChipsWithName //!< Small icons with overlayed style names (if
2016-06-20 14:23:05 +12:00
//! user-defined).
2016-06-15 18:43:10 +12:00
};
// for displaying the linked style name from studio palette
enum NameDisplayMode { Style, Original, StyleAndOriginal };
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
PageViewer(QWidget *parent = 0, PaletteViewType viewType = LEVEL_PALETTE,
bool hasPasteColors = true);
~PageViewer();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setPaletteHandle(TPaletteHandle *paletteHandle);
TPaletteHandle *getPaletteHandle() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setXsheetHandle(TXsheetHandle *xsheetHandle);
TXsheetHandle *getXsheetHandle() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setFrameHandle(TFrameHandle *xsheetHandle);
TFrameHandle *getFrameHandle() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// for clearing the cache when execute paste style command on styleSelection
void setLevelHandle(TXshLevelHandle *levelHandle);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setCurrentStyleIndex(int index);
int getCurrentStyleIndex() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setPage(TPalette::Page *page);
TPalette::Page *getPage() const { return m_page; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setChangeStyleCommand(ChangeStyleCommand *changeStyleCommand) {
m_changeStyleCommand = changeStyleCommand;
};
ChangeStyleCommand *getChangeStyleCommand() const {
return m_changeStyleCommand;
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int getChipCount() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
ViewMode getViewMode() const { return m_viewMode; }
void setViewMode(ViewMode mode);
2020-01-22 16:14:07 +13:00
NameDisplayMode getNameDisplayMode() const { return m_nameDisplayMode; }
2016-06-15 18:43:10 +12:00
void setNameDisplayMode(NameDisplayMode mode);
2016-03-19 06:57:51 +13:00
void toggleShowStyleIndex();
bool getShowStyleIndex();
2016-06-15 18:43:10 +12:00
PaletteViewerGUI::PaletteViewType getViewType() const { return m_viewType; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int posToIndex(const QPoint &pos) const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
QRect getItemRect(int index) const;
QRect getColorChipRect(int index) const;
QRect getColorNameRect(int index) const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void drop(int indexInPage, const QMimeData *mimeData);
void createDropPage();
2016-06-19 20:06:29 +12:00
void onSelectionChanged() override { update(); }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TStyleSelection *getSelection() const { return m_styleSelection; }
void clearSelection();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// update the "lock"s for commands when the StyleSelection becomes current and
// when the current palettte changed
void updateCommandLocks();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setTextColor(const QColor &color) { m_textColor = color; }
QColor getTextColor() const { return m_textColor; }
2016-03-19 06:57:51 +13:00
UI update and Icons from Konero (#126) * add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix travis-install (#3389) * Fix assert debug crash in flipconsole.cpp Fix crash when using the viewer controls in the console (debug) * Redraw Audio Waveform Fills the waveform rather than outlines it. * Update .gitignore * fix undo data when drawing arc and mutliarc * fix overwriting raster drawing palette (#3387) * mode sensitive fx settings * Create New Style Command Button (#3394) * Create New Style Command Button This PR creates a new button in the pallette editor that creates a new style. Button is large and easy access for a faster and easier workflow. Original code developed by Turtletooth for Tahoma. Given permission to develop within Openoonz. Co-Authored-By: Jeremy Bullock <turtletooth@users.noreply.github.com> * Update paletteviewergui.cpp Made changes to the PR per request by Shun. * Fixed a space within the code that wasn't suppose to be there. Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> * tahoma license (#3396) * new style button optional * fix loading pegbars (removing updateKeyframes) * periodic random expression * add fx in linear color space this commit is based on source for the ComposeAdd plugin fx by DWANGO Co., Ltd. in dwango_opentoonz_plugins and opentoonz_plugin_utility repositories. * fractal noise iwa fx * skip unnecessary icon invalidation * fix frame range fill with tablet * stop function editor to open by dbl clicking key * Expanding the radius of the rotation handle. This just changes when the cursor transforms into the rotation tool. (cherry picked from commit 7722ae989bbdc6aa5cb48df7a4c08bae1fe6ea39) * fix vector img patern stroke style * Update Stylesheets - Support the new icon sizes - XSheet and Timeline significantly redesigned - Lots of margin fixes and refactoring - Remove deprecated icons, as some icons are moved into binary - New Light theme * New Icons - Redesigns almost every icon as symbolic - Adds icons for most commands * Add Option for Icon Themes - Adds option for icon themes - Removes useless label from Preferences category list * Update Icon Functions - Adds themePath() boolean - Adds function for recoloring black pixels in pixmaps to any color - Rebuilds createQIcon to use fromTheme() and recolorPixmap() - Removes createQIconOnOff as it seemed to be a rarely used duplicate of createQIcon - Removes a grey horizontal line drawn above the console play bar in the viewer * Set Default Icon Theme and Paths - Sets search paths for icons for use with QIcon::fromTheme() - Sets default start icon theme on first install - Sets flag for displaying icons in menus, so we can selectively hide them * Set Icons for Commands - Sets icons for the commands - Hides icons being displayed in menus as most icons are 20x20, they will look blurry when shrunk to 16x16 - Selectively allows icons to display for Tools in menus * Change Icon Sizes, General Fixes and Stylesheet Additions - Change icon sizes to new size - Remove margin around FX Editor window - Remove white line under color sliders in Style Editor - Make keyframe icons uniform and color stylable in the stylesheets - Removes deprecated stylesheet strings - Redesign GUI for palette list view - Make tree list header sort row stylable - Remove black lines from scrollbars in New Project window - Remove margin around combobox in Level Strip - Alter how some lines are drawn in the Timeline to fix some alpha issues - Make conditional fixed onion skin and normal onion skin dots contrast more against a light background area to make sure they have good visibility - Make text always viewable in the FPS field in console bar - Increase size of radio buttons in Cleanup Settings - Increase size of switches in motion path nodes - Remove unessesary "Layer" label in Timeline and other rects - Various colors made stylable in the stylesheets; palette numpad and selection frame, cleanup settings border, scene cast folder path, schematic lines, ruler, xsheet lines, keyframes, cell input box and more - Moves some external stylesheet icons into binary * Make TPanelTitleBar Icon States Stylable - Makes icon states for TPanelTitleBar buttons stylable in stylesheets * Travis Fixes * Swap Startup Popup Logos They were in the wrong folders * Revert "Swap Startup Popup Logos" This reverts commit 815908a9f3e725f48507dab8a2270bdfa045649d. * Fix Startup Popup Logo It wasn't switching * Feedback Changes - Change render visualization to clapboard - Fix text contrast on levels in XSheet * Make Cell Selection More Clear * Darken Light Theme and Tint Empty Cell Selection * Fix missing icons * Fix memo button * Bring back colors * Hide Motion Tab * Fix Play Range Area (Light) Make play range area more visible * Vector Column Color Co-authored-by: pojienie <pojienie@gmail.com> Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun.iwasawa@ghibli.jp> Co-authored-by: Rodney <rodney.baker@gmail.com> Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> Co-authored-by: shun-iwasawa <shun-iwasawa@users.noreply.github.com> Co-authored-by: Kite <konero@users.noreply.github.com> Co-authored-by: Jeremy Bullock <turtletooth@users.noreply.github.com> Co-authored-by: DoctorRyan <doctorryan1969.gmail.com>
2020-09-01 06:51:22 +12:00
// list view chip separator color
void setSeparatorColor(const QColor &color) { m_separatorColor = color; }
QColor getSeparatorColor() const { return m_separatorColor; }
void setSelectedBorderColor(const QColor &color) {
m_selectedBorderColor = color;
}
QColor getSelectedBorderColor() const { return m_selectedBorderColor; }
// numpad shortcut key style
void setNumpadShortcutBgColor(const QColor &color) {
m_numpadShortcutBgColor = color;
}
QColor getNumpadShortcutBgColor() const { return m_numpadShortcutBgColor; }
void setNumpadShortcutBorderColor(const QColor &color) {
m_numpadShortcutBorderColor = color;
}
QColor getNumpadShortcutBorderColor() const {
return m_numpadShortcutBorderColor;
}
// list view current cell color
void setCurrentCellColor(const QColor &color) { m_currentCellColor = color; }
QColor getCurrentCellColor() const { return m_currentCellColor; }
// list view selected cell color
void setSelectedCellColor(const QColor &color) {
m_selectedCellColor = color;
}
QColor getSelectedCellColor() const { return m_selectedCellColor; }
// list view numpad shortcut border color
void setListNumpadShortcutBorderColor(const QColor &color) {
m_listNumpadShortcutBorderColor = color;
}
QColor getListNumpadShortcutBorderColor() const {
return m_listNumpadShortcutBorderColor;
}
2016-03-19 06:57:51 +13:00
public slots:
2016-06-15 18:43:10 +12:00
void computeSize();
void onFrameChanged();
void onStyleRenamed();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void addNewColor();
void addNewPage();
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
QSize getChipSize() const;
void drawColorChip(QPainter &p, QRect &chipRect, TColorStyle *style);
void drawColorName(QPainter &p, QRect &nameRect, TColorStyle *style,
int styleIndex);
void drawToggleLink(QPainter &p, QRect &chipRect, TColorStyle *style);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
// event handlers
2016-06-19 20:06:29 +12:00
void paintEvent(QPaintEvent *) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void resizeEvent(QResizeEvent *) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void mouseDoubleClickEvent(QMouseEvent *event) override;
void contextMenuEvent(QContextMenuEvent *event) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void keyPressEvent(QKeyEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
2016-06-15 18:43:10 +12:00
void startDragDrop();
void createMenuAction(QMenu &menu, const char *id, QString name,
const char *slot);
2016-06-19 20:06:29 +12:00
void showEvent(QShowEvent *) override;
void hideEvent(QHideEvent *) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
bool event(QEvent *e) override;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void select(int indexInPage, QMouseEvent *event);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void zoomInChip();
void zoomOutChip();
2016-03-19 06:57:51 +13:00
2016-09-12 22:51:52 +12:00
bool hasShortcut(int indexInPage);
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
DVGui::LineEdit *m_renameTextField;
QPoint m_dragStartPosition;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TPalette::Page *m_page;
QPoint m_chipsOrigin;
int m_chipPerRow;
ViewMode m_viewMode;
NameDisplayMode m_nameDisplayMode;
int m_dropPositionIndex;
bool m_dropPageCreated;
bool m_startDrag;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TStyleSelection *m_styleSelection;
TFrameHandle *m_frameHandle;
bool m_hasPasteColors;
PaletteViewType m_viewType;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
ChangeStyleCommand *m_changeStyleCommand;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
QShortcut *m_zoomInShortCut;
QShortcut *m_zoomOutShortCut;
StyleNameEditor *m_styleNameEditor;
2016-03-19 06:57:51 +13:00
signals:
2016-06-15 18:43:10 +12:00
void changeWindowTitleSignal();
void switchToPage(int);
2016-03-19 06:57:51 +13:00
};
//****************************************************************************
// PaletteTabBar declaration
//****************************************************************************
class DVAPI PaletteTabBar final : public QTabBar {
2016-06-15 18:43:10 +12:00
Q_OBJECT
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
PaletteTabBar(QWidget *parent, bool hasPageCommand);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setPageViewer(PageViewer *pageViewer) { m_pageViewer = pageViewer; }
2016-03-19 06:57:51 +13:00
public slots:
2016-06-15 18:43:10 +12:00
void updateTabName();
2016-03-19 06:57:51 +13:00
signals:
2016-06-15 18:43:10 +12:00
void tabTextChanged(int index);
void movePage(int srcIndex, int dstIndex);
2016-03-19 06:57:51 +13:00
protected:
2016-06-19 20:06:29 +12:00
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dropEvent(QDropEvent *event) override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
DVGui::LineEdit *m_renameTextField;
int m_renameTabIndex;
PageViewer *m_pageViewer;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool m_hasPageCommand;
2016-03-19 06:57:51 +13:00
};
//****************************************************************************
// PaletteIconWidget declaration
//****************************************************************************
/*!
2016-06-15 18:43:10 +12:00
\brief Special placeholder toolbar icon for \a starting a palette
move
through drag & drop.
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
\details This widget is currently employed as a mere mouse event filter
to propagate drag & drop starts to a PaletteViewer ancestor
in the widgets hierarchy.
*/
2016-03-19 06:57:51 +13:00
class DVAPI PaletteIconWidget final : public QWidget {
2016-06-15 18:43:10 +12:00
Q_OBJECT
2016-03-19 06:57:51 +13:00
public:
#if QT_VERSION >= 0x050500
2016-06-15 18:43:10 +12:00
PaletteIconWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
2016-03-19 06:57:51 +13:00
#else
2016-06-15 18:43:10 +12:00
PaletteIconWidget(QWidget *parent = 0, Qt::WFlags flags = 0);
2016-03-19 06:57:51 +13:00
#endif
2016-06-15 18:43:10 +12:00
~PaletteIconWidget();
2016-03-19 06:57:51 +13:00
signals:
2016-06-15 18:43:10 +12:00
void startDrag(); //!< Emitted \a once whenever the icon is sensibly dragged
//! by the user.
2016-03-19 06:57:51 +13:00
protected:
2016-06-19 20:06:29 +12:00
void paintEvent(QPaintEvent *) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
QPoint m_mousePressPos; //!< Mouse position at mouse press.
bool m_isOver, //!< Whether mouse is hovering on this widget.
m_dragged; //!< Whether user has started a drag operation on the icon.
2016-03-19 06:57:51 +13:00
};
2016-06-15 18:43:10 +12:00
} // namespace PaletteViewerGUI
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
#endif // PALETTEVIEWERGUI_H