MiscBlock.js 2.7 KB

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