1 #ifndef _COPY_PASTE_ENGINE_ 2 #define _COPY_PASTE_ENGINE_ 3 4 enum PASTE_CONFLICT_OPTIONS{ 5 PASTE_CONFLICT_OPTION_USE_SOURCE = 1, 6 PASTE_CONFLICT_OPTION_USE_DESTINATION, 7 PASTE_CONFLICT_OPTION_RENAME, 8 PASTE_CONFLICT_OPTION_ABORT 9 }; 10 11 typedef struct { 12 CString source_id_name; 13 CString translated_id_name; 14 } resource_trans_entry; 15 16 class copy_paste_info 17 { 18 public: 19 copy_paste_info(); 20 ~copy_paste_info(); 21 folder_info *template_dependencies; 22 folder_info *copied_widgets; 23 }; 24 25 class copy_paste_engine 26 { 27 public: 28 copy_paste_engine(); 29 ~copy_paste_engine(); 30 31 void SetProject(studiox_project *project); 32 33 BOOL CopyToClipboard(CArray<widget_info *> &info_list, HWND hWnd, folder_info *folder = NULL); 34 BOOL CopyToClipboard(widget_info *info, HWND hWnd); 35 BOOL CopyToClipboard(folder_info *folder, HWND hWnd); 36 copy_paste_info *PasteFromClipboard(HWND hWnd, int Display); 37 38 private: 39 folder_info *ReadWidgets(xml_reader &reader, const char *tagname); 40 void ClearResourceList(); 41 void BuildResourceList(widget_info *info, BOOL entry = FALSE); 42 void BuildBaseList(widget_info *base); 43 void CheckAddToList(CArray<int> &list, int res_id); 44 void CheckAddToBaseList(widget_info *base); 45 46 void ClearResourceTransList(); 47 void WriteColorDependencies(xml_writer &writer); 48 void WriteFontDependencies(xml_writer &writer); 49 void WritePixelmapDependencies(xml_writer &writer); 50 void WriteStringDependencies(xml_writer &writer); 51 52 BOOL ReadColorDependencies(xml_reader &reader); 53 BOOL ReadFontDependencies(xml_reader &reader); 54 BOOL ReadPixelmapDependencies(xml_reader &reader); 55 BOOL ReadStringDependencies(xml_reader &reader); 56 57 int TranslateId(CArray<resource_trans_entry> &list, int res_type, int res_id); 58 59 void TranslateWidgetResourceIds(widget_info *info); 60 61 int mDisplay; 62 studiox_project *mProject; 63 64 // these arrays hold the resource ids that need to be written out: 65 CArray<int> write_color_list; 66 CArray<int> write_font_list; 67 CArray<int> write_pixelmap_list; 68 CArray<int> write_string_list; 69 CArray<widget_info *> base_list; 70 71 // These arrays hold the old-to-new resource id name mapping tables: 72 CArray<resource_trans_entry> color_trans; 73 CArray<resource_trans_entry> string_trans; 74 }; 75 #endif