MiscModify.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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/Misc/Misc.js");
  20. /**
  21. * \class MiscModify
  22. * \brief Base class for misc modify tools.
  23. */
  24. function MiscModify(guiAction) {
  25. EAction.call(this, guiAction);
  26. }
  27. MiscModify.prototype = new EAction();
  28. MiscModify.includeBasePath = includeBasePath;
  29. MiscModify.getMenu = function() {
  30. // var menu = EAction.getSubMenu(
  31. // Misc.getMenu(),
  32. // 51100, 350,
  33. // MiscModify.getTitle(),
  34. // "MiscModifyMenu"
  35. // );
  36. // return menu;
  37. };
  38. MiscModify.getToolBar = function() {
  39. var tb = EAction.getToolBar(qsTr("Misc") + " " + MiscModify.getTitle(), "MiscModifyToolBar", Qt.TopToolBarArea, Misc.getContextMenuCategory());
  40. tb.orientation = Qt.Vertical;
  41. tb.visible = false;
  42. return tb;
  43. };
  44. MiscModify.getCadToolBarPanel = function() {
  45. var mtb = Misc.getCadToolBarPanel();
  46. var actionName = "MiscModifyToolsPanelAction";
  47. if (!isNull(mtb) && mtb.findChild(actionName)==undefined) {
  48. var action = new RGuiAction(qsTr("Misc Modification Tools"), mtb);
  49. action.setScriptFile(MiscModify.includeBasePath + "/MiscModify.js");
  50. action.objectName = actionName;
  51. action.setRequiresDocument(true);
  52. //action.setIcon(MiscModify.includeBasePath + "/MiscModify.svg");
  53. //action.setStatusTip(qsTr("Show misc modification tools"));
  54. action.setNoState();
  55. action.setDefaultCommands(["miscmodifymenu"]);
  56. action.setGroupSortOrder(90);
  57. action.setSortOrder(350);
  58. action.setWidgetNames(["MiscToolsPanel"]);
  59. }
  60. var tb = EAction.getCadToolBarPanel(
  61. MiscModify.getTitle(),
  62. "MiscModifyToolsPanel",
  63. true
  64. );
  65. return tb;
  66. };
  67. MiscModify.getTitle = function() {
  68. return qsTr("&Modify");
  69. };
  70. MiscModify.prototype.getTitle = function() {
  71. return MiscModify.getTitle();
  72. };
  73. MiscModify.init = function() {
  74. MiscModify.getMenu();
  75. MiscModify.getToolBar();
  76. MiscModify.getCadToolBarPanel();
  77. };