446 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
|
|
|
3 |
*
|
|
|
4 |
* This program is free software; you can redistribute it and/or modify
|
|
|
5 |
* it under the terms of the GNU General Public License as published by
|
|
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
|
|
7 |
* (at your option) any later version.
|
|
|
8 |
*
|
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
* GNU General Public License for more details.
|
|
|
13 |
*
|
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
|
15 |
* along with this program; if not, write to the Free Software Foundation,
|
|
|
16 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
17 |
*/
|
|
|
18 |
#ifndef __TPAGELIST_H__
|
|
|
19 |
#define __TPAGELIST_H__
|
|
|
20 |
|
|
|
21 |
#include <string>
|
|
|
22 |
#include <vector>
|
|
|
23 |
#include "texpat++.h"
|
|
|
24 |
#include "tvalidatefile.h"
|
|
|
25 |
|
|
|
26 |
#define POPUPTYPE_SUBPAGE 1
|
|
|
27 |
#define POPUPTYPE_SUBVIEW 2
|
|
|
28 |
|
|
|
29 |
typedef struct PAGELIST_T
|
|
|
30 |
{
|
|
|
31 |
std::string name;
|
|
|
32 |
int pageID{0};
|
|
|
33 |
std::string file;
|
|
|
34 |
int isValid{-1};
|
|
|
35 |
|
|
|
36 |
void clear()
|
|
|
37 |
{
|
|
|
38 |
name.clear();
|
|
|
39 |
pageID = 0;
|
|
|
40 |
file.clear();
|
|
|
41 |
isValid = -1;
|
|
|
42 |
}
|
|
|
43 |
}PAGELIST_T;
|
|
|
44 |
|
|
|
45 |
typedef struct SUBPAGELIST_T
|
|
|
46 |
{
|
|
|
47 |
std::string name;
|
|
|
48 |
int pageID{0};
|
|
|
49 |
std::string file;
|
|
|
50 |
std::string group;
|
|
|
51 |
int isValid{-1};
|
|
|
52 |
int popupType{0};
|
|
|
53 |
|
|
|
54 |
void clear()
|
|
|
55 |
{
|
|
|
56 |
name.clear();
|
|
|
57 |
pageID = 0;
|
|
|
58 |
file.clear();
|
|
|
59 |
group.clear();
|
|
|
60 |
isValid = -1;
|
|
|
61 |
popupType = 0;
|
|
|
62 |
}
|
|
|
63 |
}SUBPAGELIST_T;
|
|
|
64 |
|
|
|
65 |
typedef struct SUBVIEWITEM_T
|
|
|
66 |
{
|
|
|
67 |
int index{0};
|
|
|
68 |
int pageID{0};
|
|
|
69 |
}SUBVIEWITEM_T;
|
|
|
70 |
|
|
|
71 |
typedef struct SUBVIEWLIST_T
|
|
|
72 |
{
|
|
|
73 |
std::string name;
|
|
|
74 |
int id{0};
|
|
|
75 |
int pgWidth{0};
|
|
|
76 |
int pgHeight{0};
|
|
|
77 |
std::vector<SUBVIEWITEM_T> items;
|
|
|
78 |
}SUBVIEWLIST_T;
|
|
|
79 |
|
|
|
80 |
class TPageList : public TValidateFile
|
|
|
81 |
{
|
|
|
82 |
public:
|
|
|
83 |
TPageList();
|
|
|
84 |
~TPageList();
|
|
|
85 |
|
|
|
86 |
PAGELIST_T findPage(const std::string& name, bool system=false);
|
|
|
87 |
PAGELIST_T findPage(int pageID);
|
|
|
88 |
SUBPAGELIST_T findSubPage(const std::string& name, bool system=false);
|
|
|
89 |
SUBPAGELIST_T findSubPage(int pageID);
|
|
|
90 |
|
|
|
91 |
SUBVIEWLIST_T findSubViewList(int id);
|
|
|
92 |
int findSubViewListPageID(int id, int index);
|
|
|
93 |
int findSubViewListNextPageID(int id, int *index);
|
|
|
94 |
int findSubViewListID(int pageID, int *index);
|
|
|
95 |
|
|
|
96 |
std::vector<PAGELIST_T>& getPagelist() { return mPageList; }
|
|
|
97 |
std::vector<SUBPAGELIST_T>& getSubPageList() { return mSubPageList; }
|
|
|
98 |
std::vector<PAGELIST_T>& getSystemPagelist() { return mSystemPageList; }
|
|
|
99 |
std::vector<SUBPAGELIST_T>& getSystemSupPageList() { return mSystemSubPageList; }
|
|
|
100 |
std::vector<SUBVIEWLIST_T>& getSubViewList() { return mSubViewList; }
|
|
|
101 |
|
|
|
102 |
private:
|
|
|
103 |
void initialize(bool system=false);
|
|
|
104 |
void loadSubPageSets(Expat::TExpat *xml);
|
|
|
105 |
void cleanup();
|
|
|
106 |
|
|
|
107 |
std::string mProject;
|
|
|
108 |
std::string mSystemProject;
|
|
|
109 |
std::vector<PAGELIST_T> mPageList;
|
|
|
110 |
std::vector<SUBPAGELIST_T> mSubPageList;
|
|
|
111 |
std::vector<PAGELIST_T> mSystemPageList;
|
|
|
112 |
std::vector<SUBPAGELIST_T> mSystemSubPageList;
|
|
|
113 |
std::vector<SUBVIEWLIST_T> mSubViewList;
|
|
|
114 |
};
|
|
|
115 |
|
|
|
116 |
#endif
|