<commit_before>/**
 * MLJLib
 * MeshLabJS Library
 * 
 * Copyright(C) 2015
 * <NAME> 
 * Visual Computing Lab
 * ISTI - CNR
 * 
 * All rights reserved.
 *
 * This program 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 2 of the License, or (at your option) any later 
 * version.
 *
 * This program 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 theGNU General Public License 
 * (http://www.gnu.org/licenses/gpl.txt) for more details.
 * 
 */

/**
 * @file Defines and installs the SceneBar widget 
 * @author <NAME>
 */
(function (component) {
    /**         
     * @class Create a new SceneBar widget
     * @augments  MLJ.gui.Widget
     * @private
     * @memberOf MLJ.gui.widget
     * @author <NAME> 
     */
    var _SceneBar = function () {

        var _toolBar = new component.ToolBar();
        var _dialog = new component.Dialog({
            title:"Save mesh", modal:true, draggable: false, resizable:false
        });
        
        var _html =  "<div id='mlj-save-dialog'><label for='filename'>Name:</label><br/>";
            _html += "<input id='filename' type='text'/>";
            _html += "<label for='extension'>Extension:</label><br/>";
            _html += "<select id='extension'>";
        
        var ext;
        for(var key in MLJ.core.File.SupportedExtensions) {
            ext = MLJ.core.File.SupportedExtensions[key];
            _html +="<option name='"+ext+"'>"+ext+"</option>";
        }       
         
        _html += "</select>";
        _html += "<div id='button-wrapper'><button id='mlj-save-dialog-button'>Save</button></div></div>";
        _dialog.appendContent(_html);

        function init() {

            var open = new component.FileButton({
                tooltip: "Open mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0049-folder-open.png",
                multiple: true
            });
                        

            var save = new component.Button({
                tooltip: "Save mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0099-floppy-disk.png"
            });
            
            MLJ.gui.disabledOnSceneEmpty(save);
            
            var reload = new component.Button({
                tooltip: "Reload mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0133-spinner11.png"
            });
                                                          
            MLJ.gui.disabledOnSceneEmpty(reload);
            //The reload button must be disalbed if the layer is created by a
            //creation filter
            MLJ.gui.disabledOnCreationFilterMesh(reload);

            var snapshot = new component.Button({
                tooltip: "Take snapshot",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0016-camera.png"
            });
            
            MLJ.gui.disabledOnSceneEmpty(snapshot);

            var deleteLayer = new component.Button({
                tooltip: "Delete current layer",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0173-bin.png"
            });
            var doc = new component.Button({
                tooltip: "Go to the documentation page",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0266-question.png",
				right:true
            });
			var git = new component.Button({
                tooltip: "Go to the Github page",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0437-github4.png",
				right:true
            });
            MLJ.gui.disabledOnSceneEmpty(deleteLayer);
            
            _toolBar.add(open, save, reload, snapshot, deleteLayer);
			_toolBar.add(doc,git);

            // SCENE BAR EVENT HANDLERS
            open.onChange(function (input) {
                MLJ.core.File.openMeshFile(input.files);
            });
			doc.onClick(function () {
				 var win = window.open("./doc/html/", '_blank');
					win.focus();
			});
			git.onClick(function () {
				 var win = window.open("https://github.com/cnr-isti-vclab/meshlabjs", '_blank');
					win.focus();
			});
            save.onClick(function () {
                var layer = MLJ.core.Scene.getSelectedLayer();
                //Name = meshInfo[0], extension = meshInfo[meshInfo.length-1]
                var meshInfo = layer.name.split(".");                
                _dialog.show();
                $('#mlj-save-dialog > #filename').val(meshInfo[0]);
                
                $('#mlj-save-dialog > #extension option[name=".'+meshInfo[meshInfo.length-1]+'"]')
                        .attr('selected','selected');
               
                $('#mlj-save-dialog-button').click(function() {                    
                    var name = $('#mlj-save-dialog > #filename').val();
                    var extension = $('#mlj-save-dialog > #extension').val();
                    MLJ.core.File.saveMeshFile(layer, name+extension);
                    _dialog.destroy();
                    $(this).off();
                });
            });                        

            reload.onClick(function () {
                var mf = MLJ.core.Scene.getSelectedLayer();
                MLJ.core.File.reloadMeshFile(mf);
            });

            snapshot.onClick(function () {                
                MLJ.core.Scene.takeSnapshot();
            });

            deleteLayer.onClick(function() {
                MLJ.core.Scene.removeLayerByName(MLJ.core.Scene.getSelectedLayer().name)
            })
                                             
        }
        
        /**
         * @author <NAME>         
         */
        this._make = function () {
            _toolBar.$.attr("id", "mlj-scenebar-widget");
            return _toolBar.$;
        };

        init();

        MLJ.gui.Widget.call(this);
    };

    MLJ.extend(MLJ.gui.Widget, _SceneBar);

    //Install widget
    MLJ.gui.installWidget("SceneBar", new _SceneBar());

})(MLJ.gui.component);
<commit_msg>Replaced icons for the new buttons<commit_after>/**
 * MLJLib
 * MeshLabJS Library
 * 
 * Copyright(C) 2015
 * <NAME> 
 * Visual Computing Lab
 * ISTI - CNR
 * 
 * All rights reserved.
 *
 * This program 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 2 of the License, or (at your option) any later 
 * version.
 *
 * This program 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 theGNU General Public License 
 * (http://www.gnu.org/licenses/gpl.txt) for more details.
 * 
 */

/**
 * @file Defines and installs the SceneBar widget 
 * @author <NAME>
 */
(function (component) {
    /**         
     * @class Create a new SceneBar widget
     * @augments  MLJ.gui.Widget
     * @private
     * @memberOf MLJ.gui.widget
     * @author <NAME> 
     */
    var _SceneBar = function () {

        var _toolBar = new component.ToolBar();
        var _dialog = new component.Dialog({
            title:"Save mesh", modal:true, draggable: false, resizable:false
        });
        
        var _html =  "<div id='mlj-save-dialog'><label for='filename'>Name:</label><br/>";
            _html += "<input id='filename' type='text'/>";
            _html += "<label for='extension'>Extension:</label><br/>";
            _html += "<select id='extension'>";
        
        var ext;
        for(var key in MLJ.core.File.SupportedExtensions) {
            ext = MLJ.core.File.SupportedExtensions[key];
            _html +="<option name='"+ext+"'>"+ext+"</option>";
        }       
         
        _html += "</select>";
        _html += "<div id='button-wrapper'><button id='mlj-save-dialog-button'>Save</button></div></div>";
        _dialog.appendContent(_html);

        function init() {

            var open = new component.FileButton({
                tooltip: "Open mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0049-folder-open.png",
                multiple: true
            });
                        

            var save = new component.Button({
                tooltip: "Save mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0099-floppy-disk.png"
            });
            
            MLJ.gui.disabledOnSceneEmpty(save);
            
            var reload = new component.Button({
                tooltip: "Reload mesh file",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0133-spinner11.png"
            });
                                                          
            MLJ.gui.disabledOnSceneEmpty(reload);
            //The reload button must be disalbed if the layer is created by a
            //creation filter
            MLJ.gui.disabledOnCreationFilterMesh(reload);

            var snapshot = new component.Button({
                tooltip: "Take snapshot",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0016-camera.png"
            });
            
            MLJ.gui.disabledOnSceneEmpty(snapshot);

            var deleteLayer = new component.Button({
                tooltip: "Delete current layer",
                icon: "img/icons/IcoMoon-Free-master/PNG/48px/0173-bin.png"
            });
            var doc = new component.Button({
                tooltip: "Go to the documentation page",
                icon: "img/icons/question.png",
				right:true
            });
			var git = new component.Button({
                tooltip: "Go to the Github page",
                icon: "img/icons/github.png",
				right:true
            });
            MLJ.gui.disabledOnSceneEmpty(deleteLayer);
            
            _toolBar.add(open, save, reload, snapshot, deleteLayer);
			_toolBar.add(doc,git);

            // SCENE BAR EVENT HANDLERS
            open.onChange(function (input) {
                MLJ.core.File.openMeshFile(input.files);
            });
			doc.onClick(function () {
				 var win = window.open("./doc/html/", '_blank');
					win.focus();
			});
			git.onClick(function () {
				 var win = window.open("https://github.com/cnr-isti-vclab/meshlabjs", '_blank');
					win.focus();
			});
            save.onClick(function () {
                var layer = MLJ.core.Scene.getSelectedLayer();
                //Name = meshInfo[0], extension = meshInfo[meshInfo.length-1]
                var meshInfo = layer.name.split(".");                
                _dialog.show();
                $('#mlj-save-dialog > #filename').val(meshInfo[0]);
                
                $('#mlj-save-dialog > #extension option[name=".'+meshInfo[meshInfo.length-1]+'"]')
                        .attr('selected','selected');
               
                $('#mlj-save-dialog-button').click(function() {                    
                    var name = $('#mlj-save-dialog > #filename').val();
                    var extension = $('#mlj-save-dialog > #extension').val();
                    MLJ.core.File.saveMeshFile(layer, name+extension);
                    _dialog.destroy();
                    $(this).off();
                });
            });                        

            reload.onClick(function () {
                var mf = MLJ.core.Scene.getSelectedLayer();
                MLJ.core.File.reloadMeshFile(mf);
            });

            snapshot.onClick(function () {                
                MLJ.core.Scene.takeSnapshot();
            });

            deleteLayer.onClick(function() {
                MLJ.core.Scene.removeLayerByName(MLJ.core.Scene.getSelectedLayer().name)
            })
                                             
        }
        
        /**
         * @author <NAME>         
         */
        this._make = function () {
            _toolBar.$.attr("id", "mlj-scenebar-widget");
            return _toolBar.$;
        };

        init();

        MLJ.gui.Widget.call(this);
    };

    MLJ.extend(MLJ.gui.Widget, _SceneBar);

    //Install widget
    MLJ.gui.installWidget("SceneBar", new _SceneBar());

})(MLJ.gui.component);

{'fraction_non_alphanumeric': 0.13150242326332795, 'fraction_numerical': 0.007673667205169628, 'mean_word_length': 1.576154806491885, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 53, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7520295', 'n_tokens_mistral': 3620, 'n_tokens_neox': 3327, 'n_words': 705}