/cwxeditor_src/cwx/editor/gui/dwt/replacedialog.d
D | 4172 lines | 3962 code | 140 blank | 70 comment | 734 complexity | db2c64d38f688f2071e9751bd1eb210b MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- module cwx.editor.gui.dwt.replacedialog;
- import cwx.area;
- import cwx.summary;
- import cwx.event;
- import cwx.coupon;
- import cwx.utils;
- import cwx.card;
- import cwx.motion;
- import cwx.flag;
- import cwx.usecounter;
- import cwx.types;
- import cwx.path;
- import cwx.background;
- import cwx.skin;
- import cwx.msgutils;
- import cwx.menu;
- import cwx.jpy;
- import cwx.cab;
- import cwx.features;
- import cwx.textholder;
- import cwx.system;
- import cwx.warning;
- import cwx.editor.gui.dwt.dprops;
- import cwx.editor.gui.dwt.dutils;
- import cwx.editor.gui.dwt.centerlayout;
- import cwx.editor.gui.dwt.customtable;
- import cwx.editor.gui.dwt.commons;
- import cwx.editor.gui.dwt.dskin;
- import cwx.editor.gui.dwt.splitpane;
- import cwx.editor.gui.dwt.undo;
- import cwx.editor.gui.dwt.dmenu;
- import cwx.editor.gui.dwt.chooser;
- import cwx.editor.gui.dwt.incsearch;
- import std.ascii;
- import std.conv;
- import std.array;
- import std.string;
- import std.file;
- import std.path;
- import std.regex : Regex, regex, RegexMatch, match;
- import std.utf;
- import std.algorithm : uniq, swap;
- import std.traits;
- import std.typecons : Tuple;
- import org.eclipse.swt.all;
- import java.lang.all;
- private class CWXPathString {
- string scPath;
- CWXPath path;
- string array;
- this (string scPath, CWXPath path, string array) { mixin(S_TRACE);
- this.scPath = scPath;
- this.path = path;
- this.array = array;
- }
- }
- private class FilePathString {
- string scPath;
- string array;
- this (string scPath, string array) { mixin(S_TRACE);
- this.scPath = scPath;
- this.array = array;
- }
- }
- private class FKeyCodesUndo : TUndo!(FKeyCode[]) {
- this (FKeyCode[] old, FKeyCode[] n, void delegate(FKeyCode[]) set) { mixin(S_TRACE);
- super (old.dup, n.dup, set, (FKeyCode[] v) {return v.dup;});
- }
- }
- /// ??????????????
- class ReplaceDialog {
- private:
- class UndoRepl : UndoArr {
- this (Undo[] array, bool rev = true) { mixin(S_TRACE);
- super (array, rev);
- }
- override void undo() { mixin(S_TRACE);
- reset(false);
- super.undo();
- refContentText();
- _status.setText(.tryFormat(_prop.msgs.replaceUndo, .formatNum(_result.getItemCount())));
- _comm.replText.call();
- }
- override void redo() { mixin(S_TRACE);
- reset(false);
- super.redo();
- refContentText();
- _status.setText(.tryFormat(_prop.msgs.replaceRedo, .formatNum(_result.getItemCount())));
- _comm.replText.call();
- }
- }
- class RUndo : Undo {
- private CWXPath _path = null;
- private string _filePath = null;
- private Undo[] _uArr;
- this (CWXPath path, Undo[] uArr) { mixin(S_TRACE);
- _path = path;
- _uArr = uArr;
- }
- this (string filePath, Undo[] uArr) { mixin(S_TRACE);
- _filePath = filePath;
- _uArr = uArr;
- }
- void undo() { mixin(S_TRACE);
- size_t dmy = 0;
- foreach_reverse (u; _uArr) u.undo();
- if (_path) addResult(_path, dmy);
- if (_filePath) addResult(_filePath, dmy);
- }
- void redo() { mixin(S_TRACE);
- size_t dmy = 0;
- foreach_reverse (u; _uArr) u.redo();
- if (_path) addResult(_path, dmy);
- if (_filePath) addResult(_filePath, dmy);
- }
- void dispose() { mixin(S_TRACE);
- foreach (u; _uArr) u.dispose();
- }
- }
- void store(string filePath, Undo[] uArr) { mixin(S_TRACE);
- _rUndo ~= new RUndo(filePath, uArr);
- }
- void store(CWXPath path, Undo[] uArr) { mixin(S_TRACE);
- _rUndo ~= new RUndo(path, uArr);
- }
- void store(CWXPath path, string o, string n, void delegate(string) set) { mixin(S_TRACE);
- _rUndo ~= new RUndo(path, [new StrUndo(o, n, set)]);
- }
- void store(CWXPath path, string[] o, string[] n, void delegate(string[]) set) { mixin(S_TRACE);
- _rUndo ~= new RUndo(path, [new StrArrUndo(o, n, set)]);
- }
- void store(CWXPath path, FKeyCode[] o, FKeyCode[] n, void delegate(FKeyCode[]) set) { mixin(S_TRACE);
- _rUndo ~= new RUndo(path, [new FKeyCodesUndo(o, n, set)]);
- }
- void storeID(User, Id)(CWXPath path, User u, Id from, Id to, void delegate(Id) set) { mixin(S_TRACE);
- _rUndo ~= new RUndo(path, [new TUndo!Id(from, to, set)]);
- }
- bool _inProc = false;
- bool _inUndo = false;
- Undo[] _rUndo;
- void delegate()[] _after;
- core.thread.Thread _uiThread;
- Commons _comm;
- Props _prop;
- Summary _summ;
- UndoManager _undo;
- Summary _grepSumm = null;
- int _grepCount = -1;
- Skin _grepSkin = null;
- string _grepFile = "";
- bool _inGrep = false;
- bool _cancel = false;
- Shell _win;
- Composite _parent;
- CTabFolder _tabf;
- CTabItem _tabText;
- CTabItem _tabID;
- CTabItem _tabPath;
- CTabItem _tabContents;
- CTabItem _tabCoupon;
- CTabItem _tabUnuse;
- CTabItem _tabError;
- CTabItem _tabGrep;
- CTabItem _lastFind = null;
- Button _find;
- Button _replace;
- Button _close;
- Button _rangeAllCheck;
- bool ignoreMod = false;
- Composite _textGrp1, _textGrp2, _textFromComp, _grepFromComp;
- Combo _from;
- Combo _to;
- IncSearch _fromIncSearch = null;
- IncSearch _toIncSearch = null;
- Combo _idKind;
- Combo _fromID;
- Composite _fromIDComp;
- Spinner _fromIDVal;
- ulong[int] _fromIDTbl;
- Combo _toID;
- Composite _toIDComp;
- Spinner _toIDVal;
- ulong[int] _toIDTbl;
- IncSearch _fromIDIncSearch = null;
- IncSearch _toIDIncSearch = null;
- Combo _fromPath;
- Combo _toPath;
- IncSearch _fromPathIncSearch = null;
- IncSearch _toPathIncSearch = null;
- Combo _grepDir;
- Button _grepSubDir;
- Button _notIgnoreCase;
- Button _useRegex;
- Button _useWildcard;
- Button _exact;
- Button _ignoreReturnCode;
- class SelRegex : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- if (_useRegex.getSelection()) { mixin(S_TRACE);
- _useWildcard.setSelection(false);
- }
- }
- }
- class SelWildcard : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- if (_useWildcard.getSelection()) { mixin(S_TRACE);
- _useRegex.setSelection(false);
- }
- }
- }
- class SelIgnoreReturnCode : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- _comm.refreshToolBar();
- }
- }
- @property
- const
- bool catchMod() {return !ignoreMod;}
- /// ???
- Button _summary;
- /// ????????
- Button _rCoupon;
- /// ?????
- Button _msg;
- /// ????
- Button _cardName;
- /// ?????
- Button _cardDesc;
- /// ????????
- Button _event;
- /// ?????
- Button _start;
- /// ???/????
- Button _flag;
- /// ????
- Button _coupon;
- /// ????
- Button _gossip;
- /// ???
- Button _end;
- /// ???/???/??????
- Button _area;
- /// ?????
- Button _keyCode;
- /// ????
- Button _file;
- /// ????
- Button _comment;
- /// JPTX????
- Button _jptx;
- Button[] _noSummText;
- Button _unuseFlag;
- Button _unuseStep;
- Button _unuseArea;
- Button _unuseBattle;
- Button _unusePackage;
- Button _unuseCast;
- Button _unuseSkill;
- Button _unuseItem;
- Button _unuseBeast;
- Button _unuseInfo;
- Button _unuseStart;
- Button _unusePath;
- Button _cCoupon;
- Button _cGossip;
- Button _cEnd;
- Button _cKeyCode;
- // FIXME: CardWirth 1.60 ????
- /+ Button _cCellName;
- +/
- Table _result;
- TableTextEdit _edit;
- Tree _range;
- Composite[CTabItem] _comps;
- ToolItem[CType] _contents;
- Label _status;
- bool _notIgnoreCaseSel;
- bool _exactSel;
- bool _ignoreReturnCodeSel;
- bool _summarySel;
- bool _msgSel;
- bool _cardNameSel;
- bool _cardDescSel;
- bool _eventSel;
- bool _startSel;
- bool _flagSel;
- bool _couponSel;
- bool _gossipSel;
- bool _endSel;
- bool _areaSel;
- bool _keyCodeSel;
- bool _fileSel;
- bool _commentSel;
- bool _jptxSel;
- string _fromText;
- string _toText;
- bool _flagDirOnRange = false;
- bool _resultRedraw = true;
- void resultRedraw(bool val) { mixin(S_TRACE);
- if (!_win || _win.isDisposed()) return;
- if (_resultRedraw !is val) { mixin(S_TRACE);
- _resultRedraw = val;
- _result.setRedraw(val);
- }
- }
- class AddResultPath : Runnable {
- size_t count = 0;
- string path;
- string desc;
- void run() { mixin(S_TRACE);
- if (cancel) return;
- if (!_win || _win.isDisposed()) return;
- if (_inProc && !_prop.var.etc.searchResultRealtime) resultRedraw(false);
- auto itm = new TableItem(_result, SWT.NONE);
- auto summ = _grepSumm ? _grepSumm : _summ;
- auto fullPath = std.path.buildPath(summ.scenarioPath, path);
- if (_grepSumm) { mixin(S_TRACE);
- if (!_grepSkin) _grepSkin = findSkin(_comm, _prop, summ);
- itm.setImage(fimage(fullPath, _grepSkin));
- } else { mixin(S_TRACE);
- itm.setImage(fimage(fullPath, _comm.skin));
- }
- string scPath = null;
- string text = encodePath(path);
- itm.setText(0, text);
- if (desc.length) { mixin(S_TRACE);
- itm.setText(2, desc);
- itm.setImage(2, _prop.images.warning);
- }
- if (_grepSumm) { mixin(S_TRACE);
- scPath = _grepSumm.useTemp ? _grepSumm.zipName : _grepSumm.scenarioPath;
- text = .tryFormat(_prop.msgs.grepScenario, _grepSumm.scenarioName, scPath);
- itm.setText(2, text);
- itm.setImage(2, _prop.images.summary);
- }
- itm.setData(new FilePathString(scPath, path));
- refResultStatus(count, false);
- }
- }
- class AddResultCWXPath : Runnable {
- CWXPath path;
- int index;
- string desc;
- size_t count = 0;
- void run() { mixin(S_TRACE);
- if (cancel) return;
- if (!_win || _win.isDisposed()) return;
- if (_inProc && !_prop.var.etc.searchResultRealtime) resultRedraw(false);
- auto itm = new TableItem(_result, SWT.NONE, -1 == index ? _result.getItemCount() : index);
- string text1, text2;
- Image img1, img2;
- getPathParams(path, text1, text2, img1, img2);
- itm.setImage(0, img1);
- itm.setText(0, text1);
- itm.setImage(1, img2);
- itm.setText(1, text2);
- if (desc.length) { mixin(S_TRACE);
- itm.setText(2, desc);
- itm.setImage(2, _prop.images.warning);
- }
- string scPath = null;
- if (_grepSumm) { mixin(S_TRACE);
- scPath = _grepSumm.useTemp ? _grepSumm.zipName : _grepSumm.scenarioPath;
- itm.setText(2, .tryFormat(_prop.msgs.grepScenario, _grepSumm.scenarioName, scPath));
- itm.setImage(2, _prop.images.summary);
- }
- itm.setData(new CWXPathString(scPath, _grepSumm ? null : path, path.cwxPath(true)));
- refResultStatus(count, false);
- }
- }
- class AddResultMsg : Runnable {
- string name;
- Image delegate() image;
- int index;
- size_t count = 0;
- void run() { mixin(S_TRACE);
- if (cancel) return;
- if (!_win || _win.isDisposed()) return;
- if (_inProc && !_prop.var.etc.searchResultRealtime) resultRedraw(false);
- auto itm = new TableItem(_result, SWT.NONE, -1 == index ? _result.getItemCount() : index);
- itm.setText(name);
- itm.setImage(image());
- refResultStatus(count, false);
- }
- }
- class AddResultUse : Runnable {
- string name;
- uint use;
- Image delegate() image;
- int index;
- size_t count = 0;
- void run() { mixin(S_TRACE);
- if (cancel) return;
- if (!_win || _win.isDisposed()) return;
- if (_inProc && !_prop.var.etc.searchResultRealtime) resultRedraw(false);
- auto itm = new TableItem(_result, SWT.NONE, -1 == index ? _result.getItemCount() : index);
- itm.setText(0, name);
- itm.setImage(0, image());
- itm.setText(1, .text(use));
- refResultStatus(count, false);
- }
- }
- Display _display;
- class ML : MouseAdapter {
- public override void mouseDoubleClick(MouseEvent e) { mixin(S_TRACE);
- if (_result.isFocusControl() && e.button == 1) { mixin(S_TRACE);
- openPath();
- }
- }
- }
- class KL : KeyAdapter {
- public override void keyPressed(KeyEvent e) { mixin(S_TRACE);
- if (_result.isFocusControl() && e.character == SWT.CR) { mixin(S_TRACE);
- openPath();
- }
- }
- }
- static const ID_AREA = 0;
- static const ID_BATTLE = 1;
- static const ID_PACKAGE = 2;
- static const ID_CAST = 3;
- static const ID_SKILL = 4;
- static const ID_ITEM = 5;
- static const ID_BEAST = 6;
- static const ID_INFO = 7;
- static const ID_FLAG = 8;
- static const ID_STEP = 9;
- static const ID_COUPON = 10;
- static const ID_GOSSIP = 11;
- static const ID_COMPLETE_STAMP = 12;
- static const ID_KEY_CODE = 13;
- // FIXME: CardWirth 1.60 ????
- /+ static const ID_CELL_NAME = 14;
- +/ private void setupIDsImpl2(T)(T[] arr, Combo combo, Spinner spn, ref ulong[int] tbl, bool clear, IncSearch incSearch) { mixin(S_TRACE);
- ulong[int] tbl2;
- string oldSel = clear ? "" : combo.getText();
- combo.removeAll();
- static if (is(T:Flag) || is(T:Step)) {
- auto set = new HashSet!string;
- if (_summ) { mixin(S_TRACE);
- static if (is(T:Flag)) {
- foreach (key; _summ.useCounter.flag.keys) { mixin(S_TRACE);
- if (_prop.sys.randomValue == cast(string)key) continue;
- if (!incSearch.match(cast(string)key)) continue;
- set.add(cast(string)key);
- }
- } else static if (is(T:Step)) {
- foreach (key; _summ.useCounter.step.keys) { mixin(S_TRACE);
- if (_prop.sys.randomValue == cast(string)key) continue;
- if (!incSearch.match(cast(string)key)) continue;
- set.add(cast(string)key);
- }
- } else static assert (0);
- }
- foreach (i, a; arr) { mixin(S_TRACE);
- auto p = a.path;
- if (p == "") continue;
- if (!incSearch.match(p)) continue;
- combo.add(p);
- set.remove(p);
- }
- bool delegate(string a, string b) cmps;
- if (_prop.var.etc.logicalSort) { mixin(S_TRACE);
- cmps = (a, b) => incmp(a, b) < 0;
- } else { mixin(S_TRACE);
- cmps = (a, b) => icmp(a, b) < 0;
- }
- foreach (p; .sortDlg(set.array(), cmps)) { mixin(S_TRACE);
- if (p == "") continue;
- if (!incSearch.match(p)) continue;
- combo.add(p);
- }
- combo.setText(oldSel);
- if (combo.getText() == "" && combo.getItemCount()) { mixin(S_TRACE);
- combo.select(0);
- }
- spn.setEnabled(false);
- } else static if (is(T:CouponId) || is(T:GossipId) || is(T:CompleteStampId) || is(T:KeyCodeId) || is(T:CellNameId)) {
- string[] arr2;
- static if (is(T:CouponId)) {
- arr2 = .allCoupons(_comm, _summ, CouponComboType.AllCoupons);
- } else static if (is(T:GossipId)) {
- arr2 = .allGossips(_comm, _summ);
- } else static if (is(T:CompleteStampId)) {
- arr2 = .allCompleteStamps(_comm, _summ);
- } else static if (is(T:KeyCodeId)) {
- arr2 = .allKeyCodes(_comm, _summ);
- } else static if (is(T:CellNameId)) {
- arr2 = .allCellNames(_comm, _summ);
- } else static assert (0);
- foreach (a; arr2) {
- if (!incSearch.match(a)) continue;
- combo.add(a);
- }
- combo.setText(oldSel);
- if (combo.getText() == "" && combo.getItemCount()) { mixin(S_TRACE);
- combo.select(0);
- }
- spn.setEnabled(false);
- } else {
- combo.add(_prop.msgs.replSetID);
- foreach (i, a; arr) { mixin(S_TRACE);
- if (!incSearch.match(a.name)) continue;
- combo.add(to!(string)(a.id) ~ "." ~ a.name);
- tbl2[i + 1] = a.id;
- }
- combo.select(1 < combo.getItemCount() ? 1 : 0);
- if (oldSel) { mixin(S_TRACE);
- auto i = combo.indexOf(oldSel);
- if (i >= 0) combo.select(i);
- }
- spn.setEnabled(combo.getSelectionIndex() == 0);
- }
- tbl = tbl2;
- }
- private void setupIDsImpl1(T)(T[] arr, bool clear, bool from, bool to) { mixin(S_TRACE);
- if (from) setupIDsImpl2(arr, _fromID, _fromIDVal, _fromIDTbl, clear, _fromIDIncSearch);
- if (to) setupIDsImpl2(arr, _toID, _toIDVal, _toIDTbl, clear, _toIDIncSearch);
- }
- private void setupIDs(bool clear, bool from, bool to) { mixin(S_TRACE);
- if (!_summ) { mixin(S_TRACE);
- _fromID.removeAll();
- _fromID.setEnabled(false);
- _fromIDVal.setEnabled(false);
- _toID.removeAll();
- _toID.setEnabled(false);
- _toIDVal.setEnabled(false);
- return;
- }
- if (from) _fromID.setEnabled(true);
- if (to) _toID.setEnabled(true);
- switch (_idKind.getSelectionIndex()) {
- case ID_AREA: setupIDsImpl1(_summ.areas, clear, from, to); break;
- case ID_BATTLE: setupIDsImpl1(_summ.battles, clear, from, to); break;
- case ID_PACKAGE: setupIDsImpl1(_summ.packages, clear, from, to); break;
- case ID_CAST: setupIDsImpl1(_summ.casts, clear, from, to); break;
- case ID_SKILL: setupIDsImpl1(_summ.skills, clear, from, to); break;
- case ID_ITEM: setupIDsImpl1(_summ.items, clear, from, to); break;
- case ID_BEAST: setupIDsImpl1(_summ.beasts, clear, from, to); break;
- case ID_INFO: setupIDsImpl1(_summ.infos, clear, from, to); break;
- case ID_FLAG: setupIDsImpl1(_summ.flagDirRoot.allFlags, clear, from, to); break;
- case ID_STEP: setupIDsImpl1(_summ.flagDirRoot.allSteps, clear, from, to); break;
- case ID_COUPON: setupIDsImpl1(_summ.useCounter.coupon.keys, clear, from, to); break;
- case ID_GOSSIP: setupIDsImpl1(_summ.useCounter.gossip.keys, clear, from, to); break;
- case ID_COMPLETE_STAMP: setupIDsImpl1(_summ.useCounter.completeStamp.keys, clear, from, to); break;
- case ID_KEY_CODE: setupIDsImpl1(_summ.useCounter.keyCode.keys, clear, from, to); break;
- // FIXME: CardWirth 1.60 ????
- /+ case ID_CELL_NAME: setupIDsImpl1(_summ.useCounter.cellName.keys, clear, from, to); break;
- +/ default: assert (0);
- }
- }
- private void fromIDIncSearch() { mixin(S_TRACE);
- .forceFocus(_fromID, true);
- _fromIDIncSearch.startIncSearch();
- }
- private void toIDIncSearch() { mixin(S_TRACE);
- .forceFocus(_toID, true);
- _toIDIncSearch.startIncSearch();
- }
- private string[] _lastMaterialPaths;
- private string[] allMaterials(bool scenarioOnly) { mixin(S_TRACE);
- if (!_summ) return [];
- return _summ.allMaterials(_comm.skin, _prop.var.etc.ignorePaths, _prop.var.etc.logicalSort, scenarioOnly);
- }
- private void setupPaths() { mixin(S_TRACE);
- bool oldIgnoreMod = ignoreMod;
- ignoreMod = true;
- scope (exit) ignoreMod = oldIgnoreMod;
- _lastMaterialPaths = [""] ~ allMaterials(false);
- setupPathsImpl(true, true);
- }
- private void setupPathsImpl(bool from, bool to) {
- void setPaths(Combo combo, IncSearch incSearch) { mixin(S_TRACE);
- auto old = combo.getText();
- combo.removeAll();
- foreach (path; _lastMaterialPaths) {
- if (!incSearch.match(path)) continue;
- combo.add(path);
- }
- combo.setText(old);
- }
- if (from) setPaths(_fromPath, _fromPathIncSearch);
- if (to) setPaths(_toPath, _toPathIncSearch);
- }
- class SListener : ShellAdapter {
- override void shellActivated(ShellEvent e) { mixin(S_TRACE);
- setupIDs(false, true, true);
- setupPaths();
- _comm.refreshToolBar();
- }
- }
- class SelID : SelectionAdapter {
- private Spinner _spn;
- this (Spinner spn) {_spn = spn;}
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- auto combo = cast(Combo) e.widget;
- _spn.setEnabled(combo.getSelectionIndex() == 0);
- _comm.refreshToolBar();
- }
- }
- class SelIDKind : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- selIDKind();
- }
- }
- void selIDKind() {
- updateIDCombo();
- setupIDs(true, true, true);
- _prop.var.etc.searchIDKind = _idKind.getSelectionIndex();
- _comm.refreshToolBar();
- }
- @property
- private bool idKindIsString() {
- auto index = _idKind.getSelectionIndex();
- // FIXME: CardWirth 1.60 ???? ????
- /+ return index == ID_FLAG || index == ID_STEP || index == ID_COUPON || index == ID_GOSSIP || index == ID_COMPLETE_STAMP || index == ID_KEY_CODE || index == ID_CELL_NAME;
- +/ return index == ID_FLAG || index == ID_STEP || index == ID_COUPON || index == ID_GOSSIP || index == ID_COMPLETE_STAMP || index == ID_KEY_CODE;
- // FIXME: CardWirth 1.60 ???? ????
- }
- private void updateIDCombo() { mixin(S_TRACE);
- if (idKindIsString) { mixin(S_TRACE);
- if (_fromID && !(_fromID.getStyle() & SWT.READ_ONLY)) return;
- if (_fromID) { mixin(S_TRACE);
- _fromID.dispose();
- _toID.dispose();
- }
-
- _fromID = new Combo(_fromIDComp, SWT.BORDER | SWT.DROP_DOWN);
- _fromID.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- _toID = new Combo(_toIDComp, SWT.BORDER | SWT.DROP_DOWN);
- _toID.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- } else { mixin(S_TRACE);
- if (_fromID && (_fromID.getStyle() & SWT.READ_ONLY)) return;
- if (_fromID) { mixin(S_TRACE);
- _fromID.dispose();
- _toID.dispose();
- }
- _fromID = new Combo(_fromIDComp, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
- _fromID.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- _fromID.addSelectionListener(new SelID(_fromIDVal));
- _toID = new Combo(_toIDComp, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
- _toID.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- _toID.addSelectionListener(new SelID(_toIDVal));
- }
- auto fMenu = new Menu(_win, SWT.POP_UP);
- _fromID.setMenu(fMenu);
- createMenuItem(_comm, fMenu, MenuID.IncSearch, &fromIDIncSearch, null);
- new MenuItem(fMenu, SWT.SEPARATOR);
- createTextMenu!Combo(_comm, _prop, _fromID, &catchMod);
- auto tMenu = new Menu(_win, SWT.POP_UP);
- _toID.setMenu(tMenu);
- createMenuItem(_comm, tMenu, MenuID.IncSearch, &toIDIncSearch, null);
- new MenuItem(tMenu, SWT.SEPARATOR);
- createTextMenu!Combo(_comm, _prop, _toID, &catchMod);
- _fromIDIncSearch = new IncSearch(_comm, _fromID);
- _fromIDIncSearch.modEvent ~= () => setupIDs(false, true, false);
- _toIDIncSearch = new IncSearch(_comm, _toID);
- _toIDIncSearch.modEvent ~= () => setupIDs(false, false, true);
- _fromIDComp.layout();
- _toIDComp.layout();
- }
- private void tabChanged() { mixin(S_TRACE);
- auto sel = _tabf.getSelection();
- if (!sel) return;
- _parent.setRedraw(false);
- scope (exit) _parent.setRedraw(true);
- _prop.var.etc.searchPlan = _tabf.getSelectionIndex();
- if (sel is _tabText || sel is _tabGrep) { mixin(S_TRACE);
- auto comp = _comps[sel is _tabGrep ? _tabGrep : _tabText];
- if (_textGrp1.getParent() !is comp) _textGrp1.setParent(comp);
- if (_textGrp2.getParent() !is comp) _textGrp2.setParent(comp);
- auto fromComp = sel is _tabGrep ? _grepFromComp : _textFromComp;
- if (_from.getParent() !is fromComp) { mixin(S_TRACE);
- _from.setParent(fromComp);
- }
- }
- foreach (tab, comp; _comps) { mixin(S_TRACE);
- auto gd = cast(GridData) comp.getLayoutData();
- if (tab is sel) { mixin(S_TRACE);
- gd.heightHint= SWT.DEFAULT;
- } else { mixin(S_TRACE);
- gd.heightHint= 0;
- }
- }
- _parent.layout(true);
- _replace.setEnabled(!(sel is _tabText && _ignoreReturnCode.getSelection()) && sel !is _tabContents && sel !is _tabCoupon && sel !is _tabUnuse && sel !is _tabError);
- _range.setEnabled(sel !is _tabUnuse && sel !is _tabGrep);
- _rangeAllCheck.setEnabled(_range.getEnabled());
- _comm.refreshToolBar();
- }
- class TSListener : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- tabChanged();
- }
- }
- LCheck[] _checked;
- class LCheck : SelectionAdapter {
- Widget[] buttons;
- private Button _all = null;
- private void setSelection(Widget b, bool s) { mixin(S_TRACE);
- auto button = cast(Button) b;
- if (button) button.setSelection(s);
- auto ti = cast(ToolItem) b;
- if (ti) ti.setSelection(s);
- }
- private bool getSelection(Widget b) { mixin(S_TRACE);
- auto button = cast(Button) b;
- if (button) return button.getSelection();
- auto ti = cast(ToolItem) b;
- if (ti) return ti.getSelection();
- assert (0);
- }
- class AllCheck : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- foreach (b; buttons) { mixin(S_TRACE);
- setSelection(b, _all.getSelection());
- }
- }
- }
- void check() { mixin(S_TRACE);
- bool checked = true;
- foreach (b; buttons) { mixin(S_TRACE);
- checked &= getSelection(b);
- }
- _all.setSelection(checked);
- }
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- assert (_all);
- check();
- }
- void createAlls(Composite parent, string text) { mixin(S_TRACE);
- _all = new Button(parent, SWT.CHECK);
- _all.setText(text);
- _all.addSelectionListener(new AllCheck);
- check();
- }
- }
- Composite addButtonLine(Composite grp) { mixin(S_TRACE);
- auto comp = new Composite(grp, SWT.NONE);
- comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- auto rl = new RowLayout(SWT.HORIZONTAL);
- rl.wrap = true;
- rl.pack = false;
- comp.setLayout(rl);
- return comp;
- }
- void constructText(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- auto comp2gl = windowGridLayout(1, true);
- comp2gl.marginWidth = 0;
- comp2gl.marginHeight = 0;
- comp2.setLayout(comp2gl);
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.replText);
- grp.setLayout(new GridLayout(2, false));
- auto fl = new Label(grp, SWT.NONE);
- fl.setText(_prop.msgs.replFrom);
- _textFromComp = new Composite(grp, SWT.NONE);
- _textFromComp.setLayout(new FillLayout);
- _from = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN);
- _from.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.nameWidth;
- _textFromComp.setLayoutData(gd);
- auto lt = new Label(grp, SWT.NONE);
- lt.setText(_prop.msgs.replTo);
- _to = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN);
- _to.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- _to.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- auto fMenu = new Menu(_win, SWT.POP_UP);
- _from.setMenu(fMenu);
- createMenuItem(_comm, fMenu, MenuID.IncSearch, {
- .forceFocus(_from, true);
- _fromIncSearch.startIncSearch();
- }, null);
- new MenuItem(fMenu, SWT.SEPARATOR);
- createTextMenu!Combo(_comm, _prop, _from, &catchMod);
- auto tMenu = new Menu(_win, SWT.POP_UP);
- _to.setMenu(tMenu);
- createMenuItem(_comm, tMenu, MenuID.IncSearch, {
- .forceFocus(_to, true);
- _toIncSearch.startIncSearch();
- }, null);
- new MenuItem(tMenu, SWT.SEPARATOR);
- createTextMenu!Combo(_comm, _prop, _to, &catchMod);
- _fromIncSearch = new IncSearch(_comm, _from);
- _fromIncSearch.modEvent ~= &updateFromHistory;
- _toIncSearch = new IncSearch(_comm, _to);
- _toIncSearch.modEvent ~= &updateToHistory;
- }
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- _textGrp1 = grp;
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.searchResultTableWidth;
- grp.setLayoutData(gd);
- grp.setText(_prop.msgs.replCond);
- grp.setLayout(new GridLayout(3, false));
- _notIgnoreCase = new Button(grp, SWT.CHECK);
- _notIgnoreCase.setText(_prop.msgs.replNotIgnoreCase);
- _exact = new Button(grp, SWT.CHECK);
- _exact.setText(_prop.msgs.replExactMatch);
- _ignoreReturnCode = new Button(grp, SWT.CHECK);
- _ignoreReturnCode.setText(_prop.msgs.replIgnoreReturnCode);
- _ignoreReturnCode.addSelectionListener(new SelIgnoreReturnCode);
- _useWildcard = new Button(grp, SWT.CHECK);
- _useWildcard.setText(_prop.msgs.replWildcard);
- _useWildcard.addSelectionListener(new SelWildcard);
- auto gdw = new GridData;
- gdw.horizontalSpan = 3;
- _useWildcard.setLayoutData(gdw);
- _useRegex = new Button(grp, SWT.CHECK);
- _useRegex.setText(_prop.msgs.replRegExp);
- _useRegex.addSelectionListener(new SelRegex);
- auto gdr = new GridData;
- gdr.horizontalSpan = 3;
- _useRegex.setLayoutData(gdr);
- }
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- _textGrp2 = grp;
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.searchResultTableWidth;
- grp.setLayoutData(gd);
- grp.setText(_prop.msgs.replTextTarget);
- grp.setLayout(zeroGridLayout(1, true));
- auto checked = new LCheck;
- _checked ~= checked;
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- Button createB(string text, char accr, bool summ = false) { mixin(S_TRACE);
- auto b = new Button(btns, SWT.CHECK);
- b.setText(text ~ "(&" ~ accr ~ ")");
- checked.buttons ~= b;
- b.addSelectionListener(checked);
- if (!summ) _noSummText ~= b;
- return b;
- }
- _summary = createB(_prop.msgs.replTextSummary, '1', true);
- _msg = createB(_prop.msgs.replTextMessage, '2');
- _cardName = createB(_prop.msgs.replTextCardName, '3');
- _cardDesc = createB(_prop.msgs.replTextCardDesc, '4');
- _event = createB(_prop.msgs.replTextEventText, '5');
- _start = createB(_prop.msgs.replTextStart, '6');
- _flag = createB(_prop.msgs.replTextFlagAndStep, '7');
- _coupon = createB(_prop.msgs.replTextCoupon, '8');
- _gossip = createB(_prop.msgs.replTextGossip, '9');
- _end = createB(_prop.msgs.replTextEndScenario, 'A');
- _area = createB(_prop.msgs.replTextAreaName, 'B');
- _keyCode = createB(_prop.msgs.replTextKeyCode, 'D');
- _file = createB(_prop.msgs.replTextFile, 'E');
- _comment = createB(_prop.msgs.replTextComment, 'G');
- _jptx = createB(_prop.msgs.replTextJptx, 'H');
- }
- auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- checked.createAlls(btns, _prop.msgs.allCheck);
- }
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForText);
- tab.setControl(comp);
- _tabText = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructID(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- comp2.setLayout(zeroGridLayout(1, true));
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.replID);
- grp.setLayout(new GridLayout(3, false));
- { mixin(S_TRACE);
- auto l = new Label(grp, SWT.NONE);
- l.setText(_prop.msgs.replIDKind);
- _idKind = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
- _idKind.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- _idKind.add(_prop.msgs.replIDArea);
- _idKind.add(_prop.msgs.replIDBattle);
- _idKind.add(_prop.msgs.replIDPackage);
- _idKind.add(_prop.msgs.replIDCast);
- _idKind.add(_prop.msgs.replIDSkill);
- _idKind.add(_prop.msgs.replIDItem);
- _idKind.add(_prop.msgs.replIDBeast);
- _idKind.add(_prop.msgs.replIDInfo);
- _idKind.add(_prop.msgs.replIDFlag);
- _idKind.add(_prop.msgs.replIDStep);
- _idKind.add(_prop.msgs.replIDCoupon);
- _idKind.add(_prop.msgs.replIDGossip);
- _idKind.add(_prop.msgs.replIDCompleteStamp);
- _idKind.add(_prop.msgs.replIDKeyCode);
- // FIXME: CardWirth 1.60 ????
- /+ _idKind.add(_prop.msgs.replIDCellName);
- +/ _idKind.select(0);
- if (0 <= _prop.var.etc.searchIDKind && _prop.var.etc.searchIDKind < _idKind.getItemCount()) { mixin(S_TRACE);
- _idKind.select(_prop.var.etc.searchIDKind);
- }
- auto gd = new GridData;
- gd.horizontalSpan = 2;
- _idKind.setLayoutData(gd);
- _idKind.addSelectionListener(new SelIDKind);
- }
- { mixin(S_TRACE);
- auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- sep.setLayoutData(gd);
- }
- void setupID(string text, ref Composite comboComp, ref Spinner spn) { mixin(S_TRACE);
- auto l = new Label(grp, SWT.NONE);
- l.setText(text);
- comboComp = new Composite(grp, SWT.NONE);
- auto cl = new CenterLayout(SWT.HORIZONTAL | SWT.VERTICAL, 0);
- cl.fillHorizontal = true;
- cl.fillVertical = true;
- comboComp.setLayout(cl);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.nameWidth;
- comboComp.setLayoutData(gd);
- spn = new Spinner(grp, SWT.BORDER);
- initSpinner(spn);
- spn.setMinimum(1);
- spn.setMaximum(_prop.looks.idMax);
- }
- setupID(_prop.msgs.replFrom, _fromIDComp, _fromIDVal);
- setupID(_prop.msgs.replTo, _toIDComp, _toIDVal);
- updateIDCombo();
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForID);
- tab.setControl(comp);
- _tabID = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 0;
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructPath(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- comp2.setLayout(zeroGridLayout(1, true));
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.replPath);
- grp.setLayout(new GridLayout(2, false));
- Combo setupPath(string text, ref IncSearch incSearch) { mixin(S_TRACE);
- auto l = new Label(grp, SWT.NONE);
- l.setText(text);
- auto combo = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN);
- combo.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.nameWidth;
- combo.setLayoutData(gd);
- auto menu = new Menu(_win, SWT.POP_UP);
- combo.setMenu(menu);
- createMenuItem(_comm, menu, MenuID.IncSearch, {
- .forceFocus(combo, true);
- incSearch.startIncSearch();
- }, null);
- new MenuItem(menu, SWT.SEPARATOR);
- createTextMenu!Combo(_comm, _prop, combo, &catchMod);
- incSearch = new IncSearch(_comm, combo);
- return combo;
- }
- _fromPath = setupPath(_prop.msgs.replFrom, _fromPathIncSearch);
- _fromPathIncSearch.modEvent ~= () => setupPathsImpl(true, false);
- _toPath = setupPath(_prop.msgs.replTo, _toPathIncSearch);
- _fromPathIncSearch.modEvent ~= () => setupPathsImpl(false, true);
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForPath);
- tab.setControl(comp);
- _tabPath = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 0;
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructContents(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- comp2.setLayout(zeroGridLayout(1, true));
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.searchResultTableWidth;
- grp.setLayoutData(gd);
- grp.setText(_prop.msgs.searchRange);
- grp.setLayout(zeroGridLayout(1, true));
- auto checked = new LCheck;
- _checked ~= checked;
- auto comp3 = new Composite(grp, SWT.NONE);
- comp3.setLayoutData(new GridData(GridData.FILL_BOTH));
- comp3.setLayout(windowGridLayout(1, true));
- auto bar = new ToolBar(comp3, SWT.HORIZONTAL | SWT.FLAT | SWT.WRAP);
- _comm.put(bar);
- bar.setLayoutData(new GridData(GridData.FILL_BOTH));
- foreach (cGrp, cs; CTYPE_GROUP) { mixin(S_TRACE);
- foreach (cType; cs) { mixin(S_TRACE);
- auto text = _prop.msgs.contentName(cType);
- auto img = _prop.images.content(cType);
- void delegate() func = null;
- auto ti = createToolItem2(_comm, bar, text, img, func, null, SWT.CHECK);
- _contents[cType] = ti;
- checked.buttons ~= ti;
- ti.addSelectionListener(checked);
- }
- if (cGrp < CTypeGroup.max) { mixin(S_TRACE);
- new ToolItem(bar, SWT.SEPARATOR);
- }
- }
- auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- auto btns = addButtonLine(grp);
- checked.createAlls(btns, _prop.msgs.allSelect);
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replContents);
- tab.setControl(comp);
- _tabContents = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 0;
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructCoupon(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- auto comp2gl = windowGridLayout(1, true);
- comp2gl.marginWidth = 0;
- comp2gl.marginHeight = 0;
- comp2.setLayout(comp2gl);
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.searchResultTableWidth;
- grp.setLayoutData(gd);
- grp.setText(_prop.msgs.searchRange);
- grp.setLayout(zeroGridLayout(1, true));
- auto checked = new LCheck;
- _checked ~= checked;
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- Button createB(string text, char accr) { mixin(S_TRACE);
- auto b = new Button(btns, SWT.CHECK);
- b.setText(text ~ "(&" ~ accr ~ ")");
- checked.buttons ~= b;
- b.addSelectionListener(checked);
- return b;
- }
- _cCoupon = createB(_prop.msgs.replTextCoupon, '1');
- _cGossip = createB(_prop.msgs.replTextGossip, '2');
- _cEnd = createB(_prop.msgs.replTextEndScenario, '3');
- _cKeyCode = createB(_prop.msgs.replTextKeyCode, '4');
- // FIXME: CardWirth 1.60 ????
- /+ _cCellName = createB(_prop.msgs.replTextCellName, '5');
- +/ }
- auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- checked.createAlls(btns, _prop.msgs.allCheck);
- }
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForCoupon);
- tab.setControl(comp);
- _tabCoupon = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructUnuse(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- comp2.setLayout(zeroGridLayout(1, true));
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.replUnuseTarget);
- grp.setLayout(zeroGridLayout(1, true));
- auto checked = new LCheck;
- _checked ~= checked;
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- Button createB(string text, char accr) { mixin(S_TRACE);
- auto b = new Button(btns, SWT.CHECK);
- b.setText(text ~ "(&" ~ accr ~ ")");
- checked.buttons ~= b;
- b.addSelectionListener(checked);
- return b;
- }
- _unuseFlag = createB(_prop.msgs.replUnuseFlag, '1');
- _unuseStep = createB(_prop.msgs.replUnuseStep, '2');
- _unuseArea = createB(_prop.msgs.replUnuseArea, '3');
- _unuseBattle = createB(_prop.msgs.replUnuseBattle, '4');
- _unusePackage = createB(_prop.msgs.replUnusePackage, '5');
- _unuseCast = createB(_prop.msgs.replUnuseCast, '6');
- _unuseSkill = createB(_prop.msgs.replUnuseSkill, '7');
- _unuseItem = createB(_prop.msgs.replUnuseItem, '8');
- _unuseBeast = createB(_prop.msgs.replUnuseBeast, '9');
- _unuseInfo = createB(_prop.msgs.replUnuseInfo, 'A');
- _unuseStart = createB(_prop.msgs.replUnuseStart, 'B');
- _unusePath = createB(_prop.msgs.replUnusePath, 'C');
- }
- auto sep = new Label(grp, SWT.SEPARATOR | SWT.HORIZONTAL);
- sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- { mixin(S_TRACE);
- auto btns = addButtonLine(grp);
- checked.createAlls(btns, _prop.msgs.allCheck);
- }
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForUnuse);
- tab.setControl(comp);
- _tabUnuse = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 0;
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructError(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- comp2.setLayout(zeroGridLayout(1, true));
- { mixin(S_TRACE);
- auto l = new Label(comp2, SWT.WRAP);
- l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- l.setText(_prop.msgs.replError);
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replForError);
- tab.setControl(comp);
- _tabError = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 0;
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void constructGrep(CTabFolder tabf) { mixin(S_TRACE);
- auto comp = new Composite(tabf, SWT.NONE);
- comp.setLayout(new GridLayout(1, true));
- auto comp2 = new Composite(comp, SWT.NONE);
- auto comp2gl = windowGridLayout(1, true);
- comp2gl.marginWidth = 0;
- comp2gl.marginHeight = 0;
- comp2.setLayout(comp2gl);
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.grepText);
- grp.setLayout(new GridLayout(2, false));
- auto fl = new Label(grp, SWT.NONE);
- fl.setText(_prop.msgs.grepFrom);
- _grepFromComp = new Composite(grp, SWT.NONE);
- _grepFromComp.setLayout(new FillLayout);
- auto gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = _prop.var.etc.nameWidth;
- _grepFromComp.setLayoutData(gd);
- }
- { mixin(S_TRACE);
- auto grp = new Group(comp2, SWT.NONE);
- grp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- grp.setText(_prop.msgs.grepTarget);
- grp.setLayout(new GridLayout(4, false));
- _grepDir = new Combo(grp, SWT.BORDER | SWT.DROP_DOWN);
- _grepDir.setVisibleItemCount(_prop.var.etc.comboVisibleItemCount);
- createTextMenu!Combo(_comm, _prop, _grepDir, &catchMod);
- _grepDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- auto grepDirRef = new Button(grp, SWT.PUSH);
- grepDirRef.setText(_prop.msgs.reference);
- .listener(grepDirRef, SWT.Selection, { mixin(S_TRACE);
- selectDir(_prop, _grepDir, _prop.msgs.grepDir, _prop.msgs.grepDirDesc, _grepDir.getText());
- });
- createOpenButton(_comm, grp, {return _prop.toAppAbs(_grepDir.getText());}, true);
- auto grepCurrent = new Button(grp, SWT.PUSH);
- grepCurrent.setText(_prop.msgs.grepCurrent);
- .listener(grepCurrent, SWT.Selection, &setGrepCurrentDir);
- _grepSubDir = new Button(grp, SWT.CHECK);
- auto gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- gd.horizontalSpan = 4;
- _grepSubDir.setLayoutData(gd);
- _grepSubDir.setText(_prop.msgs.grepSubDir);
- .listener(_grepDir, SWT.Modify, { mixin(S_TRACE);
- if (ignoreMod) return;
- _prop.var.etc.grepDir = _grepDir.getText();
- });
- .listener(_grepSubDir, SWT.Selection, { mixin(S_TRACE);
- if (ignoreMod) return;
- _prop.var.etc.grepSubDir = _grepSubDir.getSelection();
- });
- }
- auto tab = new CTabItem(tabf, SWT.NONE);
- tab.setText(_prop.msgs.replGrep);
- tab.setControl(comp);
- _tabGrep = tab;
- auto gd = new GridData(GridData.FILL_BOTH);
- comp2.setLayoutData(gd);
- _comps[tab] = comp2;
- }
- void setGrepCurrentDir() { mixin(S_TRACE);
- if (_summ) { mixin(S_TRACE);
- auto sc = _summ.scenarioPath.dirName();
- if (_summ.useTemp) sc = _summ.zipName.dirName();
- _grepDir.setText(sc);
- }
- }
- void refFunc(bool Del, A : CWXPath)(A a) { mixin(S_TRACE);
- bool recurse(TreeItem itm) { mixin(S_TRACE);
- if (a is itm.getData()) { mixin(S_TRACE);
- static if (Del) {
- itm.dispose();
- } else { mixin(S_TRACE);
- itm.setText(a.name);
- }
- return true;
- } else { mixin(S_TRACE);
- foreach (child; itm.getItems()) { mixin(S_TRACE);
- if (recurse(child)) { mixin(S_TRACE);
- return true;
- }
- }
- return false;
- }
- }
- foreach (child; _range.getItems()) { mixin(S_TRACE);
- if (recurse(child)) { mixin(S_TRACE);
- return;
- }
- }
- static if (!Del) {
- // ??
- refreshRangeTree();
- }
- }
- void delArea(Area a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delBattle(Battle a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delPackage(Package a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delCast(CastCard a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delSkill(SkillCard a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delItem(ItemCard a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delBeast(BeastCard a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void delInfo(InfoCard a) { mixin(S_TRACE);
- refFunc!true(a);
- }
- void refArea(Area a) { mixin(S_TRACE);
- if (_prop.var.etc.showAreaDirTree) {
- refreshRangeTree();
- } else {
- refFunc!false(a);
- }
- }
- void refBattle(Battle a) { mixin(S_TRACE);
- if (_prop.var.etc.showAreaDirTree) {
- refreshRangeTree();
- } else {
- refFunc!false(a);
- }
- }
- void refPackage(Package a) { mixin(S_TRACE);
- if (_prop.var.etc.showAreaDirTree) {
- refreshRangeTree();
- } else {
- refFunc!false(a);
- }
- }
- void refCast(CastCard a) { mixin(S_TRACE);
- refFunc!false(a);
- }
- void refSkill(SkillCard a) { mixin(S_TRACE);
- refFunc!false(a);
- }
- void refItem(ItemCard a) { mixin(S_TRACE);
- refFunc!false(a);
- }
- void refBeast(BeastCard a) { mixin(S_TRACE);
- refFunc!false(a);
- }
- void refInfo(InfoCard a) { mixin(S_TRACE);
- refFunc!false(a);
- }
- static CWXPath[] rangeTree(Summary summ) { mixin(S_TRACE);
- CWXPath[] r;
- r ~= summ;
- r ~= summ.flagDirRoot;
- foreach (a; summ.areas) r ~= a;
- foreach (a; summ.battles) r ~= a;
- foreach (a; summ.packages) r ~= a;
- foreach (a; summ.casts) { mixin(S_TRACE);
- r ~= a;
- foreach (c; a.skills) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- r ~= c;
- }
- foreach (c; a.items) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- r ~= c;
- }
- foreach (c; a.beasts) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- r ~= c;
- }
- }
- foreach (a; summ.skills) r ~= a;
- foreach (a; summ.items) r ~= a;
- foreach (a; summ.beasts) r ~= a;
- foreach (a; summ.infos) r ~= a;
- return r;
- }
- void refreshRangeTree() { mixin(S_TRACE);
- _range.setRedraw(false);
- scope (exit) _range.setRedraw(true);
- if (!_summ) { mixin(S_TRACE);
- _range.removeAll();
- return;
- }
- CWXPath sel = null;
- auto selItm = _range.getSelection();
- if (selItm.length) { mixin(S_TRACE);
- sel = cast(CWXPath)selItm[0].getData();
- }
- _range.removeAll();
- TreeItem add(TreeItem par, string name, CWXPath path) { mixin(S_TRACE);
- TreeItem itm;
- if (par) { mixin(S_TRACE);
- itm = new TreeItem(par, SWT.NONE);
- } else { mixin(S_TRACE);
- itm = new TreeItem(_range, SWT.NONE);
- }
- string text1, text2;
- Image img1, img2;
- getPathParams(path, text1, text2, img1, img2, false);
- itm.setText(name);
- itm.setImage(img1);
- itm.setData(cast(Object) path);
- itm.setChecked(true);
- if (sel is path) { mixin(S_TRACE);
- _range.setSelection([itm]);
- }
- return itm;
- }
- add(null, _prop.msgs.summary, _summ);
- add(null, _prop.msgs.flagsAndSteps, _summ.flagDirRoot);
- if (_prop.var.etc.showAreaDirTree) { mixin(S_TRACE);
- TreeItem[string] itmTable;
- auto dirSet = new HashSet!string;
- auto dirSet2 = new HashSet!string;
- void put1(string dirName) { mixin(S_TRACE);
- auto l = dirName.toLower();
- if (dirSet2.contains(l)) return;
- dirSet.add(dirName);
- dirSet2.add(l);
- }
- foreach (a; _summ.areas) put1(a.dirName);
- foreach (a; _summ.battles) put1(a.dirName);
- foreach (a; _summ.packages) put1(a.dirName);
- bool delegate(string, string) cmps;
- if (_prop.var.etc.logicalSort) {
- cmps = (a, b) => incmp(a, b) < 0;
- } else {
- cmps = (a, b) => icmp(a, b) < 0;
- }
- foreach (dirName; .sortDlg(dirSet.toArray(), cmps)) { mixin (S_TRACE);
- auto dirs = .split(dirName, "\\");
- TreeItem itm = null;
- foreach (i, dir; dirs) { mixin (S_TRACE);
- auto fPath = dirs[0 .. i + 1].join("\\");
- auto path = fPath.toLower();
- auto p = path in itmTable;
- if (p) { mixin (S_TRACE);
- itm = *p;
- } else { mixin (S_TRACE);
- TreeItem sub;
- if (itm) { mixin (S_TRACE);
- sub = new TreeItem(itm, SWT.NONE);
- } else { mixin (S_TRACE);
- sub = new TreeItem(_range, SWT.NONE);
- }
- sub.setText(dir);
- sub.setImage(_prop.images.areaDir);
- sub.setChecked(true);
- itm = sub;
- itmTable[path] = sub;
- }
- }
- itmTable[dirName.toLower()] = itm;
- }
- void put(A)(A[] arr) { mixin (S_TRACE);
- foreach (a; arr) { mixin (S_TRACE);
- add(itmTable[a.dirName.toLower()], .tryFormat("%s.%s", a.id, a.baseName), a);
- }
- }
- put(_summ.areas);
- put(_summ.battles);
- put(_summ.packages);
- } else { mixin(S_TRACE);
- foreach (a; _summ.areas) add(null, a.name, a);
- foreach (a; _summ.battles) add(null, a.name, a);
- foreach (a; _summ.packages) add(null, a.name, a);
- }
- foreach (a; _summ.casts) { mixin(S_TRACE);
- auto par = add(null, .tryFormat("%s.%s", a.id, a.name), a);
- foreach (c; a.skills) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- add(par, .tryFormat("%s.%s", c.id, c.name), c);
- }
- foreach (c; a.items) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- add(par, .tryFormat("%s.%s", c.id, c.name), c);
- }
- foreach (c; a.beasts) { mixin(S_TRACE);
- if (0 != c.linkId) continue;
- add(par, .tryFormat("%s.%s", c.id, c.name), c);
- }
- }
- foreach (a; _summ.skills) { mixin(S_TRACE);
- add(null, .tryFormat("%s.%s", a.id, a.name), a);
- }
- foreach (a; _summ.items) { mixin(S_TRACE);
- add(null, .tryFormat("%s.%s", a.id, a.name), a);
- }
- foreach (a; _summ.beasts) { mixin(S_TRACE);
- add(null, .tryFormat("%s.%s", a.id, a.name), a);
- }
- foreach (a; _summ.infos) { mixin(S_TRACE);
- add(null, .tryFormat("%s.%s", a.id, a.name), a);
- }
- _range.treeExpandedAll();
- _range.showSelection();
- _comm.refreshToolBar();
- }
- void refreshRangeAllCheck() { mixin(S_TRACE);
- bool recurse(TreeItem itm) { mixin(S_TRACE);
- if (!itm.getChecked()) { mixin(S_TRACE);
- return true;
- } else { mixin(S_TRACE);
- foreach (child; itm.getItems()) { mixin(S_TRACE);
- if (recurse(child)) { mixin(S_TRACE);
- return true;
- }
- }
- return false;
- }
- }
- foreach (child; _range.getItems()) { mixin(S_TRACE);
- if (recurse(child)) { mixin(S_TRACE);
- _rangeAllCheck.setSelection(false);
- return;
- }
- }
- _rangeAllCheck.setSelection(true);
- }
- class RefRangeAllCheck : SelectionAdapter {
- override void widgetSelected(SelectionEvent e) { mixin(S_TRACE);
- if (SWT.CHECK != e.detail) return;
- auto par = (cast(TreeItem)e.item);
- // ????????????????
- // ??????????????????
- if (par && !par.getData()) { mixin(S_TRACE);
- void recurse(TreeItem itm) { mixin(S_TRACE);
- itm.setChecked(par.getChecked());
- foreach (child; itm.getItems()) recurse(child);
- }
- foreach (itm; par.getItems()) { mixin(S_TRACE);
- recurse(itm);
- }
- }
- // ??????????????????
- // ?????????????????????????
- while (par && par.getParentItem() && !par.getParentItem().getData()) { mixin(S_TRACE);
- bool same = true;
- void recurse2(TreeItem itm) { mixin(S_TRACE);
- if (itm.getChecked() != par.getChecked()) { mixin(S_TRACE);
- same = false;
- return;
- }
- foreach (child; itm.getItems()) recurse2(child);
- }
- foreach (itm; par.getParentItem().getItems()) { mixin(S_TRACE);
- recurse2(itm);
- }
- if (!same) break;
- par.getParentItem().setChecked(par.getChecked());
- pa…
Large files files are truncated, but you can click here to view the full file