2024-04-20 16:23:08 +00:00
|
|
|
/*
|
2024-06-15 18:12:48 +00:00
|
|
|
* Descent 3
|
|
|
|
* Copyright (C) 2024 Parallax Software
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2024-04-20 16:23:08 +00:00
|
|
|
|
2024-04-19 20:58:24 +00:00
|
|
|
#ifndef _TABLE_MANAGE_H_
|
|
|
|
#define _TABLE_MANAGE_H_
|
|
|
|
|
|
|
|
#include "genericpage.h"
|
|
|
|
#include "pstypes.h"
|
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
#define NO_DESCRIPTION_STRING "<None>"
|
|
|
|
#define TEMP_TABLE_FILENAME "TempTable.loc"
|
2024-04-19 20:58:24 +00:00
|
|
|
|
|
|
|
// Generic Page Node class
|
|
|
|
class GenericPageNode {
|
2024-06-15 18:12:48 +00:00
|
|
|
friend class GenericPageList;
|
|
|
|
|
2024-04-19 20:58:24 +00:00
|
|
|
private:
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageNode *prev;
|
|
|
|
GenericPageNode *next;
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
mngs_generic_page genericpage; // Generic Page Data
|
|
|
|
uint32_t page_id; // Page's file index (i.e. the page_id'th page in file)
|
2024-04-19 20:58:24 +00:00
|
|
|
|
|
|
|
public:
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageNode::GenericPageNode();
|
|
|
|
GenericPageNode::~GenericPageNode();
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
bool operator<(const GenericPageNode &node);
|
2024-04-19 20:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Generic Page List class (maintains linked list of pages)
|
|
|
|
class GenericPageList {
|
|
|
|
private:
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageNode *m_head;
|
|
|
|
GenericPageNode *m_tail;
|
|
|
|
uint32_t m_size;
|
|
|
|
|
|
|
|
CString m_TableFilename;
|
|
|
|
bool m_TableLoaded;
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
bool m_TableModified;
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageNode *m_SelectedNode;
|
|
|
|
uint32_t m_SelectedIndex;
|
2024-04-19 20:58:24 +00:00
|
|
|
|
|
|
|
public:
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageList::GenericPageList();
|
|
|
|
GenericPageList::~GenericPageList();
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
void SetModified(bool mMod) { m_TableModified = mMod; }
|
|
|
|
bool IsModified(void) { return (m_TableModified); }
|
|
|
|
bool IsLoaded(void) { return (m_TableLoaded); }
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
void ClearList(void);
|
|
|
|
bool AddToList(GenericPageNode *node);
|
|
|
|
bool LoadTable(char *table_filename);
|
|
|
|
bool SaveTable(char *table_filename);
|
|
|
|
bool FillFromList(CComboBox *list);
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
GenericPageNode *FindNode(uint32_t page_id);
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
void SelectNext(void);
|
|
|
|
void SelectPrev(void);
|
|
|
|
void SelectNode(uint32_t list_index);
|
|
|
|
void DisplaySelected(CComboBox *list, CEdit *description);
|
|
|
|
void SaveSelected(CEdit *description);
|
2024-04-19 20:58:24 +00:00
|
|
|
|
2024-06-15 18:12:48 +00:00
|
|
|
int ModifiedPrompt(CDialog *wnd);
|
|
|
|
void SetTitleString(CDialog *wnd);
|
2024-04-19 20:58:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _TABLE_MANAGE_H_ */
|