diff --git a/app/src/gambas3/.project b/app/src/gambas3/.project index 18c712c3e..3a4adbb06 100644 --- a/app/src/gambas3/.project +++ b/app/src/gambas3/.project @@ -25,6 +25,7 @@ Component=gb.gui.qt.webkit Component=gb.net Component=gb.net.curl Component=gb.markdown +Component=gb.util Description="Integrated Development Environment for Gambas" Authors="Benoît Minisini\nFabien Bodard\nCharlie Reinl\nJosé Luis Redrejo\nRobert Rowe\nTobias Boege" TabSize=2 diff --git a/app/src/gambas3/.src/CRecentProject.class b/app/src/gambas3/.src/CRecentProject.class index fec3fc650..6a0788c94 100644 --- a/app/src/gambas3/.src/CRecentProject.class +++ b/app/src/gambas3/.src/CRecentProject.class @@ -11,7 +11,7 @@ Static Private $hSettings As Settings Public Const MAX_RECENT As Integer = 100 Public Path As String -Public Date As Date +Public ({Date}) As Date Public Sub _new(sPath As String, dDate As Date) diff --git a/app/src/gambas3/.src/Editor/Image/FImageEditor.class b/app/src/gambas3/.src/Editor/Image/FImageEditor.class index 7e5b233ee..43bf67a37 100644 --- a/app/src/gambas3/.src/Editor/Image/FImageEditor.class +++ b/app/src/gambas3/.src/Editor/Image/FImageEditor.class @@ -1406,44 +1406,42 @@ End ' ' End -Private Sub PaintImage(hImage As Image, X As Float, Y As Float, Optional fOpacity As Float = 1.0, Optional hRect As Rect) - - Dim fZoom As Float = imvImage.Zoom - Dim iZoom As Integer = CInt(fZoom) - Dim I, P, S As Integer - - If Not hImage Then Return - - If hRect Then - X += hRect.X * fZoom - Y += hRect.Y * fZoom - Else - hRect = Rect(0, 0, hImage.W, hImage.H) - Endif - - Paint.ZoomImage(hImage, fZoom, X, Y, Color.SetAlpha(Color.Black, 128), hRect, fOpacity) - - ' Paint.DrawImage(hImage, X, Y, hRect.W * fZoom, hRect.H * fZoom, fOpacity, hRect) 'hRect.W, hRect.H) - - ' If iZoom > 8 Then - ' - ' P = X - ' S = hRect.H * iZoom - ' For I = 0 To hRect.W - 1 - ' Paint.FillRect(P, Y, 1, S, Color.LightForeground) - ' P += iZoom - ' Next - ' - ' P = Y - ' S = hRect.W * iZoom - ' For I = 0 To hRect.H - 1 - ' Paint.FillRect(X, P, S, 1, Color.LightForeground) - ' P += iZoom - ' Next - ' - ' Endif - -End +' Private Sub PaintImage(hImage As Image, X As Float, Y As Float, Optional fOpacity As Float = 1.0, Optional hRect As Rect) +' +' Dim fZoom As Float = imvImage.Zoom +' +' If Not hImage Then Return +' +' If hRect Then +' X += hRect.X * fZoom +' Y += hRect.Y * fZoom +' Else +' hRect = Rect(0, 0, hImage.W, hImage.H) +' Endif +' +' Paint.ZoomImage(hImage, fZoom, X, Y, Color.SetAlpha(Color.Black, 128), hRect, fOpacity) +' +' ' Paint.DrawImage(hImage, X, Y, hRect.W * fZoom, hRect.H * fZoom, fOpacity, hRect) 'hRect.W, hRect.H) +' +' ' If iZoom > 8 Then +' ' +' ' P = X +' ' S = hRect.H * iZoom +' ' For I = 0 To hRect.W - 1 +' ' Paint.FillRect(P, Y, 1, S, Color.LightForeground) +' ' P += iZoom +' ' Next +' ' +' ' P = Y +' ' S = hRect.W * iZoom +' ' For I = 0 To hRect.H - 1 +' ' Paint.FillRect(X, P, S, 1, Color.LightForeground) +' ' P += iZoom +' ' Next +' ' +' ' Endif +' +' End Public Sub imvImage_Draw(hZoom As Image) @@ -1458,7 +1456,6 @@ Public Sub imvImage_Draw(hZoom As Image) Dim Y As Integer Dim iGrid As Integer Dim W As Float - Dim hSave As Image Dim hZoomOrg As Image If Project.ActiveForm = Me And If FImageProperty.HasBalance() Then bBalance = True diff --git a/app/src/gambas3/.src/Options/FOption.class b/app/src/gambas3/.src/Options/FOption.class index b2f5177de..d720ab55a 100644 --- a/app/src/gambas3/.src/Options/FOption.class +++ b/app/src/gambas3/.src/Options/FOption.class @@ -129,6 +129,7 @@ Public Sub _new() [txtName, "/Identity/Name", User.Name], [txtMail, "/Identity/Mail", User.Name & "@" & System.Host], [txtVendor, "/Packager/Vendor", ""], + [txtVendorPrefix, "/Packager/VendorPrefix", ""], [txtLicense, "/Packager/License", "General Public License"], [txtURL, "/Packager/URL", "www.endoftheinternet.com"], [cmbPrefix, "/Packager/UsePrefix", 0]] @@ -1092,6 +1093,12 @@ Public Sub txtVendor_LostFocus() End +Public Sub txtVendorPrefix_LostFocus() + + Settings["/Packager/VendorPrefix"] = txtVendorPrefix.Text + +End + Public Sub txtLicense_LostFocus() Settings["/Packager/License"] = txtLicense.Text @@ -1312,6 +1319,12 @@ Public Sub txtVendor_KeyPress() End +Public Sub txtVendorPrefix_KeyPress() + + Project.OnVendorKeyPress(True) + +End + Public Sub choBackgroundColor_Click() Project.SetBackgroundColor("#" & Hex$(choBackgroundColor.Current, 6)) diff --git a/app/src/gambas3/.src/Options/FOption.form b/app/src/gambas3/.src/Options/FOption.form index d8ad05615..008670a4c 100644 --- a/app/src/gambas3/.src/Options/FOption.form +++ b/app/src/gambas3/.src/Options/FOption.form @@ -28,7 +28,7 @@ } } { ipnOption IconPanel - MoveScaled(1,1,92,60) + MoveScaled(1,1,94,60) Arrangement = Arrange.Vertical Spacing = True Count = 10 @@ -85,10 +85,23 @@ MoveScaled(20,0,44,4) } } - { HBox39 HBox + { HBox36 HBox MoveScaled(1,25,66,4) Spacing = True Indent = True + { Label35 Label + MoveScaled(0,0,17,4) + Expand = True + Text = ("Vendor prefix") + } + { txtVendorPrefix TextBox + MoveScaled(20,0,44,4) + } + } + { HBox39 HBox + MoveScaled(1,31,66,4) + Spacing = True + Indent = True { Label37 Label MoveScaled(0,0,17,4) Expand = True @@ -102,7 +115,7 @@ } } { HBox40 HBox - MoveScaled(1,30,66,4) + MoveScaled(1,36,66,4) Spacing = True Indent = True { Label38 Label @@ -115,7 +128,7 @@ } } { HBox34 HBox - MoveScaled(1,35,66,4) + MoveScaled(1,41,66,4) Spacing = True Indent = True { Label41 Label diff --git a/app/src/gambas3/.src/Packager/FMakeInstall.class b/app/src/gambas3/.src/Packager/FMakeInstall.class index 6eeb74f81..d0e72f47d 100644 --- a/app/src/gambas3/.src/Packager/FMakeInstall.class +++ b/app/src/gambas3/.src/Packager/FMakeInstall.class @@ -69,6 +69,12 @@ Public Sub Form_Open() txtVendor.Text = Settings["/Packager/Vendor"] Endif + If Project.VendorPrefix Then + txtVendorPrefix.Text = Project.VendorPrefix + Else + txtVendorPrefix.Text = Settings["/Packager/VendorPrefix"] + Endif + If Project.License Then txtLicense.Text = Project.License Else @@ -154,7 +160,7 @@ End Private Sub UpdatePackageName() - txtPackage.Text = Package.GetPackageFullName(txtVendor.Text, chkPrefix.Value, True) + txtPackage.Text = Package.GetPackageFullName(txtVendor.Text, txtVendorPrefix.Text, chkPrefix.Value, True) End @@ -300,6 +306,7 @@ Public Sub wizInstall_BeforeChange() Project.Maintainer = Trim(txtName.Text) Project.Address = Trim(txtMail.Text) Project.Vendor = Trim(txtVendor.Text) + Project.VendorPrefix = Trim(txtVendorPrefix.Text) Project.License = Trim(txtLicense.Text) Project.Url = Trim(txtUrl.Text) @@ -895,6 +902,12 @@ Public Sub txtVendor_Change() End +Public Sub txtVendorPrefix_Change() + + UpdatePackageName + +End + Public Sub chkCreateDir_Click() Project.CreateEachDirectory = chkCreateDir.Value @@ -1188,6 +1201,12 @@ Public Sub txtVendor_KeyPress() End +Public Sub txtVendorPrefix_KeyPress() + + Project.OnVendorKeyPress(True) + +End + Public Sub btnCopy_Click() Clipboard.Copy(edtLog.Text, "text/plain;charset=utf-8") diff --git a/app/src/gambas3/.src/Packager/FMakeInstall.form b/app/src/gambas3/.src/Packager/FMakeInstall.form index 2d5f678b7..6e918a009 100644 --- a/app/src/gambas3/.src/Packager/FMakeInstall.form +++ b/app/src/gambas3/.src/Packager/FMakeInstall.form @@ -68,15 +68,27 @@ Expand = True } } + { HBox20 HBox + MoveScaled(1,20,70,4) + Spacing = True + { Label9 Label + MoveScaled(0,0,23,4) + Text = ("Vendor prefix") + } + { txtVendorPrefix TextBox + MoveScaled(24,0,44,4) + Expand = True + } + } { TextLabel2 TextLabel - MoveScaled(1,19,64,4) + MoveScaled(1,24,64,4) Font = Font["Bold"] AutoResize = True Text = ("Maintainer information") Alignment = Align.BottomNormal } { HBox1 HBox - MoveScaled(1,24,71,4) + MoveScaled(1,29,71,4) Spacing = True { Label1 Label MoveScaled(0,0,23,4) @@ -88,7 +100,7 @@ } } { HBox2 HBox - MoveScaled(1,29,70,4) + MoveScaled(1,34,70,4) Spacing = True { Label2 Label MoveScaled(0,0,23,4) @@ -100,7 +112,7 @@ } } { HBox16 HBox - MoveScaled(1,34,70,4) + MoveScaled(1,39,70,4) Spacing = True { Label7 Label MoveScaled(0,0,23,4) diff --git a/app/src/gambas3/.src/Packager/Package.module b/app/src/gambas3/.src/Packager/Package.module index 735dffb2e..0ca3b5f35 100644 --- a/app/src/gambas3/.src/Packager/Package.module +++ b/app/src/gambas3/.src/Packager/Package.module @@ -15,12 +15,13 @@ Private MAKESELF_PROG As String Private $sOutput As String Private $bEnd As Boolean -Private $sName As String ' Project name -Private $sComponentName As String -Private $sPrefix As String ' Prefix -Private $sPackageName As String ' Package name, i.e project name with prefix -Private $sCategories As String ' Categories list -Private $sHome As String ' Home user directory +Private $sName As String ' Project name +Private $sVendor As String ' Vendor +Private $sVendorPrefix As String ' Vendor prefix +Private $sComponentName As String ' Project name with a vendor prefix +Private $sUnsafePackageName As String ' Package name, i.e project name with prefix, but with possible forbidden characters inside +Private $sCategories As String ' Categories list +Private $sHome As String ' Home user directory Private $sVersion As String Private $sDescription As String Private $sSavePath As String @@ -134,14 +135,17 @@ Private Sub InitMake(sSys As String) $sName = Project.Name $sComponentName = $sName + $sVendor = Project.Vendor + $sVendorPrefix = Project.VendorPrefix + If Not $sVendorPrefix Then $sVendorPrefix = $sVendor If Project.Type = Project.TYPE_COMPONENT Then - If $sName Not Begins Project.Vendor & "." Then $sComponentName = Project.Vendor & "." & $sName + If $sName Not Begins $sVendorPrefix & "." Then $sComponentName = $sVendorPrefix & "." & $sName $sComponentName = String.LCase($sComponentName) Endif - $sPrefix = GetPackagePrefix(Project.Vendor, Project.Prefix) - $sPackageName = GetPackageFullName(Project.Vendor, Project.Prefix, False) + '$sPrefix = GetPackagePrefix(Project.Vendor, Project.Prefix) + $sUnsafePackageName = GetPackageFullName($sVendor, $sVendorPrefix, Project.Prefix, False) $sHome = System.User.Home @@ -646,6 +650,27 @@ Private Sub GetDebianBuildPackageCommand() As String End +' From Debian Policy Manual: +' Package names (both source and binary, see Package, Section 5.6.7) must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.). +' They must be at least two characters long And must start With an alphanumeric character. + + +Private Sub FormatDebPackageName(sName As String) As String + + Dim I As Integer + Dim sCar As String + Dim sRes As String + + For I = 1 To Len(sName) + sCar = Mid$(sName, I, 1) + If Not IsLetter(sCar) And If Not IsDigit(sCar) And If InStr("+-", sCar) = 0 Then sCar = "-" + sRes &= sCar + Next + + Return sRes + +End + Private Function MakeDebPackage(sSys As String) Dim hFile As File @@ -664,7 +689,7 @@ Private Function MakeDebPackage(sSys As String) $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMinMax - sPackageName = $sPackageName + sPackageName = FormatDebPackageName($sUnsafePackageName) '$sName = Replace$($sName, "_", "-") sIcon = sPackageName & ".png" @@ -921,7 +946,7 @@ Private Function MakeDebSupportPackage(sSys As String, sSupport As String, aComp $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMin & Replace($sFormatMax, "<<", "<=") - sPackageName = $sPackageName & "-" & sSupport + sPackageName = FormatDebPackageName($sUnsafePackageName) & "-" & sSupport ' Step 1. Create the build directory @@ -967,7 +992,7 @@ Private Function MakeDebSupportPackage(sSys As String, sSupport As String, aComp Print #hFile Print #hFile, "Package: "; sPackageName Print #hFile, "Architecture: all" - Print #hFile, "Depends: "; $sPackageName;; "(>=";; $sVersion;; "), "; $sPackageName;; "(<=";; $sVersion; ")"; GetDependencies(aComp) + Print #hFile, "Depends: "; FormatDebPackageName($sUnsafePackageName);; "(>=";; $sVersion;; "), "; FormatDebPackageName($sUnsafePackageName);; "(<=";; $sVersion; ")"; GetDependencies(aComp) Print #hFile, "Description: This is the "; sSupport; " support for "; If(Project.Title, Project.Title, Project.Name) @@ -1100,6 +1125,21 @@ Private Sub ChangelogToDebChangelog(sSys As String, sPackageName As String) As S End +Private Sub FormatRpmPackageName(sName As String) As String + + Dim I As Integer + Dim sCar As String + Dim sRes As String + + For I = 1 To Len(sName) + sCar = Mid$(sName, I, 1) + If Not IsLetter(sCar) And If Not IsDigit(sCar) Then sCar = "-" + sRes &= sCar + Next + + Return sRes + +End Private Function MakeRpmPackage(sSys As String) @@ -1115,6 +1155,7 @@ Private Function MakeRpmPackage(sSys As String) Dim sDistribution As String Dim sVendor As String Dim sRelease As String + Dim sPackageName As String Inc Application.Busy @@ -1123,6 +1164,8 @@ Private Function MakeRpmPackage(sSys As String) $sFormatMax = ",&1 < &3" $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMin & Replace($sFormatMax, "<", "<=") + + sPackageName = FormatRpmPackageName($sUnsafePackageName) sRelease = CStr(Project.PackageVersion) @@ -1166,7 +1209,7 @@ Private Function MakeRpmPackage(sSys As String) Print #hFile, "%packager "; Project.Maintainer & "<" & SConv(Project.Address) & ">" Print #hFile, "%buildhost "; System.Host Print #hFile, "%distribution "; sDistribution - Print #hFile, "%vendor "; If(Project.Vendor, Project.Vendor, sVendor) + Print #hFile, "%vendor "; If($sVendor, $sVendor, sVendor) Close #hFile ' step 2, write source tarball (with bzip) to SOURCES dir @@ -1190,16 +1233,16 @@ Private Function MakeRpmPackage(sSys As String) Project.StretchIcon(Project.Dir &/ Project.Icon, 48).Save(sDir &/ "48.png") Project.StretchIcon(Project.Dir &/ Project.Icon, 64).Save(sDir &/ "64.png") - sArch = sSrc &/ Subst("&1-&2.tar.bz2", $sPackageName, $sVersion) + sArch = sSrc &/ Subst("&1-&2.tar.bz2", sPackageName, $sVersion) Project.MakeSourcePackageTo(sArch) Shell "rm -rf " & Shell$(sDir) Wait AddLog(("Creating .spec file.")) - hFile = Open $sHome &/ "RPM/SPECS" &/ $sPackageName & ".spec" For Create + hFile = Open $sHome &/ "RPM/SPECS" &/ sPackageName & ".spec" For Create - Print #hFile, "%define name " & $sPackageName + Print #hFile, "%define name " & sPackageName Print #hFile, "%define version " & $sVersion Print #hFile, "%define release "; sRelease @@ -1430,7 +1473,7 @@ Private Function MakeRpmPackage(sSys As String) sLang = System.Language System.Language = "C" - sCmd = RPMBUILD_PROG & " -ba " & Shell$($sHome &/ "RPM/SPECS" &/ $sPackageName & ".spec") + sCmd = RPMBUILD_PROG & " -ba " & Shell$($sHome &/ "RPM/SPECS" &/ sPackageName & ".spec") AddLog(sCmd) 'sTemp = Temp$ @@ -1458,7 +1501,7 @@ Private Function MakeRpmPackage(sSys As String) For Each sCmd In Split(sOutput, "\n") If Left(sCmd, 6) = "Wrote:" And Right$(sCmd, 10) = "noarch.rpm" Then - sPackage = Subst("&1-&2-&3.noarch.rpm", $sPackageName, $sVersion, sRelease) + sPackage = Subst("&1-&2-&3.noarch.rpm", sPackageName, $sVersion, sRelease) ' IF sSys = "debian" THEN ' SHELL "cd " & Shell$(sHome &/ "RPM/RPMS/noarch") & "; fakeroot " & ALIEN_PROG & " --to-deb -k " & Shell$(sPackage) WAIT ' sPackage = sPrefix & Subst("&1_&2.&3-&4_all.deb", LCase(Project.Name), Project.MajorVersion, Project.MinorVersion, sRelease) @@ -1467,7 +1510,7 @@ Private Function MakeRpmPackage(sSys As String) MoveFile($sHome &/ "RPM/RPMS/noarch" &/ sPackage, Path &/ sPackage) AddLog(sPackage) - sPackage = Subst("&1-&2-&3.src.rpm", $sPackageName, $sVersion, sRelease) + sPackage = Subst("&1-&2-&3.src.rpm", sPackageName, $sVersion, sRelease) ' IF sSys = "debian" THEN ' SHELL "cd " & Shell$(sHome &/ "RPM/SRPMS") & "; fakeroot alien --to-deb -k " & Shell$(sPackage) WAIT ' sPackage = sPrefix & Subst("&1_&2.&3-&4_all.deb", LCase(Project.Name), Project.MajorVersion, Project.MinorVersion, sRelease) @@ -1503,7 +1546,7 @@ Private Function MakeRpmSupportPackage(sSys As String, sSupport As String, aComp $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMinMax - sPackageName = $sPackageName & "-" & sSupport + sPackageName = FormatRpmPackageName($sUnsafePackageName) & "-" & sSupport Select Case sSys @@ -1546,7 +1589,7 @@ Private Function MakeRpmSupportPackage(sSys As String, sSupport As String, aComp Print #hFile, "%packager "; Project.Maintainer & "<" & SConv(Project.Address) & ">" Print #hFile, "%buildhost "; System.Host Print #hFile, "%distribution "; sDistribution - Print #hFile, "%vendor "; If(Project.Vendor, Project.Vendor, sVendor) + Print #hFile, "%vendor "; If($sVendor, $sVendor, sVendor) Close #hFile ' step 2, write source tarball (with bzip) to SOURCES dir @@ -1572,7 +1615,7 @@ Private Function MakeRpmSupportPackage(sSys As String, sSupport As String, aComp 'PRINT #hFile, "BuildRequires: gambas2-ide" Print #hFile, "BuildArch: noarch" - Print #hFile, "Requires: "; $sPackageName;; ">=";; $sVersion;; ","; $sPackageName;; "<=";; $sVersion; GetDependencies(aComp) + Print #hFile, "Requires: "; FormatRpmPackageName($sUnsafePackageName);; ">=";; $sVersion;; ","; FormatRpmPackageName($sUnsafePackageName);; "<=";; $sVersion; GetDependencies(aComp) Print #hFile @@ -1692,6 +1735,13 @@ Private Sub PrintSlackDescContents(hFile As File, sData As String, nLine As Inte End +Private Sub FormatTgzPackageName(sName As String) As String + + ' Use the same format as RPM at the moment + Return FormatRpmPackageName(sName) + +End + Private Sub MakeTgzPackage(sSys As String) Dim sDistribution As String @@ -1715,7 +1765,7 @@ Private Sub MakeTgzPackage(sSys As String) $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMinMax - sPackageName = $sPackageName + sPackageName = FormatTgzPackageName($sUnsafePackageName) sDistribution = "Slackware" sVendor = "Slackware" @@ -1879,7 +1929,7 @@ Private Sub MakeTgzSupportPackage((sSys) As String, sSupport As String, aComp As $sFormatMinMax = $sFormatMin & $sFormatMax $sFormatEqual = $sFormatMinMax - sPackageName = $sPackageName & "-" & sSupport + sPackageName = FormatTgzPackageName($sUnsafePackageName) & "-" & sSupport sDistribution = "Slackware" sVendor = "Slackware" @@ -1911,8 +1961,8 @@ Private Sub MakeTgzSupportPackage((sSys) As String, sSupport As String, aComp As hFile = Open sBuildDir &/ "/install/slack-required" For Create - Print #hFile, $sPackageName; " >= "; $sVersion - Print #hFile, $sPackageName; " <= "; $sVersion + Print #hFile, FormatTgzPackageName($sUnsafePackageName); " >= "; $sVersion + Print #hFile, FormatTgzPackageName($sUnsafePackageName); " <= "; $sVersion Print #hFile, GetDependencies(aComp); Close #hFile @@ -2014,7 +2064,7 @@ Private Sub MakeAutotoolsPackage((sSys) As String) AddLog("") sPackage = Dir(sBuildDir, Project.Name & "*" & $sVersion & "*")[0] - MoveFile(sBuildDir &/ sPackage, Path &/ $sPrefix & sPackage) + MoveFile(sBuildDir &/ sPackage, Path &/ GetPackagePrefix($sVendor, $sVendorPrefix, Project.Prefix) & sPackage) AddLog(sPackage) ' Remove build dir @@ -2022,6 +2072,23 @@ Private Sub MakeAutotoolsPackage((sSys) As String) End +Private Sub FormatArchPackageName(sName As String) As String + + Dim I As Integer + Dim sCar As String + Dim sRes As String + + For I = 1 To Len(sName) + sCar = Mid$(sName, I, 1) + If Not IsLetter(sCar) And If Not IsDigit(sCar) Then sCar = "-" + sRes &= sCar + Next + + Return sRes + +End + + Private Function MakeArchPackage(sSys As String) Dim sBuildDir As String @@ -2030,9 +2097,12 @@ Private Function MakeArchPackage(sSys As String) Dim sCmd As String Dim sDependencies As String Dim sPkgDesc As String + Dim sPackageName As String Inc Application.Busy + sPackageName = FormatArchPackageName($sUnsafePackageName) + sPkgDesc = Replace($sDescription, "\n", " ") If sPkgDesc = "" Then sPkgDesc = "a software done with Gambas3" @@ -2063,7 +2133,7 @@ Private Function MakeArchPackage(sSys As String) Project.StretchIcon(Project.Dir &/ Project.Icon, 48).Save(sBuildDir &/ Project.Name & ".png") - hFile = Open sBuildDir &/ $sPackageName & ".desktop" For Create + hFile = Open sBuildDir &/ sPackageName & ".desktop" For Create PrintDesktopFile(hFile, "/usr/bin/" & $sName, "/usr/share/pixmaps/" & $sName & ".png") Close #hFile @@ -2073,7 +2143,7 @@ Private Function MakeArchPackage(sSys As String) Print #hFile, "# generated by the gambas3 ide" Print #hFile, "# Maintainer : " & Project.Maintainer & " <" & Project.Address & ">" Print #hFile, "" - Print #hFile, "pkgname="; $sPackageName + Print #hFile, "pkgname="; sPackageName Print #hFile, "_realname="; $sName Print #hFile, "pkgdesc=\"" & sPkgDesc & "\"" Print #hFile, "pkgver=" & $sVersion @@ -2091,7 +2161,7 @@ Private Function MakeArchPackage(sSys As String) Print #hFile, "makedepend=('gambas3-devel')" Print #hFile, "source=(${_realname}-$pkgver.tar.bz2 license.txt"; If Project.Type = Project.TYPE_NORMAL Then - Print #hFile, "\\\n '" & $sPackageName & ".desktop'"; + Print #hFile, "\\\n '" & sPackageName & ".desktop'"; Print #hFile, " '" & Project.Name & ".png'"; Endif Print #hFile, ")" @@ -2142,14 +2212,14 @@ Private Function MakeArchPackage(sSys As String) Print #hFile, " install -m755 " & $sName & ".gambas ${pkgdir}/usr/bin" &/ $sName Print #hFile, " install -D .." &/ Project.Name & ".png \\" Print #hFile, " ${pkgdir}/usr/share/pixmaps" &/ Project.Name & ".png" - Print #hFile, " install -D .." &/ $sPackageName & ".desktop \\" - Print #hFile, " ${pkgdir}/usr/share/applications" &/ $sPackageName & ".desktop" + Print #hFile, " install -D .." &/ sPackageName & ".desktop \\" + Print #hFile, " ${pkgdir}/usr/share/applications" &/ sPackageName & ".desktop" End Select Print #hFile, GetExtraFilesDir(sSys, " install -d ${pkgdir}&1"); Print #hFile, GetExtraFiles(sSys, " install -p ${srcdir}/${_realname}/.hidden/&1 ${pkgdir}&2/&1", " cp -R --preserve=timestamp ${srcdir}/${_realname}/.hidden/&1 ${pkgdir}&2/&1"); - Print #hFile, " install -Dm644 ${srcdir}/license.txt ${pkgdir}/usr/share/licenses" &/ $sPackageName &/ "license.txt" + Print #hFile, " install -Dm644 ${srcdir}/license.txt ${pkgdir}/usr/share/licenses" &/ sPackageName &/ "license.txt" Print #hFile, "}" Close #hFile @@ -2162,7 +2232,7 @@ Private Function MakeArchPackage(sSys As String) RunCommand(sCmd, sBuildDir) Next - RunCommand("cp " & $sPackageName & "-" & $sVersion & "-1*.tar.* " & Shell$(Path) &/ "", sBuildDir) + RunCommand("cp " & sPackageName & "-" & $sVersion & "-1*.tar.* " & Shell$(Path) &/ "", sBuildDir) ' Remove build dir Shell "rm -rf " & Shell(sBuildDir) Wait @@ -2182,7 +2252,7 @@ Private Function MakeArchSupportPackage((sSys) As String, sSupport As String, aC Inc Application.Busy - sPackageName = $sPackageName & "-" & sSupport + sPackageName = FormatArchPackageName($sUnsafePackageName & "-" & sSupport) sPkgDesc = "This is the " & sSupport & " support for " & If(Project.Title, Project.Title, Project.Name) @@ -2223,7 +2293,7 @@ Private Function MakeArchSupportPackage((sSys) As String, sSupport As String, aC Endif Print #hFile, "license=('custom')" If Len(sDependencies) > 0 Then - Print #hFile, "depends=(" & Subst($sFormatEqual, $sPackageName, $sVersion) & Left$(sDependencies, -1) & ")" + Print #hFile, "depends=(" & Subst($sFormatEqual, FormatArchPackageName($sUnsafePackageName), $sVersion) & Left$(sDependencies, -1) & ")" Endif 'Print #hFile, "makedepend=('gambas3-devel')" 'Print #hFile, "source=(${_realname}-$pkgver.tar.bz2 license.txt"; @@ -2344,38 +2414,45 @@ End Private Sub GetPackageName() As String Dim sName As String - - sName = Replace(LCase(Project.Name), ".", "-") - sName = Replace(sName, "_", "-") - + + sName = LCase(String.RemoveDiacritics(Project.Name)) + sName = Replace(sName, ".", "-") Return sName End -Private Sub GetPackagePrefix(sVendor As String, bPrefix As Boolean) As String +Private Sub GetPackagePrefix(sVendor As String, sVendorPrefix As String, bPrefix As Boolean) As String Dim sText As String Dim sPackage As String - - sVendor = String.LCase(Trim(sVendor)) - sVendor = Replace(sVendor, "-", "_") + Dim sPrefix As String If Project.Type = Project.TYPE_COMPONENT Then - If Not sVendor Then sVendor = "gb" + sPrefix = String.LCase(Trim(sVendorPrefix)) + If Not sPrefix Then sPrefix = "gb" + sPackage = GetPackageName() - If sPackage Begins sVendor & "-" Or If sPackage = sVendor Then - sVendor = "" + If sPackage Begins sPrefix & "-" Or If sPackage = sPrefix Then + sPrefix = "" Else - sVendor &= "-" + sPrefix &= "-" Endif - sText = "gambas" & System.Version & "-" & sVendor + sText = "gambas" & System.Version & "-" & sPrefix Else If bPrefix Then - If Not sVendor Then sVendor = "gambas" - sText = sVendor & "-" + + sPrefix = sVendorPrefix + If Not sPrefix Then sPrefix = sVendor + sPrefix = String.LCase(Trim(sPrefix)) + sPrefix = Replace(sPrefix, "_", "-") + + If Not sPrefix Then sPrefix = "gambas" + + sText = sPrefix & "-" + Endif Endif @@ -2384,14 +2461,12 @@ Private Sub GetPackagePrefix(sVendor As String, bPrefix As Boolean) As String End -Public Sub GetPackageFullName(sVendor As String, bPrefix As Boolean, bWithVersion As Boolean) As String +Public Sub GetPackageFullName(sVendor As String, sVendorPrefix As String, bPrefix As Boolean, bWithVersion As Boolean) As String Dim sText As String - sText = GetPackagePrefix(sVendor, bPrefix) & GetPackageName() - + sText = GetPackagePrefix(sVendor, sVendorPrefix, bPrefix) & GetPackageName() If bWithVersion Then sText &= "-" & Project.FormatVersion() - Return sText End diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index f6c3308b3..4e56ff473 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -75,6 +75,7 @@ Public PackageSignature As Boolean Public Maintainer As String Public Address As String Public Vendor As String +Public VendorPrefix As String Public Url As String Public License As String Public CreateEachDirectory As Boolean @@ -3213,6 +3214,7 @@ Public Sub ReadProject(Optional bConvert As Boolean) 'BreakOnError = False Maintainer = "" Vendor = "" + VendorPrefix = "" Address = "" Url = "" License = "" @@ -3432,6 +3434,9 @@ Public Sub ReadProject(Optional bConvert As Boolean) Case "vendor" Vendor = sVal + Case "vendorprefix" + VendorPrefix = sVal + Case "address" Address = sVal @@ -3629,6 +3634,7 @@ Public Sub WriteProject(Optional bComponentDoNotChange As Boolean, Optional bMak If Maintainer Then Print #hFic, "Maintainer="; Maintainer If Vendor Then Print #hFic, "Vendor="; Vendor + If VendorPrefix Then Print #hFic, "VendorPrefix="; VendorPrefix If Address Then Print #hFic, "Address="; Address If Url And If Url <> DEFAULT_URL Then Print #hFic, "Url="; Url If License Then Print #hFic, "License="; License @@ -6120,7 +6126,7 @@ Public Sub UpdateComponentFile() End -Public Sub OnVendorKeyPress() +Public Sub OnVendorKeyPress(Optional bPrefix As Boolean) If Key.Text Then If Len(Key.Text) = 1 Then @@ -6128,7 +6134,9 @@ Public Sub OnVendorKeyPress() If Asc(Key.Text) = 127 Then Return If IsDigit(Key.Text) Then Return If IsLetter(Key.Text) Then Return - If InStr("-_", Key.Text) Then Return + If Not bPrefix Then + If InStr("-_", Key.Text) Then Return + Endif Endif Stop Event Endif diff --git a/app/src/gambas3/.src/Project/Farm/SoftwareBox.class b/app/src/gambas3/.src/Project/Farm/SoftwareBox.class index 9999d3c89..254cd100a 100644 --- a/app/src/gambas3/.src/Project/Farm/SoftwareBox.class +++ b/app/src/gambas3/.src/Project/Farm/SoftwareBox.class @@ -254,10 +254,10 @@ Private Function Software_Read() As CSoftware End -Static Public Sub PaintStat(hSoft As CSoftware, Optional bWithSize As Boolean) +Static Public Sub PaintStat(hSoft As CSoftware, Optional (bWithSize) As Boolean) Dim sDownload As String - Dim X, Y, W As Integer + Dim X, Y As Integer Dim P As Integer P = Desktop.Scale