From 95f65e231080d68f47f7c666caed66883f8c998a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 28 Sep 2013 17:10:23 +0000 Subject: [PATCH] [EXAMPLES] * BUG: Fix WebCam example. git-svn-id: svn://localhost/gambas/trunk@5855 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- .../examples/Multimedia/MyWebCam/.project | 4 +-- .../Multimedia/WebCam/.src/FDevice.class | 31 +++++++++---------- .../Multimedia/WebCam/.src/FMain.class | 9 +++--- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/examples/examples/Multimedia/MyWebCam/.project b/examples/examples/Multimedia/MyWebCam/.project index 8cc5385a3..ec90503ce 100644 --- a/examples/examples/Multimedia/MyWebCam/.project +++ b/examples/examples/Multimedia/MyWebCam/.project @@ -1,9 +1,9 @@ # Gambas Project File 3.0 -# Compiled with Gambas 3.3.90 +# Compiled with Gambas 3.4.90 Title=Webcam example Startup=Form1 Icon=camera.png -Version=3.3.90 +Version=3.4.90 VersionFile=1 Component=gb.image Component=gb.gui diff --git a/examples/examples/Multimedia/WebCam/.src/FDevice.class b/examples/examples/Multimedia/WebCam/.src/FDevice.class index 3748f6126..8e70d4764 100644 --- a/examples/examples/Multimedia/WebCam/.src/FDevice.class +++ b/examples/examples/Multimedia/WebCam/.src/FDevice.class @@ -46,7 +46,7 @@ Public Sub _new(dev As VideoDevice, i As Integer) End -Public Sub Resize() +Public Sub ResizeDevice() Dim $spacing As Integer @@ -101,7 +101,7 @@ Public Sub Resize() End -Public Sub form_Show() +Public Sub Form_Show() Dim key As String = Subst("Camera_&1", $index) @@ -122,7 +122,7 @@ Public Sub Form_Open() picture_size.Index = Settings[key & "/size", 1] - 1 picture_size_Click() - Resize() + ResizeDevice() Wait 0.1 slider_bright.Value = Settings[key & "/brightness", $device.Bright] @@ -140,17 +140,6 @@ Public Sub Form_Open() End -Public Sub Close() As Integer - - Refresh.Stop - Me.Hide - Wait - $device.Close - $device = Null - -End - - Public Sub Refresh_Timer() Dim when As Date @@ -190,7 +179,7 @@ Public Sub picture_size_Click() $device.Resize(640, 480) End Select - Resize() + ResizeDevice() End @@ -235,7 +224,7 @@ End Public Sub button_hide_Click() tools.Hide() - Resize() + ResizeDevice() End @@ -285,7 +274,7 @@ Public Sub buttonSettings_Click() Else tools.Show Endif - Resize() + ResizeDevice() Select $device.Width Case 160 @@ -307,3 +296,11 @@ Public Sub button_reset_Click() slider_hue.Value = $device.HueDefault End + +Public Sub Form_Close() + + Refresh.Stop + $device.Close + $device = Null + +End diff --git a/examples/examples/Multimedia/WebCam/.src/FMain.class b/examples/examples/Multimedia/WebCam/.src/FMain.class index 0639195b7..f50454768 100644 --- a/examples/examples/Multimedia/WebCam/.src/FMain.class +++ b/examples/examples/Multimedia/WebCam/.src/FMain.class @@ -17,6 +17,7 @@ Public Sub ScanDevices() Dim count As Integer Dim item As Menu Dim status As String + Dim sDevice As String $windows = New Form[] count = 0 @@ -24,7 +25,9 @@ Public Sub ScanDevices() status = "Searching: " For i = 0 To 20 - Try dev = New VideoDevice("/dev/video" & Str(i)) + sDevice = "/dev/video" & Str(i) + Print sDevice + Try dev = New VideoDevice(sDevice) If Not Error Then status &= "!" myWin = New FDevice(dev, count) @@ -48,8 +51,6 @@ Public Sub ScanDevices() myWin.Show Next -Catch - End Public Sub menu_scan_Click() @@ -96,12 +97,12 @@ Public Sub menu_quit_Click() $windows.Pop().Close Wend Me.Close + tooltray.Hide End Public Sub menu_save_Click() - Dim key As String Dim mywin As FDevice For Each myWin In $windows