[DEVELOPMENT ENVIRONMENT]

* NEW: A new panel in the option dialog that allows to define which files
  must be ignored when creating a source package or an installation 
  package.

[INTERPRETER]
* BUG: Fix String.Mid$() when the third argument goes after the string 
  length.

[GB.FORM]
* NEW: IconPanel now uses a GridView and not an IconView anymore.
* BUG: GridView.Mouse property now works as expected.


git-svn-id: svn://localhost/gambas/trunk@4528 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-03-03 02:17:24 +00:00
parent 7dcd32d1b6
commit fb26ef792f
18 changed files with 1469 additions and 1260 deletions

View file

@ -375,7 +375,7 @@ msgstr ""
#: FGotoLine.form:23 FHelpBrowser.form:61 FIconEditor.class:1415
#: FList.form:121 FMain.class:200 FMakeInstall.class:336 FMenu.form:378
#: FNewConnection.form:255 FNewTable.form:86 FNewTranslation.form:21
#: FOpenProject.form:174 FOption.class:618 FPasteSpecial.form:77
#: FOpenProject.form:174 FOption.class:634 FPasteSpecial.form:77
#: FPasteTable.form:107 FPropertyComponent.form:221 FPropertyProject.form:691
#: FReportBorderChooser.form:48 FReportBrushChooser.form:34
#: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28
@ -531,7 +531,7 @@ msgstr ""
#: FCommit.form:109 FConflict.form:71 FConnectionEditor.form:391
#: FEditor.form:128 FForm.form:211 FIconEditor.form:87 FImageEditor.form:99
#: FOption.form:611 FOutput.form:41 FTextEditor.form:84
#: FOption.form:617 FOutput.form:41 FTextEditor.form:84
msgid "Undo"
msgstr ""
@ -760,7 +760,7 @@ msgid "Run query"
msgstr ""
#: FConnectionEditor.form:450 FForm.form:255 FMain.class:200
#: FNewConnection.class:325 FOption.class:765 FTranslate.class:636
#: FNewConnection.class:325 FOption.class:781 FTranslate.class:636
msgid "Delete"
msgstr ""
@ -1177,7 +1177,7 @@ msgstr ""
msgid "Debug"
msgstr ""
#: FDebugInfo.form:58 FMain.form:1004 FOption.form:568 FSearch.class:94
#: FDebugInfo.form:58 FMain.form:1004 FOption.form:574 FSearch.class:94
msgid "Console"
msgstr ""
@ -1197,7 +1197,8 @@ msgstr ""
msgid "Add expression"
msgstr ""
#: FDebugInfo.form:119 FMakeInstall.form:548 FPropertyComponent.form:184
#: FDebugInfo.form:119 FMakeInstall.form:548 FOption.form:965
#: FPropertyComponent.form:184
msgid "&Add"
msgstr ""
@ -1205,7 +1206,7 @@ msgstr ""
msgid "Remove current expression"
msgstr ""
#: FDebugInfo.form:127 FMain.form:759 FMakeInstall.form:554 FOption.form:821
#: FDebugInfo.form:127 FMain.form:759 FMakeInstall.form:554 FOption.form:823
#: FPropertyComponent.form:190 FPropertyProject.form:432
msgid "&Remove"
msgstr ""
@ -1250,7 +1251,7 @@ msgstr ""
msgid "Search again"
msgstr ""
#: FDebugInfo.form:232
#: FDebugInfo.form:232 FOption.class:917
msgid "Reset"
msgstr ""
@ -1258,11 +1259,11 @@ msgstr ""
msgid "Show search window"
msgstr ""
#: FDebugInfo.form:282 FSearch.class:467 FTranslate.class:597
#: FDebugInfo.form:281 FSearch.class:467 FTranslate.class:597
msgid "Search string cannot be found."
msgstr ""
#: FDebugInfo.form:315
#: FDebugInfo.form:314
msgid "Stack backtrace"
msgstr ""
@ -1275,7 +1276,7 @@ msgid "Function"
msgstr ""
#: FDebugInfo.class:57 FIconEditor.form:200 FImportTable.class:68
#: FOption.form:382
#: FOption.form:388
msgid "Line"
msgstr ""
@ -1296,7 +1297,7 @@ msgid "Do you want to clear the expression list ?"
msgstr ""
#: FDebugInfo.class:533 FIconEditor.class:1415 FList.class:155
#: FOption.class:618 FOutput.form:79
#: FOption.class:634 FOutput.form:79
msgid "Clear"
msgstr ""
@ -1416,7 +1417,7 @@ msgstr ""
msgid "Paste as comments"
msgstr ""
#: FEditor.form:341 FOption.form:343
#: FEditor.form:341 FOption.form:349
msgid "Editor"
msgstr ""
@ -2443,7 +2444,7 @@ msgstr ""
msgid "Refresh project"
msgstr ""
#: FMain.form:921 FOption.form:147
#: FMain.form:921 FOption.form:154
msgid "Preferences"
msgstr ""
@ -2992,7 +2993,7 @@ msgstr ""
msgid "This menu is too deep !"
msgstr ""
#: FMenu.class:947 Project.module:5053
#: FMenu.class:947 Project.module:5056
msgid "modified"
msgstr ""
@ -3140,282 +3141,294 @@ msgstr ""
msgid "Quick"
msgstr ""
#: FOption.form:159
#: FOption.form:166
msgid "Foreground color..."
msgstr ""
#: FOption.form:163
#: FOption.form:170
msgid "Background color..."
msgstr ""
#: FOption.form:170
#: FOption.form:177
msgid "Bold"
msgstr ""
#: FOption.form:174
#: FOption.form:181
msgid "Italic"
msgstr ""
#: FOption.form:178
#: FOption.form:185
msgid "Underline"
msgstr ""
#: FOption.form:188
#: FOption.form:195
msgid "Interface"
msgstr ""
#: FOption.form:198
#: FOption.form:205
msgid "Font size"
msgstr ""
#: FOption.form:204
#: FOption.form:211
msgid "Normal"
msgstr ""
#: FOption.form:204
#: FOption.form:211
msgid "Small"
msgstr ""
#: FOption.form:204
#: FOption.form:211
msgid "Tiny"
msgstr ""
#: FOption.form:215
#: FOption.form:222
msgid "Tabstrip font size"
msgstr ""
#: FOption.form:232
#: FOption.form:239
msgid "Toolbox size"
msgstr ""
#: FOption.form:249
#: FOption.form:256
msgid "Sort properties"
msgstr ""
#: FOption.form:255 FPropertyComponent.form:90 FPropertyProject.form:285
#: FOption.form:262 FPropertyComponent.form:90 FPropertyProject.form:285
msgid "No"
msgstr ""
#: FOption.form:255 FPropertyComponent.form:90 FPropertyProject.form:285
#: FOption.form:262 FPropertyComponent.form:90 FPropertyProject.form:285
msgid "Yes"
msgstr ""
#: FOption.form:270
#: FOption.form:277
msgid "Minimize at runtime"
msgstr ""
#: FOption.form:291
#: FOption.form:298
msgid "Icon theme"
msgstr ""
#: FOption.form:308
#: FOption.form:314
msgid "Use utility windows"
msgstr ""
#: FOption.form:329
#: FOption.form:335
msgid "Always display optional messages"
msgstr ""
#: FOption.form:353
#: FOption.form:359
msgid "Default tab size"
msgstr ""
#: FOption.form:365 FPropertyProject.form:260
#: FOption.form:371 FPropertyProject.form:260
msgid "space(s)"
msgstr ""
#: FOption.form:376
#: FOption.form:382
msgid "Procedure separation"
msgstr ""
#: FOption.form:382 FProperty.class:744
#: FOption.form:388 FProperty.class:744
msgid "None"
msgstr ""
#: FOption.form:382
#: FOption.form:388
msgid "Blend"
msgstr ""
#: FOption.form:382 MTheme.module:6
#: FOption.form:388 MTheme.module:6
msgid "Background"
msgstr ""
#: FOption.form:393
#: FOption.form:399
msgid "Highlight current line"
msgstr ""
#: FOption.form:414
#: FOption.form:420
msgid "Highlight modified lines"
msgstr ""
#: FOption.form:435
#: FOption.form:441
msgid "Show line numbers"
msgstr ""
#: FOption.form:456
#: FOption.form:462
msgid "Show spaces at end of line with dots"
msgstr ""
#: FOption.form:477
#: FOption.form:483
msgid "Fold procedures by default"
msgstr ""
#: FOption.form:498
#: FOption.form:504
msgid "Keywords in upper case"
msgstr ""
#: FOption.form:519
#: FOption.form:525
msgid "Control structure automatic completion"
msgstr ""
#: FOption.form:533
#: FOption.form:539
msgid "Style"
msgstr ""
#: FOption.form:539
#: FOption.form:545
msgid "Fonts"
msgstr ""
#: FOption.form:581
#: FOption.form:587
msgid "Theme"
msgstr ""
#: FOption.form:599
#: FOption.form:605
msgid "Import theme"
msgstr ""
#: FOption.form:605
#: FOption.form:611
msgid "Export theme"
msgstr ""
#: FOption.form:627
#: FOption.form:633
msgid "Applications"
msgstr ""
#: FOption.form:637
#: FOption.form:643
msgid "Browser"
msgstr ""
#: FOption.form:654
#: FOption.form:659
msgid "Terminal"
msgstr ""
#: FOption.form:671
#: FOption.form:675
msgid "Image editor"
msgstr ""
#: FOption.form:688
#: FOption.form:691
msgid "Quiet external commands"
msgstr ""
#: FOption.form:702 MTheme.module:6
#: FOption.form:705 MTheme.module:6
msgid "Help"
msgstr ""
#: FOption.form:712
#: FOption.form:715
msgid "Display property help"
msgstr ""
#: FOption.form:733
#: FOption.form:736
msgid "Show tooltips"
msgstr ""
#: FOption.form:754
#: FOption.form:757
msgid "Show documentation in popups"
msgstr ""
#: FOption.form:775
#: FOption.form:778
msgid "Clear documentation cache"
msgstr ""
#: FOption.form:780
#: FOption.form:783
msgid "Code snippets"
msgstr ""
#: FOption.form:785
#: FOption.form:788
msgid "Activate code snippets"
msgstr ""
#: FOption.form:807 FTranslate.form:299
#: FOption.form:809 FTranslate.form:299
msgid "&New..."
msgstr ""
#: FOption.form:814
#: FOption.form:816
msgid "&Edit..."
msgstr ""
#: FOption.form:829
#: FOption.form:831
msgid "Re&set"
msgstr ""
#: FOption.form:837
#: FOption.form:839
msgid "E&xport..."
msgstr ""
#: FOption.form:845
#: FOption.form:847
msgid "&Import..."
msgstr ""
#: FOption.form:851
#: FOption.form:853
msgid "Code formatting"
msgstr ""
#: FOption.form:861
#: FOption.form:863
msgid "Format on load & save"
msgstr ""
#: FOption.form:882
#: FOption.form:884
msgid "Indent local variable declaration"
msgstr ""
#: FOption.form:903
#: FOption.form:905
msgid "Remove useless spaces at end of line"
msgstr ""
#: FOption.form:924
#: FOption.form:926
msgid "Keep successive void lines"
msgstr ""
#: FOption.class:59
#: FOption.form:940
msgid "Packages"
msgstr ""
#: FOption.form:945
msgid "Ignore these files in source packages"
msgstr ""
#: FOption.class:72
msgid "Select a theme"
msgstr ""
#: FOption.class:60
#: FOption.class:73
msgid "Desktop"
msgstr ""
#: FOption.class:61 FTranslate.class:135
#: FOption.class:74 FTranslate.class:135
msgid "(Default)"
msgstr ""
#: FOption.class:113
#: FOption.class:126
msgid "Define..."
msgstr ""
#: FOption.class:149
#: FOption.class:165
msgid "Gambas highlight theme files"
msgstr ""
#: FOption.class:150
#: FOption.class:166
msgid "Export a theme file"
msgstr ""
#: FOption.class:308
#: FOption.class:324
msgid "Select a theme file"
msgstr ""
#: FOption.class:331
#: FOption.class:347
msgid "You need to restart the application to see your changes."
msgstr ""
#: FOption.class:618
#: FOption.class:634
msgid "Do you really want to clear the documentation cache?"
msgstr ""
#: FOption.class:765
#: FOption.class:781
msgid "Do you really want to delete this snippet?"
msgstr ""
#: FOption.class:917
msgid "Do you really want to reset the list to its default value?"
msgstr ""
#: FOutput.form:30
msgid "Console - Gambas"
msgstr ""
@ -5817,39 +5830,39 @@ msgid ""
"already exists."
msgstr ""
#: Project.module:4143
#: Project.module:4146
msgid "Create source package"
msgstr ""
#: Project.module:4144
#: Project.module:4147
msgid "Source packages"
msgstr ""
#: Project.module:4421
#: Project.module:4424
msgid "Cannot copy file &1."
msgstr ""
#: Project.module:4470
#: Project.module:4473
msgid "Cannot create link &1."
msgstr ""
#: Project.module:4487
#: Project.module:4490
msgid "Cannot move a directory inside itself."
msgstr ""
#: Project.module:4555
#: Project.module:4558
msgid "Cannot move file &1."
msgstr ""
#: Project.module:5204
#: Project.module:5207
msgid "Project cleanup..."
msgstr ""
#: Project.module:5210
#: Project.module:5213
msgid "Project files conversion..."
msgstr ""
#: Project.module:5240
#: Project.module:5243
msgid "Unable to convert &1"
msgstr ""

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -66,7 +66,7 @@ Public Sub _new()
.Columns[1].Text = ("Line")
.Columns[2].Width = Desktop.Scale * 6
.Columns[2].Text = ("Col.")
.Columns[3].Width = 1024
.Columns[3].Width = 32
.Columns[3].Text = ("Text")
End With
@ -1136,12 +1136,6 @@ Public Sub IsSearchListVisible() As Boolean
End
Public Sub Form_Resize()
gvwFind.Columns[3].Width = Me.W - gvwFind.Columns[3].X - 8
End
Public Sub btnClearSearch_Click()
FSearch.ResetBrowse

View file

@ -197,9 +197,8 @@
Visible = False
Mode = Select.Single
Header = GridView.Horizontal
Scrollbar = Scroll.Vertical
ScrollBar = Scroll.Vertical
Border = False
AutoResize = False
Resizable = False
}
{ lblNotFound TextLabel

View file

@ -47,6 +47,19 @@ Private Sub ReadConfig()
End
Private Sub LoadIgnoreFiles()
Dim aIgnore As String[]
Dim iInd As Integer
aIgnore = Project.GetIgnoreFiles()
tvwIgnore.Rows.Count = aIgnore.Count
For iInd = 0 To aIgnore.Max
tvwIgnore[iInd, 0].Text = aIgnore[iInd]
Next
End
Public Sub _new()
@ -122,6 +135,9 @@ Public Sub _new()
gvwSnippet.Columns.Count = 2
gvwSnippet.Columns[0].Width = Desktop.Scale * 8
tvwIgnore.Columns.Count = 1
LoadIgnoreFiles
Me.Utility = Settings["/UseUtilityWindows", 1]
End
@ -824,3 +840,83 @@ Public Sub cmbFormatOnLoad_Click()
Settings["/FormatCode/FormatOnLoad"] = cmbFormatOnLoad.Index = 1
End
Public Sub tvwIgnore_Click()
tvwIgnore.Edit
End
Public Sub tvwIgnore_Save(Row As Integer, Column As Integer, Value As String)
Value = Trim(Value)
If Not Value Then
tvwIgnore.Rows.Remove(Row)
Else
tvwIgnore[Row, Column].Text = Value
Endif
SaveIgnoreFiles
End
Public Sub tvwIgnore_Insert()
btnInsertIgnore_Click
End
Public Sub btnInsertIgnore_Click()
If tvwIgnore.Rows.Count = 0 Or If Trim(tvwIgnore[tvwIgnore.Rows.Max, 0].Text) Then
Inc tvwIgnore.Rows.Count
Endif
tvwIgnore.MoveTo(tvwIgnore.Rows.Max, 0)
tvwIgnore.Edit
End
Public Sub btnRemoveIgnore_Click()
If tvwIgnore.Row < 0 Then Return
tvwIgnore.Save
tvwIgnore.Rows.Remove(tvwIgnore.Row)
SaveIgnoreFiles
tvwIgnore.Edit
End
Public Sub tvwIgnore_Change()
While tvwIgnore.Rows.Count
If Trim(tvwIgnore[tvwIgnore.Rows.Max, 0].Text) Or tvwIgnore.Row = tvwIgnore.Rows.Max Then Return
Dec tvwIgnore.Rows.Count
Wend
End
Private Sub SaveIgnoreFiles()
Dim aIgnore As New String[]
Dim I As Integer
Dim sIgnore As String
For I = 0 To tvwIgnore.Rows.Max
sIgnore = Trim(tvwIgnore[I, 0].Text)
If Not sIgnore Then Continue
aIgnore.Add(sIgnore)
Next
Settings["/IgnoreFiles"] = aIgnore
End
Public Sub btnResetIgnore_Click()
If Message.Warning(("Do you really want to reset the list to its default value?"), ("Cancel"), ("Reset")) = 1 Then Return
Settings["/IgnoreFiles"] = ""
LoadIgnoreFiles
End

View file

@ -1,7 +1,7 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,92,57)
MoveScaled(0,0,92,56)
Action = "option"
Text = ("Preferences")
Icon = Picture["icon:/small/options"]
@ -31,10 +31,10 @@
}
}
{ ipnOption IconPanel
MoveScaled(1,1,90,55)
MoveScaled(1,1,90,54)
Arrangement = Arrange.Vertical
Spacing = True
Count = 7
Count = 8
Index = 0
Text = ("Interface")
Picture = Picture["icon:/large/menu"]
@ -125,7 +125,6 @@
{ cmbIconTheme ComboBox
MoveScaled(48,0,18,4)
ReadOnly = True
List = []
}
}
{ HBox26 HBox
@ -410,7 +409,6 @@
{ cmbBrowser ComboBox
MoveScaled(48,0,18,4)
ReadOnly = True
List = []
}
}
{ HBox2 HBox
@ -424,7 +422,6 @@
{ cmbTerminal ComboBox
MoveScaled(48,0,18,4)
ReadOnly = True
List = []
}
}
{ HBox9 HBox
@ -438,7 +435,6 @@
{ cmbImageEditor ComboBox
MoveScaled(48,0,18,4)
ReadOnly = True
List = []
}
}
{ HBox10 HBox
@ -537,7 +533,6 @@
MoveScaled(0,0,33,46)
Expand = True
Mode = Select.Single
Scrollbar = Scroll.Vertical
}
{ VBox2 VBox
MoveScaled(46,1,17,45)
@ -654,6 +649,44 @@
MoveScaled(59,0,7,4)
}
}
Index = 7
Text = ("Packages")
Picture = Picture["icon:/32/archive"]
{ Label33 Label
MoveScaled(0,1,66,3)
Text = ("Ignore these files in source packages")
}
{ HBox34 HBox
MoveScaled(1,6,65,46)
Expand = True
Spacing = True
{ tvwIgnore TableView
MoveScaled(2,2,39,41)
Expand = True
}
{ VBox1 VBox
MoveScaled(46,1,17,41)
Spacing = True
{ btnInsertIgnore Button
MoveScaled(0,0,17,4)
AutoResize = True
Text = ("&Add")
Picture = Picture["icon:/small/new"]
}
{ btnRemoveIgnore Button
MoveScaled(0,5,17,4)
AutoResize = True
Text = ("&Remove")
Picture = Picture["icon:/small/delete"]
}
{ btnResetIgnore Button
MoveScaled(0,10,17,4)
AutoResize = True
Text = ("Re&set")
Picture = Picture["icon:/small/undo"]
}
}
}
Index = 0
}
}

View file

@ -4102,6 +4102,7 @@ Public Sub MakeSourcePackageTo(sPath As String)
Dim sCmd As String
Dim sOpt As String
Dim sIgnore As String
Inc Application.Busy
@ -4124,7 +4125,9 @@ Public Sub MakeSourcePackageTo(sPath As String)
sCmd &= " --exclude=" & Shell$(".lang/*.pot")
sCmd &= " --exclude=" & Shell$(".lang/.pot")
sCmd &= " --exclude=" & Shell$(".xvpics")
sCmd &= " --exclude=" & Shell$(".svn")
For Each sIgnore In GetIgnoreFiles()
sCmd &= " --exclude=" & Shell$(sIgnore)
Next
sCmd &= " " & Shell$(File.Name(Project.Dir)) & " > /dev/null"
Shell sCmd Wait
@ -5241,3 +5244,9 @@ Catch
Return True
End
Public Sub GetIgnoreFiles() As String[]
Return Settings["/IgnoreFiles", [".bzr", ".bzrignore", ".hg", ".hgignore", ".hgtags", "hgrc", ".git", ".gitignore", ".svn", "CVS", "CVSROOT"]]
End

View file

@ -1133,6 +1133,14 @@ Current
r
_GridView_Cell
Font
p
Font
Mouse
p
i
ScrollX
p
i
@ -1432,19 +1440,19 @@ _get
m
_IconPanelContainer
(Index)i
_GetIconView
_GetView
m
IconView
GridView
_GetIndex
m
i
(hCont)_IconPanelContainer;
IconView_Select
View_Select
m
IconView_MouseWheel
View_MouseWheel
m

View file

@ -24,6 +24,9 @@ Property AutoResize As Boolean
Property Header As Integer
Property ShowCursor As Boolean
Property Read Current As _GridView_Cell
Property Font As Font
Property Mouse As Integer
'Property RowCount As Integer
'Property ColumnCount As Integer
@ -54,6 +57,7 @@ Private $iMode As Integer
Private $iHeader As Integer
Private $bShowCursor As Boolean
Private $bAutoResize As Boolean = True
Private $iDefaultMouse As Integer = Mouse.Default
Private $iRow As Integer
Private $iCol As Integer
@ -356,8 +360,8 @@ Public Sub ScrollArea_Draw()
' Header limits
If $iHeader And Horizontal Then Draw.FillRect(0, $hColumns.Height + F - 1, $hView.ClientW, 1, iGrid)
If $iHeader And Vertical Then Draw.FillRect($hRows.Width + F - 1, 0, 1, $hView.ClientH, iGrid)
If $iHeader And Horizontal Then Draw.FillRect(0, $hColumns.Height + F - 1, $hView.ClientW, 1, Color.LightForeground)
If $iHeader And Vertical Then Draw.FillRect($hRows.Width + F - 1, 0, 1, $hView.ClientH, Color.LightForeground)
If $hColumns.Count = 0 Or If $hRows.Count = 0 Then Return
@ -574,7 +578,7 @@ Public Sub ScrollArea_MouseMove()
Return
Endif
iMouse = Mouse.Default
iMouse = $iDefaultMouse 'Mouse.Default
$iRowResize = -1
$iColResize = -1
@ -1435,3 +1439,29 @@ Public Sub _InsertRows(Start As Integer, Length As Integer)
End
'
Private Function Font_Read() As Font
Return Super.Font
End
Private Sub Font_Write(Value As Font)
Super.Font = Value
_ResizeContents
End
Private Function Mouse_Read() As Integer
Return Super.Mouse
End
Private Sub Mouse_Write(Value As Integer)
Super.Mouse = Value
$iDefaultMouse = Value
End

View file

@ -139,11 +139,12 @@ Public Sub _Layout()
If NX = 0 Then
W = $aColumns[N].Width + VW - W
If W > 0 Then
$aColumns[N]._W = W
Endif
Else If W < hView.ClientW Then
Else If W < VW Then
For I = 0 To N
If $aColumns[I].Expand Then

View file

@ -18,7 +18,7 @@ Property Font As Font
Property TextFont As Font
Property Border As Boolean
Private $hIconView As IconView
Private $hView As GridView
Private $aCont As New _IconPanelContainer[]
Private $iCurrent As Integer = -1
@ -31,12 +31,15 @@ Public Sub _new()
Me.Arrangement = Arrange.Horizontal
Me.Spacing = True
$hIconView = New IconView(Me) As "IconView"
$hIconView.Orientation = Arrange.Horizontal
$hIconView.IconLines = 2
$hIconView.Width = Desktop.Scale * MIN_WIDTH_PANEL
$hIconView.Mouse = Mouse.Pointing
$hIconView.ScrollBar = Scroll.None
$hView = New GridView(Me) As "View"
'$hView.Orientation = Arrange.Horizontal
'$hView.IconLines = 2
$hView.Width = Desktop.Scale * MIN_WIDTH_PANEL
$hView.Mouse = Mouse.Pointing
$hView.Columns.Count = 1
$hView.Mode = Select.Single
$hView.Grid = False
'$hView.ScrollBar = Scroll.None
$hPanel = New Panel(Me) As "Panel"
$hPanel.Expand = True
@ -60,17 +63,26 @@ End
Public Sub _UpdateIconViewWidth()
Dim iInd As Integer
Dim W As Integer
Dim W, H, WC As Integer
W = Desktop.Scale * MIN_WIDTH_PANEL
For iInd = 0 To $aCont.Max
W = Max(W, $hIconView.Font.TextWidth($hIconView[iInd].Text) + $hIconView.IconSize + Desktop.Scale * 4)
WC = $hView.Font.TextWidth($hView[iInd, 0].Text) + Desktop.Scale * 4
If $hView[iInd, 0].Picture Then WC += $hView[iInd, 0].Picture.Width + Desktop.Scale
W = Max(W, WC)
H = Max(H, $hView.Font.TextHeight($hView[iInd, 0].Text))
If $hView[iInd, 0].Picture Then H = Max(H, $hView[iInd, 0].Picture.Height)
$hView[iInd, 0].Padding = Desktop.Scale
Next
$hIconView.W = Min(W, Me.Width / 2)
$hView.Rows.H = H + Desktop.Scale * 2
$hView.W = Min(W, Me.Width / 2)
End
@ -103,7 +115,7 @@ Private Sub Count_Write(iCount As Integer)
For iInd = $aCont.Max To iCount Step -1
$aCont[iInd].Delete
$hIconView.Remove(iInd)
$hView.Rows.Remove(iInd)
If iInd <= iCurrent Then Dec iCurrent
Next
@ -114,11 +126,16 @@ Private Sub Count_Write(iCount As Integer)
Else
$hView.Rows.Count = iCount
For iInd = $aCont.Count To iCount - 1
hToolbar = New _IconPanelContainer($hPanel) As "_IconPanelContainer"
'hToolbar.Text = "Toolbar " & CInt(iInd)
$aCont.Add(hToolbar)
$hIconView.Add(iInd, "Item " & CStr(iInd))
'$hView.Add(iInd, "Item " & CStr(iInd))
With $hView[iInd, 0]
.Text = "Item " & CStr(iInd)
End With
_UpdateIconViewWidth
Next
'ME.Container = hCont
@ -144,7 +161,7 @@ Private Sub Index_Write(iIndex As Integer)
Me._Container = $aCont[iIndex]
$iCurrent = iIndex
$hIconView[$iCurrent].Selected = True
$hView.Rows[$iCurrent].Selected = True
UpdateContainer
Raise Click
@ -228,19 +245,19 @@ End
Private Function TextFont_Read() As Font
Return $hIconView.Font
Return $hView.Font
End
Private Sub TextFont_Write(Value As Font)
$hIconView.Font = Value
$hView.Font = Value
End
Public Sub _GetIconView() As IconView
Public Sub _GetView() As GridView
Return $hIconView
Return $hView
End
@ -250,14 +267,13 @@ Public Sub _GetIndex(hCont As _IconPanelContainer) As Integer
End
Public Sub IconView_Select()
Public Sub View_Select()
If Not $hIconView.Key Then Return
Index_Write(CInt($hIconView.Key))
Index_Write($hView.Row)
End
Public Sub IconView_MouseWheel()
Public Sub View_MouseWheel()
If Mouse.Delta < 0 And If $iCurrent < $aCont.Max Then
Index_Write($iCurrent + 1)

View file

@ -14,9 +14,9 @@ Private Sub GetIconPanel() As IconPanel
End
Private Sub GetIconView() As IconView
Private Sub GetView() As GridView
Return GetIconPanel()._GetIconView()
Return GetIconPanel()._GetView()
End
@ -34,26 +34,26 @@ End
Private Function Text_Read() As String
Try Return GetIconView()[GetIndex()].Text
Try Return GetView()[GetIndex(), 0].Text
End
Private Sub Text_Write(sText As String)
Try GetIconView()[GetIndex()].Text = sText
Try GetView()[GetIndex(), 0].Text = sText
GetIconPanel()._UpdateIconViewWidth
End
Private Function Picture_Read() As Picture
Try Return GetIconView()[GetIndex()].Picture
Try Return GetView()[GetIndex(), 0].Picture
End
Private Sub Picture_Write(hPict As Picture)
Try GetIconView()[GetIndex()].Picture = hPict
Try GetView()[GetIndex(), 0].Picture = hPict
GetIconPanel()._UpdateIconViewWidth
End

View file

@ -24,6 +24,7 @@
{ gvwView GridView
Move(42,63,287,273)
Font = Font["-2"]
Mouse = Mouse.Pointing
Expand = True
Mode = Select.Multiple
ShowCursor = True

View file

@ -5,7 +5,8 @@
Arrangement = Arrange.Vertical
Margin = True
{ ScrollArea1 ScrollArea
MoveScaled(4,2,38,25)
MoveScaled(4,2,35,25)
Mouse = Mouse.Pointing
}
{ ScrollView1 ScrollView
MoveScaled(5,29,34,18)

View file

@ -1,20 +1,9 @@
' Gambas class file
Private icwView As IconPanel
Public Sub Form_Open()
Dim I As Integer
Dim hPanel As Panel
Dim hLabel As Label
For I = 1 To 5
hPanel = New Panel(ListContainer1)
hPanel.H = 40
hPanel.Arrangement = Arrange.Fill
hPanel.Padding = 4
hPanel.Name = "Label" & I
hLabel = New Label(hPanel)
hLabel.Text = "Label #" & I
Next
icwView = New IconPanel(Me)
End

View file

@ -2,8 +2,6 @@
{ Form Form
MoveScaled(0,0,53,71)
Arrangement = Arrange.Vertical
{ ListContainer1 ListContainer
MoveScaled(4,7,34,45)
}
Arrangement = Arrange.Fill
Margin = True
}

View file

@ -213,7 +213,11 @@ static int utf8_get_pos(const char *str, int len, int index)
}
for (i = UTF8_POS_COUNT - 1; i < index; i++)
{
if (pos >= len)
return len;
pos += utf8_get_char_length(str[pos]);
}
return pos;
}
@ -266,7 +270,7 @@ static void String_Mid(ushort code)
{
char *str;
int start, length;
int len, ulen;
int len, ulen, upos;
bool null;
SUBR_ENTER();
@ -311,7 +315,12 @@ static void String_Mid(ushort code)
if (length == 1)
ulen = utf8_get_char_length(str[ulen]);
else
ulen = utf8_get_pos(str, len, start + length) - ulen;
{
upos = utf8_get_pos(str, len, start + length);
if (upos > len)
upos = len;
ulen = upos - ulen;
}
}
if (ulen <= 0)