[chronojump] Initial code for sliding horizontally over image



commit dcf09008d796b74b0559dc06476d18e4ef00b169
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 26 18:45:14 2016 +0100

    Initial code for sliding horizontally over image

 build/build.environment.mk |    3 +-
 glade/chronojump.glade     |  107 ++++++++++++++++++++++++++++++++++++++++++-
 src/gui/chronojump.cs      |   39 ++++++++++++++++
 3 files changed, 145 insertions(+), 4 deletions(-)
---
diff --git a/build/build.environment.mk b/build/build.environment.mk
index f3ae9b9..bd2b655 100644
--- a/build/build.environment.mk
+++ b/build/build.environment.mk
@@ -37,7 +37,8 @@ REF_DEP_CHRONOJUMP = \
        $(LINK_GLADE) \
        $(LINK_GTK) \
        $(LINK_CESARPLAYER) \
-       $(LINK_JSON)
+       $(LINK_JSON) \
+       $(LINK_CAIRO)
 
 REF_DEP_CESARPLAYER = \
        $(LINK_SYSTEM) \
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 583fcd3..4f9e558 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -579,6 +579,47 @@
                                 <property name="position">2</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkVBox" id="vbox63">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <widget class="GtkDrawingArea" id="drawingarea_cairo_prova">
+                                    <property name="width_request">165</property>
+                                    <property name="height_request">44</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <signal name="configure_event" 
handler="on_drawingarea_cairo_prova_configure_event" swapped="no"/>
+                                    <signal name="expose_event" 
handler="on_drawingarea_cairo_prova_expose_event" swapped="no"/>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHScale" id="hscale_cairo_prova">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="adjustment">1 1 165 1 10 0</property>
+                                    <property name="round_digits">1</property>
+                                    <property name="value_pos">bottom</property>
+                                    <signal name="value_changed" 
handler="on_hscale_cairo_prova_value_changed" swapped="no"/>
+                                  </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">3</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">True</property>
@@ -7931,6 +7972,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -9396,6 +9440,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -10502,6 +10549,9 @@ after time</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -22277,6 +22327,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -23282,6 +23335,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24779,6 +24835,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -25333,6 +25392,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -37265,6 +37327,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -39248,6 +39328,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -40543,9 +40635,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -41550,6 +41639,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -45327,6 +45419,9 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -45996,6 +46091,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -46680,6 +46778,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 7d7cccb..5144223 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -64,6 +64,9 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_selector_start_jumps;
        [Widget] Gtk.Image image_selector_start_runs;
        [Widget] Gtk.Image image_selector_start_encoder;
+       
+       [Widget] Gtk.DrawingArea drawingarea_cairo_prova;
+       [Widget] Gtk.HScale hscale_cairo_prova;
 
        //gui for small screens
        [Widget] Gtk.RadioButton radio_mode_jumps_small;
@@ -464,6 +467,38 @@ public partial class ChronoJumpWindow
        //int chronopicCancelledTimes = 0;
 
 
+       Pixbuf cairo_pixbuf;
+       public void on_drawingarea_cairo_prova_expose_event(object o, ExposeEventArgs args)
+       {
+               DrawingArea area = (DrawingArea) o;
+               using (Cairo.Context g = Gdk.CairoHelper.Create (area.GdkWindow)) 
+               {
+                       //add image
+                       Gdk.CairoHelper.SetSourcePixbuf (g, cairo_pixbuf, 0, 0);
+                       g.Paint();
+
+                       //add rectangle
+                       g.SetSourceRGBA(1, 0, 0, 1); //red
+                       
+                       int xpos = Convert.ToInt32(hscale_cairo_prova.Value);
+                       g.MoveTo(xpos, 0);
+                       g.LineTo(xpos, cairo_pixbuf.Height);
+                       
+                       g.Stroke();
+
+                       g.GetTarget ().Dispose ();
+               }
+       }
+       public void on_drawingarea_cairo_prova_configure_event(object o, ConfigureEventArgs args)
+       {
+       }
+       
+       public void on_hscale_cairo_prova_value_changed(object o, EventArgs args)
+       {
+               LogB.Information("changed!");
+               LogB.Information(hscale_cairo_prova.Value.ToString());
+               drawingarea_cairo_prova.QueueDraw(); //will fire ExposeEvent
+       }
 
        //only called the first time the software runs
        //and only on windows
@@ -503,6 +538,9 @@ public partial class ChronoJumpWindow
                this.progVersion = progVersion;
                this.progName = progName;
                this.runningFileName = runningFileName;
+               
+               cairo_pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameLogo);
+               
 
                Glade.XML gxml;
                gxml = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "app1", 
"chronojump");
@@ -837,6 +875,7 @@ public partial class ChronoJumpWindow
                image_logo.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + Constants.FileNameLogo320); //changed 
to 270 for the presentation
                image_presentation_logo.Pixbuf = pixbuf;
+
        }
 
        private void loadPreferences () 


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