PageRenderTime 80ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 1ms

/cwxeditor_src/cwx/editor/gui/dwt/settingsdialog.d

https://bitbucket.org/k4nagatsuki/cwxeditor
D | 3195 lines | 3083 code | 106 blank | 6 comment | 400 complexity | d1722b509d8bfadc6ca58aed0450e4d7 MD5 | raw file
Possible License(s): LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. /// ?????????????????
  2. module cwx.editor.gui.dwt.settingsdialog;
  3. import cwx.background;
  4. import cwx.utils;
  5. import cwx.xml;
  6. import cwx.summary;
  7. import cwx.skin;
  8. import cwx.graphics;
  9. import cwx.structs;
  10. import cwx.menu;
  11. import cwx.variables;
  12. import cwx.cab;
  13. import cwx.script;
  14. import cwx.props;
  15. import cwx.features;
  16. import cwx.types;
  17. import cwx.editor.gui.sound;
  18. import cwx.editor.gui.dwt.dprops;
  19. import cwx.editor.gui.dwt.properties;
  20. import cwx.editor.gui.dwt.dutils;
  21. import cwx.editor.gui.dwt.dskin;
  22. import cwx.editor.gui.dwt.centerlayout;
  23. import cwx.editor.gui.dwt.absdialog;
  24. import cwx.editor.gui.dwt.splitpane;
  25. import cwx.editor.gui.dwt.commons;
  26. import cwx.editor.gui.dwt.areaview;
  27. import cwx.editor.gui.dwt.areaviewutils;
  28. import cwx.editor.gui.dwt.xmlbytestransfer;
  29. import cwx.editor.gui.dwt.dockingfolder;
  30. import cwx.editor.gui.dwt.customtext;
  31. import cwx.editor.gui.dwt.undo;
  32. import cwx.editor.gui.dwt.dmenu;
  33. import cwx.editor.gui.dwt.customtable;
  34. import cwx.editor.gui.dwt.loader;
  35. import cwx.editor.gui.dwt.scripterrordialog;
  36. import cwx.editor.gui.dwt.incsearch;
  37. import std.path;
  38. import std.file;
  39. import std.string;
  40. import std.functional;
  41. import std.traits;
  42. import std.array;
  43. import std.ascii;
  44. import std.exception;
  45. import std.algorithm : iota;
  46. import org.eclipse.swt.all;
  47. import java.lang.all;
  48. enum BackupType {
  49. Time = 0,
  50. Edit = 1,
  51. }
  52. class SettingsDialog : AbsDialog {
  53. private:
  54. Commons _comm;
  55. Props _prop;
  56. Summary _summ;
  57. DockingFolderCTC _dock;
  58. void delegate() _sendReloadProps;
  59. CTabItem _tabB;
  60. Text _enginePath;
  61. Button _refEnginePath;
  62. Button _findEnginePath;
  63. Text _tempDir;
  64. Text _backupDir;
  65. Button _backupEnabled;
  66. Button _backupIntervalTypeTime;
  67. Button _backupIntervalTypeEdit;
  68. Spinner _backupIntervalTime;
  69. Spinner _backupIntervalEdit;
  70. Spinner _backupCount;
  71. Button _backupRefAuthor;
  72. Button _autoSave;
  73. Button _backupArchived;
  74. Button _backupRef;
  75. Button _backupDirOpen;
  76. Text _backupBeforeSaveDir;
  77. Button _backupBeforeSaveEnabled;
  78. Button _backupBeforeSaveRef;
  79. Button _backupBeforeSaveDirOpen;
  80. Text _author;
  81. Text _wallpaper;
  82. Combo _wallpaperStyle;
  83. int[int] _wallpaperStyleTbl;
  84. int[int] _wallpaperStyleTbl2;
  85. Button _clearHist;
  86. Spinner _histMax;
  87. Button _clearSHist;
  88. Spinner _sHistMax;
  89. Spinner _undoMaxMainView;
  90. Spinner _undoMaxEvent;
  91. Spinner _undoMaxReplace;
  92. Spinner _undoMaxEtc;
  93. CTabFolder _tabf;
  94. CTabItem _tabS;
  95. BgImageS[] _bgImagesDefault;
  96. ToolsPane!BgImageSetting _bgStgs;
  97. Text _keyCodes;
  98. CTabItem _tabT;
  99. ToolsPane!OuterTool _tools;
  100. ToolsPane!ClassicEngine _cEngines;
  101. CTabItem _tabC;
  102. ToolsPane!ScTemplate _scTempls;
  103. ToolsPane!EvTemplate _evTempls;
  104. CTabItem _tabE;
  105. Combo _language;
  106. string[int] _msgsTableIndex;
  107. string[string] _msgsTableFile;
  108. Text _ignorePaths;
  109. TableItem _singleWindow = null;
  110. TableItem _showAreaDirTree;
  111. TableItem _showSummaryInAreaTable;
  112. TableItem _clickIsOpenEvent;
  113. TableItem _smoothingCard;
  114. TableItem _showImagePreview;
  115. TableItem _editTriggerTypeIsQuick;
  116. TableItem _classicStyleTree;
  117. TableItem _adjustContentName;
  118. TableItem _radarStyleParams;
  119. TableItem _showEventTreeMark;
  120. TableItem _showCardListHeader;
  121. TableItem _showCardListTitle;
  122. TableItem _showSkillCardLevel;
  123. TableItem _ignoreEmptyStart;
  124. TableItem _expandXMLs;
  125. TableItem _contentsFloat;
  126. TableItem _contentsAutoHide;
  127. TableItem _comboListVisible;
  128. TableItem _xmlCopy;
  129. TableItem _showSpNature;
  130. TableItem _saveInnerImagePath;
  131. TableItem _linkCard;
  132. TableItem _traceDirectories;
  133. TableItem _logicalSort;
  134. TableItem _copyDesc;
  135. TableItem _refCardsAtEditBgImage;
  136. TableItem _floatMessagePreview;
  137. TableItem _addNewClassicEngine;
  138. TableItem _doubleIO;
  139. TableItem _switchTabWheel;
  140. TableItem _closeTabWithMiddleClick;
  141. TableItem _openTabAtRightOfCurrentTab;
  142. TableItem _reconstruction;
  143. TableItem _openLastScenario;
  144. TableItem _showVariableValuesInEventText;
  145. TableItem _cautionBeforeReplace;
  146. TableItem _saveNeedChanged;
  147. TableItem _applyDialogsBeforeSave;
  148. TableItem _useNamesAfterStandard;
  149. TableItem _selectVariableWithTree;
  150. TableItem _autoUpdateJpy1File;
  151. TableItem _straightEventTreeView;
  152. TableItem _gentleAngleEventTree;
  153. TableItem _forceIndentBranchContent;
  154. TableItem _showTerminalMark;
  155. TableItem _clickIconIsStartEdit;
  156. Combo _targetVersion;
  157. int[string] _targetVersionTbl;
  158. string[int] _targetVersionTbl2;
  159. Combo _soundPlayType;
  160. int[int] _soundPlayTypeTbl;
  161. int[int] _soundPlayTypeTbl2;
  162. Spinner _bgmVolume;
  163. Combo _soundEffectPlayType;
  164. int[int] _soundEffectPlayTypeTbl;
  165. int[int] _soundEffectPlayTypeTbl2;
  166. Spinner _seVolume;
  167. Combo _dialogStatus;
  168. int[int] _dialogStatusTbl;
  169. int[int] _dialogStatusTbl2;
  170. Text _savedSound;
  171. Text _mnemonic;
  172. HotKeyField _hotkey;
  173. Table _menu;
  174. Button _menuApply;
  175. Button _menuDel;
  176. class SMenuData {
  177. MenuID id;
  178. string mnemonic;
  179. string hotkey;
  180. }
  181. IncSearch _menuIncSearch;
  182. void menuIncSearch() { mixin(S_TRACE);
  183. _menuIncSearch.startIncSearch();
  184. }
  185. class RefE : SelectionAdapter, ModifyListener {
  186. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  187. refreshEnabled();
  188. }
  189. override void modifyText(ModifyEvent e) { mixin(S_TRACE);
  190. refreshEnabled();
  191. }
  192. }
  193. string dropEngine(string[] files) { mixin(S_TRACE);
  194. if (!files.length) return "";
  195. string file = files[0];
  196. if (cfnmatch(baseName(file), _prop.var.etc.engine)) { mixin(S_TRACE);
  197. return file;
  198. } else { mixin(S_TRACE);
  199. return "";
  200. }
  201. }
  202. const SYSTEM_SOUND_EXT = [
  203. ".aiff", // AIFF
  204. ".mid", ".midi", // MIDI
  205. ".mod", ".s3m", ".xm", ".it", ".mt2", ".669", ".med", // MOD
  206. ".ogg", ".ogv", ".oga", ".ogx", // Ogg
  207. ".voc", // VOC
  208. ".wav" // WAV/RIFF
  209. ];
  210. string dropSysSound(string[] files) { mixin(S_TRACE);
  211. if (!files.length) return "";
  212. foreach (file; files) { mixin(S_TRACE);
  213. string ext = .toLower(.extension(file));
  214. if (.contains!("a == b", string, string)(SYSTEM_SOUND_EXT, ext)) { mixin(S_TRACE);
  215. return file;
  216. }
  217. }
  218. return "";
  219. }
  220. const WALLPAPER_EXT = [".bmp", ".ico", ".icon", ".jpg", ".jpeg", ".gif", ".png", ".tif", ".tiff"];
  221. string dropWallpaper(string[] files) { mixin(S_TRACE);
  222. if (!files.length) return "";
  223. foreach (file; files) { mixin(S_TRACE);
  224. if (.contains!("a == b", string, string)(WALLPAPER_EXT, .toLower(.extension(file)))) { mixin(S_TRACE);
  225. return file;
  226. }
  227. }
  228. return "";
  229. }
  230. void selectEngine() { mixin(S_TRACE);
  231. selectFile(_enginePath, [_prop.var.etc.engine], [_prop.var.etc.engine],
  232. _prop.var.etc.engine, .tryFormat(_prop.msgs.dlgTitEnginePath, _prop.var.etc.engine),
  233. _prop.var.etc.enginePath);
  234. }
  235. void selectSysSound(Text widget) { mixin(S_TRACE);
  236. string[] extArr;
  237. foreach (sse; SYSTEM_SOUND_EXT) { mixin(S_TRACE);
  238. extArr ~= "*." ~ sse;
  239. }
  240. string exts = std.string.join(extArr, ";");
  241. selectFile(widget, [.tryFormat(_prop.msgs.playableSounds, exts)], [exts],
  242. baseName(widget.getText()), _prop.msgs.dlgTitSystemSound,
  243. widget.getText());
  244. }
  245. void selectTemp() { mixin(S_TRACE);
  246. selectDir(_prop, _tempDir, _prop.msgs.tempDir, _prop.msgs.tempDirDesc, _prop.tempPath);
  247. }
  248. void selectBackup() { mixin(S_TRACE);
  249. selectDir(_prop, _backupDir, _prop.msgs.backupDir, _prop.msgs.backupDirDesc, _prop.backupPath);
  250. }
  251. void selectBackupBeforeSave() { mixin(S_TRACE);
  252. selectDir(_prop, _backupBeforeSaveDir, _prop.msgs.backupBeforeSaveDir, _prop.msgs.backupBeforeSaveDirDesc, _prop.backupBeforeSavePath);
  253. }
  254. void selectWallpaper() { mixin(S_TRACE);
  255. string[] filterName = [_prop.msgs.filterWallpaper, _prop.msgs.filterAll];
  256. string[] filter = [
  257. "*" ~ std.string.join(WALLPAPER_EXT.dup, ";*"),
  258. "*"
  259. ];
  260. selectFile(_wallpaper, filterName, filter, _prop.var.etc.wallpaper, _prop.msgs.dlgTitWallpaper, getcwd());
  261. }
  262. class SelEngine : SelectionAdapter {
  263. override void widgetSelected(SelectionEvent e) {selectEngine();}
  264. }
  265. class SelTemp : SelectionAdapter {
  266. override void widgetSelected(SelectionEvent e) {selectTemp();}
  267. }
  268. class SelBackup : SelectionAdapter {
  269. override void widgetSelected(SelectionEvent e) {selectBackup();}
  270. }
  271. class SelBackupBeforeSave : SelectionAdapter {
  272. override void widgetSelected(SelectionEvent e) {selectBackupBeforeSave();}
  273. }
  274. class SelWallpaper : SelectionAdapter {
  275. override void widgetSelected(SelectionEvent e) {selectWallpaper();}
  276. }
  277. class SelSysSound : SelectionAdapter {
  278. private Text _text;
  279. this (Text text) { mixin(S_TRACE);
  280. _text = text;
  281. }
  282. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  283. selectSysSound(_text);
  284. }
  285. }
  286. void refHistories() { mixin(S_TRACE);
  287. _clearHist.setEnabled(_prop.var.etc.openHistories.length > 0);
  288. }
  289. void refSearchHistories() { mixin(S_TRACE);
  290. _clearSHist.setEnabled(_prop.var.etc.searchHistories.length || _prop.var.etc.replaceHistories.length);
  291. }
  292. class ClearHist : SelectionAdapter {
  293. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  294. auto dlg = new MessageBox(_histMax.getShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
  295. dlg.setText(_prop.msgs.dlgTitQuestion);
  296. dlg.setMessage(_prop.msgs.dlgMsgHistoryClear);
  297. if (SWT.OK == dlg.open()) { mixin(S_TRACE);
  298. _prop.var.etc.openHistories = [];
  299. _comm.refHistories.call();
  300. _prop.var.save(_dock);
  301. _sendReloadProps();
  302. }
  303. }
  304. }
  305. class ClearSHist : SelectionAdapter {
  306. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  307. auto dlg = new MessageBox(_sHistMax.getShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
  308. dlg.setText(_prop.msgs.dlgTitQuestion);
  309. dlg.setMessage(_prop.msgs.dlgMsgSearchHistoryClear);
  310. if (SWT.OK == dlg.open()) { mixin(S_TRACE);
  311. _prop.var.etc.searchHistories = [];
  312. _prop.var.etc.replaceHistories = [];
  313. _prop.var.etc.grepDirHistories = [];
  314. _comm.refSearchHistories.call();
  315. _prop.var.save(_dock);
  316. _sendReloadProps();
  317. }
  318. }
  319. }
  320. void construct1(CTabFolder tabf) { mixin(S_TRACE);
  321. auto comp = new Composite(tabf, SWT.NONE);
  322. comp.setLayout(new GridLayout(1, false));
  323. _tabB = new CTabItem(tabf, SWT.NONE);
  324. _tabB.setText(_prop.msgs.baseSettings);
  325. _tabB.setControl(comp);
  326. { mixin(S_TRACE);
  327. auto comp2 = new Composite(comp, SWT.NONE);
  328. comp2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  329. comp2.setLayout(zeroMarginGridLayout(2, false));
  330. { mixin(S_TRACE);
  331. auto grp = new Group(comp2, SWT.NONE);
  332. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  333. grp.setLayout(new GridLayout(3, false));
  334. grp.setText(.tryFormat(_prop.msgs.enginePath, _prop.var.etc.engine));
  335. _enginePath = new Text(grp, SWT.BORDER);
  336. createTextMenu!Text(_comm, _prop, _enginePath, &catchMod);
  337. _enginePath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  338. mod(_enginePath);
  339. _refEnginePath = new Button(grp, SWT.PUSH);
  340. _refEnginePath.setText(_prop.msgs.reference);
  341. _refEnginePath.addSelectionListener(new SelEngine);
  342. createOpenButton(_comm, grp, &_enginePath.getText, false);
  343. _findEnginePath = new Button(grp, SWT.CHECK);
  344. mod(_findEnginePath);
  345. _findEnginePath.setText(_prop.msgs.findEnginePath);
  346. auto gd = new GridData;
  347. gd.horizontalSpan = 3;
  348. _findEnginePath.setLayoutData(gd);
  349. setupDropFile(grp, _enginePath, &dropEngine);
  350. .listener(_enginePath, SWT.Modify, { mixin(S_TRACE);
  351. _findEnginePath.setEnabled(0 == _enginePath.getText().length);
  352. });
  353. .listener(_findEnginePath, SWT.Selection, { mixin(S_TRACE);
  354. _enginePath.setEnabled(!_findEnginePath.getSelection());
  355. _refEnginePath.setEnabled(!_findEnginePath.getSelection());
  356. });
  357. }
  358. { mixin(S_TRACE);
  359. auto grp = new Group(comp2, SWT.NONE);
  360. grp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  361. grp.setText(_prop.msgs.languageSetting);
  362. grp.setLayout(new GridLayout(1, true));
  363. string defLocale;
  364. auto msgsTable = _prop.parent.msgsTable(_prop.var.etc.languageDir, _msgsTableFile, defLocale);
  365. _language = new Combo(grp, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER);
  366. mod(_language);
  367. _language.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
  368. _language.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  369. _language.add(_prop.msgs.languageSystem);
  370. _language.select(0);
  371. string curLocale = _prop.msgs.locale;
  372. foreach (locale; msgsTable.keys.sort) { mixin(S_TRACE);
  373. _language.add(msgsTable[locale].localeName);
  374. int index = _language.getItemCount() - 1;
  375. _msgsTableIndex[index] = locale;
  376. if (!_prop.var.etc.useSystemLanguage && 0 == icmp(curLocale, locale)) { mixin(S_TRACE);
  377. _language.select(index);
  378. }
  379. }
  380. auto l = new Label(grp, SWT.NONE);
  381. l.setText(_prop.msgs.languageCaution);
  382. }
  383. }
  384. { mixin(S_TRACE);
  385. auto grp = new Group(comp, SWT.NONE);
  386. grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  387. grp.setLayout(new GridLayout(3, false));
  388. grp.setText(_prop.msgs.tempDir);
  389. _tempDir = new Text(grp, SWT.BORDER);
  390. createTextMenu!Text(_comm, _prop, _tempDir, &catchMod);
  391. _tempDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  392. mod(_tempDir);
  393. auto refr = new Button(grp, SWT.PUSH);
  394. refr.setText(_prop.msgs.reference);
  395. refr.addSelectionListener(new SelTemp);
  396. createOpenButton(_comm, grp, &_tempDir.getText, true);
  397. setupDropFile(grp, _tempDir, toDelegate(&dropDir));
  398. }
  399. { mixin(S_TRACE);
  400. auto grp = new Group(comp, SWT.NONE);
  401. grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  402. grp.setText(_prop.msgs.backupDir);
  403. auto gl = new GridLayout(3, false);
  404. gl.horizontalSpacing = 10;
  405. grp.setLayout(gl);
  406. { mixin(S_TRACE);
  407. _backupEnabled = new Button(grp, SWT.CHECK);
  408. _backupEnabled.setText(_prop.msgs.backupEnabled);
  409. mod(_backupEnabled);
  410. _backupEnabled.addSelectionListener(_refe);
  411. }
  412. { mixin(S_TRACE);
  413. auto comp2 = new Composite(grp, SWT.NONE);
  414. comp2.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  415. comp2.setLayout(zeroMarginGridLayout(6, false));
  416. _backupIntervalTypeTime = new Button(comp2, SWT.RADIO);
  417. _backupIntervalTypeTime.setText(_prop.msgs.backupIntervalTime);
  418. _backupIntervalTime = new Spinner(comp2, SWT.BORDER);
  419. initSpinner(_backupIntervalTime);
  420. _backupIntervalTime.setMinimum(1);
  421. _backupIntervalTime.setMaximum(99);
  422. mod(_backupIntervalTime);
  423. auto l2 = new Label(comp2, SWT.CENTER);
  424. l2.setText(_prop.msgs.minute);
  425. _backupIntervalTypeTime.addSelectionListener(_refe);
  426. _backupIntervalTypeEdit = new Button(comp2, SWT.RADIO);
  427. _backupIntervalTypeEdit.setText(_prop.msgs.backupIntervalEdit);
  428. _backupIntervalEdit = new Spinner(comp2, SWT.BORDER);
  429. initSpinner(_backupIntervalEdit);
  430. _backupIntervalEdit.setMinimum(1);
  431. _backupIntervalEdit.setMaximum(9999);
  432. mod(_backupIntervalEdit);
  433. auto l3 = new Label(comp2, SWT.CENTER);
  434. l3.setText(_prop.msgs.count);
  435. _backupIntervalTypeEdit.addSelectionListener(_refe);
  436. }
  437. { mixin(S_TRACE);
  438. auto comp2 = new Composite(grp, SWT.NONE);
  439. comp2.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  440. comp2.setLayout(zeroMarginGridLayout(2, false));
  441. auto l = new Label(comp2, SWT.CENTER);
  442. l.setText(_prop.msgs.backupCount);
  443. _backupCount = new Spinner(comp2, SWT.BORDER);
  444. initSpinner(_backupCount);
  445. _backupCount.setMinimum(0);
  446. _backupCount.setMaximum(99);
  447. mod(_backupCount);
  448. }
  449. { mixin(S_TRACE);
  450. auto comp2 = new Composite(grp, SWT.NONE);
  451. auto gd = new GridData(GridData.FILL_HORIZONTAL);
  452. gd.horizontalSpan = 3;
  453. comp2.setLayoutData(gd);
  454. comp2.setLayout(zeroMarginGridLayout(4, false));
  455. auto l = new Label(comp2, SWT.NONE);
  456. l.setText(_prop.msgs.backupPath);
  457. _backupDir = new Text(comp2, SWT.BORDER);
  458. createTextMenu!Text(_comm, _prop, _backupDir, &catchMod);
  459. _backupDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  460. mod(_backupDir);
  461. _backupRef = new Button(comp2, SWT.PUSH);
  462. _backupRef.setText(_prop.msgs.reference);
  463. _backupRef.addSelectionListener(new SelBackup);
  464. _backupDirOpen = createOpenButton(_comm, comp2, &_backupDir.getText, true);
  465. setupDropFile(grp, _backupDir, toDelegate(&dropDir));
  466. }
  467. { mixin(S_TRACE);
  468. auto comp2 = new Composite(grp, SWT.NONE);
  469. auto gd = new GridData(GridData.FILL_HORIZONTAL);
  470. gd.horizontalSpan = 3;
  471. comp2.setLayoutData(gd);
  472. comp2.setLayout(zeroMarginGridLayout(3, false));
  473. _backupRefAuthor = new Button(comp2, SWT.CHECK);
  474. _backupRefAuthor.setText(_prop.msgs.backupRefAuthor);
  475. mod(_backupRefAuthor);
  476. _backupRefAuthor.addSelectionListener(_refe);
  477. _autoSave = new Button(comp2, SWT.CHECK);
  478. _autoSave.setText(_prop.msgs.autoSave);
  479. mod(_autoSave);
  480. _autoSave.addSelectionListener(_refe);
  481. _backupArchived = new Button(comp2, SWT.CHECK);
  482. _backupArchived.setText(_prop.msgs.backupArchived);
  483. mod(_backupArchived);
  484. _backupArchived.addSelectionListener(_refe);
  485. }
  486. }
  487. { mixin(S_TRACE);
  488. auto grp = new Group(comp, SWT.NONE);
  489. grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  490. grp.setText(_prop.msgs.backupBeforeSaveDir);
  491. grp.setLayout(new GridLayout(1, false));
  492. { mixin(S_TRACE);
  493. _backupBeforeSaveEnabled = new Button(grp, SWT.CHECK);
  494. _backupBeforeSaveEnabled.setText(_prop.msgs.backupBeforeSaveEnabled);
  495. mod(_backupBeforeSaveEnabled);
  496. _backupBeforeSaveEnabled.addSelectionListener(_refe);
  497. }
  498. { mixin(S_TRACE);
  499. auto comp2 = new Composite(grp, SWT.NONE);
  500. auto gd = new GridData(GridData.FILL_HORIZONTAL);
  501. gd.horizontalSpan = 3;
  502. comp2.setLayoutData(gd);
  503. comp2.setLayout(zeroMarginGridLayout(4, false));
  504. auto l = new Label(comp2, SWT.NONE);
  505. l.setText(_prop.msgs.backupBeforeSavePath);
  506. _backupBeforeSaveDir = new Text(comp2, SWT.BORDER);
  507. createTextMenu!Text(_comm, _prop, _backupBeforeSaveDir, &catchMod);
  508. _backupBeforeSaveDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  509. mod(_backupBeforeSaveDir);
  510. _backupBeforeSaveRef = new Button(comp2, SWT.PUSH);
  511. _backupBeforeSaveRef.setText(_prop.msgs.reference);
  512. _backupBeforeSaveRef.addSelectionListener(new SelBackupBeforeSave);
  513. _backupBeforeSaveDirOpen = createOpenButton(_comm, comp2, &_backupBeforeSaveDir.getText, true);
  514. setupDropFile(grp, _backupBeforeSaveDir, toDelegate(&dropDir));
  515. }
  516. }
  517. { mixin(S_TRACE);
  518. auto comp2 = new Composite(comp, SWT.NONE);
  519. comp2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  520. comp2.setLayout(zeroMarginGridLayout(2, false));
  521. { mixin(S_TRACE);
  522. auto comp3 = new Composite(comp2, SWT.NONE);
  523. comp3.setLayoutData(new GridData(GridData.FILL_BOTH));
  524. comp3.setLayout(zeroMarginGridLayout(1, false));
  525. { mixin(S_TRACE);
  526. auto grp = new Group(comp3, SWT.NONE);
  527. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  528. auto cl = new CenterLayout;
  529. cl.fillHorizontal = true;
  530. grp.setLayout(cl);
  531. grp.setText(_prop.msgs.scenarioAuthor);
  532. _author = new Text(grp, SWT.BORDER);
  533. createTextMenu!Text(_comm, _prop, _author, &catchMod);
  534. mod(_author);
  535. }
  536. { mixin(S_TRACE);
  537. auto grp = new Group(comp3, SWT.NONE);
  538. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  539. grp.setLayout(new GridLayout(1, true));
  540. grp.setText(_prop.msgs.wallpaper);
  541. { mixin(S_TRACE);
  542. auto comp4 = new Composite(grp, SWT.NONE);
  543. comp4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  544. comp4.setLayout(zeroMarginGridLayout(3, false));
  545. _wallpaper = new Text(comp4, SWT.BORDER);
  546. createTextMenu!Text(_comm, _prop, _wallpaper, &catchMod);
  547. _wallpaper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  548. mod(_wallpaper);
  549. auto refr = new Button(comp4, SWT.PUSH);
  550. refr.setText(_prop.msgs.reference);
  551. refr.addSelectionListener(new SelWallpaper);
  552. createOpenButton(_comm, comp4, &_wallpaper.getText, false);
  553. }
  554. { mixin(S_TRACE);
  555. auto comp4 = new Composite(grp, SWT.NONE);
  556. comp4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  557. comp4.setLayout(zeroMarginGridLayout(2, false));
  558. int[] styles;
  559. string[] names;
  560. foreach (s; [WallpaperStyle.Center, WallpaperStyle.Tile, WallpaperStyle.ExpandFull, WallpaperStyle.Expand]) { mixin(S_TRACE);
  561. styles ~= cast(int) s;
  562. names ~= _prop.msgs.wallpaperStyleName(s);
  563. }
  564. _wallpaperStyle = createEnumC(comp4, _prop.msgs.wallpaperStyle, styles, names, _wallpaperStyleTbl, _wallpaperStyleTbl2);
  565. }
  566. setupDropFile(grp, _wallpaper, &dropWallpaper);
  567. }
  568. { mixin(S_TRACE);
  569. auto grp = new Group(comp3, SWT.NONE);
  570. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  571. grp.setText(_prop.msgs.systemSounds);
  572. grp.setLayout(new GridLayout(7, false));
  573. auto l = new Label(grp, SWT.NONE);
  574. l.setText(_prop.msgs.soundSaved);
  575. _savedSound = new Text(grp, SWT.BORDER);
  576. createTextMenu!Text(_comm, _prop, _savedSound, &catchMod);
  577. _savedSound.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  578. mod(_savedSound);
  579. auto refr = new Button(grp, SWT.PUSH);
  580. refr.setText(_prop.msgs.reference);
  581. refr.addSelectionListener(new SelSysSound(_savedSound));
  582. createOpenButton(_comm, grp, &_savedSound.getText, false);
  583. setupDropFile(grp, _savedSound, &dropSysSound);
  584. auto sep = new Label(grp, SWT.SEPARATOR);
  585. auto sgd = new GridData(GridData.FILL_VERTICAL);
  586. sgd.heightHint = 0;
  587. sep.setLayoutData(sgd);
  588. auto play = new Button(grp, SWT.PUSH);
  589. play.setToolTipText(_prop.msgs.menuText(MenuID.PlaySE));
  590. play.setImage(_prop.images.menu(MenuID.PlaySE));
  591. .listener(play, SWT.Selection, { mixin(S_TRACE);
  592. string file = _savedSound.getText();
  593. if (file.length && .exists(file)) { mixin(S_TRACE);
  594. playSE(file, SOUND_TYPE_SDL);
  595. }
  596. });
  597. auto stop = new Button(grp, SWT.PUSH);
  598. stop.setToolTipText(_prop.msgs.menuText(MenuID.StopSE));
  599. stop.setImage(_prop.images.menu(MenuID.StopSE));
  600. .listener(stop, SWT.Selection, { mixin(S_TRACE);
  601. stopSE();
  602. });
  603. }
  604. }
  605. { mixin(S_TRACE);
  606. auto comp3 = new Composite(comp2, SWT.NONE);
  607. comp3.setLayout(zeroMarginGridLayout(1, true));
  608. comp3.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  609. { mixin(S_TRACE);
  610. auto grp = new Group(comp3, SWT.NONE);
  611. grp.setText(_prop.msgs.historiesSettings);
  612. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  613. grp.setLayout(new GridLayout(3, false));
  614. { mixin(S_TRACE);
  615. auto lComp = new Composite(grp, SWT.NONE);
  616. auto cl = new CenterLayout(SWT.HORIZONTAL | SWT.VERTICAL, 0);
  617. cl.fillHorizontal = true;
  618. lComp.setLayout(cl);
  619. lComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  620. auto l = new Label(lComp, SWT.NONE);
  621. l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  622. l.setText(_prop.msgs.openHistoryMax);
  623. _histMax = new Spinner(grp, SWT.BORDER);
  624. initSpinner(_histMax);
  625. _histMax.setMinimum(0);
  626. _histMax.setMaximum(99);
  627. mod(_histMax);
  628. _clearHist = new Button(grp, SWT.PUSH);
  629. _clearHist.setEnabled(_prop.var.etc.openHistories.length > 0);
  630. _clearHist.setText(_prop.msgs.openHistoryClear);
  631. _clearHist.addSelectionListener(new ClearHist);
  632. }
  633. { mixin(S_TRACE);
  634. auto lComp = new Composite(grp, SWT.NONE);
  635. auto cl = new CenterLayout(SWT.HORIZONTAL | SWT.VERTICAL, 0);
  636. cl.fillHorizontal = true;
  637. lComp.setLayout(cl);
  638. lComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  639. auto l = new Label(lComp, SWT.NONE);
  640. l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  641. l.setText(_prop.msgs.searchHistoryMax);
  642. _sHistMax = new Spinner(grp, SWT.BORDER);
  643. initSpinner(_sHistMax);
  644. _sHistMax.setMinimum(0);
  645. _sHistMax.setMaximum(99);
  646. mod(_sHistMax);
  647. _clearSHist = new Button(grp, SWT.PUSH);
  648. _clearSHist.setEnabled(_prop.var.etc.searchHistories.length || _prop.var.etc.grepDirHistories.length);
  649. _clearSHist.setText(_prop.msgs.searchHistoryClear);
  650. _clearSHist.addSelectionListener(new ClearSHist);
  651. }
  652. }
  653. { mixin(S_TRACE);
  654. auto grp = new Group(comp3, SWT.NONE);
  655. grp.setText(_prop.msgs.undoMax);
  656. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  657. grp.setLayout(new GridLayout(2, false));
  658. Spinner createUndoMax(string title) { mixin(S_TRACE);
  659. auto l = new Label(grp, SWT.NONE);
  660. l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  661. l.setText(title);
  662. auto spn = new Spinner(grp, SWT.BORDER);
  663. initSpinner(spn);
  664. mod(spn);
  665. spn.setMaximum(_prop.var.etc.undoMaxLimit);
  666. spn.setMinimum(0);
  667. return spn;
  668. }
  669. _undoMaxMainView = createUndoMax(_prop.msgs.undoMaxMainView);
  670. _undoMaxEvent = createUndoMax(_prop.msgs.undoMaxEvent);
  671. _undoMaxReplace = createUndoMax(_prop.msgs.undoMaxReplace);
  672. _undoMaxEtc = createUndoMax(_prop.msgs.undoMaxEtc);
  673. }
  674. }
  675. }
  676. }
  677. class DefBgSetting : SelectionAdapter {
  678. private DefBgImgDialog _dlg = null;
  679. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  680. if (_dlg) { mixin(S_TRACE);
  681. _dlg.active();
  682. return;
  683. }
  684. _dlg = new DefBgImgDialog(_comm, _prop, getShell(), _bgImagesDefault);
  685. _dlg.appliedEvent ~= { mixin(S_TRACE);
  686. _bgImagesDefault = _dlg.backs;
  687. applyEnabled();
  688. };
  689. _dlg.closeEvent ~= { mixin(S_TRACE);
  690. _dlg = null;
  691. };
  692. _dlg.open();
  693. }
  694. }
  695. class DBgImgStg : DisposeListener {
  696. override void widgetDisposed(DisposeEvent e) { mixin(S_TRACE);
  697. auto ws = (cast(SplitPane) e.widget).getWeights();
  698. _prop.var.etc.bgImageSettingsSashL = ws[0];
  699. _prop.var.etc.bgImageSettingsSashR = ws[1];
  700. }
  701. }
  702. class DBgImgKeyCodeSash : DisposeListener {
  703. override void widgetDisposed(DisposeEvent e) { mixin(S_TRACE);
  704. auto ws = (cast(SplitPane) e.widget).getWeights();
  705. _prop.var.etc.bgImageKeyCodeSashL = ws[0];
  706. _prop.var.etc.bgImageKeyCodeSashR = ws[1];
  707. }
  708. }
  709. void construct2(CTabFolder tabf) { mixin(S_TRACE);
  710. auto comp = new Composite(tabf, SWT.NONE);
  711. _tabS = new CTabItem(tabf, SWT.NONE);
  712. _tabS.setText(_prop.msgs.bgImageAndKeyCode);
  713. _tabS.setControl(comp);
  714. comp.setLayout(new GridLayout(1, true));
  715. auto sash = new SplitPane(comp, SWT.HORIZONTAL);
  716. sash.setLayoutData(new GridData(GridData.FILL_BOTH));
  717. auto back = new Composite(sash, SWT.NONE);
  718. back.setLayout(zeroMarginGridLayout(1, true));
  719. { mixin(S_TRACE);
  720. auto grp = new Group(back, SWT.NONE);
  721. grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  722. auto cl = new CenterLayout;
  723. cl.fillHorizontal = true;
  724. grp.setLayout(cl);
  725. grp.setText(_prop.msgs.bgImagesDefault);
  726. auto defBtn = new Button(grp, SWT.PUSH);
  727. defBtn.setText(_prop.msgs.setBgImagesDefault);
  728. defBtn.addSelectionListener(new DefBgSetting);
  729. }
  730. { mixin(S_TRACE);
  731. _bgStgs = new ToolsPane!BgImageSetting(_comm, (b) { ignoreMod = b; }, &catchMod, &applyEnabled, back, SWT.NONE);
  732. _bgStgs.setLayoutData(new GridData(GridData.FILL_BOTH));
  733. }
  734. { mixin(S_TRACE);
  735. auto grp = new Group(sash, SWT.NONE);
  736. grp.setLayoutData(new GridData(GridData.FILL_BOTH));
  737. grp.setLayout(new GridLayout(1, false));
  738. grp.setText(_prop.msgs.standardKeyCode);
  739. _keyCodes = new Text(grp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
  740. createTextMenu!Text(_comm, _prop, _keyCodes, &catchMod);
  741. mod(_keyCodes);
  742. auto gd = new GridData(GridData.FILL_BOTH);
  743. gd.widthHint = _prop.var.etc.keyCodeWidth;
  744. gd.heightHint = 0;
  745. _keyCodes.setLayoutData(gd);
  746. }
  747. sash.setWeights([_prop.var.etc.bgImageKeyCodeSashL, _prop.var.etc.bgImageKeyCodeSashR]);
  748. sash.addDisposeListener(new DBgImgKeyCodeSash);
  749. }
  750. void construct3(CTabFolder tabf) { mixin(S_TRACE);
  751. auto comp = new Composite(tabf, SWT.NONE);
  752. comp.setLayout(new GridLayout(1, false));
  753. _tabT = new CTabItem(tabf, SWT.NONE);
  754. _tabT.setText(_prop.msgs.templates);
  755. _tabT.setControl(comp);
  756. auto sash = new SplitPane(comp, SWT.VERTICAL);
  757. sash.setLayoutData(new GridData(GridData.FILL_BOTH));
  758. _evTempls = new ToolsPane!EvTemplate(_comm, (b) { ignoreMod = b; }, &catchMod, &applyEnabled, sash, SWT.NONE);
  759. _evTempls.setLayoutData(new GridData(GridData.FILL_BOTH));
  760. _scTempls = new ToolsPane!ScTemplate(_comm, (b) { ignoreMod = b; }, &catchMod, &applyEnabled, sash, SWT.NONE);
  761. _scTempls.setLayoutData(new GridData(GridData.FILL_BOTH));
  762. sash.setWeights([_prop.var.etc.templatesSashL, _prop.var.etc.templatesSashR]);
  763. listener(sash, SWT.Dispose, { mixin(S_TRACE);
  764. auto ws = sash.getWeights();
  765. _prop.var.etc.templatesSashL = ws[0];
  766. _prop.var.etc.templatesSashR = ws[1];
  767. });
  768. }
  769. void construct4(CTabFolder tabf) { mixin(S_TRACE);
  770. auto comp = new Composite(tabf, SWT.NONE);
  771. comp.setLayout(new GridLayout(1, false));
  772. _tabC = new CTabItem(tabf, SWT.NONE);
  773. _tabC.setText(_prop.msgs.outerToolsAndClassicEngines);
  774. _tabC.setControl(comp);
  775. auto sash = new SplitPane(comp, SWT.VERTICAL);
  776. sash.setLayoutData(new GridData(GridData.FILL_BOTH));
  777. _tools = new ToolsPane!OuterTool(_comm, (b) { ignoreMod = b; }, &catchMod, &applyEnabled, sash, SWT.NONE);
  778. _tools.setLayoutData(new GridData(GridData.FILL_BOTH));
  779. _cEngines = new ToolsPane!ClassicEngine(_comm, (b) { ignoreMod = b; }, &catchMod, &applyEnabled, sash, SWT.NONE);
  780. _cEngines.setLayoutData(new GridData(GridData.FILL_BOTH));
  781. .listener(_tabf, SWT.Selection, { mixin(S_TRACE);
  782. if (_tabf.getSelection() !is _tabT && _cEngines.ceNameWin.getVisible()) { mixin(S_TRACE);
  783. _cEngines.ceNameWin.setVisible(false);
  784. _cEngines.features.setSelection(false);
  785. }
  786. });
  787. sash.setWeights([_prop.var.etc.toolsClassicEnginesSashL, _prop.var.etc.toolsClassicEnginesSashR]);
  788. listener(sash, SWT.Dispose, { mixin(S_TRACE);
  789. auto ws = sash.getWeights();
  790. _prop.var.etc.toolsClassicEnginesSashL = ws[0];
  791. _prop.var.etc.toolsClassicEnginesSashR = ws[1];
  792. });
  793. }
  794. Combo createEnumC(I)(Composite grp, string title, in I[] values, in string[] names, ref int[I] tblA, ref I[int] tblB, int hSpan = 1) { mixin(S_TRACE);
  795. assert (values.length == names.length);
  796. auto l = new Label(grp, SWT.NONE);
  797. l.setText(title);
  798. auto combo = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
  799. mod(combo);
  800. auto gd = new GridData(GridData.FILL_HORIZONTAL);
  801. gd.horizontalSpan = hSpan;
  802. combo.setLayoutData(gd);
  803. combo.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
  804. foreach (i, val; values) { mixin(S_TRACE);
  805. tblA[val] = i;
  806. tblB[i] = val;
  807. combo.add(names[i]);
  808. }
  809. return combo;
  810. }
  811. class DMISash : DisposeListener {
  812. override void widgetDisposed(DisposeEvent e) { mixin(S_TRACE);
  813. auto ws = (cast(SplitPane) e.widget).getWeights();
  814. _prop.var.etc.ignoreMenuSashL = ws[0];
  815. _prop.var.etc.ignoreMenuSashR = ws[1];
  816. }
  817. }
  818. void selectMenu() { mixin(S_TRACE);
  819. ignoreMod = true;
  820. scope (exit) ignoreMod = false;
  821. auto i = _menu.getSelectionIndex();
  822. if (-1 == i) return;
  823. auto itm = _menu.getItem(i);
  824. auto data = cast(SMenuData) itm.getData();
  825. _mnemonic.setText(data.mnemonic);
  826. _hotkey.accelerator = data.hotkey;
  827. _menuApply.setEnabled(false);
  828. _menuDel.setEnabled(_mnemonic.getText().length || _hotkey.widget.getText().length);
  829. }
  830. void applyMenu() { mixin(S_TRACE);
  831. ignoreMod = true;
  832. scope (exit) ignoreMod = false;
  833. auto i = _menu.getSelectionIndex();
  834. assert (i != -1);
  835. auto itm = _menu.getItem(i);
  836. auto data = cast(SMenuData) itm.getData();
  837. data.mnemonic = _mnemonic.getText();
  838. data.hotkey = _hotkey.acceleratorText;
  839. itm.setText(MenuProps.buildMenuSample(_prop.parent, data.id, data.mnemonic, data.hotkey));
  840. _menuApply.setEnabled(false);
  841. applyEnabled();
  842. }
  843. void refreshMenu() { mixin(S_TRACE);
  844. auto selID = MenuID.None;
  845. int selIndex = _menu.getSelectionIndex();
  846. if (-1 != selIndex) { mixin(S_TRACE);
  847. selID = (cast(SMenuData) _menu.getItem(selIndex).getData()).id;
  848. }
  849. _menu.removeAll();
  850. foreach (id; EnumMembers!MenuID) { mixin(S_TRACE);
  851. if (id == MenuID.None) continue;
  852. if (isNoKeyBindMenu(id)) continue;
  853. string name = _prop.var.menu.buildMenuSample(_prop.parent, id);
  854. if (!_menuIncSearch.match(name)) continue;
  855. auto itm = new TableItem(_menu, SWT.NONE);
  856. itm.setText(name);
  857. itm.setImage(_prop.images.menu(id));
  858. auto data = new SMenuData();
  859. data.id = id;
  860. data.mnemonic = _prop.var.menu.mnemonic(id);
  861. data.hotkey = _prop.var.menu.hotkey(id);
  862. itm.setData(data);
  863. if (id == selID) { mixin(S_TRACE);
  864. _menu.select(_menu.getItemCount() - 1);
  865. }
  866. }
  867. if (-1 == _menu.getSelectionIndex()) _menu.select(0);
  868. _menu.showSelection();
  869. selectMenu();
  870. }
  871. class SelectMenu : SelectionAdapter {
  872. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  873. selectMenu();
  874. }
  875. }
  876. class ModMenu : ModifyListener {
  877. override void modifyText(ModifyEvent e) { mixin(S_TRACE);
  878. if (ignoreMod) return;
  879. _menuApply.setEnabled(true);
  880. _menuDel.setEnabled(_mnemonic.getText().length || _hotkey.widget.getText().length);
  881. }
  882. }
  883. class DelMenuAccel : SelectionAdapter {
  884. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  885. ignoreMod = true;
  886. scope (exit) ignoreMod = false;
  887. _mnemonic.setText("");
  888. _hotkey.widget.setText("");
  889. applyMenu();
  890. _menuDel.setEnabled(false);
  891. }
  892. }
  893. class ApplyMenu : SelectionAdapter {
  894. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  895. applyMenu();
  896. }
  897. }
  898. class SelBoolTable : SelectionAdapter {
  899. override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
  900. if (e.detail != SWT.CHECK) return;
  901. applyEnabled();
  902. if (e.item is _contentsFloat && _contentsFloat.getChecked()) { mixin(S_TRACE);
  903. _contentsAutoHide.setChecked(false);
  904. }
  905. if (e.item is _contentsAutoHide && _contentsAutoHide.getChecked()) { mixin(S_TRACE);
  906. _contentsFloat.setChecked(false);
  907. }
  908. }
  909. }
  910. void construct5(CTabFolder tabf) { mixin(S_TRACE);
  911. auto comp = new Composite(tabf, SWT.NONE);
  912. _tabE = new CTabItem(tabf, SWT.NONE);
  913. _tabE.setText(_prop.msgs.etcSettings);
  914. _tabE.setControl(comp);
  915. comp.setLayout(new GridLayout(2, false));
  916. { mixin(S_TRACE);
  917. auto grp = new Group(comp, SWT.NONE);
  918. grp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  919. grp.setText(_prop.msgs.etcSettingsTitle);
  920. grp.setLayout(new GridLayout(5, false));
  921. auto boolTable = new Table(grp, SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
  922. new FullTableColumn(boolTable, SWT.NONE);
  923. boolTable.addSelectionListener(new SelBoolTable);
  924. auto tgd = new GridData(GridData.FILL_BOTH);
  925. tgd.horizontalSpan = 5;
  926. tgd.heightHint = 0;
  927. boolTable.setLayoutData(tgd);
  928. TableItem createB(string text) { mixin(S_TRACE);
  929. auto itm = new TableItem(boolTable, SWT.NONE);
  930. itm.setText(text);
  931. return itm;
  932. }
  933. if (!_comm.singleWindowMode(_prop)) { mixin(S_TRACE);
  934. _singleWindow = createB(_prop.msgs.singleWindow);
  935. }
  936. _showAreaDirTree = createB(_prop.msgs.showAreaDirTree);
  937. _showSummaryInAreaTable = createB(_prop.msgs.showSummaryInAreaTable);
  938. _clickIsOpenEvent = createB(_prop.msgs.clickIsOpenEvent);
  939. _smoothingCard = createB(_prop.msgs.smoothingCard);
  940. _showImagePreview = createB(_prop.msgs.showImagePreview);
  941. _editTriggerTypeIsQuick = createB(_prop.msgs.editTriggerTypeIsQuick);
  942. _classicStyleTree = createB(_prop.msgs.classicStyleTree);
  943. _adjustContentName = createB(_prop.msgs.adjustContentName);
  944. _radarStyleParams = createB(_prop.msgs.radarStyleParams);
  945. _showEventTreeMark = createB(_prop.msgs.showEventTreeMark);
  946. _showCardListHeader = createB(_prop.msgs.showCardListHeader);
  947. _showCardListTitle = createB(_prop.msgs.showCardListTitle);
  948. _showSkillCardLevel = createB(_prop.msgs.showSkillCardLevel);
  949. _ignoreEmptyStart = createB(_prop.msgs.ignoreEmptyStart);
  950. _expandXMLs = createB(_prop.msgs.expandXMLs);
  951. _contentsFloat = createB(_prop.msgs.contentsFloat);
  952. _contentsAutoHide = createB(_prop.msgs.contentsAutoHide);
  953. _comboListVisible = createB(_prop.msgs.comboListVisible);
  954. _xmlCopy = createB(_prop.msgs.xmlCopy);
  955. _showSpNature = createB(_prop.msgs.showSpNature);
  956. _saveInnerImagePath = createB(_prop.msgs.saveInnerImagePath);
  957. _linkCard = createB(_prop.msgs.linkCard);
  958. _traceDirectories = createB(_prop.msgs.traceDirectories);
  959. _logicalSort = createB(_prop.msgs.logicalSort);
  960. _copyDesc = createB(_prop.msgs.copyDesc);
  961. _refCardsAtEditBgImage = createB(_prop.msgs.refCardsAtEditBgImage);
  962. _floatMessagePreview = createB(_prop.msgs.floatMessagePreview);
  963. _addNewClassicEngine = createB(_prop.msgs.addNewClassicEngine);
  964. _doubleIO = createB(_prop.msgs.doubleIO);
  965. _switchTabWheel = createB(_prop.msgs.switchTabWheel);
  966. _closeTabWithMiddleClick = createB(_prop.msgs.closeTabWithMiddleClick);
  967. _openTabAtRightOfCurrentTab = createB(_prop.msgs.openTabAtRightOfCurrentTab);
  968. _reconstruction = createB(_prop.msgs.reconstruction);
  969. _openLastScenario = createB(_prop.msgs.openLastScenario);
  970. _showVariableValuesInEventText = createB(_prop.msgs.showVariableValuesInEventText);
  971. _cautionBeforeReplace = createB(_prop.msgs.cautionBeforeReplace);
  972. _saveNeedChanged = createB(_prop.msgs.saveNeedChanged);
  973. _applyDialogsBeforeSave = createB(_prop.msgs.applyDialogsBeforeSave);
  974. _useNamesAfterStandard = createB(_prop.msgs.useNamesAfterStandard);
  975. _selectVariableWithTree = createB(_prop.msgs.selectVariableWithTree);
  976. _autoUpdateJpy1File = createB(_prop.msgs.autoUpdateJpy1File);
  977. _straightEventTreeView = createB(_prop.msgs.straightEventTreeView);
  978. _gentleAngleEventTree = createB(_prop.msgs.gentleAngleEventTree);
  979. _forceIndentBranchContent = createB(_prop.msgs.forceIndentBranchContent);
  980. _showTerminalMark = createB(_prop.msgs.showTerminalMark);
  981. _clickIconIsStartEdit = createB(_prop.msgs.clickIconIsStartEdit);
  982. auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
  983. auto sepgd = new GridData(GridData.FILL_HORIZONTAL);
  984. sepgd.horizontalSpan = 5;
  985. sep.setLayoutData(sepgd);
  986. immutable string[] targetVersionVals = [
  987. "CardWirthPy",
  988. // FIXME: CardWirth 1.60
  989. /+ "1.60",
  990. +/ "1.50",
  991. "1.30",
  992. "1.29",
  993. "1.28",
  994. ];
  995. string[] targetVersionNames = [
  996. _prop.msgs.cardWirthPy.value,
  997. ] ~ std.algorithm.map!((s) => .tryFormat(_prop.msgs.cardWirthWithVersion, s))(targetVersionVals[1..$]).array();
  998. _targetVersion = createEnumC(grp, _prop.msgs.targetVersion, targetVersionVals, targetVersionNames, _targetVersionTbl, _targetVersionTbl2, 4);
  999. auto dummy2 = new Composite(grp, SWT.NONE);
  1000. auto dgd2 = new GridData(GridData.FILL_HORIZONTAL);
  1001. dgd2.widthHint = 0;
  1002. dgd2.heightHint = 0;
  1003. dummy2.setLayoutData(dgd2);
  1004. auto tvHint = new Label(grp, SWT.NONE);
  1005. tvHint.setText(_prop.msgs.targetVersionHint);
  1006. auto tvHintGD = new GridData(GridData.FILL_HORIZONTAL);
  1007. tvHintGD.horizontalSpan = 4;
  1008. tvHint.setLayoutData(tvHintGD);
  1009. version (Windows) {
  1010. immutable int[] soundPlayTypeVals = [
  1011. SOUND_TYPE_AUTO,
  1012. SOUND_TYPE_SDL,
  1013. SOUND_TYPE_MCI,
  1014. SOUND_TYPE_APP
  1015. ];
  1016. immutable string[] soundPlayTypeNames = [
  1017. _prop.msgs.soundPlayTypeDef,
  1018. _prop.msgs.soundPlayTypeSDL,
  1019. _prop.msgs.soundPlayTypeMCI,
  1020. _prop.msgs.soundPlayTypeApp
  1021. ];
  1022. } else { mixin(S_TRACE);
  1023. immutable int[] soundPlayTypeVals = [
  1024. SOUND_TYPE_AUTO,
  1025. SOUND_TYPE_SDL,
  1026. SOUND_TYPE_APP
  1027. ];
  1028. immutable string[] soundPlayTypeNames = [
  1029. _prop.msgs.soundPlayTypeDef,
  1030. _prop.msgs.soundPlayTypeSDL,
  1031. _prop.msgs.soundPlayTypeApp
  1032. ];
  1033. }
  1034. Spinner createVolume() { mixin(S_TRACE);
  1035. auto l1 = new Label(grp, SWT.CENTER);
  1036. l1.setText(_prop.msgs.soundVolume);
  1037. auto spn = new Spinner(grp, SWT.BORDER);
  1038. initSpinner(spn);
  1039. spn.setMinimum(0);
  1040. spn.setMaximum(100);
  1041. mod(spn);
  1042. auto l2 = new Label(grp, SWT.CENTER);
  1043. l2.setText(_prop.msgs.soundVolumePer);
  1044. return spn;
  1045. }
  1046. _soundPlayType = createEnumC(grp, _prop.msgs.soundPlayType, soundPlayTypeVals, soundPlayTypeNames, _soundPlayTypeTbl, _soundPlayTypeTbl2);
  1047. _bgmVolume = createVolume();
  1048. string sameBGM = _prop.msgs.soundPlaySameBGM;
  1049. _soundEffectPlayType = createEnumC(grp, _prop.msgs.soundEffectPlayType, [SOUND_TYPE_SAME_BGM] ~ soundPlayTypeVals, sameBGM ~ soundPlayTypeNames, _soundEffectPlayTypeTbl, _soundEffectPlayTypeTbl2);
  1050. _seVolume = createVolume();
  1051. auto dummy = new Composite(grp, SWT.NONE);
  1052. auto dgd = new GridData(GridData.FILL_HORIZONTAL);
  1053. dgd.widthHint = 0;
  1054. dgd.heightHint = 0;
  1055. dummy.setLayoutData(dgd);
  1056. auto volc = new Label(grp, SWT.NONE);
  1057. volc.setText(_prop.msgs.soundCaution);
  1058. auto volcgd = new GridData(GridData.FILL_HORIZONTAL);
  1059. volcgd.horizontalSpan = 4;
  1060. volc.setLayoutData(volcgd);
  1061. _dialogStatus = createEnumC(grp, _prop.msgs.dialogStatus, [
  1062. cast(int) DialogStatus.Top,
  1063. cast(int) DialogStatus.Under,
  1064. cast(int) DialogStatus.UnderWithCoupon,
  1065. ], [
  1066. _prop.msgs.dialogStatusName(DialogStatus.Top),
  1067. _prop.msgs.dialogStatusName(DialogStatus.Under),
  1068. _prop.msgs.dialogStatusName(DialogStatus.UnderWithCoupon),
  1069. ], _dialogStatusTbl, _dialogStatusTbl2, 4);
  1070. }
  1071. { mixin(S_TRACE);
  1072. auto sash = new SplitPane(comp, SWT.VERTICAL);
  1073. sash.setLayoutData(new GridData(GridData.FILL_BOTH));
  1074. { mixin(S_TRACE);
  1075. auto grp = new Group(sash, SWT.NONE);
  1076. grp.setText(_prop.msgs.keyBind);
  1077. grp.setLayout(new GridLayout(4, false));
  1078. auto l1 = new Label(grp, SWT.NONE);
  1079. l1.setText(_prop.msgs.mnemonic);
  1080. _mnemonic = mnemonicText(grp, SWT.BORDER);
  1081. createTextMenu!Text(_comm, _prop, _mnemonic, &catchMod);
  1082. _mnemonic.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  1083. _mnemonic.addModifyListener(new ModMenu);
  1084. _menuApply = new Button(grp, SWT.PUSH);
  1085. _menuApply.setText(_prop.msgs.apply);
  1086. _menuApply.addSelectionListener(new ApplyMenu);
  1087. _menuDel = new Button(grp, SWT.PUSH);
  1088. _menuDel.setText(_prop.msgs.del);
  1089. _menuDel.addSelectionListener(new DelMenuAccel);
  1090. auto l2 = new Label(grp, SWT.NONE);
  1091. l2.setText(_prop.msgs.hotkey);
  1092. _hotkey = new HotKeyField(grp, SWT.BORDER);
  1093. createTextMenu!Text(_comm, _prop, _hotkey.widget, &catchMod);
  1094. auto hgd = new GridData(GridData.FILL_HORIZONTAL);
  1095. hgd.horizontalSpan = 3;
  1096. _hotkey.widget.setLayoutData(hgd);
  1097. _hotkey.widget.addModifyListener(new ModMenu);
  1098. _menu = new Table(grp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
  1099. auto mgd = new GridData(GridData.FILL_BOTH);
  1100. mgd.horizontalSpan = 4;
  1101. mgd.heightHint = _prop.var.etc.menuSettingsHeight;
  1102. _menu.setLayoutData(mgd);
  1103. new FullTableColumn(_menu, SWT.NONE);
  1104. _menu.addSelectionListener(new SelectMenu);
  1105. _menuIncSearch = new IncSearch(_comm, _menu);
  1106. _menuIncSearch.modEvent ~= &refreshMenu;
  1107. auto menu = new Menu(_menu.getShell(), SWT.POP_UP);
  1108. createMenuItem(_comm, menu, MenuID.IncSearch, &menuIncSearch, null);
  1109. _menu.setMenu(menu);
  1110. refreshMenu();
  1111. grp.setTabList([_menuApply, _menuDel, _menu]);
  1112. }
  1113. { mixin(S_TRACE);
  1114. auto grp = new Group(sash, SWT.NONE);
  1115. grp.setText(_prop.msgs.ignorePaths);
  1116. grp.setLayout(new GridLayout(1, false));
  1117. _ignorePaths = new Text(grp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
  1118. createTextMenu!Text(_comm, _prop, _ignorePaths, &catchMod);
  1119. mod(_ignorePaths);
  1120. auto gdp = new GridData(GridData.FILL_BOTH);
  1121. gdp.widthHint = _prop.var.etc.ignorePathsWidth;
  1122. gdp.heightHint = 0;
  1123. _ignorePaths.setLayoutData(gdp);
  1124. }
  1125. sash.setWeights([_prop.var.etc.ignoreMenuSashL, _prop.var.etc.ignoreMenuSashR]);
  1126. sash.addDisposeListener(new DMISash);
  1127. }
  1128. }
  1129. private RefE _refe;
  1130. private void refreshScenario(Summary summ) { mixin(S_TRACE);
  1131. _summ = summ;
  1132. }
  1133. private void refreshEnabled() { mixin(S_TRACE);
  1134. _backupDir.setEnabled(_backupEnabled.getSelection());
  1135. _backupIntervalTypeTime.setEnabled(_backupEnabled.getSelection());
  1136. _backupIntervalTypeEdit.setEnabled(_backupEnabled.getSelection());
  1137. _backupIntervalTime.setEnabled(_backupEnabled.getSelection() && _backupIntervalTypeTime.getSelection());
  1138. _backupIntervalEdit.setEnabled(_backupEnabled.getSelection() && _backupIntervalTypeEdit.getSelection());
  1139. _backupCount.setEnabled(_backupEnabled.getSelection());
  1140. _backupRef.setEnabled(_backupEnabled.getSelection());
  1141. _backupRefAuthor.setEnabled(_backupEnabled.getSelection());
  1142. _autoSave.setEnabled(_backupEnabled.getSelection());
  1143. _backupArchived.setEnabled(_backupEnabled.getSelection());
  1144. _backupBeforeSaveDir.setEnabled(_backupBeforeSaveEnabled.getSelection());
  1145. _backupBeforeSaveRef.setEnabled(_backupBeforeSaveEnabled.getSelection());
  1146. }
  1147. void refEngineEnabled() { mixin(S_TRACE);
  1148. _findEnginePath.setEnabled(0 == _enginePath.getText().length);
  1149. _enginePath.setEnabled(!_findEnginePath.getSelection() || _enginePath.getText().length);
  1150. _refEnginePath.setEnabled(_enginePath.getEnabled());
  1151. }
  1152. public:
  1153. this (Commons comm, Props prop, Shell shell, DockingFolderCTC dock, Summary summ, void delegate() sendReloadProps) { mixin(S_TRACE);
  1154. super(prop, shell, false, prop.msgs.dlgTitSettings, prop.images.menu(MenuID.Settings), true, prop.var.settingsDlg, true);
  1155. _comm = comm;
  1156. _prop = prop;
  1157. _dock = dock;
  1158. _summ = summ;
  1159. _sendReloadProps = sendReloadProps;
  1160. }
  1161. protected:
  1162. override void setup(Composite area) { mixin(S_TRACE);
  1163. area.setLayout(windowGridLayout(1, true));
  1164. _comm.refScenario.add(&refreshScenario);
  1165. _comm.refHistories.add(&refHistories);
  1166. _comm.refSearchHistories.add(&refSearchHistories);
  1167. area.addDisposeListener(new class DisposeListener {
  1168. override void widgetDisposed(DisposeEvent e) { mixin(S_TRACE);
  1169. _comm.refScenario.remove(&refreshScenario);
  1170. _comm.refHistories.remove(&refHistories);
  1171. _comm.refSearchHistories.remove(&refSearchHistories);
  1172. }
  1173. });
  1174. _tabf = new CTabFolder(area, SWT.BORDER);
  1175. _tabf.setLayoutData(new GridData(GridData.FILL_BOTH));
  1176. _refe = new RefE;
  1177. construct1(_tabf);
  1178. construct2(_tabf);
  1179. construct3(_tabf);
  1180. construct4(_tabf);
  1181. construct5(_tabf);
  1182. _bgStgs.setup(_prop.var.etc.bgImageSettings, _prop.var.etc.bgImageSettingsSashL.value, _prop.var.etc.bgImageSettingsSashR.value);
  1183. _cEngines.setup(_prop.var.etc.classicEngines, _prop.var.etc.classicEnginesSashL.value, _prop.var.etc.classicEnginesSashR.value);
  1184. _tools.setup(_prop.var.etc.outerTools, _prop.var.etc.outerToolsSashL.value, _prop.var.etc.outerToolsSashR.value);
  1185. _scTempls.setup(_prop.var.etc.scenarioTemplates, _prop.var.etc.scenarioTemplatesSashL.value, _prop.var.etc.scenarioTemplatesSashR.value);
  1186. _evTempls.setup(_prop.var.etc.eventTemplates, _prop.var.etc.eventTemplatesSashL.value, _prop.var.etc.eventTemplatesSashR.value);
  1187. _tools.setShortcutWeights(_prop.var.etc.outerToolShortcutSashL.value, _prop.var.etc.outerToolShortcutSashR.value);
  1188. _cEngines.setShortcutWeights(_prop.var.etc.classicEngineShortcutSashL.value, _prop.var.etc.classicEngineShortcutSashR.value);
  1189. _evTempls.setShortcutWeights(_prop.var.etc.eventTemplateShortcutSashL.value, _prop.var.etc.eventTemplateShortcutSashR.value);
  1190. _enginePath.setText(_prop.var.etc.enginePath);
  1191. _findEnginePath.setSelection(_prop.var.etc.findEnginePath);
  1192. refEngineEnabled();
  1193. _tempDir.setText(_prop.var.etc.tempPath);
  1194. _backupDir.setText(_prop.var.etc.backupPath);
  1195. _backupEnabled.setSelection(_prop.var.etc.backupEnabled);
  1196. _backupIntervalTypeTime.setSelection(_prop.var.etc.backupIntervalType != BackupType.Edit);
  1197. _backupIntervalTypeEdit.setSelection(_prop.var.etc.backupIntervalType == BackupType.Edit);
  1198. _backupIntervalTime.setSelection(_prop.var.etc.backupInterval);
  1199. _backupIntervalEdit.setSelection(_prop.var.etc.backupIntervalEdit);
  1200. _backupCount.setSelection(_prop.var.etc.backupCount);
  1201. _backupRefAuthor.setSelection(_prop.var.etc.backupRefAuthor);
  1202. _autoSave.setSelection(_prop.var.etc.autoSave);
  1203. _backupArchived.setSelection(_prop.var.etc.backupArchived);
  1204. _backupBeforeSaveDir.setText(_prop.var.etc.backupBeforeSavePath);
  1205. _backupBeforeSaveEnabled.setSelection(_prop.var.etc.backupBeforeSaveEnabled);
  1206. _author.setText(_prop.var.etc.defaultAuthor);
  1207. _wallpaper.setText(_prop.var.etc.wallpaper);
  1208. auto wsp = _prop.var.etc.wallpaperStyle in _wallpaperStyleTbl;
  1209. if (wsp) { mixin(S_TRACE);
  1210. _wallpaperStyle.select(*wsp);
  1211. } else { mixin(S_TRACE);
  1212. _wallpaperStyle.select(WallpaperStyle.Tile);
  1213. }
  1214. _histMax.setSelection(_prop.var.etc.historyMax);
  1215. _sHistMax.setSelection(_prop.var.etc.searchHistoryMax);
  1216. _undoMaxMainView.setSelection(_prop.var.etc.undoMaxMainView);
  1217. _undoMaxEvent.setSelection(_prop.var.etc.undoMaxEvent);
  1218. _undoMaxReplace.setSelection(_prop.var.etc.undoMaxReplace);
  1219. _undoMaxEtc.setSelection(_prop.var.etc.undoMaxEtc);
  1220. string ipbuf = "";
  1221. foreach (path; _prop.var.etc.ignorePaths) { mixin(S_TRACE);
  1222. ipbuf ~= path ~ "\n";
  1223. }
  1224. _ignorePaths.setText(ipbuf);
  1225. _showAreaDirTree.setChecked(_prop.var.etc.showAreaDirTree);
  1226. _showSummaryInAreaTable.setChecked(_prop.var.etc.showSummaryInAreaTable);
  1227. _clickIsOpenEvent.setChecked(_prop.var.etc.clickIsOpenEvent);
  1228. _expandXMLs.setChecked(_prop.var.etc.expandXMLs);
  1229. _smoothingCard.setChecked(_prop.var.etc.smoothingCard);
  1230. _showImagePreview.setChecked(_prop.var.etc.showImagePreview);
  1231. _editTriggerTypeIsQuick.setChecked(_prop.var.etc.editTriggerType is EditTrigger.Quick);
  1232. _classicStyleTree.setChecked(_prop.var.etc.classicStyleTree);
  1233. _adjustContentName.setChecked(_prop.var.etc.adjustContentName);
  1234. _radarStyleParams.setChecked(_prop.var.etc.radarStyleParams);
  1235. _showEventTreeMark.setChecked(_prop.var.etc.showEventTreeMark);
  1236. _showCardListHeader.setChecked(_prop.var.etc.showCardListHeader);
  1237. _showCardListTitle.setChecked(_prop.var.etc.showCardListTitle);
  1238. _showSkillCardLevel.setChecked(_prop.var.etc.showSkillCardLevel);
  1239. _ignoreEmptyStart.setChecked(_prop.var.etc.ignoreEmptyStart);
  1240. if (_singleWindow) { mixin(S_TRACE);
  1241. _singleWindow.setChecked(_prop.var.etc.singleWindow);
  1242. }
  1243. _contentsFloat.setChecked(_prop.var.etc.contentsFloat);
  1244. _contentsAutoHide.setChecked(_prop.var.etc.contentsAutoHide);
  1245. _comboListVisible.setChecked(_prop.var.etc.comboListVisible);
  1246. _xmlCopy.setChecked(_prop.var.etc.xmlCopy);
  1247. _showSpNature.setChecked(_prop.var.etc.showSpNature);
  1248. _saveInnerImagePath.setChecked(_prop.var.etc.saveInnerImagePath);
  1249. _linkCard.setChecked(_prop.var.etc.lin

Large files files are truncated, but you can click here to view the full file