MiscDraw.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. /**
  20. * \defgroup ecma_misc_draw Misc drawing tools
  21. * \ingroup ecma_misc
  22. *
  23. * \brief This module contains misc drawing tools.
  24. */
  25. include("scripts/Misc/Misc.js");
  26. include("scripts/Draw/Line/Line.js");
  27. /**
  28. * \class MiscDraw
  29. * \ingroup ecma_misc_draw
  30. * \brief Base class for misc drawing tools.
  31. */
  32. function MiscDraw(guiAction) {
  33. Misc.call(this, guiAction);
  34. }
  35. MiscDraw.prototype = new Misc();
  36. MiscDraw.includeBasePath = includeBasePath;
  37. MiscDraw.getMenu = function() {
  38. // var menu = EAction.getSubMenu(
  39. // Misc.getMenu(),
  40. // 51100, 300,
  41. // MiscDraw.getTitle(),
  42. // "MiscDrawMenu"
  43. // );
  44. // return menu;
  45. };
  46. MiscDraw.getToolBar = function() {
  47. var tb = EAction.getToolBar(qsTr("Misc") + " " + MiscDraw.getTitle(), "MiscDrawToolBar", Qt.TopToolBarArea, Misc.getContextMenuCategory());
  48. tb.visible = false;
  49. return tb;
  50. };
  51. MiscDraw.getCadToolBarPanel = function() {
  52. var mtb = Misc.getCadToolBarPanel();
  53. var actionName = "MiscDrawToolsPanelAction";
  54. if (!isNull(mtb) && mtb.findChild(actionName)==undefined) {
  55. var action = new RGuiAction(qsTr("Misc Drawing Tools"), mtb);
  56. action.setScriptFile(MiscDraw.includeBasePath + "/MiscDraw.js");
  57. action.objectName = actionName;
  58. action.setRequiresDocument(true);
  59. //action.setIcon(MiscDraw.includeBasePath + "/MiscDraw.svg");
  60. //action.setStatusTip(qsTr("Show misc drawing tools"));
  61. action.setNoState();
  62. action.setDefaultCommands(["miscdrawmenu"]);
  63. action.setGroupSortOrder(90);
  64. action.setSortOrder(300);
  65. action.setWidgetNames(["MiscToolsPanel"]);
  66. }
  67. var tb = EAction.getCadToolBarPanel(
  68. MiscDraw.getTitle(),
  69. "MiscDrawToolsPanel",
  70. true
  71. );
  72. return tb;
  73. };
  74. MiscDraw.getToolMatrixPanel = function() {
  75. return EAction.getToolMatrixPanel(qsTr("Misc Draw"), "MiscDrawMatrixPanel", 2050);
  76. };
  77. MiscDraw.getTitle = function() {
  78. return qsTr("&Draw");
  79. };
  80. MiscDraw.prototype.getTitle = function() {
  81. return MiscDraw.getTitle();
  82. };
  83. MiscDraw.init = function() {
  84. MiscDraw.getMenu();
  85. MiscDraw.getToolBar();
  86. MiscDraw.getCadToolBarPanel();
  87. MiscDraw.getToolMatrixPanel();
  88. };