partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit f179c489d546de97281e4f97a14cf80dc4c0b0d5
parent 46ed9c9dfbaae5173f3a16e74ac12c7047e78759
Author: Felicitus <felicitus@felicitus.org>
Date:   Tue,  5 Jul 2011 06:07:17 +0200

Externalized icon configuration for editor grid panels, added separate icons for footprints

Diffstat:
Mfrontend/js/Components/Editor/EditorGrid.js | 7++++++-
Mfrontend/js/Components/Footprint/FootprintTree.js | 62++++++++++++++++++++++++++++++++++++++++----------------------
Afrontend/resources/icons/footprint_add.png | 0
Afrontend/resources/icons/footprint_delete.png | 0
4 files changed, 46 insertions(+), 23 deletions(-)

diff --git a/frontend/js/Components/Editor/EditorGrid.js b/frontend/js/Components/Editor/EditorGrid.js @@ -21,6 +21,11 @@ Ext.define('PartKeepr.EditorGrid', { addButtonText: i18n("Add Item"), /** + * @cfg {String} text The path to the 'add' icon + */ + addButtonIcon: 'resources/silkicons/add.png', + + /** * @cfg {String} text Defines if the "add"/"delete" buttons should show their text or icon only. If "hide", the * button text is hidden, anything else shows the text. */ @@ -89,7 +94,7 @@ Ext.define('PartKeepr.EditorGrid', { { text: (this.buttonTextMode !== "hide") ? this.addButtonText : '', tooltip: this.addButtonText, - icon: 'resources/silkicons/add.png', + icon: this.addButtonIcon, handler: Ext.bind(function () { this.fireEvent("itemAdd"); }, this) diff --git a/frontend/js/Components/Footprint/FootprintTree.js b/frontend/js/Components/Footprint/FootprintTree.js @@ -6,6 +6,20 @@ Ext.define("PartKeepr.FootprintTree", { categoryModel: 'PartKeepr.FootprintCategory', categoryService: 'FootprintCategory', folderSort: true, + + /** + * @cfg {String} text The path to the 'add' icon + */ + addButtonIcon: 'resources/icons/footprint_add.png', + + /** + * @cfg {String} text The path to the 'delete' icon + */ + deleteButtonIcon: 'resources/icons/footprint_delete.png', + + /** + * Initializes the component + */ initComponent: function () { this.callParent(); @@ -20,32 +34,14 @@ Ext.define("PartKeepr.FootprintTree", { this.addButton = Ext.create("Ext.button.Button", { tooltip: i18n("Add Footprint"), - icon: 'resources/silkicons/add.png', - handler: Ext.bind(function () { - var r = this.getSelectionModel().getLastSelected(); - - if (r && !r.get("footprintId")) { - this.fireEvent("itemAdd", { category: r.get("id") }); - } else { - if (!r) { - this.fireEvent("itemAdd", this.getRootNode().get("id")); - } else { - /* Try to find the category's parent id */ - if (r.parentNode && !r.parentNode.get("footprintId")) { - this.fireEvent("itemAdd", { category: r.parentNode.get("id") }); - } else { - this.fireEvent("itemAdd", this.getRootNode().get("id")); - } - } - - } - - }, this) + icon: this.addButtonIcon, + handler: this._onAddFootprint, + scope: this }); this.deleteButton = Ext.create("Ext.button.Button", { tooltip: i18n("Delete Footprint"), - icon: 'resources/silkicons/delete.png', + icon: this.deleteButtonIcon, handler: Ext.bind(function () { this.fireEvent("itemDelete"); }, this), @@ -58,6 +54,28 @@ Ext.define("PartKeepr.FootprintTree", { this.getSelectionModel().on("deselect", this._onItemDeselect, this); }, /** + * Called when a footprint is about to be added + */ + _onAddFootprint: function () { + var r = this.getSelectionModel().getLastSelected(); + + if (r && !r.get("footprintId")) { + this.fireEvent("itemAdd", { category: r.get("id") }); + } else { + if (!r) { + this.fireEvent("itemAdd", this.getRootNode().get("id")); + } else { + /* Try to find the category's parent id */ + if (r.parentNode && !r.parentNode.get("footprintId")) { + this.fireEvent("itemAdd", { category: r.parentNode.get("id") }); + } else { + this.fireEvent("itemAdd", this.getRootNode().get("id")); + } + } + + } + }, + /** * Called when an item was selected */ _onItemSelect: function (selectionModel, record) { diff --git a/frontend/resources/icons/footprint_add.png b/frontend/resources/icons/footprint_add.png Binary files differ. diff --git a/frontend/resources/icons/footprint_delete.png b/frontend/resources/icons/footprint_delete.png Binary files differ.