1 2 3 class screen_generator : public studio_source_writer { 4 public: 5 screen_generator(studiox_project *project); 6 ~screen_generator(); 7 8 BOOL GenerateScreens(int display); 9 void WriteErrorDirectives(); 10 11 CString GetColorIdName(int color_id) const; 12 static CString GetColorIdName(studiox_project *proj, int display, int color_id); 13 CString GetFontIdName(int font_id) const; 14 static CString GetFontIdName(studiox_project *proj, int display, int font_id); 15 CString GetStringIdName(int string_id, widget_info *info = NULL) const; 16 static CString GetStringIdName(studiox_project *proj, int display, int string_id, widget_info *info = NULL); 17 CString GetPixelmapIdName(int pixelmap_id, int frame_id = 0) const; 18 static CString GetPixelmapIdName(studiox_project *proj, int display, int pixelmap_id, int frame_id = 0); 19 20 CString GetString(int string_id, int language = 0) const; 21 22 // style flag writers 23 24 static BOOL IsTextType(widget_info *info); 25 static void AddButtonStyles(widget_info *info, CString &out); 26 static void AddButtonAlignmentStyles(widget_info *info, CString &out); 27 static void AddListStyles(widget_info *info, CString &out); 28 static void AddSliderStyles(widget_info *info, CString &out); 29 static void AddProgressBarStyles(widget_info *info, CString &out); 30 static void AddSpriteStyles(widget_info *info, CString &out); 31 static void AddScrollbarStyles(widget_info *info, CString &out); 32 static void AddScrollbarStyles(ULONG style, CString &out); 33 static void AddPixelmapSliderStyles(widget_info *info, CString &out); 34 static void AddDropListStyles(widget_info *info, CString &out); 35 static void AddTextAlignStyle(widget_info *info, CString &out); 36 static void AddWindowStyles(widget_info *info, CString &out); 37 static void AddTextScrollWheelStyles(widget_info *info, CString &out); 38 static void AddWidgetScrollWheelStyles(widget_info* info, CString& out); 39 static void AddTreeViewStyles(widget_info *info, CString &out); 40 static void AddTextInputStyles(widget_info *info, CString &out); 41 static void GetAnimationStyles(GX_ANIMATION_INFO *info, CString &out); 42 GetScreenNamePrefix()43 CString GetScreenNamePrefix(){ return m_screen_name_prefix; }; 44 45 private: 46 studiox_project *m_project; 47 int m_display; 48 int m_widget_id; 49 CString m_screen_name_prefix; 50 CString m_output_filepath; 51 CArray<CString> name_list; 52 CArray<CFile *> output_file_list; 53 CString m_strings_fit_msg; 54 55 CString GetWidgetTypeName(widget_info *info); 56 57 BOOL IsWidgetUsed(int widget_type) const; 58 BOOL IsWidgetUsed(widget_info *start, int widget_type) const; 59 60 // functions for generating header file 61 void GenerateScreenHeader(); 62 BOOL TypedefControlBlock(folder_info *folder); 63 void PrototypeCallbacks(widget_info *info); 64 BOOL CheckDependencies(widget_info *info, BOOL top_level = FALSE) const; 65 void DeclareScreenFlowStructures(); 66 67 void DeclareBaseMembers(widget_info *info); 68 void DeclareChildMembers(CString &parent_name, widget_info *info); 69 70 // functions for generating source file 71 void GenerateDisplayConfigBlock(); 72 void DeclareDisplayControlBlock(); 73 void GenerateScreenSource(); 74 void WriteWidgetsInfo(); 75 void DeclareControlBlocks(widget_info *info); 76 void DeclareControlBlocks(); 77 void WriteExternWidget(widget_info *&info); 78 void WriteExternWidgetsUsedByScreenFlow(folder_info *folder, int display_index); 79 void WriteExternWidgetsToDefaultFile(); 80 void WriteExternWidgetsUsedByScreenFlow(); 81 void DeclareWidgetTable(); 82 void DeclareDisplayTable(); 83 void WriteExternBaseDefines(); 84 void WriteExternBaseDefines(folder_info *parent_folder); 85 ULONG CalculateCanvasSizeBytes(int display); 86 bool SetOutFile(CString &outfile); 87 BOOL ProjectHasScreenFlow(); 88 CString GetTempateEventFuncName(widget_info *info); 89 CString GetWidgetReferenceName(widget_info *info); 90 BOOL CheckWriteScreenFlow(int display, widget_info *info); 91 void GenerateActionListName(flow_item *item, trigger_info *trigger, CString &name); 92 void GenerateAnimationInfo(flow_item *item, trigger_info *trigger, action_info *action, int index); 93 void GenerateAnimationInfoName(flow_item *item, CString &name, int index); 94 void WriteEventTable(flow_item *item); 95 void WriteAutoEventHandler(); 96 97 void WriteWidgetType(widget_info *info); 98 void WriteWidgetId(widget_info *info); 99 void WriteWidgetUserData(widget_info *info); 100 void WriteWidgetStyleFlags(widget_info *info); 101 void WriteWidgetStatusFlags(widget_info *info); 102 void WriteWidgetControlBlockSize(widget_info *info, BOOL bTop = FALSE); 103 void WriteWidgetColors(widget_info *info); 104 void WriteWidgetSize(widget_info *info); 105 void WriteCreateFunctionName(widget_info *info); 106 void WriteWidgetOverrides(widget_info *info); 107 void WriteCreateFunctions(); 108 109 110 void WriteChildDefine(CString &parent_name, widget_info *info); 111 void WriteParentDefine(widget_info *info); 112 void WriteWidgetIds(widget_info *info); 113 void WriteWidgetIds(folder_info *folder); 114 void WriteWidgetProperties(CString &prefix, widget_info *info, BOOL TopLevel = FALSE); 115 116 void WriteCreateFromResourceFunctions(); 117 void WriteDisplayConfigure(); 118 119 // functions specifically for Synergy targets: 120 void WriteDave2D8bppPaletteSetup(); 121 void WriteDave2D8bppPaletteRotatedSetup(); 122 123 void DeclareSynergyDriverFunctions(void); 124 void WriteDave2D16_32_Setup(UINT color_format); 125 void WriteDave2D16_32_RotatedSetup(UINT color_format); 126 void WriteDave2DSetupFunction(int display); 127 };