<commit_before>define(['dojo/_base/declare',
        'dojo/_base/array',
        'dojo/dom-construct',
        'dijit/layout/ContentPane',
        'dojo/dnd/Source',
        'dojo/fx/easing',
        'dijit/form/TextBox'
       ],
       function( declare, array, dom, ContentPane, dndSource, animationEasing, dijitTextBox ) {
return declare( 'JBrowse.View.TrackList.CoGe', null,

    /** @lends JBrowse.View.TrackList.CoGe.prototype */
    {
    /**
     * CoGe drag-and-drop track selector.
     * @constructs
     */
    constructor: function( args ) {
        this.browser = args.browser;

        // make the track list DOM nodes and widgets
        this.createTrackList( args.browser.container, args.trackConfigs );

        // maintain a list of the HTML nodes of filtered tracks
        this.filteredNodes = {};        
        
        // subscribe to drop events for tracks being DND'ed
        this.browser.subscribe(
            "/dnd/drop",
            dojo.hitch( this,
                        function( source, nodes, copy, target ) {
			            	if ( source == target) { // both source and target
			            		console.log('source = target');
			            		return;
			            	}
			            	
			            	var isSource = this.trackListWidgets.indexOf(source) != -1;
			            	var isTarget = this.trackListWidgets.indexOf(target) != -1;
			            	
			            	if( isSource && !isTarget ) { // source
                            	console.log('/dnd/drop/source');
                            	// get the configs from the tracks being dragged in
	                            var confs = dojo.filter(
	                                dojo.map( nodes, function(n) {
	                                              return source.map[n.id].data;
	                                        }),
	                                function(c) {return c;}
	                            );
                            	
	                            // highlight track to show it is enabled
	                            this.dndDrop = true;
	                            this.browser.publish( '/jbrowse/v1/v/tracks/show', confs ); // mdb: why not just call setTrackActive directly?
	                            this.dndDrop = false;
                            }
			            	
                            if( this.trackListWidgets.indexOf(target) != -1 ) { // target
                            	console.log('/dnd/drop/target');
                            	
	                            // get the configs from the tracks being dragged in
	                            var confs = dojo.filter(
	                                dojo.map( nodes, function(n) {
	                                              return n.track && n.track.config;
	                                        }),
	                                function(c) {return c;}
	                            );
	                            
	                            // return if no confs; whatever was dragged here probably wasn't a track
	                            if( ! confs.length )
	                                return;

	                            
	                            // un-highlight track to show it is disabled
	                            this.dndDrop = true;
	                            this.browser.publish( '/jbrowse/v1/v/tracks/hide', confs ); // mdb: why not just call setTrackInactive directly?
	                            this.dndDrop = false;
            				}
                        }
                      ));

        // subscribe to commands coming from the the controller
        this.browser.subscribe( '/jbrowse/v1/c/tracks/show',
                                dojo.hitch( this, 'setTracksActive' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/hide',
                                dojo.hitch( this, 'setTracksInactive' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/new',
                                dojo.hitch( this, 'addTracks' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/replace',
                                dojo.hitch( this, 'replaceTracks' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/delete',
                                dojo.hitch( this, 'deleteTracks' ));
    },

    addTracks: function( trackConfigs ) {
    	console.log('addTracks');
//        // note that new tracks are, by default, hidden, so we just put them in the list
//        this.trackListWidget.insertNodes(
//            false,
//            trackConfigs
//        );
//
//        this._blinkTracks( trackConfigs );
    },

    // mdb: unused now
    replaceTracks: function( trackConfigs ) {
    	console.log('replaceTracks');
//        // for each one
//        array.forEach( trackConfigs, function( conf ) {
//            // figure out its position in the genome view and delete it
//            var oldNode = this.inactiveTrackNodes[ conf.label ];
//            if( ! oldNode )
//                return;
//            delete this.inactiveTrackNodes[ conf.label ];
//
//            this.trackListWidget.delItem( oldNode.id );
//            if( oldNode.parentNode )
//                oldNode.parentNode.removeChild( oldNode );
//
//           // insert the new track config into the trackListWidget after the 'before'
//           this.trackListWidget.insertNodes( false, [conf], false, oldNode.previousSibling );
//       },this);
    },

    /** @private */
    createTrackList: function( renderTo, trackConfigs ) {
        var trackPane = this.pane = dojo.create(
            'div',
            { id: 'trackPane',
              style: { width: '12em' }
            },
            renderTo
        );

        // splitter on right side
        var trackWidget = new ContentPane({region: "right", splitter: true}, trackPane);

        this.div = dojo.create(
            'div',
            { id: 'tracksAvail',
              className: 'container handles',
              style: { width: '100%', height: '100%', overflowX: 'hidden', overflowY: 'auto' },
              //innerHTML: '<h2>Available Tracks</h2>',
              //onclick: dojo.hitch( this, function() { this.trackListWidget.selectNone(); } )<commit_msg>Increased min width of track selector<commit_after>define(['dojo/_base/declare',
        'dojo/_base/array',
        'dojo/dom-construct',
        'dijit/layout/ContentPane',
        'dojo/dnd/Source',
        'dojo/fx/easing',
        'dijit/form/TextBox'
       ],
       function( declare, array, dom, ContentPane, dndSource, animationEasing, dijitTextBox ) {
return declare( 'JBrowse.View.TrackList.CoGe', null,

    /** @lends JBrowse.View.TrackList.CoGe.prototype */
    {
    /**
     * CoGe drag-and-drop track selector.
     * @constructs
     */
    constructor: function( args ) {
        this.browser = args.browser;

        // make the track list DOM nodes and widgets
        this.createTrackList( args.browser.container, args.trackConfigs );

        // maintain a list of the HTML nodes of filtered tracks
        this.filteredNodes = {};        
        
        // subscribe to drop events for tracks being DND'ed
        this.browser.subscribe(
            "/dnd/drop",
            dojo.hitch( this,
                        function( source, nodes, copy, target ) {
			            	if ( source == target) { // both source and target
			            		console.log('source = target');
			            		return;
			            	}
			            	
			            	var isSource = this.trackListWidgets.indexOf(source) != -1;
			            	var isTarget = this.trackListWidgets.indexOf(target) != -1;
			            	
			            	if( isSource && !isTarget ) { // source
                            	console.log('/dnd/drop/source');
                            	// get the configs from the tracks being dragged in
	                            var confs = dojo.filter(
	                                dojo.map( nodes, function(n) {
	                                              return source.map[n.id].data;
	                                        }),
	                                function(c) {return c;}
	                            );
                            	
	                            // highlight track to show it is enabled
	                            this.dndDrop = true;
	                            this.browser.publish( '/jbrowse/v1/v/tracks/show', confs ); // mdb: why not just call setTrackActive directly?
	                            this.dndDrop = false;
                            }
			            	
                            if( this.trackListWidgets.indexOf(target) != -1 ) { // target
                            	console.log('/dnd/drop/target');
                            	
	                            // get the configs from the tracks being dragged in
	                            var confs = dojo.filter(
	                                dojo.map( nodes, function(n) {
	                                              return n.track && n.track.config;
	                                        }),
	                                function(c) {return c;}
	                            );
	                            
	                            // return if no confs; whatever was dragged here probably wasn't a track
	                            if( ! confs.length )
	                                return;

	                            
	                            // un-highlight track to show it is disabled
	                            this.dndDrop = true;
	                            this.browser.publish( '/jbrowse/v1/v/tracks/hide', confs ); // mdb: why not just call setTrackInactive directly?
	                            this.dndDrop = false;
            				}
                        }
                      ));

        // subscribe to commands coming from the the controller
        this.browser.subscribe( '/jbrowse/v1/c/tracks/show',
                                dojo.hitch( this, 'setTracksActive' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/hide',
                                dojo.hitch( this, 'setTracksInactive' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/new',
                                dojo.hitch( this, 'addTracks' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/replace',
                                dojo.hitch( this, 'replaceTracks' ));
        this.browser.subscribe( '/jbrowse/v1/c/tracks/delete',
                                dojo.hitch( this, 'deleteTracks' ));
    },

    addTracks: function( trackConfigs ) {
    	console.log('addTracks');
//        // note that new tracks are, by default, hidden, so we just put them in the list
//        this.trackListWidget.insertNodes(
//            false,
//            trackConfigs
//        );
//
//        this._blinkTracks( trackConfigs );
    },

    // mdb: unused now
    replaceTracks: function( trackConfigs ) {
    	console.log('replaceTracks');
//        // for each one
//        array.forEach( trackConfigs, function( conf ) {
//            // figure out its position in the genome view and delete it
//            var oldNode = this.inactiveTrackNodes[ conf.label ];
//            if( ! oldNode )
//                return;
//            delete this.inactiveTrackNodes[ conf.label ];
//
//            this.trackListWidget.delItem( oldNode.id );
//            if( oldNode.parentNode )
//                oldNode.parentNode.removeChild( oldNode );
//
//           // insert the new track config into the trackListWidget after the 'before'
//           this.trackListWidget.insertNodes( false, [conf], false, oldNode.previousSibling );
//       },this);
    },

    /** @private */
    createTrackList: function( renderTo, trackConfigs ) {
        var trackPane = this.pane = dojo.create(
            'div',
            { id: 'trackPane',
              style: { width: '200px' } // 'min-width': '200px' -- mdb: messes up resize
            },
            renderTo
        );

        // splitter on right side
        var trackWidget = new ContentPane({region: "right", splitter: true}, trackPane);

        this.div = dojo.create(
            'div',
            { id: 'tracksAvail',
              className: 'container handles',
              style: { width: '100%', height: '100%', overflowX: 'hidden', overflowY: 'auto' },
              //innerHTML: '<h2>Available Tracks</h2>',
              //onclick: dojo.hitch( this, function() { this.trackListWidget.selectNone(); } )
{'fraction_non_alphanumeric': 0.108608528374479, 'fraction_numerical': 0.003526771401090093, 'mean_word_length': 1.1763474620617478, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7245137', 'n_tokens_mistral': 3366, 'n_tokens_neox': 3146, 'n_words': 741}