[gnome-sound-recorder] Fix Bug 724455 The window size is too wide



commit 824179e514172b2a24263304cf71712f401ab079
Author: Meg Ford <megford gnome org>
Date:   Sun Dec 28 13:15:12 2014 -0600

    Fix Bug 724455 The window size is too wide
    
    Remove manual setting of child widget widths from the MainWindow.
    Remove manual setting of widths from the the waveform.

 src/mainWindow.js |   15 ++---------
 src/waveform.js   |   66 +++++++++++++++++++++++++---------------------------
 2 files changed, 35 insertions(+), 46 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index b052757..9b863ff 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -98,8 +98,6 @@ const MainWindow = new Lang.Class({
         play = new Play.Play();
 
         params = Params.fill(params, { title: GLib.get_application_name(),
-                                       hexpand: true,
-                                       vexpand: true,
                                        default_width: 800,
                                        default_height: 480 });
         this.parent(params);
@@ -266,9 +264,6 @@ const MainView = new Lang.Class({
         activeProfile = Application.application.getPreferences();
 
         this.recordGrid = new Gtk.Grid({ name: "recordGrid",
-                                         height_request: 36,
-                                         width_request: 775,
-                                         hexpand: true,
                                          orientation: Gtk.Orientation.HORIZONTAL });
         this.groupGrid.add(this.recordGrid);
 
@@ -317,8 +312,7 @@ const MainView = new Lang.Class({
 
     scrolledWinAdd: function() {
         this._scrolledWin = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN,
-                                                     vexpand: true,
-                                                     width_request: 775 });
+                                                     vexpand: true });
         this._scrolledWin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
         this.scrollbar = this._scrolledWin.get_vadjustment();
 
@@ -361,7 +355,7 @@ const MainView = new Lang.Class({
             this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
             this.listBox.set_header_func(null);
             this.listBox.set_activate_on_single_click(true);
-            this.listBox.connect("row-selected", Lang.bind(this,
+            this.listBox.connect("activated", Lang.bind(this,
                 function(){
                     this.rowGridCallback(this.listBox.get_selected_row())
                 }));
@@ -373,13 +367,12 @@ const MainView = new Lang.Class({
             for (let i = this._startIdx; i <= this._endIdx; i++) {
                 this.rowGrid = new Gtk.Grid({ name: i.toString(),
                                               height_request: 45,
-                                              width_request: 775,
                                               orientation: Gtk.Orientation.VERTICAL,
+                                              hexpand: true,
                                               vexpand: true });
                 this.rowGrid.set_orientation(Gtk.Orientation.HORIZONTAL);
                 this.listBox.add(this.rowGrid);
                 this.rowGrid.show();
-                let rtl = Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL;
 
                 this.placeholderImage = Gtk.Image.new();
                 this.placeholderImage.set_from_icon_name(rtl ? 'media-playback-start-rtl-symbolic' :
@@ -495,8 +488,6 @@ const MainView = new Lang.Class({
                 this.dateModifiedLabel.show();
 
                 this.waveFormGrid = new Gtk.Grid({ name: "WaveFormGrid",
-                                                   height_request: 45,
-                                                   width_request: 300,
                                                    hexpand: true,
                                                    vexpand: true,
                                                    orientation: Gtk.Orientation.VERTICAL,
diff --git a/src/waveform.js b/src/waveform.js
index 23aabac..d340e3e 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -164,105 +164,103 @@ const WaveForm = new Lang.Class({
     stopGeneration: function() {
         this.pipeline.set_state(Gst.State.NULL);
     },
-                
+
     fillSurface: function(drawing, cr) {
         let start = 0;
-        
-        if (this.waveType == WaveType.PLAY) { 
-                   
-            if (peaks.length != this.playTime) { 
+
+        if (this.waveType == WaveType.PLAY) {
+
+            if (peaks.length != this.playTime) {
                 this.pipeline.set_state(Gst.State.PLAYING);
             }
             start = Math.floor(this.playTime);
         } else {
-        
+
             if (this.recordTime >= 0)
             start = this.recordTime;
         }
-        
+
         let i = 0;
         let xAxis = 0;
         let end = start + 40;
         let width = this.drawing.get_allocated_width();
         let waveheight = this.drawing.get_allocated_height();
         let length = this.nSamples;
-        let pixelsPerSample = width/waveSamples;   
+        let pixelsPerSample = width/waveSamples;
         let gradient = new Cairo.LinearGradient(0, 0, width , waveheight);
-        if (this.waveType == WaveType.PLAY) { 
-              gradient.addColorStopRGBA(0.75, 0.94, 1.0, 0.94, 0.75);       
+        if (this.waveType == WaveType.PLAY) {
+              gradient.addColorStopRGBA(0.75, 0.94, 1.0, 0.94, 0.75);
               gradient.addColorStopRGBA(0.0, 0.94, 1.0, 0.94, 0.22);
               cr.setLineWidth(1);
               cr.setSourceRGBA(0.0, 255, 255, 255);
         } else {
-            gradient.addColorStopRGBA(0.75, 0.0, 0.72, 0.64, 0.35);       
+            gradient.addColorStopRGBA(0.75, 0.0, 0.72, 0.64, 0.35);
             gradient.addColorStopRGBA(0.0, 0.2, 0.54, 0.47, 0.22);
             cr.setLineWidth(1);
             cr.setSourceRGBA(0.0, 185, 161, 255);
         }
-                  
+
         for(i = start; i <= end; i++) {
-        
+
             // Keep moving until we get to a non-null array member
-            if (peaks[i] < 0) {            
+            if (peaks[i] < 0) {
                 cr.moveTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)))
             }
-      
-            // Start drawing when we reach the first non-null array member  
+
+            // Start drawing when we reach the first non-null array member
             if (peaks[i] != null && peaks[i] >= 0) {
                 let idx = i - 1;
-                
-                if (start >= 40 && xAxis == 0) { 
+
+                if (start >= 40 && xAxis == 0) {
                      cr.moveTo((xAxis * pixelsPerSample), waveheight);
                 }
-                
+
                 cr.lineTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)));
             }
-                                
+
             xAxis += 1;
         }
         cr.lineTo(xAxis * pixelsPerSample, waveheight);
         cr.closePath();
-        cr.strokePreserve();       
+        cr.strokePreserve();
         cr.setSource(gradient);
            cr.fillPreserve();
-           cr.$dispose(); 
+           cr.$dispose();
     },
-    
+
     _drawEvent: function(playTime, recPeaks) {
         let lastTime;
-        
+
         if (this.waveType == WaveType.PLAY) {
             lastTime = this.playTime;
             this.playTime = playTime;
-                  
+
             if (peaks.length < this.playTime) {
                 this.pipeline.set_state(Gst.State.PLAYING);
-            } 
-                    
+            }
+
             if (lastTime != this.playTime) {
                 this.drawing.queue_draw();
             }
-            
+
         } else {
             peaks.push(recPeaks);
             lastTime = this.recordTime;
             this.recordTime = playTime;
-                  
+
             if (peaks.length < this.recordTime) {
                 log("error");
             }
-                      
+
             this.drawing.queue_draw();
         }
         return true;
     },
-    
+
     endDrawing: function() {
-        let width = 380;
-        
         if(this.pipeline)
             this.stopGeneration();
-            
+
         this.count = 0;
         peaks.length = 0;
         this.drawing.destroy();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]