Commit c9ca5ab9 authored by Benoît Minisini's avatar Benoît Minisini

[CONFIGURATION]

* NEW: Update copyright year to 2013.

[GB.FORM]
* NEW: ImageView is a new control that allows to view an image inside a 
  scrolled view, at different zoom levels.
* BUG: FileProperties now works correctly if 'gb.desktop' is not used.
* NEW: The FileProperties preview tab now uses an ImageView control and has
  a toolbar to zoom the preview.
* BUG: Add the 'linux' and 'gnu' icon in the stock icon list.


git-svn-id: svn://localhost/gambas/trunk@5770 867c0c6c-44f3-4631-809d-bfa615b0a4ec
parent d860a7a5
......@@ -949,7 +949,7 @@ C
_Properties
C
s
*,Border=True,Mode{Select.*},Dir,ShowDetailed,ShowHidden,ShowDirectory,ShowPreview
*,Border=True,Mode{Select.*}=Single,Dir,ShowDetailed,ShowHidden,ShowDirectory,ShowPreview
_DefaultEvent
C
s
......@@ -1244,6 +1244,65 @@ View_MouseWheel
m
#ImageView
UserControl
C
_Properties
C
s
*,Border=True
_DefaultSize
C
s
36,36
_Group
C
s
View
Border
p
b
Image
p
Image
Zoom
p
f
Design
p
b
_new
m
View_Arrange
m
View_Draw
m
View_MouseDown
m
View_MouseMove
m
Update
m
ZoomFit
m
#InputBox
C
......
......@@ -215,7 +215,7 @@ msgstr ""
msgid "&Remove"
msgstr ""
#: FEditBookmark.form:56 FFileProperties.form:206
#: FEditBookmark.form:56 FFileProperties.form:244
msgid "Close"
msgstr ""
......@@ -235,43 +235,43 @@ msgstr ""
msgid "Remove"
msgstr ""
#: FFileProperties.form:43
#: FFileProperties.form:49
msgid "General"
msgstr ""
#: FFileProperties.form:75
#: FFileProperties.form:81
msgid "Type"
msgstr ""
#: FFileProperties.form:87
#: FFileProperties.form:93
msgid "Directory"
msgstr ""
#: FFileProperties.form:99 FileView.class:102
#: FFileProperties.form:105 FileView.class:102
msgid "Size"
msgstr ""
#: FFileProperties.form:111 FileView.class:104
#: FFileProperties.form:117 FileView.class:104
msgid "Last modified"
msgstr ""
#: FFileProperties.form:123
#: FFileProperties.form:129
msgid "Permissions"
msgstr ""
#: FFileProperties.form:136
#: FFileProperties.form:142
msgid "Owner"
msgstr ""
#: FFileProperties.form:148
#: FFileProperties.form:154
msgid "Group"
msgstr ""
#: FFileProperties.form:159
#: FFileProperties.form:165
msgid "Preview"
msgstr ""
#: FFileProperties.form:181
#: FFileProperties.form:219
msgid "Errors"
msgstr ""
......@@ -279,35 +279,39 @@ msgstr ""
msgid "Symbolic link"
msgstr ""
#: FFileProperties.class:124
#: FFileProperties.class:94
msgid "Image"
msgstr ""
#: FFileProperties.class:127
msgid "&1 properties"
msgstr ""
#: FFileProperties.class:154 Main.module:46
#: FFileProperties.class:157 Main.module:46
msgid "&1 B"
msgstr ""
#: FFileProperties.class:159
#: FFileProperties.class:162
msgid "no file"
msgstr ""
#: FFileProperties.class:161
#: FFileProperties.class:164
msgid "one file"
msgstr ""
#: FFileProperties.class:163
#: FFileProperties.class:166
msgid "files"
msgstr ""
#: FFileProperties.class:167
#: FFileProperties.class:170
msgid "no directory"
msgstr ""
#: FFileProperties.class:169
#: FFileProperties.class:172
msgid "one directory"
msgstr ""
#: FFileProperties.class:171
#: FFileProperties.class:174
msgid "directories"
msgstr ""
......@@ -359,6 +363,10 @@ msgstr ""
msgid "Cannot rename file."
msgstr ""
#: Form3.form:19
msgid "1"
msgstr ""
#: Help.module:71
msgid "The '/' character is forbidden inside file or directory names."
msgstr ""
......
......@@ -220,6 +220,7 @@ msgstr "Répertoire parent"
msgid "OK"
msgstr "OK"
#: FDirChooser.form:186 FEditBookmark.class:109 FInputBox.form:49
#: FSidePanel.class:975 FWizard.form:54
msgid "Cancel"
msgstr "Annuler"
......@@ -384,6 +385,34 @@ msgstr "&Précédent"
msgid "Cannot rename file."
msgstr "Impossible de renommer le fichier."
#: Form3.form:14
msgid "ComboBox1"
msgstr ""
#: Form3.form:20
msgid "Élément 1"
msgstr ""
#: Form3.form:20
msgid "Élément 2"
msgstr ""
#: Form3.form:20
msgid "Élément 3"
msgstr ""
#: Form3.form:20
msgid "Élément 4"
msgstr ""
#: Form3.form:20
msgid "Élément 5"
msgstr ""
#: Form3.form:21
msgid "ComboBox2"
msgstr ""
#: Help.module:71
msgid "The '/' character is forbidden inside file or directory names."
msgstr "Le caractère '/' est interdit dans les noms de fichiers ou de répertoires."
......@@ -403,4 +432,3 @@ msgstr "&1 Gio"
#: Wizard.class:77
msgid "Step #&1"
msgstr "Étape n°&1"
......@@ -12,6 +12,7 @@ FileProperties
FileView
FontChooser
IconPanel
ImageView
InputBox
LCDLabel
ListContainer
......
# Gambas Project File 3.0
# Compiled with Gambas 3.4.90
Title=More controls for graphical components
Startup=Form3
Startup=Form2
Version=3.4.90
VersionFile=1
Component=gb.image
......@@ -9,7 +9,7 @@ Component=gb.gui
Component=gb.form
Component=gb.settings
Authors="Benoît Minisini"
Environment="GB_GUI=gb.qt4\nLANG=C\nLC_ALL=C"
Environment="GB_GUI=gb.qt4\nLANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8"
TabSize=2
Translate=1
Language=en
......
......@@ -5,7 +5,7 @@ Inherits UserControl
Class DesktopMime
Public Const _Properties As String = "*,Border=True,Mode{Select.*},Dir,ShowDetailed,ShowHidden,ShowDirectory,ShowPreview"
Public Const _Properties As String = "*,Border=True,Mode{Select.*}=Single,Dir,ShowDetailed,ShowHidden,ShowDirectory,ShowPreview"
Public Const _DefaultEvent As String = "Click"
Public Const _Group As String = "View"
......
......@@ -2,15 +2,15 @@
Class DesktopMime
Static Private $aImgExt As String[] = ["png", "jpg", "jpeg", "gif", "bmp", "xpm"]
Private $sPath As String
Private $iSize As Long
Private $hTask As Task
Private $sError As String
Private $bPreview As Boolean
Private $hPreview As Picture
Private $SX As Integer
Private $SY As Integer
Private $hPreview As Image
Private TAB_PREVIEW As Integer = 1
Private TAB_ERROR As Integer = 2
......@@ -80,7 +80,7 @@ Private Sub RefreshPath()
Else If IsDir($sPath) Then
picIcon.Picture = Picture["icon:/64/directory"]
lblType.Text = ("Directory")
Else
Else If Component.IsLoaded("gb.desktop") Then
hMime = DesktopMime.FromFile($sPath)
lblType.Text = String.UCaseFirst(hMime.GetComment())
Try picIcon.Picture = hMime.GetIcon(64).Picture
......@@ -89,7 +89,10 @@ Private Sub RefreshPath()
If hMime.Type Like "image/*" Then
tabInfo[TAB_PREVIEW].Visible = True
Endif
Else If $aImgExt.Exist(File.Ext($sPath), gb.IgnoreCase) Then
picIcon.Picture = Picture["icon:/64/image"]
lblType.Text = ("Image")
tabInfo[TAB_PREVIEW].Visible = True
Endif
Endif
......@@ -267,33 +270,76 @@ Public Sub tabInfo_Click()
If tabInfo.Index = TAB_PREVIEW Then
If Not $bPreview Then
$bPreview = True
Try $hPreview = Picture.Load($sPath)
Try $hPreview = Image.Load($sPath)
If Error Then
ShowError(Error.Text & "\n")
Else
sarPreview.ResizeContents($hPreview.W, $hPreview.H)
lblSizePreview.Text = CStr($hPreview.W) & " × " & CStr($hPreview.H)
imvPreview.Image = $hPreview
btnZoomFit.Value = True
Endif
Endif
Endif
End
Public Sub sarPreview_Draw()
Private Sub UpdateLabel()
lblSizePreview.Text = CStr($hPreview.W) & " × " & CStr($hPreview.H) & " (" & Format(imvPreview.Zoom, "0%") & ")"
End
Public Sub sldZoom_Change()
imvPreview.Zoom = 2 ^ (sldZoom.Value / 4)
UpdateLabel
End
Public Sub btnZoomNormal_Click()
btnZoomFit.Value = False
sldZoom.Value = 0
imvPreview.Zoom = 1
UpdateLabel
End
Public Sub btnZoomIn_Click()
If Not sldZoom.Enabled Then
btnZoomNormal_Click
Else
sldZoom.Value += 4
Endif
End
Public Sub btnZoomOut_Click()
If $hPreview Then Paint.DrawPicture($hPreview, - sarPreview.ScrollX, - sarPreview.ScrollY)
If Not sldZoom.Enabled Then
btnZoomNormal_Click
Else
sldZoom.Value -= 4
Endif
End
Public Sub sarPreview_MouseDown()
Public Sub btnZoomFit_Click()
$SX = sarPreview.ScrollX
$SY = sarPreview.ScrollY
If btnZoomFit.Value Then
imvPreview.ZoomFit
UpdateLabel
sldZoom.Enabled = False
Else
sldZoom.Enabled = True
sldZoom_Change
Endif
End
Public Sub sarPreview_MouseMove()
Public Sub imvPreview_Arrange()
sarPreview.Scroll($SX - (Mouse.X - Mouse.StartX), $SY - (Mouse.Y - Mouse.StartY))
If tabInfo.Index <> TAB_PREVIEW Then Return
If btnZoomFit.Value Then btnZoomFit_Click
End
......@@ -107,20 +107,46 @@
}
Index = 1
Text = ("Preview")
{ sarPreview ScrollArea
MoveScaled(5,5,32,24)
Mouse = Mouse.SizeAll
{ HBox2 HBox
MoveScaled(1,1,49,4)
{ sldZoom Slider
MoveScaled(0,0,8,4)
Expand = True
MinValue = -16
MaxValue = 16
Step = 10
}
{ btnZoomNormal ToolButton
MoveScaled(28,0,4,4)
Picture = Picture["icon:/small/zoom-normal"]
}
{ btnZoomIn ToolButton
MoveScaled(32,0,4,4)
Picture = Picture["icon:/small/zoom-in"]