1 #pragma once
2 
3 // TnzCore includes
4 #include "tfilepath.h"
5 #include "tgeometry.h"
6 
7 // TnzQt includes
8 #include "toonzqt/dvdialog.h"
9 #include "toonzqt/intfield.h"
10 #include "toonzqt/styleindexlineedit.h"
11 #include "toonzqt/filefield.h"
12 
13 // STD includes
14 #include <set>
15 
16 //==================================================
17 
18 //    Forward declarations
19 
20 class QRadioButton;
21 class TPaletteHandle;
22 class TXshSimpleLevel;
23 class TXsheet;
24 
25 //==================================================
26 
27 class MergeCmappedDialog final : public DVGui::Dialog {
28   Q_OBJECT
29 
30   DVGui::FileField *m_saveInFileFld;
31   DVGui::LineEdit *m_fileNameFld;
32   TFilePath &m_levelPath;
33 
34 public:
35   MergeCmappedDialog(TFilePath &);
36 
37   void accept() override;
38 
39 protected slots:
40 
onPathChanged()41   void onPathChanged() {}
onNameChanged()42   void onNameChanged() {}
43 };
44 
45 //----------------------------------------------------------------
46 
47 class MatchlinesDialog final : public DVGui::Dialog {
48   Q_OBJECT
49 
50   QRadioButton *m_button1, *m_button2, *m_button3;
51   DVGui::StyleIndexLineEdit *m_inkIndex;
52   DVGui::IntField *m_inkPrevalence;
53   TPaletteHandle *m_pltHandle;
54 
55   QPushButton *m_lup_noGapButton;
56   QPushButton *m_rup_noGapButton;
57   QPushButton *m_lup_gapButton;
58   QPushButton *m_rup_gapButton;
59   TXsheet *m_currentXsheet;
60 
61 protected slots:
62 
63   void onChooseInkClicked(bool value);
64   void onLineStackButtonPressed(int id);
65   void onInkPrevalenceChanged(bool isDragging);
66   void accept() override;
67 
68 protected:
69   void showEvent(QShowEvent *e) override;
70 
71 public:
72   MatchlinesDialog();
73 
74   int exec(TPalette *plt);
75   int getInkIndex();
76   int getInkPrevalence();
77 };
78 
79 //----------------------------------------------------------------
80 
81 class DeleteInkDialog final : public DVGui::Dialog {
82   Q_OBJECT
83 
84   DVGui::LineEdit *m_inkIndex;
85   DVGui::LineEdit *m_frames;
86 
87 public:
88   DeleteInkDialog(const QString &str, int inkIndex);
89 
90   void setRange(const QString &str);
91 
92   std::vector<int> getInkIndexes();
93   std::vector<TFrameId> getFrames();
94 };
95 
96 //==========================================================================
97 
98 void deleteMatchlines(TXshSimpleLevel *sl, const std::set<TFrameId> &fids);
99 void deleteInk(TXshSimpleLevel *sl, const std::set<TFrameId> &fids);
100 void mergeColumns(int dstColumn, int srcColumn, bool isRedo, bool groupLevels);
101 void mergeColumns(const std::set<int> &columns, bool groupLevels);
102 void doMatchlines(int column, int mColumn, int index, int inkPrevalence,
103                   int MatchlineSessionId = 0);
104 void mergeCmapped(int dstColumn, int srcColumn, const QString &fullpath,
105                   bool isRedo);
106 std::vector<int> string2Indexes(const QString &values);
107