Merge branch 'master' of gitlab.com:ercoupeflyer/gambas

This commit is contained in:
Brian G 2020-07-30 12:56:49 -07:00
commit 06d6dffc9d
22 changed files with 451 additions and 369 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1538,7 +1538,10 @@ Public Sub Action_Activate((Key) As String) As Boolean
UpdateDiffMode
Case ".compress"
If Not $bIgnoreCompress Then Save(True)
If Not $bIgnoreCompress Then
Modify()
Save(True)
Endif
Case Else
Return True
@ -1877,6 +1880,8 @@ End
Private Sub UpdateCompressAction()
Dim sPath As String
Dim iSize As Long
Dim sComp As String
If Not $bShowCompress Then Return
@ -1885,7 +1890,13 @@ Private Sub UpdateCompressAction()
Action[".compress", Me].Value = Exist(sPath)
$bIgnoreCompress = False
If Exist(sPath) Then
btnCompress.Tooltip = Subst(("Compressed at &1"), Format(Stat(Path).Size / Stat(sPath).Size, "0%"))
iSize = Stat(sPath).Size
If iSize Then
sComp = Format(Stat(Path).Size / Stat(sPath).Size, "0%")
Else
sComp = "100%"
Endif
btnCompress.Tooltip = Subst(("Compressed at &1"), sComp)
Else
btnCompress.Tooltip = ""
Endif

View File

@ -1215,6 +1215,7 @@ Public Sub UpdateMenu()
Dim bVisible As Boolean
Dim bEnabled As Boolean
Dim sAction As String
Dim sText As String
bVisible = Not Project.ReadOnly
bEnabled = Not Project.Running
@ -1226,6 +1227,12 @@ Public Sub UpdateMenu()
Action[sAction].Enabled = bEnabled
Next
Action["run-with"].Enabled = bEnabled
sText = If(Project.Running, ("Continue"), ("Run"))
mnuRun.Text = sText
Action["start"].Tooltip = sText
UpdateProperty
Action["version-control"].Visible = VersionControl.Enabled

View File

@ -248,7 +248,7 @@
Visible = False
{ mnuRun Menu
Action = "start"
Text = Shortcut(("Run"), "R")
Text = ("Run")
Picture = Picture["icon:/small/play"]
Shortcut = "F5"
}
@ -1325,13 +1325,6 @@
MoveScaled(86,8,0,9)
Visible = False
}
{ btnWorkspaceProject ToolButton
MoveScaled(22,1,4,4)
Visible = False
ToolTip = ("Show project tree")
Ignore = True
Picture = Picture["icon:/small/view-tree"]
}
{ btnWorkspaceProperty ToolButton
MoveScaled(27,1,4,4)
Visible = False
@ -1339,6 +1332,13 @@
Ignore = True
Picture = Picture["icon:/small/properties"]
}
{ btnWorkspaceProject ToolButton
MoveScaled(22,1,4,4)
Visible = False
ToolTip = ("Show project tree")
Ignore = True
Picture = Picture["icon:/small/view-tree"]
}
}
{ panDebug SidePanel
MoveScaled(3,37,81,14)
@ -1393,13 +1393,6 @@
Text = ("Hierarchy")
Index = 0
}
{ btnPropertyToolbar ToolButton
MoveScaled(0,0,4,4)
Visible = False
ToolTip = ("Show controls")
Ignore = True
Picture = Picture["img/16/control.png"]
}
{ btnPropertyHelp ToolButton
MoveScaled(4,0,4,4)
Visible = False
@ -1407,6 +1400,13 @@
Ignore = True
Picture = Picture["icon:/small/help"]
}
{ btnPropertyToolbar ToolButton
MoveScaled(0,0,4,4)
Visible = False
ToolTip = ("Show controls")
Ignore = True
Picture = Picture["img/16/control.png"]
}
}
{ panTool SidePanel
MoveScaled(5,49,21,37)

View File

@ -1453,6 +1453,12 @@ Public Sub timFillList_Timer()
UpdateSearchList
If bUndo Then
$bIgnoreFileChange = True
Try hFile.GetEditor().End
$bIgnoreFileChange = False
Endif
If $sTaskBuffer Then Return
If $hTask Then Return
If $iReplaceFrom > 0 Then Return
@ -1464,12 +1470,6 @@ Public Sub timFillList_Timer()
Endif
Endif
If bUndo Then
$bIgnoreFileChange = True
Try hFile.GetEditor().End
$bIgnoreFileChange = False
Endif
gvwFind.Columns[0].Width = -1
gvwFind.Columns[1].Width = -1
gvwFind.Columns[4].W = -1

View File

@ -84,7 +84,8 @@ Public Sub GetBranches(ByRef sCurrent As String) As String[]
sBranch = Trim(Mid$(sBranch, 2))
bCurrent = True
Else
bCurrent = False
bCurrent = False
If sBranch Begins "+ " Then sBranch = Mid$(sBranch, 3)
Endif
If sBranch Begins "remotes/origin/" Then

View File

@ -37,6 +37,28 @@ Private Sub OnVersionControlChange()
End
Private Sub GetTextEditor() As String
Dim sProg As String
If Desktop.Is("kde4") Or If Desktop.Is("kde5") Then
sProg = "kwrite"
Else If Desktop.Is("xfce") Then
sProg = "mousepad"
Else If Desktop.Is("lxde") Then
sProg = "leafpad"
Else If Desktop.Is("mate") Then
sProg = "pluma"
Else
sProg = "gedit"
Endif
For Each sProg In [sProg, "kwrite", "gedit", "emacs"]
If System.Exist(sProg) Then Return sProg
Next
End
Public Sub Refresh()
$hVC = CVersionControl
@ -56,6 +78,15 @@ Public Sub Refresh()
CheckPaths
OnVersionControlChange
If $bEnabled Then
If Not Env["EDITOR"] Then
Env["EDITOR"] = GetTextEditor()
If Not Env["EDITOR"] Then
Message.Warning(("Please set the $EDITOR environment variable with your favorite graphical text editor. Some version control commands need it."))
Endif
Endif
Endif
End
Public Sub Disable()

View File

@ -1,6 +1,6 @@
[Component]
Key=gb.dbus.trayicon
Version=3.14.90
Version=3.15.90
State=2
Hidden=True
Needs=ImageIO

View File

@ -1,7 +1,7 @@
# Gambas Project File 3.0
Title=Tray icons using the new DBus protocol
Startup=Main
Version=3.14.90
Version=3.15.90
VersionFile=1
Component=gb.image
Component=gb.gui

View File

@ -13,7 +13,9 @@ Property Read com_canonical_dbusmenu_IconThemePath As String[]
Static Private ALL_PROPS As String[] = ["type", "label", "enabled", "visible", "toggle-type", "toggle-state", "icon-data", "shortcut", "children-display"]
Private $aProp As New Collection[]
Private $sProp As String
Private $iRevision As Integer
Private $hProp As File
Private Function com_canonical_dbusmenu_Version_Read() As _DBusUInt
@ -129,10 +131,13 @@ Private Sub UpdateMenuRec(hMenu As Menu, Optional bChild As Boolean) As Integer
Dim aChild As Integer[]
Dim aShortcut As String[]
Dim sShortcut As String
Dim sPicture As String
iId = $aProp.Count
cProp["id"] = iId
Write #$hProp, iId As Integer
cProp["menu"] = hMenu
Write #$hProp, Object.Address(hMenu) As Pointer
'If iId > 0 Then
@ -149,14 +154,20 @@ Private Sub UpdateMenuRec(hMenu As Menu, Optional bChild As Boolean) As Integer
Endif
sText = Replace(sText, "&&", "&")
cProp["label"] = sText
Write #$hProp, hMenu.Text As String
If Not hMenu.Enabled Then cProp["enabled"] = False
Write #$hProp, hMenu.Enabled As Boolean
If bChild And If Not hMenu.Visible Then cProp["visible"] = False
Write #$hProp, hMenu.Visible As Boolean
If hMenu.Picture Then
sTemp = File.SetExt(Temp$("icon"), "png")
hMenu.Picture.Save(sTemp)
cProp["icon-data"] = Byte[].FromString(File.Load(sTemp))
sPicture = File.Load(sTemp)
cProp["icon-data"] = Byte[].FromString(sPicture)
Write #$hProp, sPicture As String
Kill sTemp
Endif
@ -167,20 +178,23 @@ Private Sub UpdateMenuRec(hMenu As Menu, Optional bChild As Boolean) As Integer
cProp["toggle-type"] = "checkmark"
cProp["toggle-state"] = If(hMenu.Value, 1, 0)
Endif
Write #$hProp, hMenu.Radio As Boolean
Write #$hProp, hMenu.Toggle Or hMenu.Checked As Boolean
' shortcut
sShortcut = hMenu.Shortcut
If sShortcut Then
sShortcut = Replace(sShortcut, "Ctrl+", "Control+")
aShortcut = Split(sShortcut, "+")
cProp["shortcut"] = [aShortcut]
Endif
Write #$hProp, hMenu.Shortcut As String
'Endif
If hMenu.Children.Count Then cProp["children-display"] = "submenu"
Write #$hProp, hMenu.Children.Count As Integer
$aProp.Add(cProp)
@ -198,12 +212,25 @@ Private Sub UpdateMenuRec(hMenu As Menu, Optional bChild As Boolean) As Integer
End
Public Sub _UpdateMenu(hMenu As Menu)
Public Sub _UpdateMenu(hMenu As Menu) As Boolean
Inc $iRevision
$aProp.Clear
Dim sProp As String
Dim aProp As Collection[]
aProp = $aProp
$aProp = New Collection[]
$hProp = Open String For Write
UpdateMenuRec(hMenu)
sProp = Close #$hProp
$hProp = Null
If sProp = $sProp Then
$aProp = aProp
Return True
Endif
$sProp = sProp
Inc $iRevision
If DBus.IsRegistered(Me) Then DBus.Raise(Me, "com.canonical.dbusmenu.LayoutUpdated", [_DBusUInt($iRevision), 0])
End

View File

@ -219,9 +219,9 @@ Private Function PopupMenu_Read() As String
End
Private Sub UpdateMenu()
Private Sub UpdateMenu() As Boolean
$hMenu._UpdateMenu(GetMenu())
Return $hMenu._UpdateMenu(GetMenu())
End
@ -299,8 +299,7 @@ End
Public Sub _AboutToShow(hMenu As Menu) As Boolean
Object.Raise(hMenu, "Show")
UpdateMenu
Return True
Return Not UpdateMenu()
End

View File

@ -1,6 +1,6 @@
[Component]
Key=gb.desktop
Version=3.14.90
Version=3.15.90
State=1
Needs=Form
Requires=gb.image

View File

@ -1,7 +1,7 @@
# Gambas Project File 3.0
Title=Desktop-neutral routines from Portland project
Startup=Main
Version=3.14.90
Version=3.15.90
VersionFile=1
Component=gb.image
Component=gb.gui

View File

@ -8,10 +8,12 @@ Create Static
Property Read Enabled As Boolean
'Private $bOpen As Boolean
Private $sKDEWalletId As String
Private $sSecretTool As String
Private $sKDEOldWalletId As String
Private $sKDEWalletId As String
Private $bKDEOldWalletId As Boolean
Private $sKDEOldWalletId As String
Private $iType As Integer
Private Enum TYPE_NONE, TYPE_KDE, TYPE_GNOME, TYPE_KDE4, TYPE_KDE5
@ -108,9 +110,11 @@ Public Sub _get((Key) As String) As String
If Not $bKDEOldWalletId Then
$bKDEOldWalletId = True
Shell "qdbus org.kde.kwalletd /modules/kwalletd localWallet" To sResult
sWallet = Trim(Split(sResult, "\n")[0])
Shell Subst("qdbus org.kde.kwalletd /modules/kwalletd open &1 0 &2", Shell$(sWallet), Shell$(Application.Title)) To sResult
$sKDEOldWalletId = Trim(sResult)
Try sWallet = Trim(Split(sResult, "\n")[0])
If sWallet Then
Shell Subst("qdbus org.kde.kwalletd /modules/kwalletd open &1 0 &2", Shell$(sWallet), Shell$(Application.Title)) To sResult
$sKDEOldWalletId = Trim(sResult)
Endif
Endif
If $sKDEOldWalletId Then
Shell Subst("qdbus org.kde.kwalletd /modules/kwalletd readPassword &1 &2 &3 &4", $sKDEOldWalletId, Shell$(Application.Name), Shell$(Key), Shell$(Application.Title)) To sResult

View File

@ -1,5 +1,5 @@
[Component]
Key=gb.gui.base
Version=3.14.90
Version=3.15.90
Hidden=True
Needs=Form

View File

@ -1,7 +1,7 @@
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FListBox
Version=3.14.90
Version=3.15.90
VersionFile=1
Component=gb.image
Component=gb.gui

View File

@ -413,7 +413,7 @@ Private Sub Tooltip_Write(Value As String)
Dim hCtrl As Object
For Each hCtrl In GetControls()
hCtrl.Tooltip = Value
Try hCtrl.Tooltip = Value
Next
End

View File

@ -2847,41 +2847,43 @@ fprintf(stderr,"[ODBC][%s][%d]\n",__FILE__,__LINE__);
fprintf(stderr,"\tfield_info\n");
fflush(stderr);
#endif
SQLCHAR colname[32];
SQLCHAR colname[128];
SQLCHAR coltype[100];
SQLCHAR precision[100];
char query[200];
SQLHSTMT statHandle;
SQLHSTMT statHandle1;
SQLRETURN retcode;
//SQLRETURN V_OD_erg;
SQLLEN auton=SQL_FALSE;
int i;
int size_query = 32 + strlen(table) + strlen(field);
char query[size_query];
ODBC_CONN *han = (ODBC_CONN *)db->handle;
ODBC_CONN *han1 = (ODBC_CONN *)db->handle;
*precision = 0;
strncpy((char *)&query[0], "SELECT ",7);
/*strncpy((char *)&query[0], "SELECT ",7);
strncpy((char *)&query[7], field,strlen(field));
strncpy((char *)&query[strlen(field)+7], " FROM ",6);
strncpy((char *)&query[strlen(field)+13], table,strlen(table));
query[strlen(field)+14+strlen(table)]='\0';
strncpy((char *)&query[strlen(field)+13+strlen(table)],"\0\n\0\n",4);
strncpy((char *)&query[strlen(field)+13+strlen(table)],"\0\n\0\n",4);*/
snprintf(query, size_query, "SELECT %s FROM %s", field, table);
for (i = 0; i < 100; i++)
coltype[i] = '\0';
retcode =SQLAllocHandle(SQL_HANDLE_STMT, (ODBC_CONN *) han->odbcHandle, &statHandle);
retcode = SQLAllocHandle(SQL_HANDLE_STMT, (ODBC_CONN *) han->odbcHandle, &statHandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
{
return retcode;
}
retcode =SQLAllocHandle(SQL_HANDLE_STMT, (ODBC_CONN *) han1->odbcHandle, &statHandle1);
retcode = SQLAllocHandle(SQL_HANDLE_STMT, (ODBC_CONN *) han1->odbcHandle, &statHandle1);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO))
{
@ -2894,29 +2896,23 @@ fflush(stderr);
return retcode;
}
retcode=SQLColAttribute (statHandle1,1,SQL_DESC_AUTO_UNIQUE_VALUE,NULL,0,NULL,&auton);
retcode = SQLColAttribute (statHandle1,1,SQL_DESC_AUTO_UNIQUE_VALUE,NULL,0,NULL,&auton);
SQLFreeHandle(SQL_HANDLE_STMT, statHandle1);
if (!SQL_SUCCEEDED(retcode = SQLColumns(statHandle, NULL, 0, NULL, 0, (SQLCHAR *) table, SQL_NTS, NULL,0)))
return -1;
while (SQL_SUCCEEDED(SQLFetch(statHandle)))
{
SQLGetData(statHandle, SQLColumns_COLUMN_NAME, SQL_C_CHAR, colname, sizeof(colname), 0);
if (strcmp((char *) colname, field) == 0)
if (strcmp((char *)colname, field) == 0)
{
SQL_SUCCEEDED(SQLGetData(statHandle, SQLColumns_SQL_DATA_TYPE, SQL_C_CHAR, coltype, sizeof(coltype), 0));
SQL_SUCCEEDED(SQLGetData(statHandle, SQLColumns_COLUMN_SIZE, SQL_C_CHAR, precision, sizeof(precision), 0));
break;
}
}
info->name = NULL;

View File

@ -70,7 +70,8 @@ void SUBR_cat(ushort code)
return;
}
len = PARAM[0]._string.len ;
str = PARAM[0]._string.addr;
len = PARAM[0]._string.len;
if (len && PARAM[0]._string.start == 0 && len == STRING_length(str) && STRING_from_ptr(str)->ref == 2)
{

View File

@ -5,19 +5,19 @@
Private $Done As New String[]
Public Sub _Setup()
Public Sub _SeTuP()
$Done.Add("Setup")
End
Public Sub _SetupEach()
Public Sub _SeTuPeAcH()
$Done.Add("SetupEach")
End
Public Sub _TeardownEach()
Public Sub _TeArDoWneAcH()
$Done.Add("TeardownEach")
@ -41,11 +41,12 @@ Public Sub B()
End
Public Sub _Teardown()
Public Sub _TeArDoWn()
$Done.Add("Teardown")
If $Done.Join() <> "Setup,SetupEach,A,TeardownEach,SetupEach,B,TeardownEach,Teardown" Then
Test.BailOut("_Teardown failed")
'Assertion forbidden inside _Setup or _Teardown, so we can just bail out to report the failure
Test.BailOut("_Teardown failed. Expected '" & "Setup,SetupEach,A,TeardownEach,SetupEach,B,TeardownEach,Teardown'" & " but got '" & $Done.Join() & "'")
Endif
End

View File

@ -39,7 +39,7 @@ Public Sub Run()
Assert $MyTestModule
'$MyTestModule._SetupEach
If $MyTestModule.Symbols.Exist("_SetupEach") Then
If $MyTestModule.Symbols.Exist("_SetupEach", gb.IgnoreCase) Then
Test._InSetup = True
Object.Call($MyTestModule, "_SetupEach")
Test._InSetup = False
@ -50,7 +50,7 @@ Public Sub Run()
Assert.Fail(Subst$("&1:&2 crashed with error '&3'", $MyTestModule.Name, Me.Name, Error.Text))
Endif
If $MyTestModule.Symbols.Exist("_TeardownEach") Then
If $MyTestModule.Symbols.Exist("_TeardownEach", gb.IgnoreCase) Then
Test._InSetup = True
Object.Call($MyTestModule, "_TeardownEach")
Test._InSetup = False

View File

@ -52,7 +52,7 @@ End Sub
Private Sub StartTestModule(TestModule As Class)
If TestModule.Symbols.Exist("_Setup") Then
If TestModule.Symbols.Exist("_Setup", gb.IgnoreCase) Then
Test._InSetup = True
Object.Call(TestModule, "_Setup")
Test._InSetup = False
@ -62,7 +62,7 @@ End
Private Sub StopTestModule(TestModule As Class)
If TestModule.Symbols.Exist("_Teardown") Then
If TestModule.Symbols.Exist("_Teardown", gb.IgnoreCase) Then
Test._InSetup = True
Object.Call(TestModule, "_Teardown")
Test._InSetup = False