1 #pragma once 2 #include "afxwin.h" 3 #include <string> 4 #include "resource.h" 5 #include "express_dialog.h" 6 #include "studiox_includes.h" 7 // PaletteLayoutDlg dialog 8 9 #define VISIBLE_PALETTE_ROWS 6 10 11 class palette_row : public express_table_row 12 { 13 public: 14 palette_row(); 15 void SetData(int index, GX_COLOR color, BOOL bEnabled); 16 GX_COLOR GetData(void); 17 afx_msg void OnPaint(); 18 virtual BOOL PreTranslateMessage(MSG *pMsg); 19 20 protected: 21 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 22 afx_msg void OnChar(UINT nChar, UINT repeat, UINT nFlags); 23 DECLARE_MESSAGE_MAP() 24 virtual BOOL OnEraseBkgnd(CDC* pDC); 25 void ColorChanged(); 26 27 private: 28 29 CStatic mIndexPrompt; 30 CEdit mAlphaField; 31 CEdit mRedField; 32 CEdit mBlueField; 33 CEdit mGreenField; 34 int mIndex; 35 BOOL mEnabled; 36 unsigned char mAlpha; 37 unsigned char mRed; 38 unsigned char mGreen; 39 unsigned char mBlue; 40 GX_COLOR mColor; 41 }; 42 43 class palette_frame : public CWnd 44 { 45 public: 46 palette_frame(theme_info *theme); 47 ~palette_frame(); 48 49 DECLARE_MESSAGE_MAP() 50 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 51 afx_msg void OnSetFocus(CWnd* pOldWnd); 52 53 public: 54 void SetRowData(void); SetTopIndex(int index)55 void SetTopIndex(int index) { mTopIndex = index; } GetTopIndex()56 INT GetTopIndex() { return mTopIndex; } 57 void NotifyColorChanged(int index, GX_COLOR color); 58 void Scroll(int deltaPos); 59 void UpdateStatusMsg(CString msg); 60 61 private: 62 CStatic mStatusMsg; 63 palette_row mPaletteRows[VISIBLE_PALETTE_ROWS]; 64 theme_info *mpTheme; 65 int mTopIndex; 66 }; 67 68 class PaletteLayoutDlg : public express_dialog 69 { 70 public: 71 PaletteLayoutDlg(int display, int theme, CWnd* pParent = NULL); // standard constructor 72 virtual ~PaletteLayoutDlg(); 73 void NotifyColorChanged(int index, GX_COLOR color); 74 void Scroll(int delta); 75 76 // Dialog Data 77 enum { IDD = IDD_PALETTE_LAYOUT }; 78 79 protected: 80 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 81 82 afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); 83 afx_msg void OnPaint(); 84 afx_msg void OnCancel(); 85 afx_msg void OnReturnKey(); 86 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *bar); 87 afx_msg void OnBnClickedOk(); 88 afx_msg void OnEnChangeTotalPaletteEntries(); 89 afx_msg void OnEnChangeUserPaletteEntries(); 90 afx_msg void OnBnClickedImportPalette(); 91 afx_msg void OnBnClickedExportPalette(); 92 afx_msg void OnBnClickedDefaultPalette(); 93 afx_msg void OnGenGradient(); 94 95 DECLARE_MESSAGE_MAP() 96 97 private: 98 int mDisplay; 99 int mTheme; 100 BOOL mPaletteResetToDefault; 101 102 int old_pal_total_entries; 103 int old_pal_predefined; 104 GX_COLOR OldPalette[256]; 105 palette_frame *mpPaletteFrame; 106 107 CScrollBar mPalIndexScroll; 108 studiox_project *mpProject; 109 void CheckResetColorIndexes(res_info *info, GX_COLOR *new_palette, USHORT new_pal_size); 110 afx_msg LRESULT OnTestMessage(WPARAM wParam, LPARAM lParam); 111 112 public: 113 afx_msg void OnEnChangeAutoPaletteEntries(); 114 virtual BOOL OnInitDialog(); 115 }; 116