From 425137546d5b38d027a8e6b2ef2b415c65d5b1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 25 Apr 2012 15:46:48 +0000 Subject: [PATCH] [EXAMPLES] * NEW: PhotoTouch got a "save all" feature and some bug fixes. git-svn-id: svn://localhost/gambas/trunk@4676 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- .../examples/Image/PhotoTouch/.lang/fr.mo | Bin 1796 -> 2218 bytes .../examples/Image/PhotoTouch/.lang/fr.po | 108 +++++++++++++----- .../Image/PhotoTouch/.src/FMain.class | 85 +++++++++----- .../examples/Image/PhotoTouch/save-all.png | Bin 0 -> 1402 bytes 4 files changed, 137 insertions(+), 56 deletions(-) create mode 100644 examples/examples/Image/PhotoTouch/save-all.png diff --git a/examples/examples/Image/PhotoTouch/.lang/fr.mo b/examples/examples/Image/PhotoTouch/.lang/fr.mo index 094eb3970786e1b56bee3b75e923d1e02a4a2a4c..67152f996e7bd2d7f1c6ccd24237248376ee3ee8 100644 GIT binary patch delta 1189 zcmX|=%S%*I9LLX{aV9OB##dTeUd=QUkqX*KgqW5=nkGiHs6p;HSEiZiddD`B^pI8& zajBI=5P>};sFp=g?Q~O%R#B~5NJRYu)#t0%ew^R=oY(!m&bikUk1J-sRF>Q^$X>Jo z&05BE!&ebHWFcw{OXg9?C$O6NVmN;bH!yz>OW-ox3_rk)@GGR56*}4Z3AO(VRv0sD z{xI0WLXxj_zz*3A}R3u&A?6Y8Z5`Z zxy3+^=ONA9qbr3E;8yq)D#LeB87)CM`UF*p6_|v7q3k4MYk^fleb)eGuLZVqpcCrc zX`-?4Z_Y4~qqACo9@K|E#HN{na&!e!GIJLy^988$&*2XE5^jSZVJ-X-?w4Rp=i*R- zl!o&PIIE2+1~#mL%J5)#pa<$r^g^0BAFgMhDliEX@G_Lcn;{=U*?kRF>NijoT7rAv zXQ)78rPRNUL4sK`Y=g?=IF#cIl%YAOjBh{%cpK^w&4>HiTbK55AbV7L^{prfiK;2l zdmsiLz3LxIB~(_r3P~#}CvvDDbp=$^G@-juiLzRk76!z#nxWQ|z`EEB^h4?TRIx_1 z9E~2Jt4DQjlAUWX+e50XyU;dNl_BJ=pb)7I<{}-|k>FWmU*ebollSw% zRJ7X~d$Abpw;FI}dh?#g=Wae{r;2|5Ldth979GUz>?cRb^Gb~d%GOiO` Mji0l|f^YGbe~{{gWdHyG delta 765 zcmX}pKS1LDiC=DdqhQ;q-s6rx4iQk87dp-Kq>-L$2v5W)$H8jYtzmlRsm$>l|G zad7FNMFbr>mC|GVkf~ar3EL2exG>ygEybM%iZ(--uKd29H!y`;sGa$S+TBA`{w1o>znEZtJ*iwM(;{Z@Rw<2l(a&HbTG87 zDy>#Wph?>qNrtwPlPZ^v;jYwpBD~SLssWW&$i|k7g_axAE~`=Vaxo~(;P(P#EgH0_SeF8Rg4_B-A7mD6TtoOCp|`NOR`?vs5k& qn_u+pf;(gn+|gJ$V!A0j*Z)u*rWekBv%yx diff --git a/examples/examples/Image/PhotoTouch/.lang/fr.po b/examples/examples/Image/PhotoTouch/.lang/fr.po index 392132fcb..63a534997 100644 --- a/examples/examples/Image/PhotoTouch/.lang/fr.po +++ b/examples/examples/Image/PhotoTouch/.lang/fr.po @@ -11,111 +11,167 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: FMain.class:150 +#: FMain.class:221 +msgid "*" +msgstr "*" + +#: FMain.class:221 +msgid "/" +msgstr "/" + +#: FMain.class:201 msgid "Automatic correction" msgstr "Correction automatique" -#: FBrightness.form:56 FMain.class:150 +#: FMain.class:221 +msgid "B" +msgstr "F" + +#: FBrightness.form:39 FMain.class:201 msgid "Balance" msgstr "Balance" -#: FMain.class:150 +#: FMain.class:201 msgid "Blur" msgstr "Flou" -#: FMain.class:150 +#: FMain.class:201 msgid "Browse photos" msgstr "Parcourir les photos" -#: FMain.class:150 +#: FMain.class:201 msgid "Crop image" msgstr "Découper l'image" -#: FScissors.form:19 +#: FScissors.form:23 msgid "Cut" msgstr "Découper" -#: FMain.class:150 +#: FMain.class:221 +msgid "D" +msgstr "T" + +#: FMain.class:201 msgid "Fit to window" msgstr "Zoom à la taille de l'écran" -#: FMain.class:150 +#: FMain.class:201 msgid "Flip horizontally" msgstr "Retourner horizontalement" -#: FMain.class:150 +#: FMain.class:201 msgid "Flip vertically" msgstr "Retourner verticalement" -#: FMain.class:150 +#: FMain.class:221 +msgid "H" +msgstr "H" + +#: FMain.class:221 +msgid "I" +msgstr "I" + +#: FMain.class:201 msgid "Invert" msgstr "Inverser" -#: FMain.class:95 +#: FMain.class:221 +msgid "M" +msgstr "M" + +#: FMain.class:221 +msgid "N" +msgstr "E" + +#: FMain.class:107 msgid "No image in directory" msgstr "Aucune image dans ce répertoire" -#: FMain.class:150 +#: FMain.class:201 msgid "Normalize" msgstr "Normaliser" -#: FMain.class:150 +#: FMain.class:221 +msgid "O" +msgstr "P" + +#: FMain.class:201 msgid "Oil painting effect" msgstr "Effet de peinture à l'huile" -#: FMain.class:150 +#: FMain.class:201 msgid "Quit" msgstr "Quitter" -#: FMain.class:150 +#: FMain.class:221 +msgid "R" +msgstr "R" + +#: FMain.class:201 msgid "Remove speckles" msgstr "Enlever les tâches" -#: FMain.class:150 FResize.form:40 +#: FMain.class:201 FResize.form:40 msgid "Resize" msgstr "Redimensionner" -#: FMain.class:150 +#: FMain.class:201 msgid "Rotate left" msgstr "Rotation vers la gauche" -#: FMain.class:150 +#: FMain.class:201 msgid "Rotate right" msgstr "Rotation vers la droite" -#: FMain.class:150 +#: FMain.class:221 +msgid "S" +msgstr "N" + +#: FMain.class:201 msgid "Save" msgstr "Enregistrer" -#: FMain.class:150 +#: FMain.class:201 +msgid "Save all" +msgstr "Tout enregistrer" + +#: FMain.class:201 msgid "Select photo directory" msgstr "Choisir le répertoire des photographies" -#: FMain.class:150 +#: FMain.class:201 msgid "Sharpen" msgstr "Netteté" +#: FMain.class:201 +msgid "Show photo" +msgstr "Afficher la photographie" + #: .project:1 msgid "Simple Photo Editor" msgstr "Editeur de photographie simplifié" -#: FMain.class:98 +#: FMain.class:110 msgid "Unable to load image" msgstr "Impossible de charger l'image" -#: FMain.class:150 +#: FMain.class:201 msgid "Undo all changes" msgstr "Annuler tous les changements" -#: FMain.class:150 +#: FMain.class:221 +msgid "V" +msgstr "V" + +#: FMain.class:201 msgid "Zoom 100%" msgstr "Zoom 100%" -#: FMain.class:150 +#: FMain.class:201 msgid "Zoom in" msgstr "Zoom avant" -#: FMain.class:150 +#: FMain.class:201 msgid "Zoom out" msgstr "Zoom arrière" diff --git a/examples/examples/Image/PhotoTouch/.src/FMain.class b/examples/examples/Image/PhotoTouch/.src/FMain.class index 02c1ec1b6..2d353c069 100644 --- a/examples/examples/Image/PhotoTouch/.src/FMain.class +++ b/examples/examples/Image/PhotoTouch/.src/FMain.class @@ -196,6 +196,7 @@ Public Sub _new() "balance": ("Balance"), "resize": ("Resize"), "save": ("Save"), + "save-all": ("Save all"), "undo": ("Undo all changes"), "quit": ("Quit")] @@ -224,7 +225,7 @@ Public Sub _new() CreateButtons(aButton, cTooltip, panToolbar) - aButton = ["photo", "usb", "-", "hflip#2", "vflip#2", "rotate-left#2", "rotate-right#2", "<->", "save#2", "undo#2", "quit#2"] + aButton = ["photo", "usb", "-", "hflip#2", "vflip#2", "rotate-left#2", "rotate-right#2", "<->", "save#2", "save-all", "undo#2", "quit#2"] CreateButtons(aButton, cTooltip, panToolbarBrowser) @@ -436,6 +437,17 @@ Private Sub Action(sAction As String) Dim iPos As Integer + Select Case sAction + + Case "usb" + SetMode("") + Dialog.Title = ("Select photo directory") + If Dialog.SelectDirectory() Then Return + + End Select + + Inc Application.Busy + iPos = RInStr(sAction, "#") If iPos Then sAction = Left(sAction, iPos - 1) @@ -481,21 +493,16 @@ Private Sub Action(sAction As String) Me.Close Case "balance", "scissors", "resize" - If Not $hImage Then Return + 'If Not $hImage Then Return SetMode(sAction) Case "usb" - SetMode("") - Dialog.Title = ("Select photo directory") - If Dialog.SelectDirectory() Then Return SetDir(Dialog.Path) Case "undo" If Not $hImage Then - Inc Application.Busy - ivwImage.MoveFirst While ivwImage.Available If ivwImage.Item.Selected Then @@ -508,19 +515,16 @@ Private Sub Action(sAction As String) FillImageBrowser(True) $hImage = Null - Dec Application.Busy Else SetMode("") If $hUndoStack.Count Then - Inc Application.Busy $hImage = $hUndoStack[$hUndoStack.Max] $hUndoStack.Remove($hUndoStack.Max) $bModify = $hUndoStack.Count > 0 If Not $bModify Then RemoveImage UpdateZoom - Dec Application.Busy Else LoadImage(True) RemoveImage @@ -530,23 +534,15 @@ Private Sub Action(sAction As String) Case "save" - If Not $hImage Then + If Not $hImage Then - Inc Application.Busy - - ivwImage.MoveFirst - While ivwImage.Available - 'If ivwImage.Item.Selected Then - $iIndex = CInt(ivwImage.Item.Key) - GetImage + $iIndex = CInt(ivwImage.Key) + $sPath = CACHE_DIR &/ File.Name($aPath[$iIndex]) + If Exist($sPath) Then SaveImageDefinitely - 'Endif - ivwImage.MoveNext - Wend - - FillImageBrowser(True) + FillImageBrowser(True) + Endif $hImage = Null - Dec Application.Busy Else @@ -555,12 +551,25 @@ Private Sub Action(sAction As String) Endif + Case "save-all" + + ivwImage.MoveFirst + While ivwImage.Available + 'If ivwImage.Item.Selected Then + $iIndex = CInt(ivwImage.Item.Key) + GetImage + SaveImageDefinitely + 'Endif + ivwImage.MoveNext + Wend + + FillImageBrowser(True) + $hImage = Null + Case Else If Not $hImage Then - Inc Application.Busy - ivwImage.MoveFirst While ivwImage.Available If ivwImage.Item.Selected Then @@ -584,7 +593,6 @@ Private Sub Action(sAction As String) FillImageBrowser(True) $hImage = Null - Dec Application.Busy Else @@ -605,7 +613,7 @@ Private Sub Action(sAction As String) $hImage = $hImage.Rotate(Pi(-0.5)) Case "oil" PushUndo() - $hImage = ImageMagick("-paint 4") '$hImage.OilPaint() + $hImage = ImageMagick("-paint " & CStr(Max(3, Min($hImage.W, $hImage.H) \ 256))) Case "magic" PushUndo() $hImage = ImageMagick("-auto-gamma -auto-level") @@ -637,6 +645,8 @@ Private Sub Action(sAction As String) End Select + Dec Application.Busy + End Public Sub svwImage_MouseDown() @@ -787,11 +797,13 @@ End Public Sub Stretch(W As Integer, H As Integer) + Inc Application.Busy $hImage = $hImage.Stretch(W, H) $bModify = True $hTemp = $hImage Me.End SetZoom(0) + Dec Application.Busy End @@ -947,14 +959,22 @@ Private Sub FillImageBrowser(Optional bNoWait As Boolean) Dim I As Integer Dim hImage As Image Dim sText As String + Dim fLastTime As Float + Dim sKey As String If $bReloadFilm Then Inc Application.Busy + fLastTime = Timer + Try Mkdir CACHE_DIR + + sKey = ivwImage.Key + ivwImage.Clear ivwImage.GridSize = 280 \ Desktop.Scale + For I = 0 To $aPath.Max Try hImage = GetThumb($sDir &/ $aPath[i]) @@ -964,12 +984,17 @@ Private Sub FillImageBrowser(Optional bNoWait As Boolean) Endif sText = File.Name($aPath[I]) ivwImage.Add(I, sText, hImage.Picture) - If Not bNoWait Then Wait + If (Timer - fLastTime) > 1 Then + fLastTime = Timer + Wait + Endif Next + Try ivwImage.Key = sKey + Dec Application.Busy $bReloadFilm = False - + Endif If ivwImage.Count Then diff --git a/examples/examples/Image/PhotoTouch/save-all.png b/examples/examples/Image/PhotoTouch/save-all.png new file mode 100644 index 0000000000000000000000000000000000000000..75ade4609c4521594ceebed78cc98c575a84a6d3 GIT binary patch literal 1402 zcmV-=1%>*FP)Px)G)Y83RCwC$n_oy|RUF4ZGtTZfEiJ+zj3jDcqgaMpJ=CVF(Mr~Cgl3T?V)QW3 zA0*JHmYgRk^kG0B6bYGNWuyJmwmz(_m^*|C*^WfuB$5tWv=$l~;`sOUFyr9N+&kkq z_v&0{zHngXp5s0D_wk%_f4|>3qZ2|Pp_4#4Py@UKJjvl}6&MG`0_7)QQ|V50VE|47 z{lM$MDUwV7051bSs|6qf_$pw0vT6l*6>uqaL;WrY;EN>R3vX0w^*=4MJuOXZr>0G}k> zkr1L+NXX~&iTwP00UT*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