CadToolBarPanel.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. // don't include ColumnLayout here, causes maximum call stack reached
  20. // include before CadToolBarPanel.js instead
  21. //include("ColumnLayout.js");
  22. //function CadToolBarPanel(parent, hasBackButton) {
  23. // RWidget.call(this, parent);
  24. // this.lay = new ColumnLayout(
  25. // this, parent.parentWidget(), RSettings.getIntValue("CadToolBar/IconSize", 32) * 1.25
  26. // );
  27. // //var layout = new QVBoxLayout();
  28. // this.setLayout(this.lay);
  29. // this.sizePolicy = new QSizePolicy(
  30. // QSizePolicy.MinimumExpanding,
  31. // QSizePolicy.MinimumExpanding
  32. // );
  33. // this.backMenuName = "MainToolsPanel";
  34. // if (hasBackButton) {
  35. // var backAction = new RGuiAction(qsTr("Back"), this);
  36. // backAction.objectName = "Back";
  37. // backAction.checkable = false;
  38. // backAction.setIcon(autoPath("scripts/Widgets/CadToolBar/Back.svg"));
  39. // this.addAction(backAction);
  40. // //backAction.triggered.connect(CadToolBar, "back");
  41. // backAction.triggered.connect(CadToolBar.back);
  42. // }
  43. //}
  44. //CadToolBarPanel.prototype = new RWidget();
  45. //CadToolBarPanel.setBackMenuName = function(panel, name) {
  46. // panel.setProperty("backMenuName", name);
  47. //};
  48. //CadToolBarPanel.prototype.toString = function() {
  49. // return "CadToolBarPanel";
  50. //};
  51. //CadToolBarPanel.getButtonName = function(action) {
  52. // var buttonName = action.objectName;
  53. // if (buttonName.endsWith("Action")) {
  54. // buttonName = buttonName.left(buttonName.length-"Action".length);
  55. // }
  56. // buttonName+="Button";
  57. // return buttonName;
  58. //};
  59. //CadToolBarPanel.prototype.removeAction = function(action) {
  60. // ColumnLayout.prototype.removeAction.call(this.layout(), action);
  61. // QWidget.prototype.removeAction.call(this, action);
  62. // var buttonName = CadToolBarPanel.getButtonName(action);
  63. // var w = this.findChild(buttonName);
  64. // if (!isNull(w)) {
  65. // w.visible = false;
  66. // }
  67. //};
  68. //CadToolBarPanel.prototype.insertAction = function(before, action) {
  69. // this.addAction(action);
  70. //// QWidget.prototype.insertAction.call(this, before, action);
  71. //};
  72. //CadToolBarPanel.prototype.addAction = function(action) {
  73. // if (action.isSeparator()) {
  74. // action.setProperty("SortOrder", action.getSortOrder());
  75. // action.setProperty("GroupSortOrder", action.getGroupSortOrder());
  76. // ColumnLayout.prototype.addItem.call(this.layout(), action);
  77. // return;
  78. // }
  79. // var buttonName = CadToolBarPanel.getButtonName(action);
  80. // // check if button already exists for this action:
  81. // var button = this.findChild(buttonName);
  82. // if (isNull(button)) {
  83. // button = new QToolButton(this);
  84. // }
  85. // button.visible = true;
  86. // button.setDefaultAction(action);
  87. // button.objectName = buttonName;
  88. // var s = RSettings.getIntValue("CadToolBar/IconSize", 32);
  89. // button.iconSize = new QSize(s, s);
  90. // if (isNumber(action.property("GroupSortOrder"))) {
  91. // button.setProperty("GroupSortOrder", ColumnLayout.getGroupSortOrder(action, this.objectName));
  92. // }
  93. // if (isNumber(action.property("SortOrder"))) {
  94. // button.setProperty("SortOrder", ColumnLayout.getSortOrder(action, this.objectName));
  95. // }
  96. // if (button.objectName==="BackButton") {
  97. // button.toolTip = qsTr("Back");
  98. // button.sizePolicy = new QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum);
  99. // }
  100. // ColumnLayout.prototype.addItem.call(this.layout(), button);
  101. // QWidget.prototype.addAction.call(this, action);
  102. //};