DrawOrder.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved.
  3. *
  4. * This file is part of the QCAD project.
  5. *
  6. * QCAD is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * QCAD is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with QCAD.
  18. */
  19. include("scripts/Modify/Modify.js");
  20. /**
  21. * \defgroup ecma_draworder Draw order Tools
  22. * \ingroup ecma_modify
  23. *
  24. * \brief This module contains ECMAScript implementations of drawing order tools.
  25. */
  26. /**
  27. * \class DrawOrder
  28. * \brief Base class for all draw order tools.
  29. * \ingroup ecma_draworder
  30. */
  31. function DrawOrder(guiAction) {
  32. Modify.call(this, guiAction);
  33. }
  34. DrawOrder.prototype = new Modify();
  35. DrawOrder.includeBasePath = includeBasePath;
  36. DrawOrder.getMenu = function() {
  37. // var menu = EAction.getSubMenu(
  38. // Modify.getMenu(),
  39. // 13600, 100,
  40. // DrawOrder.getTitle(),
  41. // "ModifyDrawOrderMenu"
  42. // //DrawOrder.includeBasePath + "/DrawOrder.svg"
  43. // );
  44. // menu.setProperty("scriptFile", DrawOrder.includeBasePath + "/DrawOrder.js");
  45. // return menu;
  46. };
  47. /*
  48. DrawOrder.getToolBar = function() {
  49. var tb = EAction.getToolBar(DrawOrder.getTitle(), "DrawOrderToolBar");
  50. tb.visible = false;
  51. return tb;
  52. };
  53. */
  54. /*
  55. DrawOrder.getCadToolBarPanel = function() {
  56. var mtb = Draw.getCadToolBarPanel();
  57. var actionName = "DrawOrderToolsPanelAction";
  58. if (!isNull(mtb) && isNull(mtb.findChild(actionName))) {
  59. var action = new RGuiAction(qsTr("DrawOrder Tools"), mtb);
  60. action.setScriptFile(DrawOrder.includeBasePath + "/DrawOrder.js");
  61. action.objectName = actionName;
  62. action.setRequiresDocument(true);
  63. action.setIcon(DrawOrder.includeBasePath + "/DrawOrder.svg");
  64. //action.setStatusTip(qsTr("Show projection tools"));
  65. action.setDefaultShortcut(new QKeySequence("w,j"));
  66. action.setNoState();
  67. action.setDefaultCommands(["projectmenu"]);
  68. action.setGroupSortOrder(50);
  69. action.setSortOrder(100);
  70. action.setWidgetNames(["MainToolsPanel"]);
  71. }
  72. var tb = EAction.getCadToolBarPanel(DrawOrder.getTitle(), "DrawOrderToolsPanel", true);
  73. return tb;
  74. };
  75. */
  76. /*
  77. DrawOrder.getToolMatrixPanel = function() {
  78. return EAction.getToolMatrixPanel(DrawOrder.getTitle(), "DrawOrderMatrixPanel", 3500);
  79. };
  80. */
  81. DrawOrder.getTitle = function() {
  82. return qsTr("&Draw Order");
  83. };
  84. DrawOrder.prototype.getTitle = function() {
  85. return DrawOrder.getTitle();
  86. };
  87. DrawOrder.init = function() {
  88. DrawOrder.getMenu();
  89. // make sure there's an action:
  90. var appWin = EAction.getMainWindow();
  91. var action = new RGuiAction(qsTr("Draw Order"), appWin);
  92. action.setScriptFile(DrawOrder.includeBasePath + "/DrawOrder.js");
  93. action.setWidgetNames([]);
  94. //DrawOrder.getToolBar();
  95. //DrawOrder.getCadToolBarPanel();
  96. //DrawOrder.getToolMatrixPanel();
  97. };