[chronojump] Encoder shows video capture



commit 0f6f396d819c329ef46dc8071086c9eb7b711796
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 18 19:01:39 2013 +0200

    Encoder shows video capture

 glade/chronojump.glade | 152 ++++++++++++++++++++++++++++++++++++++++++-------
 src/gui/chronojump.cs  |  99 +++++++++++++++++++++++++++-----
 2 files changed, 214 insertions(+), 37 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 7a3f90e..00030f9 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -791,6 +791,7 @@
                             <property name="can_focus">True</property>
                             <property name="tab_hborder">18</property>
                             <property name="tab_vborder">4</property>
+                            <signal name="switch_page" handler="on_notebook_sup_switch_page" swapped="no"/>
                             <child>
                               <widget class="GtkVBox" id="vbox44">
                                 <property name="visible">True</property>
@@ -5992,7 +5993,7 @@ Second Chronopic to platforms.</property>
                                                             <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkButton" 
id="event_execute_button_cancel">
-                                                            <property name="height_request">34</property>
+                                                            <property name="height_request">30</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="can_default">True</property>
@@ -6006,6 +6007,7 @@ Second Chronopic to platforms.</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="stock">gtk-cancel</property>
+                                                            <property name="icon-size">2</property>
                                                             </widget>
                                                             </child>
                                                             </widget>
@@ -6017,7 +6019,7 @@ Second Chronopic to platforms.</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkButton" 
id="event_execute_button_finish">
-                                                            <property name="height_request">34</property>
+                                                            <property name="height_request">30</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="can_default">True</property>
@@ -6032,6 +6034,7 @@ Second Chronopic to platforms.</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="stock">gtk-goto-last</property>
+                                                            <property name="icon-size">2</property>
                                                             </widget>
                                                             </child>
                                                             </widget>
@@ -6061,14 +6064,14 @@ Second Chronopic to platforms.</property>
                                                             <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkProgressBar" 
id="event_execute_progressbar_event">
-                                                            <property name="height_request">34</property>
+                                                            <property name="height_request">30</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="pulse_step">0.10000000149</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
@@ -6076,21 +6079,7 @@ Second Chronopic to platforms.</property>
                                                             <widget class="GtkVBox" id="vbox15">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">3</property>
-                                                            <child>
-                                                            <widget class="GtkProgressBar" 
id="event_execute_progressbar_time">
-                                                            <property name="height_request">34</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property 
name="pulse_step">0.10000000149</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
+                                                            <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox14">
                                                             <property name="visible">True</property>
@@ -6124,14 +6113,27 @@ Second Chronopic to platforms.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkProgressBar" 
id="event_execute_progressbar_time">
+                                                            <property name="height_request">30</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="pulse_step">0.10000000149</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
@@ -12361,6 +12363,112 @@ on current Chronojump version.</property>
                                                         <property name="position">3</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox94">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">4</property>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox19">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkCheckButton" 
id="checkbutton_video_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Record video (on / off)</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="relief">none</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <signal name="clicked" 
handler="on_checkbutton_video_encoder_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox95">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_video_yes_encoder">
+                                                            <property name="width_request">16</property>
+                                                            <property name="height_request">16</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-media-record</property>
+                                                            <property name="icon-size">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_video_no_encoder">
+                                                            <property name="width_request">16</property>
+                                                            <property name="height_request">16</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-no</property>
+                                                            <property name="icon-size">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_video_feedback_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" 
id="hbox_video_capture_encoder">
+                                                            <property name="width_request">75</property>
+                                                            <property name="height_request">60</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="pack_type">end</property>
+                                                        <property name="position">4</property>
+                                                      </packing>
+                                                    </child>
                                                   </widget>
                                                 </child>
                                               </widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5db43bd..327856d 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -155,12 +155,20 @@ public partial class ChronoJumpWindow
        //[Widget] Gtk.TextView textview_message_connected_chronopics;
        //[Widget] Gtk.Image image_connected_chronopics;
        
-       [Widget] Gtk.CheckButton checkbutton_volume;
-       [Widget] Gtk.Image image_volume;
+       [Widget] Gtk.HBox hbox_video_capture;
+       [Widget] Gtk.HBox hbox_video_capture_encoder;
+       [Widget] Gtk.Label label_video_feedback;
+       [Widget] Gtk.Label label_video_feedback_encoder;
        [Widget] Gtk.CheckButton checkbutton_video;
-       [Widget] Gtk.Label label_video;
+       [Widget] Gtk.CheckButton checkbutton_video_encoder;
+       //[Widget] Gtk.Label label_video;
        [Widget] Gtk.Image image_video_yes;
        [Widget] Gtk.Image image_video_no;
+       [Widget] Gtk.Image image_video_yes_encoder;
+       [Widget] Gtk.Image image_video_no_encoder;
+       [Widget] Gtk.CheckButton checkbutton_volume;
+       [Widget] Gtk.Image image_volume;
+
 
        //multiChronopic        
        [Widget] Gtk.Button button_edit_selected_multi_chronopic;
@@ -254,9 +262,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_encoder_analyze_stats;
        [Widget] Gtk.Image image_encoder_signal_delete;
 
-       [Widget] Gtk.HBox hbox_video_capture;
-       [Widget] Gtk.Label label_video_feedback;
-
        Random rand;
        bool volumeOn; //TODO: always true now because it's hidden from GUI until videoOn is working
        bool videoOn; //TODO: now always false because it crashes on windows
@@ -856,13 +861,18 @@ public partial class ChronoJumpWindow
                        videoOn = false;
 
                UtilGtk.ColorsCheckOnlyPrelight(checkbutton_video);
+               UtilGtk.ColorsCheckOnlyPrelight(checkbutton_video_encoder);
                
                //don't raise the signal        
                checkbutton_video.Clicked -= new EventHandler(on_checkbutton_video_clicked);
                checkbutton_video.Active = videoOn;
                checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked);
+               //don't raise the signal        
+               checkbutton_video_encoder.Clicked -= new EventHandler(on_checkbutton_video_encoder_clicked);
+               checkbutton_video_encoder.Active = videoOn;
+               checkbutton_video_encoder.Clicked += new EventHandler(on_checkbutton_video_encoder_clicked);
                
-               changeVideoButton(videoOn);
+               changeVideoButtons(videoOn);
 
 
                //load preferences, update radios, but not update database
@@ -2736,18 +2746,51 @@ public partial class ChronoJumpWindow
         * videoOn and volumeOn
         */
 
+       //at what tab of notebook_sup there's the video_capture
+       private int video_capture_notebook_sup = 0;
+
+       //changed by user clicking on notebook tabs
+       private void on_notebook_sup_switch_page (object o, SwitchPageArgs args) {
+               if( 
+                               (notebook_sup.CurrentPage == 0 && video_capture_notebook_sup == 1) ||
+                               (notebook_sup.CurrentPage == 1 && video_capture_notebook_sup == 0)) 
+               {
+                       //first stop showing video
+                       bool wasActive = false;
+                       if(checkbutton_video.Active) {
+                               wasActive = true;
+                               checkbutton_video.Active = false;
+                       }
+
+                       if(notebook_sup.CurrentPage == 0) {
+                               //remove video capture from encoder tab
+                               hbox_video_capture_encoder.Remove(capturer);
+                               //add in contacts tab
+                               hbox_video_capture.PackStart(capturer, true, true, 0);
+                       } else {
+                               //remove video capture from contacts tab
+                               hbox_video_capture.Remove(capturer);
+                               //add in encoder tab
+                               hbox_video_capture_encoder.PackStart(capturer, true, true, 0);
+                       }
+               
+                       if(wasActive) 
+                               checkbutton_video.Active = true;
+               
+                       video_capture_notebook_sup = notebook_sup.CurrentPage;
+               }
+       }
+
        CapturerBin capturer;
-       //Gtk.Window capturerWindow;
        private void videoCaptureInitialize() 
        {
                capturer = new CapturerBin();
-       
+               
                hbox_video_capture.PackStart(capturer, true, true, 0);
-
-               videoCapturePrepare();
+               
+               videoCapturePrepare(); 
        }
        
-
        private void videoCapturePrepare() {
                CapturePropertiesStruct s = new CapturePropertiesStruct();
 
@@ -2760,18 +2803,22 @@ public partial class ChronoJumpWindow
                s.Height = 288;
 
                capturer.CaptureProperties = s;
+
+               //checkbutton_video and checkbutton_video_encoder are synchronized
                if(checkbutton_video.Active)
                        capturer.Type = CapturerType.Live;
                else
                        capturer.Type = CapturerType.Fake;
                capturer.Visible=true;
-       
+
                capturer.Run();
        }
        
-       private void changeVideoButton(bool myVideo) {
+       private void changeVideoButtons(bool myVideo) {
                image_video_yes.Visible = myVideo;
                image_video_no.Visible = ! myVideo;
+               image_video_yes_encoder.Visible = myVideo;
+               image_video_no_encoder.Visible = ! myVideo;
        }
        
        private void on_checkbutton_video_clicked(object o, EventArgs args) {
@@ -2782,11 +2829,33 @@ public partial class ChronoJumpWindow
                        videoOn = false;
                        SqlitePreferences.Update("videoOn", "False", false);
                }
-               changeVideoButton(videoOn);
+               //change encoder checkbox but don't raise the signal    
+               checkbutton_video_encoder.Clicked -= new EventHandler(on_checkbutton_video_encoder_clicked);
+               checkbutton_video_encoder.Active = videoOn;
+               checkbutton_video_encoder.Clicked += new EventHandler(on_checkbutton_video_encoder_clicked);
+               
+               changeVideoButtons(videoOn);
                
                videoCapturePrepare();
        }
 
+       private void on_checkbutton_video_encoder_clicked(object o, EventArgs args) {
+               if(checkbutton_video_encoder.Active) {
+                       videoOn = true;
+                       SqlitePreferences.Update("videoOn", "True", false);
+               } else {
+                       videoOn = false;
+                       SqlitePreferences.Update("videoOn", "False", false);
+               }
+               //change contacts checkbox but don't raise the signal   
+               checkbutton_video.Clicked -= new EventHandler(on_checkbutton_video_clicked);
+               checkbutton_video.Active = videoOn;
+               checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked);
+               
+               changeVideoButtons(videoOn);
+               
+               videoCapturePrepare();
+       }
 
        private void changeVolumeButton(bool myVolume) {
                Pixbuf pixbuf;


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