1 #pragma once 2 #include "afxwin.h" 3 4 // string_table_edit_dlg dialog 5 6 class string_reference_row : public CWnd 7 { 8 public: 9 string_reference_row(CWnd *parent, widget_info *info, int string_id); 10 ~string_reference_row(); 11 12 public: 13 DECLARE_MESSAGE_MAP() 14 afx_msg void OnPaint(); 15 16 public: GetWidgetPreviewSize()17 GX_RECTANGLE GetWidgetPreviewSize(){ return m_preview_size; }; GetInfoText()18 CString GetInfoText(){ return mInfoText; }; 19 void MakeWidgetPreview(); 20 21 protected: 22 widget_info *mpInfo; 23 int mStringId; 24 GX_BMP_INFO m_bitmap; 25 GX_WIDGET *mpWidget; 26 GX_CANVAS *mpCanvas; 27 GX_WINDOW_ROOT *mpRoot; 28 CString mInfoText; 29 30 int m_text_height; 31 GX_RECTANGLE m_preview_size; 32 }; 33 34 class string_reference_win : public CWnd 35 { 36 public: 37 string_reference_win(CWnd *parent, string_table *table, int string_index); 38 ~string_reference_win(); 39 40 public: 41 DECLARE_MESSAGE_MAP() 42 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 43 afx_msg void OnDestroy(); 44 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 45 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 46 47 public: 48 void CreateStringReferenceRows(widget_info *info, int string_id); 49 void CreateStringReferenceRows(); 50 void PositionChildren(); 51 void CreateDisplay(); 52 void UpdateResourceTable(); 53 void SetActiveLanguage(int language); 54 void StringSelected(int string_index); GetDisplay()55 GX_DISPLAY *GetDisplay(){ return mpDisplay; }; 56 CFont *GetDialogFont(); 57 58 protected: 59 int mStringIndex; 60 string_table *mpTable; 61 CScrollHelper *m_scroll_helper; 62 GX_DISPLAY *mpDisplay; 63 64 int m_text_height; 65 }; 66 67 //class table_frame; // forward reference 68 69 class table_frame : public CWnd 70 { 71 public: 72 table_frame(CWnd *parent, string_table *table); 73 ~table_frame(); 74 75 void RowSelected(int column, int row_id, bool assign_focus=FALSE); 76 void SelectedVisible(); GetSelectedId()77 int GetSelectedId() { return mSelectedRow; } GetRowCount()78 int GetRowCount() { return mRowCount; }; 79 80 void AddString(); 81 void DeleteString(int row_id); 82 83 void ToggleThreeColumnMode(); 84 BOOL IncrementTransLanguage(); 85 BOOL DecrementTransLanguage(); IsThreeColumnMode()86 BOOL IsThreeColumnMode() { return mThreeColumnMode;} 87 int GetTransLanguage(); 88 void SetSearchString(CString &search); 89 void ImportString(CString pathname); 90 CFont *GetUniFont(); 91 92 void SortStringTable(); 93 void SelectFirstRow(); 94 void InvalidateRow(int row_id); 95 int GetStringIndex(int row_id); 96 97 protected: 98 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 99 afx_msg void OnDestroy(void); 100 afx_msg void OnPaint(); 101 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); 102 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); 103 afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); 104 afx_msg void OnSize(UINT nType, int cx, int cy); 105 afx_msg void OnSetFocus(CWnd* pOldWnd); 106 afx_msg void OnKillFocus(CWnd* pNewWnd); 107 virtual BOOL PreTranslateMessage(MSG* pMsg); 108 void PositionChildren(); 109 void CreateTableRows(); 110 int CountFilterRows(); 111 void GetRowName(int row_id, CString& name); 112 CWnd *GetRow(int row_id); 113 114 BOOL IncludeInSearch(int RowId); 115 DECLARE_MESSAGE_MAP() 116 117 private: 118 CScrollHelper *m_scroll_helper; 119 string_table *mpTable; 120 int mSelectedRow; 121 int mTransLanguage; 122 int mRowHeight; 123 int mRowCount; 124 BOOL mThreeColumnMode; 125 CString mSearchString; 126 }; 127 128 class table_row : public CWnd 129 { 130 public: 131 table_row(CWnd *parent, int Id, int string_index, string_table *table); 132 afx_msg void OnPaint(); 133 afx_msg void OnSetFocus(CWnd *Wnd); 134 afx_msg void OnLButtonDown(UINT di, CPoint cp); 135 void SetTransLanguage(int language_index); 136 int GetRowHeight(); GetRowId()137 int GetRowId() {return mRowId;} GetStringIndex()138 int GetStringIndex() { return mStringIndex; } 139 140 private: 141 void PaintHeaderRow(CDC *dc, CRect &size); 142 void PaintStringRow(CDC *dc, CRect &size); 143 144 int mRowId; 145 int mStringIndex; 146 int mRowHeight; 147 string_table *mpTable; 148 table_frame *mpFrame; 149 DECLARE_MESSAGE_MAP() 150 }; 151 152 class table_header : public CWnd 153 { 154 public: 155 table_header(table_frame *frame, string_table *table); 156 afx_msg void OnPaint(); 157 afx_msg void OnLButtonDown(UINT di, CPoint cp); 158 void SetTransLanguage(int language_index); GetIconWidth()159 int GetIconWidth() { return m_icon_width; } 160 161 private: 162 void PaintHeader(CDC *dc, CRect &size); 163 string_table *mpTable; 164 table_frame *mpFrame; 165 int m_icon_width; 166 DECLARE_MESSAGE_MAP() 167 }; 168 169 class button_frame : public CWnd 170 { 171 public: 172 button_frame(string_table *table); 173 ~button_frame(); 174 175 void UpdateControlDimensions(int text_scaler); 176 177 protected: 178 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 179 afx_msg void OnSize(UINT nType, int cx, int cy); 180 181 afx_msg void OnAddString(); 182 afx_msg void OnDeleteClicked(); 183 afx_msg void OnSearchButton(); 184 afx_msg void OnSearchEdit(); 185 afx_msg void OnImportString(); 186 afx_msg void OnExportString(); 187 afx_msg void OnSortStringTable(); 188 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 189 virtual BOOL PreTranslateMessage(MSG* pMsg); 190 191 DECLARE_MESSAGE_MAP() 192 193 private: 194 void PositionChildren(); 195 string_table *mpTable; 196 CButton mAddButton; 197 CButton mDeleteButton; 198 //CButton mSortById; 199 //CButton mSortByString; 200 CStatic mSortLabel; 201 express_combobox mSortCombobox; 202 CButton mImportButton; 203 CButton mExportButton; 204 CEdit mSearchString; 205 CButton mSearchButton; 206 CBitmap mSearchBitmap; 207 208 int m_button_width; 209 int m_button_height; 210 }; 211 212 class string_table_edit_dlg : public express_dialog 213 { 214 DECLARE_DYNAMIC(string_table_edit_dlg) 215 216 public: 217 string_table_edit_dlg(string_table *table, CWnd* pParent = NULL); // standard constructor 218 virtual ~string_table_edit_dlg(); 219 void SetControlDimensions(int text_scaler); 220 BOOL StringSelected(int row_id, BOOL bIdColumn); 221 BOOL SaveStringInfo(); 222 void UpdateEditFieldContent(); 223 void SetThreeColumnMode(BOOL bOnOff); 224 void Exit(int exit_code); GetTableFrame()225 table_frame *GetTableFrame() {return mpTableFrame;} GetStrReferenceWin()226 string_reference_win *GetStrReferenceWin(){ return mpStrReferenceWin; }; GetUniFont()227 CFont *GetUniFont(){ return &mUniFont; }; GetDialogFont()228 CFont* GetDialogFont() { return &m_dialog_font; } 229 afx_msg LRESULT OnTestMessage(WPARAM wParam, LPARAM lParam); InvalideTableHeader()230 void InvalideTableHeader() { mpTableHeader->Invalidate(); } 231 void UpdateSearchMessage(); 232 233 // Dialog Data 234 enum { IDD = IDD_STRING_TABLE_EDIT 235 }; 236 237 protected: 238 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 239 afx_msg void OnSize(UINT nType, int cx, int cy); 240 afx_msg HBRUSH OnCtlColor(CDC *pDC, CWnd *pWnd, UINT nCtlColor); 241 afx_msg void OnStringEdit(); 242 afx_msg void OnIdEdit(); 243 244 afx_msg void OnChangeFont(); 245 afx_msg void OnGetMinMaxInfo(MINMAXINFO *lpMMI); 246 afx_msg void OnOK(); 247 DECLARE_MESSAGE_MAP() 248 249 public: 250 virtual BOOL OnInitDialog(); 251 afx_msg void OnPaint(); 252 virtual INT_PTR DoModal(); 253 afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection); 254 255 private: 256 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 257 void PositionChildren(); 258 void UpdateStringWidth(GX_RESOURCE_ID font_id, CString &str); 259 void UpdateStringFields(); 260 261 void SetRichEditReadingDirection(CRichEditCtrl* edit, INT format); 262 263 string_reference_win *mpStrReferenceWin; 264 CStatic mStrReferenceLabel; 265 266 button_frame *mpButtonFrame; 267 table_header *mpTableHeader; 268 table_frame *mpTableFrame; 269 view_header *mpWinHeader; 270 string_table *mpTable; 271 int mRowId; 272 BOOL mThreeColumnMode; 273 string_table_record m_record; 274 275 CButton mOkButton; 276 CStatic mIdLabel; 277 CStatic mTopEditLabel; 278 CStatic mNumRefLabel; 279 CStatic mNumReferences; 280 CStatic mWidthLabel; 281 CStatic mWidth; 282 CStatic mFontLabel; 283 CStatic mNotesLabel; 284 CEdit mIdEdit; 285 CBrush *mNotesBrush; 286 CBrush *mViewEditBrush; 287 express_combobox mFontCombo; 288 CStatic mRequiredIndicationLable; 289 290 CRichEditCtrl mTopStringEdit; 291 CRichEditCtrl mBottomStringEdit; 292 LOGFONT lf; 293 CFont mUniFont; 294 CEdit mNotesEdit; 295 int m_button_bar_height; 296 int m_table_header_height; 297 int m_string_info_column_width; 298 int m_info_field_width; 299 int m_info_field_space; 300 int m_min_string_dialog_width; 301 int m_lable_height; 302 int m_lable_width; 303 int m_sys_dpi; 304 }; 305