Source: widgets/chem/editor/kekule.chemEditor.actions.js

  1. /**
  2. * @fileoverview
  3. * Implements of actions related with chem editor.
  4. * @author Partridge Jiang
  5. */
  6. /*
  7. * requires /lan/classes.js
  8. * requires /utils/kekule.utils.js
  9. * requires /io/kekule.io.js
  10. * requires /xbrowsers/kekule.x.js
  11. * requires /widgets/kekule.widget.base.js
  12. * requires /widgets/kekule.widget.clipboards.js
  13. * requires /widgets/chem/kekule.chemWidget.chemObjDisplayers.js
  14. * requires /widgets/chem/editor/kekule.chemEditor.baseEditors.js
  15. * requires /widgets/chem/editor/kekule.chemEditor.composers.js
  16. * requires /widgets/operation/kekule.actions.js
  17. *
  18. * requires /localization/kekule.localize.widget.js
  19. */
  20. (function(){
  21. "use strict";
  22. var AU = Kekule.ArrayUtils;
  23. var BNS = Kekule.ChemWidget.ComponentWidgetNames;
  24. var CCNS = Kekule.ChemWidget.HtmlClassNames;
  25. //var CWT = Kekule.ChemWidgetTexts;
  26. var AM = Kekule.ActionManager;
  27. var _editorActionRegInfo = [];
  28. /** @ignore */
  29. Kekule.ChemWidget.HtmlClassNames = Object.extend(Kekule.ChemWidget.HtmlClassNames, {
  30. // predefined actions
  31. ACTION_UNDO: 'K-Chem-Undo',
  32. ACTION_REDO: 'K-Chem-Redo',
  33. ACTION_NEWDOC: 'K-Chem-NewDoc',
  34. ACTION_CLONE_SELECTION: 'K-Chem-Clone-Selection',
  35. ACTION_COPY: 'K-Chem-Copy',
  36. ACTION_CUT: 'K-Chem-Cut',
  37. ACTION_PASTE: 'K-Chem-Paste',
  38. ACTION_TOGGLE_SELECT: 'K-Chem-Toggle-Select-State',
  39. ACTION_TOGGLE_INSPECTOR: 'K-Chem-Toggle-Inspector'
  40. });
  41. Object.extend(Kekule.ChemWidget.ComponentWidgetNames, {
  42. manipulateMarquee: 'manipulateMarquee',
  43. manipulateLasso: 'manipulateLasso',
  44. manipulateBrush: 'manipulateBrush',
  45. manipulateAncestor: 'manipulateAncestor',
  46. molBondSingle: 'bondSingle',
  47. molBondDouble: 'bondDouble',
  48. molBondTriple: 'bondTriple',
  49. molBondCloser: 'bondCloser',
  50. molBondWedgeUp: 'bondWedgeUp',
  51. molBondWedgeDown: 'bondWedgeDown',
  52. molBondWedgeUpOrDown: 'bondWedgeUpOrDown',
  53. molBondDoubleEither: 'bondDoubleEither',
  54. molChargeClear: 'chargeClear',
  55. molChargePositive: 'chargePositive',
  56. molChargeNegative: 'chargeNegative',
  57. molRadicalSinglet: 'radicalSinglet',
  58. molRadicalTriplet: 'radicalTriplet',
  59. molRadicalDoublet: 'radicalDoublet',
  60. molElectronLonePair: 'electronLonePair',
  61. molChain: 'chain',
  62. molRing3: 'ring3',
  63. molRing4: 'ring4',
  64. molRing5: 'ring5',
  65. molRing6: 'ring6',
  66. molRing7: 'ring7',
  67. molRing8: 'ring8',
  68. molRingAr6: 'ringAr6',
  69. molRingAr5: 'ringAr5',
  70. molFlexRing: 'flexRing',
  71. molRepCyclopentaneHaworth1: 'repCyclopentaneHaworth1',
  72. molRepCyclopentaneHaworth2: 'repCyclopentaneHaworth2',
  73. molRepCyclohexaneHaworth1: 'repCyclohexaneHaworth1',
  74. molRepCyclohexaneHaworth2: 'repCyclohexaneHaworth2',
  75. molRepCyclohexaneChair1: 'repCyclohexaneChair1',
  76. molRepCyclohexaneChair2: 'repCyclohexaneChair2',
  77. molRepSubBondMark: 'subBondMark',
  78. molRepMethane: 'methane',
  79. molRepFischer1: 'repFischer1',
  80. molRepFischer2: 'repFischer2',
  81. molRepFischer3: 'repFischer3',
  82. molRepSawhorseStaggered: 'repSawhorseStaggered',
  83. molRepSawhorseEclipsed: 'repSawhorseEclipsed',
  84. glyphRepLine: 'repLine',
  85. glyphRepOpenArrowLine: 'repOpenArrowLine',
  86. glyphRepTriangleArrowLine: 'repTriangleArrowLine',
  87. glyphRepDiOpenArrowLine: 'repDiOpenArrowLine',
  88. glyphRepDiTriangleArrowLine: 'repDiTriangleArrowLine',
  89. glyphRepReversibleArrowLine: 'repReversibleArrowLine',
  90. glyphRepOpenArrowDiLine: 'repOpenArrowDiLine',
  91. glyphRepOpenArrowArc: 'repOpenArrowArc',
  92. glyphRepSingleSideOpenArrowArc: 'repSingleSideOpenArrowArc',
  93. glyphRepHeatSymbol: 'repHeatSymbol',
  94. glyphRepAddSymbol: 'repAddSymbol'
  95. });
  96. /**
  97. * A helper class for editor actions.
  98. * @class
  99. */
  100. Kekule.Editor.ActionOperUtils = {
  101. /**
  102. * Add standalone objects to a chem space editor, with operation support.
  103. * @param {Kekule.Editor.ChemSpaceEditor} editor
  104. * @param {Array} objs
  105. * @param {Hash} coordOffset Coords of new added objects will be added with this value.
  106. */
  107. addObjectsToChemSpaceEditor: function(editor, objs, coordOffset)
  108. {
  109. var chemSpace = editor.getChemSpace && editor.getChemSpace();
  110. if (editor && chemSpace && editor.canAddNewStandaloneObject && editor.canAddNewStandaloneObject())
  111. {
  112. editor.beginUpdateObject();
  113. try
  114. {
  115. var marcoOper = new Kekule.MacroOperation();
  116. for (var i = 0, l = objs.length; i < l; ++i)
  117. {
  118. var obj = objs[i];
  119. var oper = new Kekule.ChemObjOperation.Add(objs[i], chemSpace, null, editor);
  120. marcoOper.add(oper);
  121. }
  122. marcoOper.execute();
  123. if (coordOffset)
  124. {
  125. for (var i = 0, l = objs.length; i < l; ++i)
  126. {
  127. var obj = objs[i];
  128. var coord = editor.getObjectScreenCoord(obj);
  129. var newCoord = Kekule.CoordUtils.add(coord, coordOffset);
  130. editor.setObjectScreenCoord(obj, newCoord);
  131. }
  132. }
  133. editor.pushOperation(marcoOper);
  134. editor.select(objs);
  135. }
  136. finally
  137. {
  138. editor.endUpdateObject();
  139. }
  140. }
  141. }
  142. };
  143. /**
  144. * Base class for actions for chem editor only.
  145. * @class
  146. * @augments Kekule.ChemWidget.ActionOnDisplayer
  147. *
  148. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  149. * @param {String} caption
  150. * @param {String} hint
  151. * @param {String} explicitGroup Use this property to explicitly set child actions to different group.
  152. */
  153. Kekule.Editor.ActionOnEditor = Class.create(Kekule.ChemWidget.ActionOnDisplayer,
  154. /** @lends Kekule.Editor.ActionOnEditor# */
  155. {
  156. /** @private */
  157. CLASS_NAME: 'Kekule.Editor.ActionOnEditor',
  158. /** @constructs */
  159. initialize: function($super, editor, caption, hint)
  160. {
  161. $super(editor, caption, hint);
  162. },
  163. /** @private */
  164. initProperties: function()
  165. {
  166. this.defineProp('explicitGroup', {'dataType': DataType.STRING});
  167. },
  168. /**
  169. * Returns the widget class that best fit this action.
  170. * Descendants may override this method.
  171. * @returns {null}
  172. */
  173. getPreferredWidgetClass: function()
  174. {
  175. return null;
  176. },
  177. /** @private */
  178. doUpdate: function()
  179. {
  180. var displayer = this.getDisplayer();
  181. this.setEnabled(displayer && displayer.getChemObj() && displayer.getChemObjLoaded() && displayer.getEnabled());
  182. },
  183. /**
  184. * Returns target chem editor object.
  185. * @returns {Kekule.Editor.BaseEditor}
  186. */
  187. getEditor: function()
  188. {
  189. var result = this.getDisplayer();
  190. return (result instanceof Kekule.Editor.BaseEditor)? result: null;
  191. }
  192. });
  193. /**
  194. * An undo action on editor.
  195. * @class
  196. * @augments Kekule.Editor.ActionOnEditor
  197. *
  198. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  199. */
  200. Kekule.Editor.ActionEditorUndo = Class.create(Kekule.Editor.ActionOnEditor,
  201. /** @lends Kekule.Editor.ActionEditorUndo# */
  202. {
  203. /** @private */
  204. CLASS_NAME: 'Kekule.Editor.ActionEditorUndo',
  205. /** @private */
  206. HTML_CLASSNAME: CCNS.ACTION_UNDO,
  207. /** @constructs */
  208. initialize: function($super, editor)
  209. {
  210. $super(editor, /*CWT.CAPTION_UNDO, CWT.HINT_UNDO*/Kekule.$L('ChemWidgetTexts.CAPTION_UNDO'), Kekule.$L('ChemWidgetTexts.HINT_UNDO'));
  211. },
  212. /** @private */
  213. doUpdate: function($super)
  214. {
  215. $super();
  216. if (this.getEnabled())
  217. this.setEnabled(this.getEditor().canUndo());
  218. },
  219. /** @private */
  220. doExecute: function()
  221. {
  222. var editor = this.getEditor();
  223. if (editor)
  224. editor.undo();
  225. }
  226. });
  227. /**
  228. * A redo action on editor.
  229. * @class
  230. * @augments Kekule.Editor.ActionOnEditor
  231. *
  232. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  233. */
  234. Kekule.Editor.ActionEditorRedo = Class.create(Kekule.Editor.ActionOnEditor,
  235. /** @lends Kekule.Editor.ActionEditorRedo# */
  236. {
  237. /** @private */
  238. CLASS_NAME: 'Kekule.Editor.ActionEditorRedo',
  239. /** @private */
  240. HTML_CLASSNAME: CCNS.ACTION_REDO,
  241. /** @constructs */
  242. initialize: function($super, editor)
  243. {
  244. $super(editor, /*CWT.CAPTION_REDO, CWT.HINT_REDO*/Kekule.$L('ChemWidgetTexts.CAPTION_REDO'), Kekule.$L('ChemWidgetTexts.HINT_REDO'));
  245. },
  246. /** @private */
  247. doUpdate: function($super)
  248. {
  249. $super();
  250. if (this.getEnabled())
  251. this.setEnabled(this.getEditor().canRedo());
  252. },
  253. /** @private */
  254. doExecute: function()
  255. {
  256. var editor = this.getEditor();
  257. if (editor)
  258. editor.redo();
  259. }
  260. });
  261. /**
  262. * A new document action on editor.
  263. * @class
  264. * @augments Kekule.Editor.ActionOnEditor
  265. *
  266. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  267. */
  268. Kekule.Editor.ActionEditorNewDoc = Class.create(Kekule.Editor.ActionOnEditor,
  269. /** @lends Kekule.Editor.ActionEditorNewDoc# */
  270. {
  271. /** @private */
  272. CLASS_NAME: 'Kekule.Editor.ActionEditorNewDoc',
  273. /** @private */
  274. HTML_CLASSNAME: CCNS.ACTION_NEWDOC,
  275. /** @constructs */
  276. initialize: function($super, editor)
  277. {
  278. $super(editor, /*CWT.CAPTION_NEWDOC, CWT.HINT_NEWDOC*/Kekule.$L('ChemWidgetTexts.CAPTION_NEWDOC'), Kekule.$L('ChemWidgetTexts.HINT_NEWDOC'));
  279. },
  280. /** @private */
  281. doUpdate: function()
  282. {
  283. var editor = this.getDisplayer();
  284. this.setEnabled(editor && editor.getEnabled() && editor.getEnableCreateNewDoc());
  285. },
  286. /** @private */
  287. doExecute: function()
  288. {
  289. var editor = this.getEditor();
  290. if (editor)
  291. editor.newDoc();
  292. }
  293. });
  294. /**
  295. * A clone selection action on editor.
  296. * @class
  297. * @augments Kekule.Editor.ActionOnEditor
  298. *
  299. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  300. */
  301. Kekule.Editor.ActionCloneSelection = Class.create(Kekule.Editor.ActionOnEditor,
  302. /** @lends Kekule.Editor.ActionCloneSelection# */
  303. {
  304. /** @private */
  305. CLASS_NAME: 'Kekule.Editor.ActionCloneSelection',
  306. /** @private */
  307. HTML_CLASSNAME: CCNS.ACTION_CLONE_SELECTION,
  308. /** @constructs */
  309. initialize: function($super, editor)
  310. {
  311. $super(editor, /*CWT.CAPTION_CLONE_SELECTION, CWT.HINT_CLONE_SELECTION*/Kekule.$L('ChemWidgetTexts.CAPTION_CLONESELECTION'), Kekule.$L('ChemWidgetTexts.HINT_CLONE_SELECTION'));
  312. },
  313. /** @private */
  314. _hasCloneMethod: function()
  315. {
  316. var editor = this.getEditor();
  317. return editor && editor.cloneSelection;
  318. },
  319. /** @private */
  320. doUpdate: function($super)
  321. {
  322. $super();
  323. if (this.getEnabled())
  324. this.setEnabled(this._hasCloneMethod() && this.getEditor().hasSelection());
  325. this.setDisplayed(this._hasCloneMethod() && this.getEditor().canCloneObjects());
  326. },
  327. /** @private */
  328. doExecute: function()
  329. {
  330. var editor = this.getEditor();
  331. if (editor && editor.getChemSpace)
  332. {
  333. var coordOffset = editor.getDefaultCloneScreenCoordOffset && editor.getDefaultCloneScreenCoordOffset();
  334. var objs = editor.cloneSelection();
  335. Kekule.Editor.ActionOperUtils.addObjectsToChemSpaceEditor(editor, objs, coordOffset);
  336. }
  337. /*
  338. var chemSpace = editor.getChemSpace && editor.getChemSpace();
  339. if (editor && chemSpace)
  340. {
  341. var coordOffset = editor.getDefaultCloneScreenCoordOffset();
  342. editor.beginUpdateObject();
  343. try
  344. {
  345. var objs = editor.cloneSelection();
  346. var marcoOper = new Kekule.MacroOperation();
  347. for (var i = 0, l = objs.length; i < l; ++i)
  348. {
  349. var obj = objs[i];
  350. var oper = new Kekule.ChemObjOperation.Add(objs[i], chemSpace);
  351. marcoOper.add(oper);
  352. }
  353. marcoOper.execute();
  354. if (coordOffset)
  355. {
  356. for (var i = 0, l = objs.length; i < l; ++i)
  357. {
  358. var obj = objs[i];
  359. var coord = editor.getObjectScreenCoord(obj);
  360. var newCoord = Kekule.CoordUtils.add(coord, coordOffset);
  361. editor.setObjectScreenCoord(obj, newCoord);
  362. }
  363. }
  364. editor.pushOperation(marcoOper);
  365. editor.select(objs);
  366. }
  367. finally
  368. {
  369. editor.endUpdateObject();
  370. }
  371. }
  372. */
  373. }
  374. });
  375. /**
  376. * A copying selection action on editor.
  377. * @class
  378. * @augments Kekule.Editor.ActionOnEditor
  379. *
  380. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  381. */
  382. Kekule.Editor.ActionCopySelection = Class.create(Kekule.Editor.ActionOnEditor,
  383. /** @lends Kekule.Editor.ActionCopySelection# */
  384. {
  385. /** @private */
  386. CLASS_NAME: 'Kekule.Editor.ActionCopySelection',
  387. /** @private */
  388. HTML_CLASSNAME: CCNS.ACTION_COPY,
  389. /** @constructs */
  390. initialize: function($super, editor)
  391. {
  392. $super(editor, /*CWT.CAPTION_COPY, CWT.HINT_COPY*/Kekule.$L('ChemWidgetTexts.CAPTION_COPY'), Kekule.$L('ChemWidgetTexts.HINT_COPY'));
  393. },
  394. /** @private */
  395. doUpdate: function($super)
  396. {
  397. $super();
  398. if (this.getEnabled())
  399. this.setEnabled(this.getEditor().hasSelection());
  400. },
  401. /** @private */
  402. doExecute: function()
  403. {
  404. var editor = this.getEditor();
  405. var chemSpace = editor.getChemSpace && editor.getChemSpace();
  406. if (editor && chemSpace)
  407. {
  408. var objs = editor.cloneSelection();
  409. Kekule.Widget.clipboard.setObjects(Kekule.IO.MimeType.JSON, objs);
  410. //console.log(Kekule.Widget.Clipboard.getData('text/json'));
  411. }
  412. }
  413. });
  414. /**
  415. * A cutting selection action on editor.
  416. * @class
  417. * @augments Kekule.Editor.ActionOnEditor
  418. *
  419. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  420. */
  421. Kekule.Editor.ActionCutSelection = Class.create(Kekule.Editor.ActionOnEditor,
  422. /** @lends Kekule.Editor.ActionCutSelection# */
  423. {
  424. /** @private */
  425. CLASS_NAME: 'Kekule.Editor.ActionCutSelection',
  426. /** @private */
  427. HTML_CLASSNAME: CCNS.ACTION_CUT,
  428. /** @constructs */
  429. initialize: function($super, editor)
  430. {
  431. $super(editor, /*CWT.CAPTION_CUT, CWT.HINT_CUT*/Kekule.$L('ChemWidgetTexts.CAPTION_CUT'), Kekule.$L('ChemWidgetTexts.HINT_CUT'));
  432. },
  433. /** @private */
  434. doUpdate: function($super)
  435. {
  436. $super();
  437. if (this.getEnabled())
  438. this.setEnabled(this.getEditor().hasSelection());
  439. },
  440. /** @private */
  441. doExecute: function()
  442. {
  443. var editor = this.getEditor();
  444. var chemSpace = editor.getChemSpace && editor.getChemSpace();
  445. if (editor && chemSpace)
  446. {
  447. var objs = editor.cloneSelection();
  448. Kekule.Widget.clipboard.setObjects(Kekule.IO.MimeType.JSON, objs);
  449. // TODO: this is not a good approach
  450. var controller = editor.getIaController('BasicMolEraserIaController');
  451. if (controller)
  452. controller.removeSelection();
  453. }
  454. }
  455. });
  456. /**
  457. * A copying selection action on editor.
  458. * @class
  459. * @augments Kekule.Editor.ActionOnEditor
  460. *
  461. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  462. */
  463. Kekule.Editor.ActionPaste = Class.create(Kekule.Editor.ActionOnEditor,
  464. /** @lends Kekule.Editor.ActionPaste# */
  465. {
  466. /** @private */
  467. CLASS_NAME: 'Kekule.Editor.ActionPaste',
  468. /** @private */
  469. HTML_CLASSNAME: CCNS.ACTION_PASTE,
  470. /** @constructs */
  471. initialize: function($super, editor)
  472. {
  473. $super(editor, /*CWT.CAPTION_PASTE, CWT.HINT_PASTE*/Kekule.$L('ChemWidgetTexts.CAPTION_PASTE'), Kekule.$L('ChemWidgetTexts.HINT_PASTE'));
  474. Kekule.Widget.clipboard.addEventListener('setData', this._reactClipboardChange, this);
  475. },
  476. /** @ignore */
  477. finalize: function($super)
  478. {
  479. Kekule.Widget.clipboard.removeEventListener('setData', this._reactClipboardChange, this);
  480. $super();
  481. },
  482. /** @private */
  483. _reactClipboardChange: function()
  484. {
  485. this.update();
  486. },
  487. /** @private */
  488. doUpdate: function($super)
  489. {
  490. $super();
  491. if (this.getEnabled())
  492. this.setEnabled(Kekule.Widget.clipboard.hasData(Kekule.IO.MimeType.JSON) && this.getEditor().canAddNewStandaloneObject());
  493. },
  494. /** @private */
  495. getObjsCenterScreenCoord: function(editor, objects)
  496. {
  497. var BU = Kekule.BoxUtils;
  498. var CU = Kekule.CoordUtils;
  499. var containerBox = null;
  500. for (var i = 0, l = objects.length; i < l; ++i)
  501. {
  502. var box = Kekule.Render.ObjUtils.getContainerBox(objects[i], editor.getCoordMode(), editor.getAllowCoordBorrow());
  503. if (!containerBox)
  504. containerBox = box;
  505. else
  506. containerBox = BU.getContainerBox(box, containerBox);
  507. }
  508. //var centerCoord = BU.getCenterCoord(containerBox);
  509. var coords = BU.getMinMaxCoords(containerBox);
  510. var screenCoords = {
  511. 'min': editor.objCoordToScreen(coords.min),
  512. 'max': editor.objCoordToScreen(coords.max)
  513. };
  514. var result = CU.add(screenCoords.min, screenCoords.max);
  515. var result = CU.divide(result, 2);
  516. //return editor.objCoordToScreen(centerCoord);
  517. return result;
  518. },
  519. /** @private */
  520. doExecute: function()
  521. {
  522. var editor = this.getEditor();
  523. if (editor && editor.getChemSpace)
  524. {
  525. var objs = Kekule.Widget.clipboard.getObjects(Kekule.IO.MimeType.JSON);
  526. // calc coord offset
  527. var coordOffset = null;
  528. var selObjs = editor.getSelection();
  529. if (selObjs && selObjs.length)
  530. {
  531. coordOffset = editor.getDefaultCloneScreenCoordOffset? editor.getDefaultCloneScreenCoordOffset(): null;
  532. var originalSelectedObjs = AU.clone(selObjs);
  533. if (originalSelectedObjs && originalSelectedObjs.length && coordOffset)
  534. {
  535. var originCenterCoord = this.getObjsCenterScreenCoord(editor, originalSelectedObjs);
  536. var targetCenterCoord = this.getObjsCenterScreenCoord(editor, objs);
  537. var deltaCoord = Kekule.CoordUtils.substract(originCenterCoord, targetCenterCoord);
  538. coordOffset = Kekule.CoordUtils.add(coordOffset, deltaCoord);
  539. }
  540. }
  541. Kekule.Editor.ActionOperUtils.addObjectsToChemSpaceEditor(editor, objs, coordOffset);
  542. }
  543. /*
  544. var chemSpace = editor.getChemSpace && editor.getChemSpace();
  545. if (editor && chemSpace)
  546. {
  547. var objs = Kekule.Widget.Clipboard.getObjects('text/json');
  548. editor.beginUpdateObject();
  549. try
  550. {
  551. var marcoOper = new Kekule.MacroOperation();
  552. for (var i = 0, l = objs.length; i < l; ++i)
  553. {
  554. var obj = objs[i];
  555. var oper = new Kekule.ChemObjOperation.Add(objs[i], chemSpace);
  556. marcoOper.add(oper);
  557. }
  558. marcoOper.execute();
  559. var coordOffset = editor.getDefaultCloneScreenCoordOffset();
  560. if (coordOffset)
  561. {
  562. for (var i = 0, l = objs.length; i < l; ++i)
  563. {
  564. var obj = objs[i];
  565. var coord = editor.getObjectScreenCoord(obj);
  566. var newCoord = Kekule.CoordUtils.add(coord, coordOffset);
  567. editor.setObjectScreenCoord(obj, newCoord);
  568. }
  569. }
  570. editor.pushOperation(marcoOper);
  571. editor.select(objs);
  572. }
  573. finally
  574. {
  575. editor.endUpdateObject();
  576. }
  577. }
  578. */
  579. }
  580. });
  581. /**
  582. * Set isToggleSelectionOn property to editor.
  583. * @class
  584. * @augments Kekule.Editor.ActionOnEditor
  585. *
  586. * @param {Kekule.Editor.BaseEditor} editor Target editor object.
  587. */
  588. Kekule.Editor.ActionToggleSelectState = Class.create(Kekule.Editor.ActionOnEditor,
  589. /** @lends Kekule.Editor.ActionToggleSelectState# */
  590. {
  591. /** @private */
  592. CLASS_NAME: 'Kekule.Editor.ActionToggleSelectState',
  593. /** @private */
  594. HTML_CLASSNAME: CCNS.ACTION_TOGGLE_SELECT,
  595. /** @constructs */
  596. initialize: function($super, editor)
  597. {
  598. $super(editor, Kekule.$L('ChemWidgetTexts.CAPTION_TOGGLE_SELECT'), Kekule.$L('ChemWidgetTexts.HINT_TOGGLE_SELECT'));
  599. this.setExplicitGroup(''); // force no check group
  600. },
  601. /** @ignore */
  602. getPreferredWidgetClass: function()
  603. {
  604. return Kekule.Widget.CheckButton;
  605. },
  606. /** @private */
  607. doUpdate: function($super)
  608. {
  609. $super();
  610. this.setChecked(this.getEditor().getIsToggleSelectOn());
  611. },
  612. /** @ignore */
  613. checkedChanged: function($super)
  614. {
  615. $super();
  616. },
  617. /** @ignore */
  618. doExecute: function($super, target, htmlEvent)
  619. {
  620. $super(target, htmlEvent);
  621. var oldChecked = this.getChecked();
  622. var editor = this.getEditor();
  623. editor.setIsToggleSelectOn(!oldChecked);
  624. this.setChecked(!oldChecked);
  625. }
  626. });
  627. /**
  628. * Base class for actions for chem composer.
  629. * @class
  630. * @augments Kekule.Action
  631. *
  632. * @param {Kekule.Editor.Composer} composer Target composer widget.
  633. * @param {String} caption
  634. * @param {String} hint
  635. */
  636. Kekule.Editor.ActionOnComposer = Class.create(Kekule.Action,
  637. /** @lends Kekule.Editor.ActionOnComposer# */
  638. {
  639. /** @private */
  640. CLASS_NAME: 'Kekule.Editor.ActionOnComposer',
  641. /** @constructs */
  642. initialize: function($super, composer, caption, hint)
  643. {
  644. $super();
  645. this.setText(caption);
  646. this.setHint(hint);
  647. this.setComposer(composer);
  648. },
  649. /** @private */
  650. initProperties: function()
  651. {
  652. this.defineProp('composer', {'dataType': 'Kekule.Editor.Composer', 'serializable': false});
  653. },
  654. /** @private */
  655. doUpdate: function()
  656. {
  657. var composer = this.getComposer();
  658. var editor = this.getEditor();
  659. this.setEnabled(composer && composer.getEnabled() && editor && editor.getChemObj() && editor.getChemObjLoaded() && editor.getEnabled());
  660. },
  661. /**
  662. * Returns chem editor object inside composer.
  663. * @returns {Kekule.Editor.BaseEditor}
  664. */
  665. getEditor: function()
  666. {
  667. var composer = this.getComposer();
  668. return composer? composer.getEditor(): null;
  669. }
  670. });
  671. /**
  672. * Actions that has a series of child attached actions on composer (such as bond action
  673. * may has single, double, triple bond variations).
  674. * @class
  675. * @augments Kekule.Editor.ActionOnComposer
  676. *
  677. * @property {Kekule.ActionList} attachedActions
  678. * @property {Kekule.Action} defaultAttachedAction If this property is set, when check on the parent action,
  679. * if no attached action is checked, default one will be checked on automatically.
  680. */
  681. Kekule.Editor.ActionOnComposerAdv = Class.create(Kekule.Editor.ActionOnComposer,
  682. /** @lends Kekule.Editor.ActionOnComposerAdv# */
  683. {
  684. /** @private */
  685. CLASS_NAME: 'Kekule.Editor.ActionOnComposerAdv',
  686. /** @constructs */
  687. initialize: function($super, composer, caption, hint)
  688. {
  689. var actions = new Kekule.ActionList();
  690. actions.setOwnActions(true);
  691. this.setPropStoreFieldValue('attachedActions', actions);
  692. $super(composer, caption, hint);
  693. },
  694. finalize: function($super)
  695. {
  696. this.getAttachedActions().finalize();
  697. $super();
  698. },
  699. /** @private */
  700. initProperties: function()
  701. {
  702. this.defineProp('attachedActionClasses', {'dataType': DataType.ARRAY, 'serializable': false, 'setter': null});
  703. this.defineProp('attachedActions', {'dataType': 'Kekule.ActionList', 'serializable': false, 'setter': null});
  704. this.defineProp('defaultAttachedAction', {'dataType': 'Kekule.Action', 'serializable': false});
  705. },
  706. /** @private */
  707. checkedChanged: function($super)
  708. {
  709. $super();
  710. var checked = this.getChecked();
  711. //console.log('self checked change', this.getClassName(), checked);
  712. if (this.hasAttachedActions())
  713. {
  714. var composer = this.getComposer();
  715. if (composer)
  716. {
  717. if (checked)
  718. {
  719. var attachedActions = this.getAttachedActions();
  720. composer.bindAssocActions(attachedActions);
  721. composer.showAssocToolbar();
  722. var checkedChild = attachedActions.getCheckedAction(this.getClassName());
  723. //console.log('child checked change', this.getClassName(), checkedChild.getClassName(), attachedActions.getActions());
  724. /*
  725. if (checkedChild)
  726. {
  727. console.log('execute child', checkedChild.getClassName());
  728. checkedChild.execute();
  729. }
  730. else
  731. {
  732. var defAction = this.getDefaultAttachedAction();
  733. if (defAction)
  734. {
  735. if (defAction.getCheckGroup() && !this.getAttachedActions().hasActionChecked(defAction.getCheckGroup()))
  736. defAction.execute();
  737. }
  738. }
  739. */
  740. if (!checkedChild)
  741. checkedChild = this.getDefaultAttachedAction();
  742. // check and execute child
  743. if (checkedChild)
  744. {
  745. checkedChild.setChecked(false); // important, force execute again
  746. checkedChild.execute();
  747. }
  748. }
  749. else
  750. {
  751. composer.hideAssocToolbar();
  752. }
  753. }
  754. }
  755. },
  756. /**
  757. * Check if there are attached actions to this one.
  758. * @returns {Bool}
  759. */
  760. hasAttachedActions: function()
  761. {
  762. return !!this.getAttachedActions().getActionCount();
  763. },
  764. /**
  765. * Set a new position of attached child action.
  766. * @param {Kekule.Action} action
  767. * @param {Int} index
  768. */
  769. setAttachedActionIndex: function(action, index)
  770. {
  771. var actions = this.getAttachedActions();
  772. if (actions)
  773. {
  774. actions.setActionIndex(action, index);
  775. }
  776. return this;
  777. },
  778. /**
  779. * Add an attached actions.
  780. */
  781. addAttachedAction: function(action, asDefault)
  782. {
  783. this.getAttachedActions().add(action);
  784. if (asDefault)
  785. this.setDefaultAttachedAction(action);
  786. return this;
  787. },
  788. /**
  789. * Remove attached actions.
  790. */
  791. removeAttachedAction: function(action)
  792. {
  793. if (this.getDefaultAttachedAction() === action)
  794. this.setDefaultAttachedAction(null);
  795. this.getAttachedActions().remove(action);
  796. return this;
  797. },
  798. /**
  799. * Clear all attached actions.
  800. */
  801. clearAttachedActions: function()
  802. {
  803. this.setDefaultAttachedAction(null);
  804. var actions = this.getAttachedActions();
  805. actions.clear();
  806. },
  807. /** @private */
  808. doExecute: function()
  809. {
  810. // when execute a adv action, a attached panel should be shown in composer to display all attached actions
  811. // TODO
  812. },
  813. /** @ignore */
  814. update: function($super)
  815. {
  816. $super();
  817. this.getAttachedActions().updateAll();
  818. }
  819. });
  820. /**
  821. * Action to show or hide adv panel (object inspector and tree view) of composer.
  822. * @class
  823. * @augments Kekule.Editor.ActionOnComposer
  824. *
  825. * @param {Kekule.Editor.Composer} composer Target composer widget.
  826. */
  827. Kekule.Editor.ActionComposerToggleInspector = Class.create(Kekule.Editor.ActionOnComposer,
  828. /** @lends Kekule.Editor.ActionComposerToggleInspector# */
  829. {
  830. /** @private */
  831. CLASS_NAME: 'Kekule.Editor.ActionComposerToggleInspector',
  832. /** @private */
  833. HTML_CLASSNAME: CCNS.ACTION_TOGGLE_INSPECTOR,
  834. /** @constructs */
  835. initialize: function($super, composer)
  836. {
  837. $super(composer, /*CWT.CAPTION_TOGGLE_INSPECTOR, CWT.HINT_TOGGLE_INSPECTOR*/Kekule.$L('ChemWidgetTexts.CAPTION_TOGGLE_INSPECTOR'), Kekule.$L('ChemWidgetTexts.HINT_TOGGLE_INSPECTOR'));
  838. //this.setCheckGroup(this.getClassName());
  839. },
  840. /** @private */
  841. doUpdate: function()
  842. {
  843. var composer = this.getComposer();
  844. if (composer)
  845. {
  846. this.setChecked(composer.getShowInspector());
  847. }
  848. },
  849. /** @private */
  850. doExecute: function()
  851. {
  852. var composer = this.getComposer();
  853. if (composer)
  854. {
  855. this.setChecked(!this.getChecked());
  856. composer.setShowInspector(this.getChecked());
  857. }
  858. }
  859. });
  860. /**
  861. * Action to change IA controller of editor/composer.
  862. * @class
  863. * @augments Kekule.Editor.ActionOnComposerAdv
  864. *
  865. * @param {Kekule.Editor.Composer} composer Target composer widget.
  866. * @param {String} caption
  867. * @param {String} hint
  868. * @param {String} controllerId
  869. */
  870. Kekule.Editor.ActionComposerSetIaController = Class.create(Kekule.Editor.ActionOnComposerAdv,
  871. /** @lends Kekule.Editor.ActionComposerSetIaController# */
  872. {
  873. /** @private */
  874. CLASS_NAME: 'Kekule.Editor.ActionComposerSetIaController',
  875. /** @constructs */
  876. initialize: function($super, composer, caption, hint, controllerId)
  877. {
  878. $super(composer, caption, hint);
  879. this.setPropStoreFieldValue('iaControllerId', controllerId);
  880. },
  881. /** @private */
  882. initProperties: function()
  883. {
  884. //this.defineProp('editorConfigs', {'dataType': 'Kekule.Editor.BaseEditorConfigs', 'serializable': false});
  885. //this.defineProp('iaController', {'dataType': 'Kekule.Editor.BaseEditorIaController', 'serializable': false, 'setter': null});
  886. this.defineProp('iaControllerId', {'dataType': DataType.STRING, 'serializable': false, 'setter': null});
  887. },
  888. /** @private */
  889. doExecute: function()
  890. {
  891. //console.log('set active id', this.getIaControllerId());
  892. this.getEditor().setActiveIaControllerId(this.getIaControllerId());
  893. }
  894. });
  895. /** @ignore */
  896. Kekule.Editor.createComposerIaControllerActionClass = function(className,
  897. caption, hint, iaControllerId, htmlClassName,
  898. specifiedProps, attachedActionClasses, methods,
  899. actionRegName, actionTargetClass)
  900. {
  901. if (!htmlClassName)
  902. htmlClassName = iaControllerId;
  903. if (!htmlClassName.startsWith(Kekule.ChemWidget.HtmlClassNames.PREFIX))
  904. htmlClassName = Kekule.ChemWidget.HtmlClassNames.PREFIX + htmlClassName;
  905. var data = {
  906. CLASS_NAME: className,
  907. HTML_CLASSNAME: htmlClassName,
  908. initialize: function($super, composer)
  909. {
  910. $super(composer, caption, hint, iaControllerId);
  911. if (this.initAttachedActions)
  912. this.initAttachedActions();
  913. }
  914. };
  915. if (methods)
  916. {
  917. data = Object.extend(data, methods);
  918. }
  919. if (specifiedProps)
  920. {
  921. var oldDoExecute;
  922. if (data.doExecute) // has set a doExecute in methods
  923. oldDoExecute = data.doExecute;
  924. data.doExecute = function($super)
  925. {
  926. var editor = this.getEditor();
  927. var controller = editor.getIaController(iaControllerId);
  928. if (controller)
  929. {
  930. controller.setPropValues(specifiedProps);
  931. }
  932. //console.log('execute self', this.getClassName());
  933. if (oldDoExecute)
  934. oldDoExecute.apply(this, [$super]);
  935. else
  936. $super();
  937. }
  938. }
  939. if (attachedActionClasses)
  940. {
  941. data.initAttachedActions = function()
  942. {
  943. /*
  944. var composer = this.getComposer();
  945. var checkGroup = this.getClassName();
  946. for (var i = 0, l = attachedActionClasses.length; i < l; ++i)
  947. {
  948. var action = new attachedActionClasses[i](composer);
  949. action.setCheckGroup(checkGroup);
  950. this.addAttachedAction(action, i === 0); // the first one is the default action
  951. }
  952. */
  953. this.setPropStoreFieldValue('attachedActionClasses', attachedActionClasses);
  954. };
  955. }
  956. var result = Class.create(Kekule.Editor.ActionComposerSetIaController, data);
  957. if (actionRegName)
  958. {
  959. _editorActionRegInfo.push({'name': actionRegName, 'actionClass': result, 'widgetClass': actionTargetClass});
  960. }
  961. return result;
  962. };
  963. ////////////// create ia controller actions ///////////////////////////
  964. // Client drag and scroll
  965. Kekule.Editor.ActionComposerClientDragScrollController = Kekule.Editor.createComposerIaControllerActionClass(
  966. 'Kekule.Editor.ActionComposerClientDragScrollController',
  967. Kekule.$L('ChemWidgetTexts.CAPTION_CLIENT_DRAGSCROLL'), //Kekule.ChemWidgetTexts.CAPTION_ERASE,
  968. Kekule.$L('ChemWidgetTexts.HINT_CLIENT_DRAGSCROLL'), //Kekule.ChemWidgetTexts.HINT_ERASE,
  969. 'ClientDragScrollIaController',
  970. null,
  971. null,
  972. null,
  973. null,
  974. BNS.dragScroll
  975. );
  976. // Select and variantions
  977. Kekule.Editor.ActionComposerSetManipulateControllerMarquee = Kekule.Editor.createComposerIaControllerActionClass(
  978. 'Kekule.Editor.ActionComposerSetManipulateControllerMarquee',
  979. Kekule.$L('ChemWidgetTexts.CAPTION_MANIPULATE_MARQUEE'),
  980. Kekule.$L('ChemWidgetTexts.HINT_MANIPULATE_MARQUEE'),
  981. 'SelectIaController',
  982. 'SelectIaController-Marquee',
  983. {
  984. 'enableGestureManipulation': true,
  985. 'selectMode': Kekule.Editor.SelectMode.RECT
  986. },
  987. null,
  988. {
  989. doExecute: function($super)
  990. {
  991. $super();
  992. var editor = this.getEditor();
  993. editor.setSelectMode(Kekule.Editor.SelectMode.RECT);
  994. }
  995. },
  996. BNS.manipulateMarquee
  997. );
  998. Kekule.Editor.ActionComposerSetManipulateControllerLasso = Kekule.Editor.createComposerIaControllerActionClass(
  999. 'Kekule.Editor.ActionComposerSetManipulateControllerLasso',
  1000. Kekule.$L('ChemWidgetTexts.CAPTION_MANIPULATE_LASSO'),
  1001. Kekule.$L('ChemWidgetTexts.HINT_MANIPULATE_LASSO'),
  1002. 'SelectIaController',
  1003. 'SelectIaController-Lasso',
  1004. {
  1005. 'enableGestureManipulation': true,
  1006. 'selectMode': Kekule.Editor.SelectMode.POLYGON
  1007. },
  1008. null,
  1009. {
  1010. doExecute: function($super)
  1011. {
  1012. $super();
  1013. var editor = this.getEditor();
  1014. editor.setSelectMode(Kekule.Editor.SelectMode.POLYGON);
  1015. }
  1016. },
  1017. BNS.manipulateLasso
  1018. );
  1019. Kekule.Editor.ActionComposerSetManipulateControllerBrush = Kekule.Editor.createComposerIaControllerActionClass(
  1020. 'Kekule.Editor.ActionComposerSetManipulateControllerBrush',
  1021. Kekule.$L('ChemWidgetTexts.CAPTION_MANIPULATE_BRUSH'),
  1022. Kekule.$L('ChemWidgetTexts.HINT_MANIPULATE_BRUSH'),
  1023. 'SelectIaController',
  1024. 'SelectIaController-Brush',
  1025. {
  1026. 'enableGestureManipulation': true,
  1027. 'selectMode': Kekule.Editor.SelectMode.POLYLINE
  1028. },
  1029. null,
  1030. {
  1031. doExecute: function($super)
  1032. {
  1033. $super();
  1034. var editor = this.getEditor();
  1035. editor.setSelectMode(Kekule.Editor.SelectMode.POLYLINE);
  1036. }
  1037. },
  1038. BNS.manipulateBrush
  1039. );
  1040. Kekule.Editor.ActionComposerSetManipulateControllerAncestor = Kekule.Editor.createComposerIaControllerActionClass(
  1041. 'Kekule.Editor.ActionComposerSetManipulateControllerAncestor',
  1042. Kekule.$L('ChemWidgetTexts.CAPTION_MANIPULATE_ANCESTOR'),
  1043. Kekule.$L('ChemWidgetTexts.HINT_MANIPULATE_ANCESTOR'),
  1044. 'SelectIaController',
  1045. 'SelectIaController-Ancestor',
  1046. {
  1047. 'enableGestureManipulation': true,
  1048. 'selectMode': Kekule.Editor.SelectMode.ANCESTOR
  1049. },
  1050. null,
  1051. {
  1052. doExecute: function($super)
  1053. {
  1054. $super();
  1055. var editor = this.getEditor();
  1056. editor.setSelectMode(Kekule.Editor.SelectMode.ANCESTOR);
  1057. }
  1058. },
  1059. BNS.manipulateAncestor
  1060. );
  1061. Kekule.Editor.ActionComposerSetManipulateController = Kekule.Editor.createComposerIaControllerActionClass(
  1062. 'Kekule.Editor.ActionComposerSetManipulateController',
  1063. Kekule.$L('ChemWidgetTexts.CAPTION_MANIPULATE'), //Kekule.ChemWidgetTexts.CAPTION_MANIPULATE,
  1064. Kekule.$L('ChemWidgetTexts.HINT_MANIPULATE'), //Kekule.ChemWidgetTexts.HINT_MANIPULATE,
  1065. 'SelectIaController',
  1066. null,
  1067. null,
  1068. [
  1069. Kekule.Editor.ActionComposerSetManipulateControllerMarquee,
  1070. Kekule.Editor.ActionComposerSetManipulateControllerLasso,
  1071. Kekule.Editor.ActionComposerSetManipulateControllerBrush,
  1072. Kekule.Editor.ActionComposerSetManipulateControllerAncestor,
  1073. Kekule.Editor.ActionComposerClientDragScrollController,
  1074. Kekule.Editor.ActionToggleSelectState
  1075. ],
  1076. null,
  1077. BNS.manipulate
  1078. );
  1079. // Erase
  1080. Kekule.Editor.ActionComposerSetEraserController = Kekule.Editor.createComposerIaControllerActionClass(
  1081. 'Kekule.Editor.ActionComposerSetEraserController',
  1082. Kekule.$L('ChemWidgetTexts.CAPTION_ERASE'), //Kekule.ChemWidgetTexts.CAPTION_ERASE,
  1083. Kekule.$L('ChemWidgetTexts.HINT_ERASE'), //Kekule.ChemWidgetTexts.HINT_ERASE,
  1084. 'BasicMolEraserIaController',
  1085. null,
  1086. null,
  1087. null,
  1088. {
  1089. doExecute: function($super)
  1090. {
  1091. $super();
  1092. var editor = this.getEditor();
  1093. if (editor.hasSelection())
  1094. editor.getActiveIaController().removeSelection();
  1095. }
  1096. },
  1097. BNS.erase
  1098. );
  1099. // Track input
  1100. Kekule.Editor.ActionComposerSetTrackController = Kekule.Editor.createComposerIaControllerActionClass(
  1101. 'Kekule.Editor.ActionComposerSetTrackController',
  1102. Kekule.$L('ChemWidgetTexts.CAPTION_TRACK_INPUT'), //Kekule.ChemWidgetTexts.CAPTION_ERASE,
  1103. Kekule.$L('ChemWidgetTexts.HINT_TRACK_INPUT'), //Kekule.ChemWidgetTexts.HINT_ERASE,
  1104. 'TrackInputIaController',
  1105. null,
  1106. null,
  1107. null,
  1108. null,
  1109. BNS.trackInput
  1110. );
  1111. // Bond and its variations
  1112. Kekule.Editor.ActionComposerSetBondControllerSingle = Kekule.Editor.createComposerIaControllerActionClass(
  1113. 'Kekule.Editor.ActionComposerSetBondControllerSingle',
  1114. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_SINGLE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_SINGLE,
  1115. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_SINGLE'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_SINGLE,
  1116. 'MolBondIaController',
  1117. 'MolBondIaController-Single',
  1118. {
  1119. 'bondType': Kekule.BondType.COVALENT,
  1120. 'bondOrder': Kekule.BondOrder.SINGLE,
  1121. 'bondStereo': Kekule.BondStereo.NONE
  1122. },
  1123. null, null,
  1124. BNS.molBondSingle
  1125. );
  1126. Kekule.Editor.ActionComposerSetBondControllerDouble = Kekule.Editor.createComposerIaControllerActionClass(
  1127. 'Kekule.Editor.ActionComposerSetBondControllerDouble',
  1128. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE,
  1129. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_DOUBLE'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_DOUBLE,
  1130. 'MolBondIaController',
  1131. 'MolBondIaController-Double',
  1132. {
  1133. 'bondType': Kekule.BondType.COVALENT,
  1134. 'bondOrder': Kekule.BondOrder.DOUBLE,
  1135. 'bondStereo': Kekule.BondStereo.NONE
  1136. },
  1137. null, null,
  1138. BNS.molBondDouble
  1139. );
  1140. Kekule.Editor.ActionComposerSetBondControllerTriple = Kekule.Editor.createComposerIaControllerActionClass(
  1141. 'Kekule.Editor.ActionComposerSetBondControllerTriple',
  1142. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_TRIPLE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_TRIPLE,
  1143. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_TRIPLE'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_TRIPLE,
  1144. 'MolBondIaController',
  1145. 'MolBondIaController-Triple',
  1146. {
  1147. 'bondType': Kekule.BondType.COVALENT,
  1148. 'bondOrder': Kekule.BondOrder.TRIPLE,
  1149. 'bondStereo': Kekule.BondStereo.NONE
  1150. },
  1151. null, null,
  1152. BNS.molBondTriple
  1153. );
  1154. Kekule.Editor.ActionComposerSetBondControllerCloser = Kekule.Editor.createComposerIaControllerActionClass(
  1155. 'Kekule.Editor.ActionComposerSetBondControllerCloser',
  1156. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_CLOSER'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP,
  1157. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_CLOSER'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP,
  1158. 'MolBondIaController',
  1159. 'MolBondIaController-Closer',
  1160. {
  1161. 'bondType': Kekule.BondType.COVALENT,
  1162. 'bondOrder': Kekule.BondOrder.SINGLE,
  1163. 'bondStereo': Kekule.BondStereo.CLOSER
  1164. },
  1165. null, null,
  1166. BNS.molBondCloser
  1167. );
  1168. Kekule.Editor.ActionComposerSetBondControllerWedgeUp = Kekule.Editor.createComposerIaControllerActionClass(
  1169. 'Kekule.Editor.ActionComposerSetBondControllerWedgeUp',
  1170. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEUP,
  1171. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_WEDGEUP,
  1172. 'MolBondIaController',
  1173. 'MolBondIaController-WedgeUp',
  1174. {
  1175. 'bondType': Kekule.BondType.COVALENT,
  1176. 'bondOrder': Kekule.BondOrder.SINGLE,
  1177. 'bondStereo': Kekule.BondStereo.UP
  1178. },
  1179. null, null,
  1180. BNS.molBondWedgeUp
  1181. );
  1182. Kekule.Editor.ActionComposerSetBondControllerWedgeDown = Kekule.Editor.createComposerIaControllerActionClass(
  1183. 'Kekule.Editor.ActionComposerSetBondControllerWedgeDown',
  1184. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEDOWN'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_WEDGEDOWN,
  1185. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_WEDGEDOWN'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_WEDGEDOWN,
  1186. 'MolBondIaController',
  1187. 'MolBondIaController-WedgeDown',
  1188. {
  1189. 'bondType': Kekule.BondType.COVALENT,
  1190. 'bondOrder': Kekule.BondOrder.SINGLE,
  1191. 'bondStereo': Kekule.BondStereo.DOWN
  1192. },
  1193. null, null,
  1194. BNS.molBondWedgeDown
  1195. );
  1196. Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown = Kekule.Editor.createComposerIaControllerActionClass(
  1197. 'Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown',
  1198. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_WAVY'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_WAVY,
  1199. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_WAVY'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_WAVY,
  1200. 'MolBondIaController',
  1201. 'MolBondIaController-WedgeUpOrDown',
  1202. {
  1203. 'bondType': Kekule.BondType.COVALENT,
  1204. 'bondOrder': Kekule.BondOrder.SINGLE,
  1205. 'bondStereo': Kekule.BondStereo.UP_OR_DOWN
  1206. },
  1207. null, null,
  1208. BNS.molBondWedgeUpOrDown
  1209. );
  1210. Kekule.Editor.ActionComposerSetBondControllerDoubleEither = Kekule.Editor.createComposerIaControllerActionClass(
  1211. 'Kekule.Editor.ActionComposerSetBondControllerDoubleEither',
  1212. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE_EITHER'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND_DOUBLE,
  1213. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND_DOUBLE_EITHER'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND_DOUBLE,
  1214. 'MolBondIaController',
  1215. 'MolBondIaController-Double-Either',
  1216. {
  1217. 'bondType': Kekule.BondType.COVALENT,
  1218. 'bondOrder': Kekule.BondOrder.DOUBLE,
  1219. 'bondStereo': Kekule.BondStereo.E_OR_Z
  1220. },
  1221. null, null,
  1222. BNS.molBondDoubleEither
  1223. );
  1224. Kekule.Editor.ActionComposerSetRepositoryFischer1Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1225. 'Kekule.Editor.ActionComposerSetRepositoryFischer1Controller',
  1226. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER1'),
  1227. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_FISCHER1'),
  1228. 'RepositoryStructureFragmentIaController',
  1229. 'RepositoryStructureFragmentIaController-Fischer1',
  1230. {
  1231. 'repItemName': 'fischer1'
  1232. },
  1233. null, null,
  1234. BNS.molRepFischer1
  1235. );
  1236. Kekule.Editor.ActionComposerSetRepositoryFischer2Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1237. 'Kekule.Editor.ActionComposerSetRepositoryFischer2Controller',
  1238. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER2'),
  1239. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_FISCHER2'),
  1240. 'RepositoryStructureFragmentIaController',
  1241. 'RepositoryStructureFragmentIaController-Fischer2',
  1242. {
  1243. 'repItemName': 'fischer2'
  1244. },
  1245. null, null,
  1246. BNS.molRepFischer2
  1247. );
  1248. Kekule.Editor.ActionComposerSetRepositoryFischer3Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1249. 'Kekule.Editor.ActionComposerSetRepositoryFischer3Controller',
  1250. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_FISCHER3'),
  1251. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_FISCHER3'),
  1252. 'RepositoryStructureFragmentIaController',
  1253. 'RepositoryStructureFragmentIaController-Fischer3',
  1254. {
  1255. 'repItemName': 'fischer3'
  1256. },
  1257. null, null,
  1258. BNS.molRepFischer3
  1259. );
  1260. Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController = Kekule.Editor.createComposerIaControllerActionClass(
  1261. 'Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController',
  1262. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_SAWHORSE_STAGGERED'),
  1263. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_SAWHORSE_STAGGERED'),
  1264. 'RepositoryStructureFragmentIaController',
  1265. 'RepositoryStructureFragmentIaController-SawhorseStaggered',
  1266. {
  1267. 'repItemName': 'sawhorseStaggered'
  1268. },
  1269. null, null,
  1270. BNS.molRepSawhorseStaggered
  1271. );
  1272. Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController = Kekule.Editor.createComposerIaControllerActionClass(
  1273. 'Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController',
  1274. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_SAWHORSE_ECLIPSED'),
  1275. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_SAWHORSE_ECLIPSED'),
  1276. 'RepositoryStructureFragmentIaController',
  1277. 'RepositoryStructureFragmentIaController-SawhorseEclipsed',
  1278. {
  1279. 'repItemName': 'sawhorseEclipsed'
  1280. },
  1281. null, null,
  1282. BNS.molRepSawhorseEclipsed
  1283. );
  1284. Kekule.Editor.ActionComposerSetRepositoryMethaneController = Kekule.Editor.createComposerIaControllerActionClass(
  1285. 'Kekule.Editor.ActionComposerSetRepositoryMethaneController',
  1286. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_METHANE'),
  1287. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_METHANE'),
  1288. 'RepositoryStructureFragmentIaController',
  1289. 'RepositoryStructureFragmentIaController-Methane',
  1290. {
  1291. 'repItemName': 'methane'
  1292. },
  1293. null, null,
  1294. BNS.molRepMethane
  1295. );
  1296. Kekule.Editor.ActionComposerSetRepositorySubBondMarkController = Kekule.Editor.createComposerIaControllerActionClass(
  1297. 'Kekule.Editor.ActionComposerSetRepositorySubBondMarkController',
  1298. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_SUBBOND_MARK'),
  1299. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_SUBBOND_MARK'),
  1300. 'RepositoryStructureFragmentIaController',
  1301. 'RepositoryStructureFragmentIaController-SubBondMark',
  1302. {
  1303. 'repItemName': 'substituentMark'
  1304. },
  1305. null, null,
  1306. BNS.molRepSubBondMark
  1307. );
  1308. Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController = Kekule.Editor.createComposerIaControllerActionClass(
  1309. 'Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController',
  1310. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_FLEXCHAIN'),
  1311. Kekule.$L('ChemWidgetTexts.HINT_MOL_FLEXCHAIN'),
  1312. 'MolFlexChainIaController',
  1313. 'MolFlexChainIaController',
  1314. null,
  1315. null, null,
  1316. BNS.molChain
  1317. );
  1318. Kekule.Editor.ActionComposerSetBondController = Kekule.Editor.createComposerIaControllerActionClass(
  1319. 'Kekule.Editor.ActionComposerSetBondController',
  1320. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_BOND'), //Kekule.ChemWidgetTexts.CAPTION_MOL_BOND,
  1321. Kekule.$L('ChemWidgetTexts.HINT_MOL_BOND'), //Kekule.ChemWidgetTexts.HINT_MOL_BOND,
  1322. 'MolBondIaController',
  1323. null,
  1324. null,
  1325. [
  1326. Kekule.Editor.ActionComposerSetBondControllerSingle,
  1327. Kekule.Editor.ActionComposerSetBondControllerDouble,
  1328. Kekule.Editor.ActionComposerSetBondControllerTriple,
  1329. //Kekule.Editor.ActionComposerSetBondControllerCloser,
  1330. Kekule.Editor.ActionComposerSetBondControllerWedgeUp,
  1331. Kekule.Editor.ActionComposerSetBondControllerWedgeDown,
  1332. //Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown,
  1333. //Kekule.Editor.ActionComposerSetBondControllerDoubleEither,
  1334. Kekule.Editor.ActionComposerSetRepositoryMolFlexChainController,
  1335. Kekule.Editor.ActionComposerSetTrackController,
  1336. //Kekule.Editor.ActionComposerSetRepositoryMethaneController,
  1337. //Kekule.Editor.ActionComposerSetRepositorySubBondMarkController,
  1338. Kekule.Editor.ActionComposerSetRepositoryFischer1Controller,
  1339. //Kekule.Editor.ActionComposerSetRepositoryFischer2Controller,
  1340. //Kekule.Editor.ActionComposerSetRepositoryFischer3Controller,
  1341. Kekule.Editor.ActionComposerSetRepositorySawhorseStaggeredController,
  1342. Kekule.Editor.ActionComposerSetRepositorySawhorseEclipsedController
  1343. ]
  1344. /*
  1345. {
  1346. initAttachedActions: function()
  1347. {
  1348. var composer = this.getComposer();
  1349. var checkGroup = this.getClassName();
  1350. //console.log(this, this.addAttachedAction);
  1351. var classes = [
  1352. Kekule.Editor.ActionComposerSetBondControllerSingle,
  1353. Kekule.Editor.ActionComposerSetBondControllerDouble,
  1354. Kekule.Editor.ActionComposerSetBondControllerTriple,
  1355. Kekule.Editor.ActionComposerSetBondControllerWedgeUp,
  1356. Kekule.Editor.ActionComposerSetBondControllerWedgeDown,
  1357. Kekule.Editor.ActionComposerSetBondControllerWedgeUpOrDown
  1358. ];
  1359. for (var i = 0, l = classes.length; i < l; ++i)
  1360. {
  1361. var action = new classes[i](composer);
  1362. action.setCheckGroup(checkGroup);
  1363. this.addAttachedAction(action);
  1364. }
  1365. }
  1366. }
  1367. */
  1368. ,null,
  1369. BNS.molBond
  1370. );
  1371. // Atom
  1372. Kekule.Editor.ActionComposerSetAtomController = Kekule.Editor.createComposerIaControllerActionClass(
  1373. 'Kekule.Editor.ActionComposerSetAtomController',
  1374. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_ATOM'), //Kekule.ChemWidgetTexts.CAPTION_MOL_ATOM,
  1375. Kekule.$L('ChemWidgetTexts.HINT_MOL_ATOM'), //Kekule.ChemWidgetTexts.HINT_MOL_ATOM,
  1376. 'MolAtomIaController',
  1377. null,
  1378. null,
  1379. null, null,
  1380. BNS.molAtom
  1381. );
  1382. // formula
  1383. Kekule.Editor.ActionComposerSetFormulaController = Kekule.Editor.createComposerIaControllerActionClass(
  1384. 'Kekule.Editor.ActionComposerSetFormulaController',
  1385. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_FORMULA'), //Kekule.ChemWidgetTexts.CAPTION_MOL_FORMULA,
  1386. Kekule.$L('ChemWidgetTexts.HINT_MOL_FORMULA'), //Kekule.ChemWidgetTexts.HINT_MOL_FORMULA,
  1387. 'FormulaIaController',
  1388. null,
  1389. null,
  1390. null, null,
  1391. BNS.molFormula
  1392. );
  1393. Kekule.Editor.ActionComposerSetAtomAndFormulaController = Kekule.Editor.createComposerIaControllerActionClass(
  1394. 'Kekule.Editor.ActionComposerSetAtomAndFormulaController',
  1395. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_ATOM_AND_FORMULA'),
  1396. Kekule.$L('ChemWidgetTexts.HINT_MOL_ATOM_AND_FORMULA'),
  1397. 'MolAtomIaController',
  1398. null,
  1399. null,
  1400. [
  1401. Kekule.Editor.ActionComposerSetAtomController,
  1402. Kekule.Editor.ActionComposerSetFormulaController
  1403. ]
  1404. ,null,
  1405. BNS.molAtomAndFormula
  1406. );
  1407. // Attached markers
  1408. Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair = Kekule.Editor.createComposerIaControllerActionClass(
  1409. 'Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair',
  1410. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_ELECTRON_LONEPAIR'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_DOUBLET,
  1411. Kekule.$L('ChemWidgetTexts.HINT_MOL_ELECTRON_LONEPAIR'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_DOUBLET,
  1412. 'AttachedMarkerIaController',
  1413. 'AttachedMarkerIaController-LonePair',
  1414. {
  1415. 'markerClassName': 'Kekule.ChemMarker.UnbondedElectronSet',
  1416. 'targetClassName': 'Kekule.AbstractAtom',
  1417. 'initialPropValues': {'electronCount': 2}
  1418. },
  1419. null, null,
  1420. BNS.molElectronLonePair
  1421. );
  1422. // Charge and its variations
  1423. Kekule.Editor.ActionComposerSetNodeChargeControllerClear = Kekule.Editor.createComposerIaControllerActionClass(
  1424. 'Kekule.Editor.ActionComposerSetNodeChargeControllerClear',
  1425. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_CLEAR'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_CLEAR,
  1426. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_CLEAR'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_CLEAR,
  1427. 'MolNodeChargeIaController',
  1428. 'MolNodeChargeIaController-Clear',
  1429. {
  1430. 'charge': 0,
  1431. 'chargeInc': 0,
  1432. 'radical': Kekule.RadicalOrder.NONE
  1433. },
  1434. null, null,
  1435. BNS.molChargeClear
  1436. );
  1437. Kekule.Editor.ActionComposerSetNodeChargeControllerPositive = Kekule.Editor.createComposerIaControllerActionClass(
  1438. 'Kekule.Editor.ActionComposerSetNodeChargeControllerPositive',
  1439. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_POSITIVE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_POSITIVE,
  1440. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_POSITIVE'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_POSITIVE,
  1441. 'MolNodeChargeIaController',
  1442. 'MolNodeChargeIaController-Positive',
  1443. {
  1444. 'charge': null,
  1445. 'chargeInc': 1,
  1446. 'radical': Kekule.RadicalOrder.NONE
  1447. },
  1448. null, null,
  1449. BNS.molChargePositive
  1450. );
  1451. Kekule.Editor.ActionComposerSetNodeChargeControllerNegative = Kekule.Editor.createComposerIaControllerActionClass(
  1452. 'Kekule.Editor.ActionComposerSetNodeChargeControllerNegative',
  1453. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_NEGATIVE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_NEGATIVE,
  1454. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_NEGATIVE'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_NEGATIVE,
  1455. 'MolNodeChargeIaController',
  1456. 'MolNodeChargeIaController-Negative',
  1457. {
  1458. 'charge': null,
  1459. 'chargeInc': -1,
  1460. 'radical': Kekule.RadicalOrder.NONE
  1461. },
  1462. null, null,
  1463. BNS.molChargeNegative
  1464. );
  1465. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet = Kekule.Editor.createComposerIaControllerActionClass(
  1466. 'Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet',
  1467. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_SINGLET'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_SINGLET,
  1468. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_SINGLET'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_SINGLET,
  1469. 'MolNodeChargeIaController',
  1470. 'MolNodeChargeIaController-Singlet',
  1471. {
  1472. 'charge': null,
  1473. 'chargeInc': 0,
  1474. 'radical': Kekule.RadicalOrder.SINGLET
  1475. },
  1476. null, null,
  1477. BNS.molRadicalSinglet
  1478. );
  1479. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet = Kekule.Editor.createComposerIaControllerActionClass(
  1480. 'Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet',
  1481. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_TRIPLET'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_TRIPLET,
  1482. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_TRIPLET'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_TRIPLET,
  1483. 'MolNodeChargeIaController',
  1484. 'MolNodeChargeIaController-Triplet',
  1485. {
  1486. 'charge': null,
  1487. 'chargeInc': 0,
  1488. 'radical': Kekule.RadicalOrder.TRIPLET
  1489. },
  1490. null, null,
  1491. BNS.molRadicalTriplet
  1492. );
  1493. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet = Kekule.Editor.createComposerIaControllerActionClass(
  1494. 'Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet',
  1495. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE_DOUBLET'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE_DOUBLET,
  1496. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE_DOUBLET'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE_DOUBLET,
  1497. 'MolNodeChargeIaController',
  1498. 'MolNodeChargeIaController-Doublet',
  1499. {
  1500. 'charge': null,
  1501. 'chargeInc': 0,
  1502. 'radical': Kekule.RadicalOrder.DOUBLET
  1503. },
  1504. null, null,
  1505. BNS.molRadicalDoublet
  1506. );
  1507. Kekule.Editor.ActionComposerSetNodeChargeController = Kekule.Editor.createComposerIaControllerActionClass(
  1508. 'Kekule.Editor.ActionComposerSetNodeChargeController',
  1509. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_CHARGE'), //Kekule.ChemWidgetTexts.CAPTION_MOL_CHARGE,
  1510. Kekule.$L('ChemWidgetTexts.HINT_MOL_CHARGE'), //Kekule.ChemWidgetTexts.HINT_MOL_CHARGE,
  1511. 'MolNodeChargeIaController',
  1512. null,
  1513. null,
  1514. [
  1515. Kekule.Editor.ActionComposerSetNodeChargeControllerClear,
  1516. Kekule.Editor.ActionComposerSetNodeChargeControllerPositive,
  1517. Kekule.Editor.ActionComposerSetNodeChargeControllerNegative,
  1518. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalSinglet,
  1519. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalTriplet,
  1520. Kekule.Editor.ActionComposerSetNodeChargeControllerRadicalDoublet,
  1521. Kekule.Editor.ActionComposerSetAttachedMarkerIaControllerLonePair
  1522. ],
  1523. null,
  1524. BNS.molCharge
  1525. );
  1526. //////////// Text and image /////////////
  1527. // Text block
  1528. Kekule.Editor.ActionComposerSetTextBlockController = Kekule.Editor.createComposerIaControllerActionClass(
  1529. 'Kekule.Editor.ActionComposerSetTextBlockController',
  1530. Kekule.$L('ChemWidgetTexts.CAPTION_TEXT_BLOCK'),
  1531. Kekule.$L('ChemWidgetTexts.HINT_TEXT_BLOCK'),
  1532. 'TextBlockIaController',
  1533. null,
  1534. null,
  1535. null, null,
  1536. BNS.textBlock
  1537. );
  1538. // Image block
  1539. Kekule.Editor.ActionComposerSetImageBlockController = Kekule.Editor.createComposerIaControllerActionClass(
  1540. 'Kekule.Editor.ActionComposerSetImageBlockController',
  1541. Kekule.$L('ChemWidgetTexts.CAPTION_IMAGE_BLOCK'),
  1542. Kekule.$L('ChemWidgetTexts.HINT_IMAGE_BLOCK'),
  1543. 'ImageBlockIaController',
  1544. null,
  1545. null,
  1546. null, null,
  1547. BNS.imageBlock
  1548. );
  1549. Kekule.Editor.ActionComposerSetTextImageController = Kekule.Editor.createComposerIaControllerActionClass(
  1550. 'Kekule.Editor.ActionComposerSetTextImageController',
  1551. Kekule.$L('ChemWidgetTexts.CAPTION_TEXT_IMAGE'),
  1552. Kekule.$L('ChemWidgetTexts.HINT_TEXT_IMAGE'),
  1553. 'TextImageIaController',
  1554. 'TextImageIaController',
  1555. null,
  1556. [
  1557. Kekule.Editor.ActionComposerSetTextBlockController,
  1558. Kekule.Editor.ActionComposerSetImageBlockController
  1559. ],
  1560. null,
  1561. BNS.textImage
  1562. );
  1563. //////////////////// repository and its variations //////////////////////////
  1564. // MolRing
  1565. Kekule.Editor.ActionComposerSetRepositoryRing3Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1566. 'Kekule.Editor.ActionComposerSetRepositoryRing3Controller',
  1567. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_3'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_3,
  1568. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_3'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_3,
  1569. 'MolRingIaController',
  1570. 'MolRingIaController-3',
  1571. {
  1572. 'ringAtomCount': 3,
  1573. 'isAromatic': false
  1574. },
  1575. null, null,
  1576. BNS.molRing3
  1577. );
  1578. Kekule.Editor.ActionComposerSetRepositoryRing4Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1579. 'Kekule.Editor.ActionComposerSetRepositoryRing4Controller',
  1580. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_4'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_4,
  1581. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_4'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_4,
  1582. 'MolRingIaController',
  1583. 'MolRingIaController-4',
  1584. {
  1585. 'ringAtomCount': 4,
  1586. 'isAromatic': false
  1587. },
  1588. null, null,
  1589. BNS.molRing4
  1590. );
  1591. Kekule.Editor.ActionComposerSetRepositoryRing5Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1592. 'Kekule.Editor.ActionComposerSetRepositoryRing5Controller',
  1593. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_5'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_5,
  1594. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_5'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_5,
  1595. 'MolRingIaController',
  1596. 'MolRingIaController-5',
  1597. {
  1598. 'ringAtomCount': 5,
  1599. 'isAromatic': false
  1600. },
  1601. null, null,
  1602. BNS.molRing5
  1603. );
  1604. Kekule.Editor.ActionComposerSetRepositoryRing6Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1605. 'Kekule.Editor.ActionComposerSetRepositoryRing6Controller',
  1606. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_6'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_6,
  1607. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_6'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_6,
  1608. 'MolRingIaController',
  1609. 'MolRingIaController-6',
  1610. {
  1611. 'ringAtomCount': 6,
  1612. 'isAromatic': false
  1613. },
  1614. null, null,
  1615. BNS.molRing6
  1616. );
  1617. Kekule.Editor.ActionComposerSetRepositoryRing7Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1618. 'Kekule.Editor.ActionComposerSetRepositoryRing7Controller',
  1619. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_7'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_7,
  1620. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_7'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_7,
  1621. 'MolRingIaController',
  1622. 'MolRingIaController-7',
  1623. {
  1624. 'ringAtomCount': 7,
  1625. 'isAromatic': false
  1626. },
  1627. null, null,
  1628. BNS.molRing7
  1629. );
  1630. Kekule.Editor.ActionComposerSetRepositoryRing8Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1631. 'Kekule.Editor.ActionComposerSetRepositoryRing8Controller',
  1632. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_8'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_8,
  1633. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_8'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_8,
  1634. 'MolRingIaController',
  1635. 'MolRingIaController-8',
  1636. {
  1637. 'ringAtomCount': 8,
  1638. 'isAromatic': false
  1639. },
  1640. null, null,
  1641. BNS.molRing8
  1642. );
  1643. Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1644. 'Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller',
  1645. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_6'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_6,
  1646. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_AR_6'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_AR_6,
  1647. 'MolRingIaController',
  1648. 'MolRingIaController-Ar-6',
  1649. {
  1650. 'ringAtomCount': 6,
  1651. 'isAromatic': true
  1652. },
  1653. null, null,
  1654. BNS.molRingAr6
  1655. );
  1656. Kekule.Editor.ActionComposerSetRepositoryRingAr5Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1657. 'Kekule.Editor.ActionComposerSetRepositoryRingAr5Controller',
  1658. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_5'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_5,
  1659. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING_AR_5'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING_AR_5,
  1660. 'MolRingIaController',
  1661. 'MolRingIaController-Ar-5',
  1662. {
  1663. 'ringAtomCount': 5,
  1664. 'isAromatic': true
  1665. },
  1666. null, null,
  1667. BNS.molRingAr5
  1668. );
  1669. Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController = Kekule.Editor.createComposerIaControllerActionClass(
  1670. 'Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController',
  1671. Kekule.$L('ChemWidgetTexts.CAPTION_MOL_FLEXRING'),
  1672. Kekule.$L('ChemWidgetTexts.HINT_MOL_FLEXRING'),
  1673. 'MolFlexRingIaController',
  1674. 'MolFlexRingIaController',
  1675. null,
  1676. null, null,
  1677. BNS.molFlexRing
  1678. );
  1679. Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1680. 'Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller',
  1681. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOPENTANE_HARWORTH1'),
  1682. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOPENTANE_HARWORTH1'),
  1683. 'RepositoryStructureFragmentIaController',
  1684. 'RepositoryStructureFragmentIaController-CyclopentaneHaworth1',
  1685. {
  1686. 'repItemName': 'cyclopentaneHaworth1'
  1687. },
  1688. null, null,
  1689. BNS.molRepCyclopentaneHaworth1
  1690. );
  1691. Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth2Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1692. 'Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth2Controller',
  1693. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOPENTANE_HARWORTH2'),
  1694. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOPENTANE_HARWORTH2'),
  1695. 'RepositoryStructureFragmentIaController',
  1696. 'RepositoryStructureFragmentIaController-CyclopentaneHaworth2',
  1697. {
  1698. 'repItemName': 'cyclopentaneHaworth2'
  1699. },
  1700. null, null,
  1701. BNS.molRepCyclopentaneHaworth2
  1702. );
  1703. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1704. 'Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller',
  1705. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_HARWORTH1'),
  1706. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_HARWORTH1'),
  1707. 'RepositoryStructureFragmentIaController',
  1708. 'RepositoryStructureFragmentIaController-CyclohexaneHaworth1',
  1709. {
  1710. 'repItemName': 'cyclohexaneHaworth1'
  1711. },
  1712. null, null,
  1713. BNS.molRepCyclohexaneHaworth1
  1714. );
  1715. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth2Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1716. 'Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth2Controller',
  1717. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_HARWORTH2'),
  1718. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_HARWORTH2'),
  1719. 'RepositoryStructureFragmentIaController',
  1720. 'RepositoryStructureFragmentIaController-CyclohexaneHaworth2',
  1721. {
  1722. 'repItemName': 'cyclohexaneHaworth2'
  1723. },
  1724. null, null,
  1725. BNS.molRepCyclohexaneHaworth2
  1726. );
  1727. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1728. 'Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller',
  1729. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_CHAIR1'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_5,
  1730. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_CHAIR1'),
  1731. 'RepositoryStructureFragmentIaController',
  1732. 'RepositoryStructureFragmentIaController-CyclohexaneChair1',
  1733. {
  1734. 'repItemName': 'cyclohexaneChair1'
  1735. },
  1736. null, null,
  1737. BNS.molRepCyclohexaneChair1
  1738. );
  1739. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller = Kekule.Editor.createComposerIaControllerActionClass(
  1740. 'Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller',
  1741. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_CYCLOHEXANE_CHAIR2'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING_AR_5,
  1742. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_CYCLOHEXANE_CHAIR2'),
  1743. 'RepositoryStructureFragmentIaController',
  1744. 'RepositoryStructureFragmentIaController-CyclohexaneChair2',
  1745. {
  1746. 'repItemName': 'cyclohexaneChair2'
  1747. },
  1748. null, null,
  1749. BNS.molRepCyclohexaneChair2
  1750. );
  1751. Kekule.Editor.ActionComposerSetRepositoryRingController = Kekule.Editor.createComposerIaControllerActionClass(
  1752. 'Kekule.Editor.ActionComposerSetRepositoryRingController',
  1753. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_RING'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_RING,
  1754. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_RING'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_RING,
  1755. 'MolRingIaController',
  1756. null,
  1757. null,
  1758. [
  1759. Kekule.Editor.ActionComposerSetRepositoryRing3Controller,
  1760. Kekule.Editor.ActionComposerSetRepositoryRing4Controller,
  1761. Kekule.Editor.ActionComposerSetRepositoryRing5Controller,
  1762. Kekule.Editor.ActionComposerSetRepositoryRing6Controller,
  1763. //Kekule.Editor.ActionComposerSetRepositoryRing7Controller,
  1764. //Kekule.Editor.ActionComposerSetRepositoryRing8Controller,
  1765. Kekule.Editor.ActionComposerSetRepositoryMolFlexRingController,
  1766. Kekule.Editor.ActionComposerSetRepositoryRingAr6Controller,
  1767. //Kekule.Editor.ActionComposerSetRepositoryRingAr5Controller,
  1768. Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth1Controller,
  1769. //Kekule.Editor.ActionComposerSetRepositoryCyclopentaneHaworth2Controller,
  1770. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth1Controller,
  1771. //Kekule.Editor.ActionComposerSetRepositoryCyclohexaneHaworth2Controller,
  1772. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair1Controller,
  1773. Kekule.Editor.ActionComposerSetRepositoryCyclohexaneChair2Controller
  1774. ],
  1775. null,
  1776. BNS.molRing
  1777. );
  1778. // PathGlyph
  1779. Kekule.Editor.ActionComposerSetRepositoryPathLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1780. 'Kekule.Editor.ActionComposerSetRepositoryPathGlyphLineController',
  1781. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_LINE,
  1782. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_LINE,
  1783. 'ArrowLineIaController',
  1784. 'ArrowLineIaController-Line',
  1785. {
  1786. 'glyphClass': Kekule.Glyph.StraightLine,
  1787. 'glyphInitialParams': null,
  1788. 'lineLength': 1.5
  1789. },
  1790. null, null,
  1791. BNS.glyphRepLine
  1792. );
  1793. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1794. 'Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowLineController',
  1795. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_LINE,
  1796. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_LINE,
  1797. 'ArrowLineIaController',
  1798. 'ArrowLineIaController-OpenArrowLine',
  1799. {
  1800. 'glyphClass': Kekule.Glyph.StraightLine,
  1801. 'glyphInitialParams': {
  1802. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1803. 'endArrowWidth': 0.25,
  1804. 'endArrowLength': 0.25,
  1805. 'lineLength': 1.5
  1806. }
  1807. },
  1808. null, null,
  1809. BNS.glyphRepOpenArrowLine
  1810. );
  1811. Kekule.Editor.ActionComposerSetRepositoryPathTriangleArrowLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1812. 'Kekule.Editor.ActionComposerSetRepositoryPathTriangleArrowLineController',
  1813. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE,
  1814. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_TRIANGLE_ARROW_LINE,
  1815. 'ArrowLineIaController',
  1816. 'ArrowLineIaController-TriangleArrowLine',
  1817. {
  1818. 'glyphClass': Kekule.Glyph.StraightLine,
  1819. 'glyphInitialParams': {
  1820. 'endArrowType': Kekule.Glyph.ArrowType.TRIANGLE,
  1821. 'endArrowWidth': 0.25,
  1822. 'endArrowLength': 0.25,
  1823. 'lineLength': 1.5
  1824. }
  1825. },
  1826. null, null,
  1827. BNS.glyphRepTriangleArrowLine
  1828. );
  1829. Kekule.Editor.ActionComposerSetRepositoryPathDiOpenArrowLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1830. 'Kekule.Editor.ActionComposerSetRepositoryPathDiOpenArrowLineController',
  1831. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE,
  1832. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_OPEN_ARROW_LINE,
  1833. 'ArrowLineIaController',
  1834. 'ArrowLineIaController-DiOpenArrowLine',
  1835. {
  1836. 'glyphClass': Kekule.Glyph.StraightLine,
  1837. 'glyphInitialParams': {
  1838. 'startArrowType': Kekule.Glyph.ArrowType.OPEN,
  1839. 'startArrowWidth': 0.25,
  1840. 'startArrowLength': 0.25,
  1841. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1842. 'endArrowWidth': 0.25,
  1843. 'endArrowLength': 0.25,
  1844. 'lineLength': 1.5
  1845. }
  1846. },
  1847. null, null,
  1848. BNS.glyphRepDiOpenArrowLine
  1849. );
  1850. Kekule.Editor.ActionComposerSetRepositoryPathDiTriangleArrowLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1851. 'Kekule.Editor.ActionComposerSetRepositoryPathDiTriangleArrowLineController',
  1852. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE,
  1853. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_DI_TRIANGLE_ARROW_LINE,
  1854. 'ArrowLineIaController',
  1855. 'ArrowLineIaController-DiTriangleArrowLine',
  1856. {
  1857. 'glyphClass': Kekule.Glyph.StraightLine,
  1858. 'glyphInitialParams': {
  1859. 'startArrowType': Kekule.Glyph.ArrowType.TRIANGLE,
  1860. 'startArrowWidth': 0.25,
  1861. 'startArrowLength': 0.25,
  1862. 'endArrowType': Kekule.Glyph.ArrowType.TRIANGLE,
  1863. 'endArrowWidth': 0.25,
  1864. 'endArrowLength': 0.25,
  1865. 'lineLength': 1.5
  1866. }
  1867. },
  1868. null, null,
  1869. BNS.glyphRepDiTriangleArrowLine
  1870. );
  1871. Kekule.Editor.ActionComposerSetRepositoryPathReversibleArrowLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1872. 'Kekule.Editor.ActionComposerSetRepositoryPathReversibleArrowLineController',
  1873. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_REV_ARROW_LINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_REV_ARROW_LINE,
  1874. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_REV_ARROW_LINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_REV_ARROW_LINE,
  1875. 'ArrowLineIaController',
  1876. 'ArrowLineIaController-ReversibleArrowLine',
  1877. {
  1878. 'glyphClass': Kekule.Glyph.StraightLine,
  1879. 'glyphInitialParams': {
  1880. 'startArrowType': Kekule.Glyph.ArrowType.OPEN,
  1881. 'startArrowSide': Kekule.Glyph.ArrowSide.REVERSED,
  1882. 'startArrowWidth': 0.25,
  1883. 'startArrowLength': 0.25,
  1884. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1885. 'endArrowSide': Kekule.Glyph.ArrowSide.SINGLE,
  1886. 'endArrowWidth': 0.25,
  1887. 'endArrowLength': 0.25,
  1888. 'lineLength': 1.5,
  1889. 'lineGap': 0.1,
  1890. 'lineCount': 2
  1891. }
  1892. },
  1893. null, null,
  1894. BNS.glyphRepReversibleArrowLine
  1895. );
  1896. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowDblLineController = Kekule.Editor.createComposerIaControllerActionClass(
  1897. 'Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowDblLineController',
  1898. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_DILINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1899. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_DILINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1900. 'ArrowLineIaController',
  1901. 'ArrowLineIaController-OpenArrowDiLine',
  1902. {
  1903. 'glyphClass': Kekule.Glyph.StraightLine,
  1904. 'glyphInitialParams': {
  1905. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1906. 'endArrowWidth': 0.25,
  1907. 'endArrowLength': 0.25,
  1908. 'lineLength': 1.5,
  1909. 'lineGap': 0.1,
  1910. 'lineCount': 2
  1911. }
  1912. },
  1913. null, null,
  1914. BNS.glyphRepOpenArrowDiLine
  1915. );
  1916. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowArcController = Kekule.Editor.createComposerIaControllerActionClass(
  1917. 'Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowArcController',
  1918. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_ARC'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1919. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_ARC'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1920. 'ArrowLineIaController',
  1921. 'ArrowLineIaController-OpenArrowArc',
  1922. {
  1923. 'glyphClass': Kekule.Glyph.Arc,
  1924. 'glyphInitialParams': {
  1925. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1926. 'endArrowWidth': 0.25,
  1927. 'endArrowLength': 0.25,
  1928. 'lineLength': 1,
  1929. 'lineGap': 0.1,
  1930. 'lineCount': 1
  1931. }
  1932. },
  1933. null, null,
  1934. BNS.glyphRepOpenArrowArc
  1935. );
  1936. Kekule.Editor.ActionComposerSetRepositoryPathSingleSideOpenArrowArcController = Kekule.Editor.createComposerIaControllerActionClass(
  1937. 'Kekule.Editor.ActionComposerSetRepositoryPathSingleSideOpenArrowArcController',
  1938. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_SINGLE_SIDE_OPEN_ARROW_ARC'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1939. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_GLYPH_SINGLE_SIDE_OPEN_ARROW_ARC'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_GLYPH_OPEN_ARROW_DILINE,
  1940. 'ArrowLineIaController',
  1941. 'ArrowLineIaController-SingleSideOpenArrowArc',
  1942. {
  1943. 'glyphClass': Kekule.Glyph.Arc,
  1944. 'glyphInitialParams': {
  1945. 'endArrowType': Kekule.Glyph.ArrowType.OPEN,
  1946. 'endArrowSide': Kekule.Glyph.ArrowSide.REVERSED,
  1947. 'endArrowWidth': 0.25,
  1948. 'endArrowLength': 0.25,
  1949. 'lineLength': 1,
  1950. 'lineGap': 0.1,
  1951. 'lineCount': 1
  1952. }
  1953. },
  1954. null, null,
  1955. BNS.glyphRepSingleSideOpenArrowArc
  1956. );
  1957. Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController = Kekule.Editor.createComposerIaControllerActionClass(
  1958. 'Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController',
  1959. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_HEAT_SYMBOL'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_HEAT_SYMBOL,
  1960. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_HEAT_SYMBOL'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_HEAT_SYMBOL,
  1961. 'ArrowLineIaController',
  1962. 'ArrowLineIaController-HeatSymbol',
  1963. {
  1964. 'glyphClass': Kekule.Glyph.HeatSymbol,
  1965. 'glyphInitialParams': {
  1966. 'lineLength': 1
  1967. }
  1968. },
  1969. null, null,
  1970. BNS.glyphRepHeatSymbol
  1971. );
  1972. Kekule.Editor.ActionComposerSetRepositoryAddSymbolController = Kekule.Editor.createComposerIaControllerActionClass(
  1973. 'Kekule.Editor.ActionComposerSetRepositoryAddSymbolController',
  1974. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_ADD_SYMBOL'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_ADD_SYMBOL,
  1975. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_ADD_SYMBOL'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_ADD_SYMBOL,
  1976. 'ArrowLineIaController',
  1977. 'ArrowLineIaController-AddSymbol',
  1978. {
  1979. 'glyphClass': Kekule.Glyph.AddSymbol,
  1980. 'glyphInitialParams': {
  1981. 'lineLength': 1
  1982. }
  1983. },
  1984. null, null,
  1985. BNS.glyphRepAddSymbol
  1986. );
  1987. Kekule.Editor.ActionComposerSetRepositoryGlyphController = Kekule.Editor.createComposerIaControllerActionClass(
  1988. 'Kekule.Editor.ActionComposerSetRepositoryGlyphController',
  1989. Kekule.$L('ChemWidgetTexts.CAPTION_REPOSITORY_ARROWLINE'), //Kekule.ChemWidgetTexts.CAPTION_REPOSITORY_ARROWLINE,
  1990. Kekule.$L('ChemWidgetTexts.HINT_REPOSITORY_ARROWLINE'), //Kekule.ChemWidgetTexts.HINT_REPOSITORY_ARROWLINE,
  1991. 'ArrowLineIaController',
  1992. null,
  1993. null,
  1994. [
  1995. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowLineController,
  1996. Kekule.Editor.ActionComposerSetRepositoryPathTriangleArrowLineController,
  1997. Kekule.Editor.ActionComposerSetRepositoryPathDiOpenArrowLineController,
  1998. Kekule.Editor.ActionComposerSetRepositoryPathDiTriangleArrowLineController,
  1999. Kekule.Editor.ActionComposerSetRepositoryPathReversibleArrowLineController,
  2000. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowDblLineController,
  2001. Kekule.Editor.ActionComposerSetRepositoryPathOpenArrowArcController,
  2002. Kekule.Editor.ActionComposerSetRepositoryPathSingleSideOpenArrowArcController,
  2003. Kekule.Editor.ActionComposerSetRepositoryPathLineController,
  2004. Kekule.Editor.ActionComposerSetRepositoryHeatSymbolController,
  2005. Kekule.Editor.ActionComposerSetRepositoryAddSymbolController
  2006. ],
  2007. null,
  2008. BNS.glyph
  2009. );
  2010. // register actions to editor/composer widget
  2011. Kekule._registerAfterLoadSysProc(function(){
  2012. var AM = Kekule.ActionManager;
  2013. var CW = Kekule.ChemWidget;
  2014. var CE = Kekule.Editor;
  2015. var widgetClass = Kekule.Editor.ChemSpaceEditor;
  2016. var reg = AM.registerNamedActionClass;
  2017. reg(BNS.newDoc, CE.ActionEditorNewDoc, widgetClass);
  2018. reg(BNS.loadFile, CW.ActionDisplayerLoadFile, widgetClass);
  2019. reg(BNS.loadData, CW.ActionDisplayerLoadData, widgetClass);
  2020. reg(BNS.saveData, CW.ActionDisplayerSaveFile, widgetClass);
  2021. reg(BNS.zoomIn, CW.ActionDisplayerZoomIn, widgetClass);
  2022. reg(BNS.zoomOut, CW.ActionDisplayerZoomOut, widgetClass);
  2023. reg(BNS.resetZoom, CW.ActionDisplayerResetZoom, widgetClass);
  2024. reg(BNS.reset, CW.ActionDisplayerReset, widgetClass);
  2025. reg(BNS.config, Kekule.Widget.ActionOpenConfigWidget, widgetClass);
  2026. reg(BNS.undo, CE.ActionEditorUndo, widgetClass);
  2027. reg(BNS.redo, CE.ActionEditorRedo, widgetClass);
  2028. reg(BNS.cloneSelection, CE.ActionCloneSelection, widgetClass);
  2029. reg(BNS.copy, CE.ActionCopySelection, widgetClass);
  2030. reg(BNS.cut, CE.ActionCutSelection, widgetClass);
  2031. reg(BNS.paste, CE.ActionPaste, widgetClass);
  2032. //reg(BNS.manipulate, CE.ActionComposerSetManipulateController, widgetClass);
  2033. //reg(BNS.erase, CE.ActionComposerSetEraserController, widgetClass);
  2034. //reg(BNS.molAtom, CE.ActionComposerSetAtomController, widgetClass);
  2035. //reg(BNS.molFormula, CE.ActionComposerSetFormulaController, widgetClass);
  2036. //reg(BNS.molBond, CE.ActionComposerSetBondController, widgetClass);
  2037. //reg(BNS.molCharge, CE.ActionComposerSetNodeChargeController, widgetClass);
  2038. //reg(BNS.textBlock, CE.ActionComposerSetTextBlockController, widgetClass);
  2039. //reg(BNS.imageBlock, CE.ActionComposerSetImageBlockController, widgetClass);
  2040. //reg(BNS.textImage, CE.ActionComposerSetTextImageController, widgetClass);
  2041. //reg(BNS.molRing, CE.ActionComposerSetRepositoryRingController, widgetClass);
  2042. //reg(BNS.glyph, CE.ActionComposerSetRepositoryGlyphController, widgetClass);
  2043. reg(BNS.objInspector, CE.ActionComposerToggleInspector, widgetClass);
  2044. // actions created by function createComposerIaControllerActionClass
  2045. for (var i = 0, l = _editorActionRegInfo.length; i < l; ++i)
  2046. {
  2047. var info = _editorActionRegInfo[i];
  2048. reg(info.name, info.actionClass, info.widgetClass || widgetClass);
  2049. }
  2050. });
  2051. })();