Revisión | a57d7c91c5be00e5919ae0bd066774c5d91228e7 (tree) |
---|---|
Tiempo | 2018-06-18 19:49:03 |
Autor | Starg <starg@user...> |
Commiter | Starg |
[sfviewer] Add option to prepend "dir ${basedir}" to cfg files
@@ -22,13 +22,14 @@ | ||
22 | 22 | #define IDM_OPT_APPEND_COMMENT 40010 |
23 | 23 | #define IDM_OPT_APPEND_FSPACES 40011 |
24 | 24 | #define IDM_OPT_KEEP_FULLPATH 40012 |
25 | +#define IDM_OPT_PREPEND_BASEDIR 40013 | |
25 | 26 | |
26 | 27 | // Next default values for new objects |
27 | 28 | // |
28 | 29 | #ifdef APSTUDIO_INVOKED |
29 | 30 | #ifndef APSTUDIO_READONLY_SYMBOLS |
30 | 31 | #define _APS_NEXT_RESOURCE_VALUE 105 |
31 | -#define _APS_NEXT_COMMAND_VALUE 40013 | |
32 | +#define _APS_NEXT_COMMAND_VALUE 40014 | |
32 | 33 | #define _APS_NEXT_CONTROL_VALUE 1004 |
33 | 34 | #define _APS_NEXT_SYMED_VALUE 101 |
34 | 35 | #endif |
@@ -23,6 +23,7 @@ BEGIN | ||
23 | 23 | MENUITEM "Append first spaces(&P)", IDM_OPT_APPEND_FSPACES |
24 | 24 | MENUITEM SEPARATOR |
25 | 25 | MENUITEM "Keep original full-path(&K)", IDM_OPT_KEEP_FULLPATH |
26 | + MENUITEM "Prepend ""dir ${basedir}""(&D)", IDM_OPT_PREPEND_BASEDIR | |
26 | 27 | END |
27 | 28 | END |
28 | 29 |
@@ -80,14 +80,13 @@ extern "C" void InsertDrum(int bank, int preset, int note, const char *str, cons | ||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outComment, int outSpace, int keepFullPath) | |
83 | +void SFView_ExportConfigFile(char *outFileName, int outListEnable, int outComment, int outSpace, int keepFullPath, int prependBaseDir) | |
84 | 84 | { |
85 | 85 | FILE *fp = fopen(outFileName, "w"); |
86 | + if (!outListEnable && prependBaseDir) | |
87 | + fprintf(fp, "dir \"${basedir}\"\n"); | |
86 | 88 | for (std::map< int, std::map< int, sfvSFInst > >::iterator it = g_sfInst.begin(); it != g_sfInst.end(); ++it) { |
87 | - if (outListEnable) | |
88 | - fprintf(fp, "bank %d\n", (*it).first); | |
89 | - else | |
90 | - fprintf(fp, "bank %d\n", (*it).first); | |
89 | + fprintf(fp, "bank %d\n", (*it).first); | |
91 | 90 | for (std::map< int, sfvSFInst >::iterator itc = (*it).second.begin(); itc != (*it).second.end(); ++itc) { |
92 | 91 | const char *file = (*itc).second.str.c_str(); |
93 | 92 | const int program = (*itc).first; |
@@ -152,8 +151,8 @@ void ExportFile(HWND hDlg, bool bExportList) | ||
152 | 151 | { |
153 | 152 | MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; |
154 | 153 | HMENU hMenu = GetMenu(hDlg); |
155 | - CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH }; | |
156 | - BOOL states[] = { FALSE, FALSE, FALSE }; | |
154 | + CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH, IDM_OPT_PREPEND_BASEDIR}; | |
155 | + BOOL states[] = { FALSE, FALSE, FALSE, FALSE }; | |
157 | 156 | CMyFileDialog fd; |
158 | 157 | fd.setSaveDlgDefaultSetting(); |
159 | 158 | fd.setTitle("Export filename .."); |
@@ -172,13 +171,15 @@ void ExportFile(HWND hDlg, bool bExportList) | ||
172 | 171 | fd.setDefaultExt("cfg"); |
173 | 172 | fd.setFilter("TiMidity++ Config File (*.cfg)\0*.cfg\0\0"); |
174 | 173 | } |
175 | - if (fd.Execute()) { | |
176 | - SFView_ExportConfigFile((char*)fd.getFile(0), | |
177 | - (int)bExportList, | |
178 | - (int)states[0], | |
179 | - (int)states[1], | |
180 | - (int)states[2]); | |
181 | - } | |
174 | + if (fd.Execute()) { | |
175 | + SFView_ExportConfigFile((char*)fd.getFile(0), | |
176 | + (int)bExportList, | |
177 | + (int)states[0], | |
178 | + (int)states[1], | |
179 | + (int)states[2], | |
180 | + (int)states[3] | |
181 | + ); | |
182 | + } | |
182 | 183 | } |
183 | 184 | |
184 | 185 | HIMAGELIST g_hil = NULL; |
@@ -188,8 +189,8 @@ LRESULT DlgMainProc_INITDIALOG(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
188 | 189 | { |
189 | 190 | MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; |
190 | 191 | HMENU hMenu = GetMenu(hDlg); |
191 | - CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH }; | |
192 | - CONST UINT states[] = { MFS_UNCHECKED, MFS_UNCHECKED, MFS_CHECKED }; | |
192 | + CONST UINT menuIDs[] = { IDM_OPT_APPEND_COMMENT, IDM_OPT_APPEND_FSPACES, IDM_OPT_KEEP_FULLPATH, IDM_OPT_PREPEND_BASEDIR}; | |
193 | + CONST UINT states[] = { MFS_CHECKED, MFS_UNCHECKED, MFS_UNCHECKED, MFS_CHECKED }; | |
193 | 194 | |
194 | 195 | if (__argc == 2) { |
195 | 196 | ResetSoundFontTree(hDlg); |
@@ -276,6 +277,7 @@ LRESULT DlgMainProc_COMMAND(HWND hDlg, WPARAM wParam, LPARAM lParam) | ||
276 | 277 | case IDM_OPT_APPEND_COMMENT: |
277 | 278 | case IDM_OPT_APPEND_FSPACES: |
278 | 279 | case IDM_OPT_KEEP_FULLPATH: |
280 | + case IDM_OPT_PREPEND_BASEDIR: | |
279 | 281 | hMenu = GetMenu(hDlg); |
280 | 282 | mii.fMask = MIIM_STATE | MIIM_ID; |
281 | 283 | GetMenuItemInfo(hMenu, LOWORD(wParam), FALSE, &mii); |