MiscSelect.js 2.7 KB

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