/** * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. */ include("scripts/sprintf.js"); function GridSettings() { } GridSettings.getPreferencesCategory = function(appPreferences) { if (appPreferences) { return [ qsTr("Defaults for New Drawings"), qsTr("Grid") ]; } return [ qsTr("General"), qsTr("Grid") ]; }; /** * Called when the user changed the drawing / global paper unit in another * preference page. */ GridSettings.updateUnit = function(unit) { var unitSymbol = ""; if (isString(unit)) { unit = parseInt(unit, 10); } unitSymbol = RUnit.unitToSymbol(unit); if (isNull(GridSettings.widgets)) { return; } for (var i=0; i<4; i++) { if (isNull(GridSettings.widgets["GridSpacingXUnit0%1".arg(i)])) { continue; } GridSettings.widgets["GridSpacingXUnit0%1".arg(i)].text = unitSymbol; GridSettings.widgets["GridSpacingYUnit0%1".arg(i)].text = unitSymbol; GridSettings.widgets["MetaGridSpacingXUnit0%1".arg(i)].text = unitSymbol; GridSettings.widgets["MetaGridSpacingYUnit0%1".arg(i)].text = unitSymbol; } // var i; // var cb = []; // cb.push(GridSettings.widgets["GridSpacingX"]); // cb.push(GridSettings.widgets["GridSpacingY"]); // cb.push(GridSettings.widgets["MetaGridSpacingX"]); // cb.push(GridSettings.widgets["MetaGridSpacingY"]); // for (i=0; i