Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 andreas 1
/*
21 andreas 2
 * Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
3 andreas 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>
279 andreas 23
#include "texpat++.h"
3 andreas 24
#include "tvalidatefile.h"
25
 
279 andreas 26
#define POPUPTYPE_SUBPAGE       1
27
#define POPUPTYPE_SUBVIEW       2
28
 
3 andreas 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
 
279 andreas 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
 
3 andreas 80
class TPageList : public TValidateFile
81
{
82
    public:
83
        TPageList();
84
        ~TPageList();
85
 
193 andreas 86
        PAGELIST_T findPage(const std::string& name, bool system=false);
3 andreas 87
        PAGELIST_T findPage(int pageID);
193 andreas 88
        SUBPAGELIST_T findSubPage(const std::string& name, bool system=false);
3 andreas 89
        SUBPAGELIST_T findSubPage(int pageID);
90
 
279 andreas 91
        SUBVIEWLIST_T findSubViewList(int id);
92
        int findSubViewListPageID(int id, int index);
93
        int findSubViewListNextPageID(int id, int *index);
300 andreas 94
        int findSubViewListID(int pageID, int *index);
279 andreas 95
 
3 andreas 96
        std::vector<PAGELIST_T>& getPagelist() { return mPageList; }
348 andreas 97
        std::vector<SUBPAGELIST_T>& getSubPageList() { return mSubPageList; }
193 andreas 98
        std::vector<PAGELIST_T>& getSystemPagelist() { return mSystemPageList; }
99
        std::vector<SUBPAGELIST_T>& getSystemSupPageList() { return mSystemSubPageList; }
279 andreas 100
        std::vector<SUBVIEWLIST_T>& getSubViewList() { return mSubViewList; }
3 andreas 101
 
102
    private:
193 andreas 103
        void initialize(bool system=false);
279 andreas 104
        void loadSubPageSets(Expat::TExpat *xml);
193 andreas 105
        void cleanup();
106
 
3 andreas 107
        std::string mProject;
193 andreas 108
        std::string mSystemProject;
3 andreas 109
        std::vector<PAGELIST_T> mPageList;
110
        std::vector<SUBPAGELIST_T> mSubPageList;
193 andreas 111
        std::vector<PAGELIST_T> mSystemPageList;
112
        std::vector<SUBPAGELIST_T> mSystemSubPageList;
279 andreas 113
        std::vector<SUBVIEWLIST_T> mSubViewList;
3 andreas 114
};
115
 
116
#endif