[DEVELOPMENT ENVIRONMENT]
* BUG: UTF-8 characters are allowed in project data file names now. [INTEPRETER] * NEW: Allocation debugging messages can be redirected to a log file. [GB.DB.FORM] * BUG: DataBrowser FBrowser form does not incorrectly override Form.Panel anymore. [GB.GTK] * BUG: TabStrip.Font now behaves as expected. * BUG: GridView Row and Column properties can be set independently. * BUG: Fix the container arrangement and the ClientX / ClientY properties. [GB.FORM] * OPT: FileView redraws were delayed so that they are optimized. * BUG: Balloon tried to not take the focus. [GB.QT] * BUG: Fix the GridView last column stretching. [GB.QT4] * NEW: The AutoResize property of Button, ToolButton and ToggleButton controls were implemented. * BUG: Button, ToolButton and ToggleButton now behave correctly when their font change. * OPT: Arrangement was optimized. * BUG: TabStrip ClientX, ClientY, ClientWidth and ClientHeight properties now return accurate values. [GB.QT4.EXT] * BUG: Editor now draws non-highlighted lines correctly. git-svn-id: svn://localhost/gambas/trunk@1868 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
a9788faff4
commit
e2c952c375
41 changed files with 566 additions and 367 deletions
|
@ -2,6 +2,7 @@
|
||||||
# Compiled with Gambas 2.99.0
|
# Compiled with Gambas 2.99.0
|
||||||
Title=Gambas 3
|
Title=Gambas 3
|
||||||
Startup=Project
|
Startup=Project
|
||||||
|
StackTrace=1
|
||||||
Icon=img/logo/new-logo.png
|
Icon=img/logo/new-logo.png
|
||||||
Version=2.99.0
|
Version=2.99.0
|
||||||
VersionProgram=gbx3 -V
|
VersionProgram=gbx3 -V
|
||||||
|
|
|
@ -93,7 +93,7 @@ Public Const KEY_PROJECT As String = "$P"
|
||||||
|
|
||||||
Private Const CLASS_AUTH_CAR As String = "abcdefghijklmnopqrstuvwxyz0123456789"
|
Private Const CLASS_AUTH_CAR As String = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
Private Const CLASS_AUTH_FIRST_CAR As String = "abcdefghijklmnopqrstuvwxyz_"
|
Private Const CLASS_AUTH_FIRST_CAR As String = "abcdefghijklmnopqrstuvwxyz_"
|
||||||
Private Const FILE_AUTH_CAR As String = "abcdefghijklmnopqrstuvwxyz0123456789-.+_"
|
Private Const FILE_FORBIDDEN_CAR As String = "?*/~"
|
||||||
|
|
||||||
Private Const PROJECT_FILE As String = ".project"
|
Private Const PROJECT_FILE As String = ".project"
|
||||||
Private Const STARTUP_FILE As String = ".startup"
|
Private Const STARTUP_FILE As String = ".startup"
|
||||||
|
@ -2803,9 +2803,14 @@ Public Function CheckFileName(sName As String, Optional sDir As String) As Strin
|
||||||
|
|
||||||
If Not sName Then Goto VOID_NAME
|
If Not sName Then Goto VOID_NAME
|
||||||
|
|
||||||
For iInd = 1 To Len(sName)
|
If String.Left$(sName) = "." Then
|
||||||
|
iInd = 1
|
||||||
|
Goto BAD_CHAR
|
||||||
|
Endif
|
||||||
|
|
||||||
If InStr(FILE_AUTH_CAR & "-._+()", LCase(Mid$(sName, iInd, 1))) = 0 Then Goto BAD_CHAR
|
For iInd = 1 To String.Len(sName)
|
||||||
|
|
||||||
|
If InStr(FILE_FORBIDDEN_CAR, String.Mid$(sName, iInd, 1)) Then Goto BAD_CHAR
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
@ -2821,7 +2826,7 @@ VOID_NAME:
|
||||||
|
|
||||||
BAD_CHAR:
|
BAD_CHAR:
|
||||||
|
|
||||||
Return ("This name contains a forbidden character:") & " [ " & Mid$(sName, iInd, 1) & " ]"
|
Return ("This name contains a forbidden character:") & " [ " & String.Mid$(sName, iInd, 1) & " ]"
|
||||||
|
|
||||||
ALREADY_EXIST:
|
ALREADY_EXIST:
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
[Component]
|
[Component]
|
||||||
Key=gb.db.form
|
Key=gb.db.form
|
||||||
|
Version=2.99.0
|
||||||
Authors=Benoît Minisini
|
Authors=Benoît Minisini
|
||||||
Needs=Form
|
Needs=Form
|
||||||
Requires=gb.db,gb.form
|
Requires=gb.db,gb.form
|
||||||
|
|
|
@ -10,11 +10,11 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: DataControl.class:83 DataView.class:198
|
#: DataControl.class:83 DataView.class:200
|
||||||
msgid "True"
|
msgid "True"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: DataControl.class:84 DataView.class:198
|
#: DataControl.class:84 DataView.class:200
|
||||||
msgid "False"
|
msgid "False"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -62,34 +62,34 @@ msgstr ""
|
||||||
msgid "End"
|
msgid "End"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:107
|
#: FMain.class:106
|
||||||
msgid "Id"
|
msgid "Id"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:112
|
#: FMain.class:111
|
||||||
msgid "Color"
|
msgid "Color"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:117
|
#: FMain.class:116
|
||||||
msgid "First Name"
|
msgid "First Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:122
|
#: FMain.class:121
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:127
|
#: FMain.class:126
|
||||||
msgid "Birth"
|
msgid "Birth"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:132
|
#: FMain.class:131
|
||||||
msgid "Active"
|
msgid "Active"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:137
|
#: FMain.class:136
|
||||||
msgid "Salary"
|
msgid "Salary"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FMain.class:142
|
#: FMain.class:141
|
||||||
msgid "Comment"
|
msgid "Comment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
# Gambas Project File 3.0
|
# Gambas Project File 3.0
|
||||||
|
# Compiled with Gambas 2.99.0
|
||||||
Startup=Main
|
Startup=Main
|
||||||
Version=2.99.91
|
Version=2.99.0
|
||||||
VersionProgram=gbx3 -V
|
VersionProgram=gbx3 -V
|
||||||
Component=gb.gui
|
Component=gb.gui
|
||||||
Component=gb.form
|
Component=gb.form
|
||||||
Component=gb.db
|
Component=gb.db
|
||||||
Component=gb.db.form
|
Component=gb.db.form
|
||||||
Authors=Benoît Minisini
|
Authors=Benoît Minisini
|
||||||
Environment="GB_GUI=gb.qt"
|
Environment="GB_GUI=gb.qt4"
|
||||||
TabSize=2
|
TabSize=2
|
||||||
Translate=1
|
Translate=1
|
||||||
Language=en
|
Language=en
|
||||||
|
|
|
@ -53,13 +53,13 @@ End
|
||||||
|
|
||||||
Private Function Control_Read() As Boolean
|
Private Function Control_Read() As Boolean
|
||||||
|
|
||||||
Return $hForm.Panel.Visible
|
Return $hForm.ButtonPanel.Visible
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Private Sub Control_Write(bVisible As Boolean)
|
Private Sub Control_Write(bVisible As Boolean)
|
||||||
|
|
||||||
$hForm.Panel.Visible = bVisible
|
$hForm.ButtonPanel.Visible = bVisible
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
|
@ -1,134 +1,136 @@
|
||||||
' Gambas class file
|
' Gambas class file
|
||||||
|
|
||||||
EXPORT
|
Export
|
||||||
INHERITS UserControl
|
Inherits UserControl
|
||||||
|
|
||||||
PUBLIC CONST _Properties AS String = "*,Mode{Select.None;Single;Multi}=None,Header{GridView.None;Horizontal;Vertical;Both}=Both,Grid,Highlight=True,Columns"
|
Public Const _Properties As String = "*,Mode{Select.None;Single;Multi}=None,Header{GridView.None;Horizontal;Vertical;Both}=Both,Grid,Highlight=True,Columns"
|
||||||
PUBLIC CONST _DrawWith AS String = "GridView"
|
Public Const _DrawWith As String = "GridView"
|
||||||
|
|
||||||
EVENT Activate
|
Event Activate
|
||||||
|
|
||||||
PROPERTY Mode AS Integer
|
Property Mode As Integer
|
||||||
PROPERTY Header AS Integer
|
Property Header As Integer
|
||||||
PROPERTY Grid AS Boolean
|
Property Grid As Boolean
|
||||||
PROPERTY Highlight AS Boolean
|
Property Highlight As Boolean
|
||||||
|
|
||||||
'PROPERTY Connection AS Connection
|
'PROPERTY Connection AS Connection
|
||||||
'PROPERTY Table AS String
|
'PROPERTY Table AS String
|
||||||
'PROPERTY Filter AS String
|
'PROPERTY Filter AS String
|
||||||
PROPERTY Columns AS String[]
|
Property Columns As String[]
|
||||||
PROPERTY READ Current AS Variant[]
|
Property Read Current As Variant[]
|
||||||
PROPERTY READ Count AS Integer
|
Property Read Count As Integer
|
||||||
PROPERTY READ Index AS Integer
|
Property Read Index As Integer
|
||||||
PROPERTY READ GridView AS GridView
|
Property Read GridView As GridView
|
||||||
|
|
||||||
'PRIVATE $hConn AS Connection
|
'PRIVATE $hConn AS Connection
|
||||||
PRIVATE $hCtrl AS GridView
|
Private $hCtrl As GridView
|
||||||
'PRIVATE $sTable AS String
|
'PRIVATE $sTable AS String
|
||||||
'PRIVATE $sFilter AS String
|
'PRIVATE $sFilter AS String
|
||||||
PRIVATE $hTable AS DataTable
|
Private $hTable As DataTable
|
||||||
PRIVATE $aColumns AS String[]
|
Private $aColumns As String[]
|
||||||
PRIVATE $bCreate AS Boolean
|
Private $bCreate As Boolean
|
||||||
PRIVATE $bRefreshColumn AS Boolean
|
Private $bRefreshColumn As Boolean
|
||||||
PRIVATE $bNoActivate AS Boolean
|
Private $bNoActivate As Boolean
|
||||||
PRIVATE $iHighlight AS Integer
|
Private $iHighlight As Integer
|
||||||
PRIVATE $bHighlight AS Boolean
|
Private $bHighlight As Boolean
|
||||||
|
|
||||||
PUBLIC SUB _new()
|
Public Sub _new()
|
||||||
|
|
||||||
$hCtrl = NEW GridView(ME) AS "GridView"
|
$hCtrl = New GridView(Me) As "GridView"
|
||||||
$hCtrl.Header = GridView.Both
|
$hCtrl.Header = GridView.Both
|
||||||
'''$hCtrl.AutoResize = TRUE
|
'''$hCtrl.AutoResize = TRUE
|
||||||
'''$hCtrl.Resizable = FALSE
|
'''$hCtrl.Resizable = FALSE
|
||||||
$hCtrl.Grid = FALSE
|
$hCtrl.Grid = False
|
||||||
Create()
|
Create()
|
||||||
Refresh
|
Refresh
|
||||||
|
|
||||||
$bHighlight = TRUE
|
$bHighlight = True
|
||||||
$iHighlight = Color.LightBackground
|
$iHighlight = Color.LightBackground
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB RefreshColumns()
|
Private Sub RefreshColumns()
|
||||||
|
|
||||||
DIM iInd AS Integer
|
Dim iInd As Integer
|
||||||
DIM sTable AS String
|
Dim sTable As String
|
||||||
|
|
||||||
IF Common.CheckDB() THEN RETURN
|
If Common.CheckDB() Then Return
|
||||||
IF NOT $bRefreshColumn THEN RETURN
|
If Not $bRefreshColumn Then Return
|
||||||
|
|
||||||
$bRefreshColumn = FALSE
|
$bRefreshColumn = False
|
||||||
|
|
||||||
sTable = $hTable.Name
|
sTable = $hTable.Name
|
||||||
|
|
||||||
IF NOT $aColumns OR IF $aColumns.Count = 0 THEN
|
If Not $aColumns Or If $aColumns.Count = 0 Then
|
||||||
$aColumns = DataConnection.GetFields(sTable)
|
$aColumns = DataConnection.GetFields(sTable)
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
'Object.Lock($hCtrl)
|
'Object.Lock($hCtrl)
|
||||||
$bNoActivate = TRUE
|
$bNoActivate = True
|
||||||
$hCtrl.Columns.Count = $aColumns.Count
|
$hCtrl.Columns.Count = $aColumns.Count
|
||||||
FOR iInd = 0 TO $aColumns.Max
|
For iInd = 0 To $aColumns.Max
|
||||||
WITH DataConnection[sTable, $aColumns[iInd]]
|
With DataConnection[sTable, $aColumns[iInd]]
|
||||||
|
'Debug .Name;; $hCtrl.Columns[iInd].Width;; .GetWidth($hCtrl)
|
||||||
$hCtrl.Columns[iInd].Text = .Name
|
$hCtrl.Columns[iInd].Text = .Name
|
||||||
$hCtrl.Columns[iInd].Width = .GetWidth($hCtrl)
|
$hCtrl.Columns[iInd].Width = .GetWidth($hCtrl)
|
||||||
END WITH
|
'Debug "--> "; $hCtrl.Columns[iInd].Width
|
||||||
NEXT
|
End With
|
||||||
$bNoActivate = FALSE
|
Next
|
||||||
|
$bNoActivate = False
|
||||||
'Object.Unlock($hCtrl)
|
'Object.Unlock($hCtrl)
|
||||||
|
|
||||||
IF $bCreate THEN Create()
|
If $bCreate Then Create()
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PRIVATE SUB Load()
|
Private Sub Load()
|
||||||
|
|
||||||
DIM hSrc AS DataSource
|
Dim hSrc As DataSource
|
||||||
|
|
||||||
IF Common.CheckDB() THEN RETURN
|
If Common.CheckDB() Then Return
|
||||||
|
|
||||||
'TRY DB.Open
|
'TRY DB.Open
|
||||||
|
|
||||||
'IF NOT $sTable THEN
|
'IF NOT $sTable THEN
|
||||||
hSrc = Common.GetSource(ME)
|
hSrc = Common.GetSource(Me)
|
||||||
IF hSrc THEN
|
If hSrc Then
|
||||||
$hTable = hSrc._GetTable()
|
$hTable = hSrc._GetTable()
|
||||||
ENDIF
|
Endif
|
||||||
'ELSE
|
'ELSE
|
||||||
' $hTable = NEW DataTable($sTable, $sFilter)
|
' $hTable = NEW DataTable($sTable, $sFilter)
|
||||||
'ENDIF
|
'ENDIF
|
||||||
|
|
||||||
IF NOT $hTable THEN
|
If Not $hTable Then
|
||||||
$hCtrl.Rows.Count = 0
|
$hCtrl.Rows.Count = 0
|
||||||
RETURN
|
Return
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
RefreshColumns
|
RefreshColumns
|
||||||
'Object.Lock($hCtrl)
|
'Object.Lock($hCtrl)
|
||||||
$bNoActivate = TRUE
|
$bNoActivate = True
|
||||||
$hCtrl.Rows.Count = $hTable.Count
|
$hCtrl.Rows.Count = $hTable.Count
|
||||||
$bNoActivate = FALSE
|
$bNoActivate = False
|
||||||
'Object.Unlock($hCtrl)
|
'Object.Unlock($hCtrl)
|
||||||
|
|
||||||
$hCtrl.Refresh
|
$hCtrl.Refresh
|
||||||
|
|
||||||
IF hSrc.Index < 0 THEN
|
If hSrc.Index < 0 Then
|
||||||
$bCreate = TRUE
|
$bCreate = True
|
||||||
$hCtrl.Rows.UnSelect
|
$hCtrl.Rows.UnSelect
|
||||||
ELSE
|
Else
|
||||||
$hCtrl.Row = hSrc.Index
|
$hCtrl.Row = hSrc.Index
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PUBLIC SUB Refresh()
|
Public Sub Refresh()
|
||||||
|
|
||||||
Load
|
Load
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,49 +162,49 @@ END
|
||||||
'
|
'
|
||||||
' END
|
' END
|
||||||
|
|
||||||
PRIVATE FUNCTION Columns_Read() AS String[]
|
Private Function Columns_Read() As String[]
|
||||||
|
|
||||||
RETURN $aColumns.Copy()
|
Return $aColumns.Copy()
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB Columns_Write(aCol AS String[])
|
Private Sub Columns_Write(aCol As String[])
|
||||||
|
|
||||||
IF NOT aCol THEN
|
If Not aCol Then
|
||||||
$aColumns = NULL
|
$aColumns = Null
|
||||||
ELSE
|
Else
|
||||||
$aColumns = aCol.Copy()
|
$aColumns = aCol.Copy()
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
$bRefreshColumn = TRUE
|
$bRefreshColumn = True
|
||||||
RefreshColumns
|
RefreshColumns
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB GridView_Data(Row AS Integer, Column AS Integer)
|
Public Sub GridView_Data(Row As Integer, Column As Integer)
|
||||||
|
|
||||||
DIM rData AS Result
|
Dim rData As Result
|
||||||
DIM vVal AS Variant
|
Dim vVal As Variant
|
||||||
|
|
||||||
rData = $hTable[Row]
|
rData = $hTable[Row]
|
||||||
IF NOT rData THEN RETURN
|
If Not rData Then Return
|
||||||
IF NOT rData.Available THEN RETURN
|
If Not rData.Available Then Return
|
||||||
|
|
||||||
IF $aColumns THEN
|
If $aColumns Then
|
||||||
vVal = rData[$aColumns[Column]]
|
vVal = rData[$aColumns[Column]]
|
||||||
ELSE
|
Else
|
||||||
vVal = rData[Column]
|
vVal = rData[Column]
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
IF IsBoolean(vVal) THEN
|
If IsBoolean(vVal) Then
|
||||||
$hCtrl.Data.Text = If(vVal, ("True"), ("False"))
|
$hCtrl.Data.Text = If(vVal, ("True"), ("False"))
|
||||||
ELSE
|
Else
|
||||||
$hCtrl.Data.Text = Str(vVal)
|
$hCtrl.Data.Text = Str(vVal)
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
IF $bHighlight AND IF Row AND 1 THEN $hCtrl.Data.Background = $iHighlight
|
If $bHighlight And If Row And 1 Then $hCtrl.Data.Background = $iHighlight
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
' PUBLIC SUB GridView_Click()
|
' PUBLIC SUB GridView_Click()
|
||||||
'
|
'
|
||||||
|
@ -211,39 +213,39 @@ END
|
||||||
' END
|
' END
|
||||||
|
|
||||||
|
|
||||||
PUBLIC SUB GridView_Change()
|
Public Sub GridView_Change()
|
||||||
|
|
||||||
IF $bNoActivate THEN RETURN
|
If $bNoActivate Then Return
|
||||||
|
|
||||||
$bCreate = FALSE
|
$bCreate = False
|
||||||
RAISE Activate
|
Raise Activate
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PRIVATE FUNCTION Mode_Read() AS Integer
|
Private Function Mode_Read() As Integer
|
||||||
|
|
||||||
RETURN $hCtrl.Mode
|
Return $hCtrl.Mode
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB Mode_Write(iMode AS Integer)
|
Private Sub Mode_Write(iMode As Integer)
|
||||||
|
|
||||||
$hCtrl.Mode = iMode
|
$hCtrl.Mode = iMode
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE FUNCTION Header_Read() AS Integer
|
Private Function Header_Read() As Integer
|
||||||
|
|
||||||
RETURN $hCtrl.Header
|
Return $hCtrl.Header
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB Header_Write(iHeader AS Integer)
|
Private Sub Header_Write(iHeader As Integer)
|
||||||
|
|
||||||
$hCtrl.Header = iHeader
|
$hCtrl.Header = iHeader
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
' PRIVATE FUNCTION Connection_Read() AS Connection
|
' PRIVATE FUNCTION Connection_Read() AS Connection
|
||||||
'
|
'
|
||||||
|
@ -260,137 +262,137 @@ END
|
||||||
'
|
'
|
||||||
' END
|
' END
|
||||||
'
|
'
|
||||||
PRIVATE FUNCTION Current_Read() AS Variant[]
|
Private Function Current_Read() As Variant[]
|
||||||
|
|
||||||
RETURN $hTable.GetKeys($hCtrl.Row)
|
Return $hTable.GetKeys($hCtrl.Row)
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB MoveFirst()
|
Public Sub MoveFirst()
|
||||||
|
|
||||||
TRY $hCtrl.Row = 0
|
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
|
||||||
$bCreate = FALSE
|
|
||||||
|
|
||||||
END
|
|
||||||
|
|
||||||
PUBLIC SUB MoveLast()
|
Try $hCtrl.Row = 0
|
||||||
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
|
$bCreate = False
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub MoveLast()
|
||||||
|
|
||||||
$hCtrl.Row = $hCtrl.Rows.Count - 1
|
$hCtrl.Row = $hCtrl.Rows.Count - 1
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
$bCreate = FALSE
|
$bCreate = False
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB MoveNext()
|
Public Sub MoveNext()
|
||||||
|
|
||||||
IF $bCreate THEN
|
If $bCreate Then
|
||||||
MoveFirst
|
MoveFirst
|
||||||
RETURN
|
Return
|
||||||
ENDIF
|
Endif
|
||||||
IF $hCtrl.Row >= ($hCtrl.Rows.Count - 1) THEN RETURN
|
If $hCtrl.Row >= ($hCtrl.Rows.Count - 1) Then Return
|
||||||
IF $hCtrl.Row < 0 THEN RETURN
|
If $hCtrl.Row < 0 Then Return
|
||||||
INC $hCtrl.Row
|
Inc $hCtrl.Row
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB MovePrevious()
|
Public Sub MovePrevious()
|
||||||
|
|
||||||
IF $bCreate THEN
|
If $bCreate Then
|
||||||
MoveFirst
|
MoveFirst
|
||||||
RETURN
|
Return
|
||||||
ENDIF
|
Endif
|
||||||
IF $hCtrl.Row <= 0 THEN RETURN
|
If $hCtrl.Row <= 0 Then Return
|
||||||
DEC $hCtrl.Row
|
Dec $hCtrl.Row
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB MoveTo(Index AS Integer)
|
Public Sub MoveTo(Index As Integer)
|
||||||
|
|
||||||
IF Index = $hCtrl.Row THEN RETURN
|
If Index = $hCtrl.Row Then Return
|
||||||
$hCtrl.Row = Index
|
$hCtrl.Row = Index
|
||||||
$hCtrl.Rows[$hCtrl.Row].Selected = TRUE
|
$hCtrl.Rows[$hCtrl.Row].Selected = True
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PUBLIC SUB Create()
|
Public Sub Create()
|
||||||
|
|
||||||
$bCreate = TRUE
|
$bCreate = True
|
||||||
$hCtrl.Rows.UnSelect
|
$hCtrl.Rows.UnSelect
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PRIVATE FUNCTION Count_Read() AS Integer
|
Private Function Count_Read() As Integer
|
||||||
|
|
||||||
RETURN $hCtrl.Rows.Count
|
Return $hCtrl.Rows.Count
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE FUNCTION Index_Read() AS Integer
|
Private Function Index_Read() As Integer
|
||||||
|
|
||||||
IF $bCreate THEN
|
If $bCreate Then
|
||||||
RETURN -1
|
Return -1
|
||||||
ELSE
|
Else
|
||||||
RETURN $hCtrl.Row
|
Return $hCtrl.Row
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PUBLIC FUNCTION Remove() AS Boolean
|
Public Function Remove() As Boolean
|
||||||
|
|
||||||
Create()
|
Create()
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE FUNCTION GridView_Read() AS GridView
|
Private Function GridView_Read() As GridView
|
||||||
|
|
||||||
RETURN $hCtrl
|
Return $hCtrl
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB GridView_ColumnClick(Column AS Integer)
|
Public Sub GridView_ColumnClick(Column As Integer)
|
||||||
|
|
||||||
DIM hSrc AS DataSource
|
Dim hSrc As DataSource
|
||||||
|
|
||||||
hSrc = Common.GetSource(ME)
|
hSrc = Common.GetSource(Me)
|
||||||
IF NOT hSrc THEN RETURN
|
If Not hSrc Then Return
|
||||||
|
|
||||||
IF hSrc.Sort <> $aColumns[Column] THEN
|
If hSrc.Sort <> $aColumns[Column] Then
|
||||||
hSrc.Sort = $aColumns[Column]
|
hSrc.Sort = $aColumns[Column]
|
||||||
ELSE
|
Else
|
||||||
hSrc.Sort = ""
|
hSrc.Sort = ""
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
$hCtrl.Refresh
|
$hCtrl.Refresh
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
|
|
||||||
PRIVATE FUNCTION Grid_Read() AS Boolean
|
Private Function Grid_Read() As Boolean
|
||||||
|
|
||||||
RETURN $hCtrl.Grid
|
Return $hCtrl.Grid
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB Grid_Write(Value AS Boolean)
|
Private Sub Grid_Write(Value As Boolean)
|
||||||
|
|
||||||
$hCtrl.Grid = Value
|
$hCtrl.Grid = Value
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE FUNCTION Highlight_Read() AS Boolean
|
Private Function Highlight_Read() As Boolean
|
||||||
|
|
||||||
RETURN $bHighlight
|
Return $bHighlight
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PRIVATE SUB Highlight_Write(Value AS Boolean)
|
Private Sub Highlight_Write(Value As Boolean)
|
||||||
|
|
||||||
$bHighlight = Value
|
$bHighlight = Value
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
' Gambas class file
|
' Gambas class file
|
||||||
|
|
||||||
Public Panel As Panel
|
Public ButtonPanel As Panel
|
||||||
Public DataView As DataView
|
Public DataView As DataView
|
||||||
|
|
||||||
Private $hSrc As DataSource
|
Private $hSrc As DataSource
|
||||||
|
@ -11,7 +11,7 @@ Private $W As Integer
|
||||||
|
|
||||||
Public Sub _new()
|
Public Sub _new()
|
||||||
|
|
||||||
Panel = panBrowser
|
ButtonPanel = panBrowser
|
||||||
DataView = dvwBrowser
|
DataView = dvwBrowser
|
||||||
dvwBrowser.Header = GridView.Horizontal
|
dvwBrowser.Header = GridView.Horizontal
|
||||||
$W = btnNew.W
|
$W = btnNew.W
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# Gambas Form File 3.0
|
# Gambas Form File 3.0
|
||||||
|
|
||||||
{ Form Form
|
{ Form Form
|
||||||
MoveScaled(0,0,64,84)
|
MoveScaled(0,0,68,84)
|
||||||
Text = ("")
|
Text = ("")
|
||||||
Arrangement = Arrange.Vertical
|
Arrangement = Arrange.Vertical
|
||||||
Spacing = 8
|
Spacing = True
|
||||||
Padding = 8
|
Padding = 8
|
||||||
{ DataCombo2 DataCombo
|
{ DataCombo2 DataCombo
|
||||||
MoveScaled(1,1,62,4)
|
MoveScaled(1,1,62,4)
|
||||||
|
@ -16,21 +16,20 @@
|
||||||
MoveScaled(1,5,62,68)
|
MoveScaled(1,5,62,68)
|
||||||
Expand = True
|
Expand = True
|
||||||
Arrangement = Arrange.Vertical
|
Arrangement = Arrange.Vertical
|
||||||
Spacing = 8
|
Spacing = True
|
||||||
Table = "test"
|
Table = "test"
|
||||||
{ DataBrowser1 DataBrowser
|
{ DataBrowser1 DataBrowser
|
||||||
MoveScaled(2,2,59,18)
|
MoveScaled(2,2,59,18)
|
||||||
Expand = True
|
Expand = True
|
||||||
Control = False
|
|
||||||
Columns = ["id", "active", "firstname", "salary"]
|
Columns = ["id", "active", "firstname", "salary"]
|
||||||
Orientation = Align.Top
|
Orientation = Align.Top
|
||||||
}
|
}
|
||||||
{ HBox1 HBox
|
{ HBox1 HBox
|
||||||
MoveScaled(2,21,59,46)
|
MoveScaled(2,21,59,46)
|
||||||
Spacing = 8
|
Spacing = True
|
||||||
{ VBox2 VBox
|
{ VBox2 VBox
|
||||||
MoveScaled(1,1,12,35)
|
MoveScaled(1,1,12,35)
|
||||||
Spacing = 8
|
Spacing = True
|
||||||
{ Label1 Label
|
{ Label1 Label
|
||||||
MoveScaled(1,3,9,4)
|
MoveScaled(1,3,9,4)
|
||||||
Text = ("Id")
|
Text = ("Id")
|
||||||
|
@ -67,13 +66,13 @@
|
||||||
{ VBox1 VBox
|
{ VBox1 VBox
|
||||||
MoveScaled(14,1,44,40)
|
MoveScaled(14,1,44,40)
|
||||||
Expand = True
|
Expand = True
|
||||||
Spacing = 8
|
Spacing = True
|
||||||
{ DataControl1 DataControl
|
{ DataControl1 DataControl
|
||||||
MoveScaled(1,3,30,4)
|
MoveScaled(1,1,30,4)
|
||||||
Field = "id"
|
Field = "id"
|
||||||
}
|
}
|
||||||
{ DataCombo1 DataCombo
|
{ DataCombo1 DataCombo
|
||||||
MoveScaled(1,7,30,4)
|
MoveScaled(1,6,30,4)
|
||||||
Field = "color"
|
Field = "color"
|
||||||
Table = "color"
|
Table = "color"
|
||||||
Display = "french"
|
Display = "french"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Gambas Project File 3.0
|
# Gambas Project File 3.0
|
||||||
# Compiled with Gambas 2.99.0 (r1814)
|
# Compiled with Gambas 2.99.0
|
||||||
Startup=FTest
|
Startup=FTest
|
||||||
StackTrace=1
|
StackTrace=1
|
||||||
Version=2.99.0
|
Version=2.99.0
|
||||||
|
@ -9,7 +9,7 @@ Component=gb.form
|
||||||
Component=gb.settings
|
Component=gb.settings
|
||||||
Component=gb.form.mdi
|
Component=gb.form.mdi
|
||||||
Authors=Benoît Minisini
|
Authors=Benoît Minisini
|
||||||
Environment="GB_GUI=gb.qt"
|
Environment="GB_GUI=gb.qt4"
|
||||||
TabSize=2
|
TabSize=2
|
||||||
Translate=1
|
Translate=1
|
||||||
Language=en
|
Language=en
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
Toggle = True
|
Toggle = True
|
||||||
}
|
}
|
||||||
{ ToolBar1 ToolBar
|
{ ToolBar1 ToolBar
|
||||||
MoveScaled(1,1,127,4)
|
MoveScaled(2,3,132,4)
|
||||||
Expand = True
|
Expand = True
|
||||||
Key = "main"
|
Key = "main"
|
||||||
Text = ("")
|
Text = ("")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
Visible = False
|
Visible = False
|
||||||
}
|
}
|
||||||
{ tabWorkspace TabStrip
|
{ tabWorkspace TabStrip
|
||||||
MoveScaled(2,7,56,51)
|
MoveScaled(3,9,56,51)
|
||||||
Visible = False
|
Visible = False
|
||||||
Expand = True
|
Expand = True
|
||||||
Arrangement = Arrange.Fill
|
Arrangement = Arrange.Fill
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
Background = Color.SelectedBackground
|
Background = Color.SelectedBackground
|
||||||
Arrangement = Arrange.Horizontal
|
Arrangement = Arrange.Horizontal
|
||||||
AutoResize = True
|
AutoResize = True
|
||||||
Spacing = 2
|
Spacing = True
|
||||||
Padding = 4
|
Padding = 4
|
||||||
{ imgIcon PictureBox
|
{ imgIcon PictureBox
|
||||||
MoveScaled(0,0,3,3)
|
MoveScaled(0,0,3,3)
|
||||||
|
@ -68,18 +68,18 @@
|
||||||
Border = Border.Plain
|
Border = Border.Plain
|
||||||
}
|
}
|
||||||
{ dwgBorder DrawingArea
|
{ dwgBorder DrawingArea
|
||||||
MoveScaled(16,6,15,11)
|
MoveScaled(14,3,15,11)
|
||||||
Background = Color.Background
|
Background = Color.Background
|
||||||
Border = Border.Raised
|
Border = Border.Raised
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ panWorkspace Panel
|
{ panWorkspace Panel
|
||||||
MoveScaled(27,43,28,25)
|
MoveScaled(27,47,28,25)
|
||||||
Arrangement = Arrange.Fill
|
Arrangement = Arrange.Fill
|
||||||
Padding = 1
|
Padding = 1
|
||||||
Border = Border.Raised
|
Border = Border.Raised
|
||||||
{ picLogo PictureBox
|
{ picLogo PictureBox
|
||||||
MoveScaled(5,4,19,19)
|
MoveScaled(3,2,19,19)
|
||||||
Visible = False
|
Visible = False
|
||||||
Ignore = True
|
Ignore = True
|
||||||
}
|
}
|
||||||
|
|
|
@ -784,6 +784,10 @@ _new
|
||||||
m
|
m
|
||||||
|
|
||||||
|
|
||||||
|
Refresh_Timer
|
||||||
|
m
|
||||||
|
|
||||||
|
|
||||||
Reload
|
Reload
|
||||||
m
|
m
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ msgstr ""
|
||||||
msgid "Strikeout"
|
msgid "Strikeout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FFontChooser.class:453 FileView.class:75
|
#: FFontChooser.class:453 FileView.class:77
|
||||||
msgid "Size"
|
msgid "Size"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -160,15 +160,15 @@ msgstr ""
|
||||||
msgid "How quickly daft jumping zebras vex"
|
msgid "How quickly daft jumping zebras vex"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FileView.class:74
|
#: FileView.class:76
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FileView.class:77
|
#: FileView.class:79
|
||||||
msgid "Last modified"
|
msgid "Last modified"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FileView.class:184
|
#: FileView.class:188
|
||||||
msgid "&1 K"
|
msgid "&1 K"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Gambas Project File 3.0
|
# Gambas Project File 3.0
|
||||||
# Compiled with Gambas 2.99.0 (r1814)
|
# Compiled with Gambas 2.99.0 (r1814)
|
||||||
Startup=FMain
|
Startup=FMain
|
||||||
|
StackTrace=1
|
||||||
Version=2.99.0
|
Version=2.99.0
|
||||||
VersionProgram=gbx3 -V
|
VersionProgram=gbx3 -V
|
||||||
Component=gb.gui
|
Component=gb.gui
|
||||||
|
|
|
@ -71,6 +71,7 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
||||||
Dim X, Y, X1, Y1, X2, Y2, X3, Y3, Y4 As Integer
|
Dim X, Y, X1, Y1, X2, Y2, X3, Y3, Y4 As Integer
|
||||||
Dim hWin As Window
|
Dim hWin As Window
|
||||||
Dim sNew As String
|
Dim sNew As String
|
||||||
|
Dim hCtrl As Control
|
||||||
|
|
||||||
$X = $hCtrl.ScreenX
|
$X = $hCtrl.ScreenX
|
||||||
$Y = $hCtrl.ScreenY
|
$Y = $hCtrl.ScreenY
|
||||||
|
@ -185,6 +186,8 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
hCtrl = Application.ActiveControl
|
||||||
|
|
||||||
If Not Me.Visible Then
|
If Not Me.Visible Then
|
||||||
hWin = Application.ActiveWindow
|
hWin = Application.ActiveWindow
|
||||||
Me.Show
|
Me.Show
|
||||||
|
@ -194,6 +197,8 @@ Private Sub MakeBorder(Optional W As Integer, H As Integer)
|
||||||
Me.Raise
|
Me.Raise
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
Try hCtrl.SetFocus
|
||||||
|
|
||||||
$dShow = Timer
|
$dShow = Timer
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
|
@ -38,6 +38,8 @@ Private $iSort As Integer
|
||||||
Private $bAsc As Boolean = True
|
Private $bAsc As Boolean = True
|
||||||
Private $aFilter As String[]
|
Private $aFilter As String[]
|
||||||
Private $hPict As Picture
|
Private $hPict As Picture
|
||||||
|
Private $hRefresh As Timer
|
||||||
|
Private $bRefreshTriggered As Boolean
|
||||||
|
|
||||||
Static Public Sub _init()
|
Static Public Sub _init()
|
||||||
|
|
||||||
|
@ -84,7 +86,9 @@ Public Sub _new()
|
||||||
.Resizable = True
|
.Resizable = True
|
||||||
End With
|
End With
|
||||||
|
|
||||||
RefreshView
|
$hRefresh = New Timer As "Refresh"
|
||||||
|
|
||||||
|
RefreshViewLater
|
||||||
RefreshGrid
|
RefreshGrid
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -199,6 +203,24 @@ Catch
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Private Sub RefreshViewLater()
|
||||||
|
|
||||||
|
If $bRefreshTriggered Then Return
|
||||||
|
|
||||||
|
$bRefreshTriggered = True
|
||||||
|
$hRefresh.Trigger
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub Refresh_Timer()
|
||||||
|
|
||||||
|
$bRefreshTriggered = False
|
||||||
|
RefreshView
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Sub Reload()
|
Public Sub Reload()
|
||||||
|
|
||||||
RefreshView
|
RefreshView
|
||||||
|
@ -220,7 +242,7 @@ End
|
||||||
Private Sub Dir_Write(sDir As String)
|
Private Sub Dir_Write(sDir As String)
|
||||||
|
|
||||||
$sDir = sDir
|
$sDir = sDir
|
||||||
RefreshView
|
RefreshViewLater
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -234,7 +256,7 @@ Private Sub ShowHidden_Write(bShowHidden As Boolean)
|
||||||
|
|
||||||
If bShowHidden = $bShowHidden Then Return
|
If bShowHidden = $bShowHidden Then Return
|
||||||
$bShowHidden = bShowHidden
|
$bShowHidden = bShowHidden
|
||||||
RefreshView
|
RefreshViewLater
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -247,7 +269,7 @@ End
|
||||||
Private Sub ShowDirectory_Write(bShow As Boolean)
|
Private Sub ShowDirectory_Write(bShow As Boolean)
|
||||||
|
|
||||||
$bShowDir = bShow
|
$bShowDir = bShow
|
||||||
RefreshView
|
RefreshViewLater
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -318,7 +340,7 @@ Private Sub ShowDetailed_Write(bDetailed As Boolean)
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
RefreshView
|
RefreshViewLater
|
||||||
TakeSelection
|
TakeSelection
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -474,7 +496,7 @@ End
|
||||||
Private Sub Filter_Write(aFilter As String[])
|
Private Sub Filter_Write(aFilter As String[])
|
||||||
|
|
||||||
$aFilter = aFilter
|
$aFilter = aFilter
|
||||||
RefreshView
|
RefreshViewLater
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
# Gambas Project File 3.0
|
# Gambas Project File 3.0
|
||||||
|
# Compiled with Gambas 2.99.0 (r1814)
|
||||||
Startup=FMain
|
Startup=FMain
|
||||||
Icon=database.png
|
Icon=database.png
|
||||||
Version=0.0.1
|
Version=0.0.1
|
||||||
Library=gb.gui
|
Component=gb.gui
|
||||||
Library=gb.form
|
Component=gb.form
|
||||||
Library=gb.db
|
Component=gb.db
|
||||||
Library=gb.db.form
|
Component=gb.db.form
|
||||||
Environment="GB_GUI=gb.qt"
|
Environment="GB_GUI=gb.gtk"
|
||||||
TabSize=2
|
TabSize=2
|
||||||
Translate=1
|
Translate=1
|
||||||
Language=fr
|
Language=fr
|
||||||
|
|
|
@ -2,26 +2,26 @@
|
||||||
|
|
||||||
'PRIVATE $hConn AS NEW Connection
|
'PRIVATE $hConn AS NEW Connection
|
||||||
|
|
||||||
PUBLIC SUB Form_Open()
|
Public Sub Form_Open()
|
||||||
|
|
||||||
WITH DataBrowser2.GridView
|
With DataBrowser2.GridView
|
||||||
.Columns[0].Text = "Color"
|
.Columns[0].Text = "Color"
|
||||||
END WITH
|
End With
|
||||||
|
|
||||||
WITH DataBrowser1.GridView
|
With DataBrowser1.GridView
|
||||||
.Columns[0].Text = "Id"
|
.Columns[0].Text = "Id"
|
||||||
.Columns[0].Width = 48
|
.Columns[0].Width = 48
|
||||||
.Columns[1].Text = "Active"
|
.Columns[1].Text = "Active"
|
||||||
.Columns[2].Text = "Name"
|
.Columns[2].Text = "Name"
|
||||||
END WITH
|
End With
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
||||||
PUBLIC SUB DataControl6_Validate(Value AS Variant)
|
Public Sub DataControl6_Validate(Value As Variant)
|
||||||
|
|
||||||
IF IsNull(Value) THEN RETURN
|
If IsNull(Value) Then Return
|
||||||
IF Value < 0 OR Value > 10000 THEN
|
If Value < 0 Or Value > 10000 Then
|
||||||
STOP EVENT
|
Stop Event
|
||||||
ENDIF
|
Endif
|
||||||
|
|
||||||
END
|
End
|
||||||
|
|
|
@ -393,7 +393,7 @@ int gContainer::clientWidth()
|
||||||
if (GTK_IS_SCROLLED_WINDOW(border))
|
if (GTK_IS_SCROLLED_WINDOW(border))
|
||||||
return (int)gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
return (int)gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
||||||
|
|
||||||
return width() - getFrameWidth() - clientX();
|
return width() - getFrameWidth() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gContainer::clientHeight()
|
int gContainer::clientHeight()
|
||||||
|
@ -423,7 +423,7 @@ int gContainer::clientHeight()
|
||||||
if (GTK_IS_SCROLLED_WINDOW(border))
|
if (GTK_IS_SCROLLED_WINDOW(border))
|
||||||
return (int)gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
return (int)gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(border))->page_size;
|
||||||
|
|
||||||
return height() - getFrameWidth() - clientY();
|
return height() - getFrameWidth() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gContainer::insert(gControl *child)
|
void gContainer::insert(gControl *child)
|
||||||
|
|
|
@ -1215,11 +1215,11 @@ void gGridView::getCursor(int *row,int *col)
|
||||||
|
|
||||||
void gGridView::setCursor(int row,int col)
|
void gGridView::setCursor(int row,int col)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount() || col < 0 || col > columnCount())
|
if (row < 0 || row >= rowCount())
|
||||||
{
|
|
||||||
row = -1;
|
row = -1;
|
||||||
|
|
||||||
|
if (col < 0 || col >= columnCount())
|
||||||
col = -1;
|
col = -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (row == cursor_row && col == cursor_col)
|
if (row == cursor_row && col == cursor_col)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
int count();
|
int count();
|
||||||
gControl *child(int n);
|
gControl *child(int n);
|
||||||
void updateColors();
|
void updateColors();
|
||||||
|
void updateFont();
|
||||||
|
|
||||||
GtkWidget *fix;
|
GtkWidget *fix;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
@ -141,6 +142,7 @@ gTabStripPage::gTabStripPage(gTabStrip *tab)
|
||||||
//gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
|
//gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
|
||||||
|
|
||||||
updateColors();
|
updateColors();
|
||||||
|
updateFont();
|
||||||
|
|
||||||
g_signal_connect(G_OBJECT(widget),"button-press-event",G_CALLBACK(gTabStrip_buttonPress),(gpointer)parent);
|
g_signal_connect(G_OBJECT(widget),"button-press-event",G_CALLBACK(gTabStrip_buttonPress),(gpointer)parent);
|
||||||
g_signal_connect(G_OBJECT(widget),"button-release-event",G_CALLBACK(gTabStrip_buttonRelease),(gpointer)parent);
|
g_signal_connect(G_OBJECT(widget),"button-release-event",G_CALLBACK(gTabStrip_buttonRelease),(gpointer)parent);
|
||||||
|
@ -179,6 +181,13 @@ void gTabStripPage::updateColors()
|
||||||
set_gdk_fg_color(label, parent->foreground());
|
set_gdk_fg_color(label, parent->foreground());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gTabStripPage::updateFont()
|
||||||
|
{
|
||||||
|
gFont *fnt = parent->font();
|
||||||
|
gtk_widget_modify_font(widget, fnt ? fnt->desc() : NULL);
|
||||||
|
gtk_widget_modify_font(label, fnt ? fnt->desc() : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void gTabStripPage::setText(char *text)
|
void gTabStripPage::setText(char *text)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -583,3 +592,13 @@ gTabStripPage *gTabStrip::get(int ind)
|
||||||
else
|
else
|
||||||
return (gTabStripPage *)g_ptr_array_index(_pages, ind);
|
return (gTabStripPage *)g_ptr_array_index(_pages, ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gTabStrip::setFont(gFont *font)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gControl::setFont(font);
|
||||||
|
|
||||||
|
for (i = 0; i < count(); i++)
|
||||||
|
get(i)->updateFont();
|
||||||
|
}
|
||||||
|
|
|
@ -36,7 +36,9 @@ public:
|
||||||
|
|
||||||
virtual void setRealBackground(gColor color);
|
virtual void setRealBackground(gColor color);
|
||||||
virtual void setRealForeground(gColor color);
|
virtual void setRealForeground(gColor color);
|
||||||
|
|
||||||
|
virtual void setFont(gFont *ft);
|
||||||
|
|
||||||
//"Events"
|
//"Events"
|
||||||
void (*onClick)(gTabStrip *sender);
|
void (*onClick)(gTabStrip *sender);
|
||||||
|
|
||||||
|
|
|
@ -492,7 +492,6 @@ GB_DESC CToolButtonDesc[] =
|
||||||
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
||||||
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
||||||
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||||
//GB_PROPERTY("Stretch", "b", CTOOLBUTTON_stretch),
|
|
||||||
|
|
||||||
TOOLBUTTON_DESCRIPTION,
|
TOOLBUTTON_DESCRIPTION,
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@ DECLARE_EVENT(EVENT_Insert);
|
||||||
DECLARE_EVENT(EVENT_BeforeArrange);
|
DECLARE_EVENT(EVENT_BeforeArrange);
|
||||||
DECLARE_EVENT(EVENT_Arrange);
|
DECLARE_EVENT(EVENT_Arrange);
|
||||||
|
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
static int _count_move, _count_resize, _count_set_geom;
|
||||||
|
#endif
|
||||||
|
|
||||||
static QWidget *get_widget(QObjectList *list)
|
static QWidget *get_widget(QObjectList *list)
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -65,19 +69,34 @@ static QWidget *get_widget(QObjectList *list)
|
||||||
static void move_widget(QWidget *wid, int x, int y)
|
static void move_widget(QWidget *wid, int x, int y)
|
||||||
{
|
{
|
||||||
if (wid->x() != x || wid->y() != y)
|
if (wid->x() != x || wid->y() != y)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_move++;
|
||||||
|
#endif
|
||||||
wid->move(x, y);
|
wid->move(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize_widget(QWidget *wid, int w, int h)
|
static void resize_widget(QWidget *wid, int w, int h)
|
||||||
{
|
{
|
||||||
if (wid->width() != w || wid->height() != h)
|
if (wid->width() != w || wid->height() != h)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_resize++;
|
||||||
|
#endif
|
||||||
wid->resize(w, h);
|
wid->resize(w, h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_set_geom++;
|
||||||
|
#endif
|
||||||
wid->setGeometry(x, y, w, h);
|
wid->setGeometry(x, y, w, h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
|
@ -110,14 +129,14 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
#define GET_WIDGET_Y(_widget) (_widget)->y()
|
#define GET_WIDGET_Y(_widget) (_widget)->y()
|
||||||
#define GET_WIDGET_W(_widget) (_widget)->width()
|
#define GET_WIDGET_W(_widget) (_widget)->width()
|
||||||
#define GET_WIDGET_H(_widget) (_widget)->height()
|
#define GET_WIDGET_H(_widget) (_widget)->height()
|
||||||
/*#define MOVE_WIDGET(_widget, _x, _y) move_widget(_widget, x, y)
|
#define MOVE_WIDGET(_widget, _x, _y) move_widget(_widget, x, y)
|
||||||
#define RESIZE_WIDGET(_widget, _w, _h) resize_widget(_widget, w, h)
|
#define RESIZE_WIDGET(_widget, _w, _h) resize_widget(_widget, w, h)
|
||||||
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
||||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) move_resize_widget(_widget, _x, _y, _w, _h)*/
|
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) move_resize_widget(_widget, _x, _y, _w, _h)
|
||||||
#define MOVE_WIDGET(_widget, _x, _y) (_widget)->move(_x, _y)
|
/*#define MOVE_WIDGET(_widget, _x, _y) (_widget)->move(_x, _y)
|
||||||
#define RESIZE_WIDGET(_widget, _w, _h) (_widget)->resize(_w, _h)
|
#define RESIZE_WIDGET(_widget, _w, _h) (_widget)->resize(_w, _h)
|
||||||
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
#define RESIZE_CONTAINER(_widget, _cont, _w, _h) resize_container((_widget), (_cont), (_w), (_h))
|
||||||
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) (_widget)->setGeometry(_x, _y, _w, _h)
|
#define MOVE_RESIZE_WIDGET(_widget, _x, _y, _w, _h) (_widget)->setGeometry(_x, _y, _w, _h)*/
|
||||||
|
|
||||||
#define INIT_CHECK_CHILDREN_LIST(_widget) \
|
#define INIT_CHECK_CHILDREN_LIST(_widget) \
|
||||||
QObjectList *list = (QObjectList *)(_widget)->children(); \
|
QObjectList *list = (QObjectList *)(_widget)->children(); \
|
||||||
|
@ -145,10 +164,35 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
|
|
||||||
//THIS_ARRANGEMENT->dirty = FALSE;
|
//THIS_ARRANGEMENT->dirty = FALSE;
|
||||||
|
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
#define FUNCTION_NAME CCONTAINER_arrange_real
|
||||||
|
#else
|
||||||
#define FUNCTION_NAME CCONTAINER_arrange
|
#define FUNCTION_NAME CCONTAINER_arrange
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gb.form.arrangement.h"
|
#include "gb.form.arrangement.h"
|
||||||
|
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
void CCONTAINER_arrange(void *_object)
|
||||||
|
{
|
||||||
|
static int level = 0;
|
||||||
|
|
||||||
|
if (!level)
|
||||||
|
{
|
||||||
|
_count_move = _count_resize = _count_set_geom = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
level++;
|
||||||
|
CCONTAINER_arrange_real(_object);
|
||||||
|
level--;
|
||||||
|
|
||||||
|
if (!level)
|
||||||
|
{
|
||||||
|
if (_count_move || _count_resize || _count_set_geom)
|
||||||
|
qDebug("CCONTAINER_arrange: (%s %s): move = %d resize = %d setGeometry = %d", GB.GetClassName(THIS), THIS->widget.name, _count_move, _count_resize, _count_set_geom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int max_w, max_h;
|
static int max_w, max_h;
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,7 @@ QTable(0, 0, parent)
|
||||||
_rows = 0;
|
_rows = 0;
|
||||||
_cols = 0;
|
_cols = 0;
|
||||||
_last_col_width = 0;
|
_last_col_width = 0;
|
||||||
|
//qDebug("MyTable: _last_col_width = %d", _last_col_width);
|
||||||
_no_row = true;
|
_no_row = true;
|
||||||
_no_col = true;
|
_no_col = true;
|
||||||
_updating_last_column = false;
|
_updating_last_column = false;
|
||||||
|
@ -362,7 +363,10 @@ void MyTable::setColumnWidth(int col, int width)
|
||||||
QTable::setColumnWidth(col, width);
|
QTable::setColumnWidth(col, width);
|
||||||
|
|
||||||
if (col == (numCols() - 1) && !_updating_last_column)
|
if (col == (numCols() - 1) && !_updating_last_column)
|
||||||
_last_col_width = columnWidth(numCols() - 1);
|
{
|
||||||
|
_last_col_width = width; //columnWidth(numCols() - 1);
|
||||||
|
//qDebug("setColumnWidth: _last_col_width = %d", _last_col_width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void MyTable::adjustColumn(int col)
|
/*void MyTable::adjustColumn(int col)
|
||||||
|
@ -444,7 +448,7 @@ void MyTable::setNumCols(int newCols)
|
||||||
QTable::setNumCols(newCols);
|
QTable::setNumCols(newCols);
|
||||||
blockSignals(b);
|
blockSignals(b);
|
||||||
|
|
||||||
_last_col_width = 0;
|
//qDebug("setNumCols: _last_col_width = %d", _last_col_width);
|
||||||
|
|
||||||
if (newCols > col)
|
if (newCols > col)
|
||||||
{
|
{
|
||||||
|
@ -458,6 +462,9 @@ void MyTable::setNumCols(int newCols)
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
|
||||||
|
_last_col_width = columnWidth(numCols() - 1);
|
||||||
|
|
||||||
emit currentChanged(-1, -1);
|
emit currentChanged(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +672,10 @@ void MyTable::updateLastColumn()
|
||||||
_updating_last_column = true;
|
_updating_last_column = true;
|
||||||
|
|
||||||
if (!_last_col_width)
|
if (!_last_col_width)
|
||||||
|
{
|
||||||
_last_col_width = columnWidth(n);
|
_last_col_width = columnWidth(n);
|
||||||
|
//qDebug("updateLastColumn: _last_col_width = %d", _last_col_width);
|
||||||
|
}
|
||||||
|
|
||||||
if (((columnPos(n) + _last_col_width) < visibleWidth()) && (columnWidth(n) != visibleWidth() - columnPos(n)))
|
if (((columnPos(n) + _last_col_width) < visibleWidth()) && (columnWidth(n) != visibleWidth() - columnPos(n)))
|
||||||
setColumnWidth(n, visibleWidth() - columnPos(n));
|
setColumnWidth(n, visibleWidth() - columnPos(n));
|
||||||
|
|
|
@ -137,12 +137,12 @@ static void set_button(CBUTTON *_object, const char *text, bool resize = false)
|
||||||
if (THIS->picture)
|
if (THIS->picture)
|
||||||
{
|
{
|
||||||
p = *(THIS->picture->pixmap);
|
p = *(THIS->picture->pixmap);
|
||||||
if (THIS->stretch)
|
/*if (THIS->stretch)
|
||||||
{
|
{
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
CWIDGET_iconset(icon, p, size);
|
CWIDGET_iconset(icon, p, size);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
CWIDGET_iconset(icon, p);
|
CWIDGET_iconset(icon, p);
|
||||||
WIDGET->setIcon(icon);
|
WIDGET->setIcon(icon);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ static void set_button(CBUTTON *_object, const char *text, bool resize = false)
|
||||||
WIDGET->setText(qtext);
|
WIDGET->setText(qtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
WIDGET->calcMinimumHeight();
|
WIDGET->calcMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,12 +183,12 @@ static void set_tool_button(CBUTTON *_object, const char *text, bool resize = fa
|
||||||
p = *(THIS->picture->pixmap);
|
p = *(THIS->picture->pixmap);
|
||||||
|
|
||||||
WIDGET_TOOL->setText(qtext);
|
WIDGET_TOOL->setText(qtext);
|
||||||
if (THIS->stretch)
|
/*if (THIS->stretch)
|
||||||
{
|
{
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
CWIDGET_iconset(icon, p, size);
|
CWIDGET_iconset(icon, p, size);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
CWIDGET_iconset(icon, p);
|
CWIDGET_iconset(icon, p);
|
||||||
|
|
||||||
WIDGET_TOOL->setIcon(icon);
|
WIDGET_TOOL->setIcon(icon);
|
||||||
|
@ -204,7 +204,7 @@ static void set_tool_button(CBUTTON *_object, const char *text, bool resize = fa
|
||||||
}
|
}
|
||||||
|
|
||||||
//CWidget::resetTooltip((CWIDGET *)_object);
|
//CWidget::resetTooltip((CWIDGET *)_object);
|
||||||
WIDGET->calcMinimumHeight();
|
WIDGET->calcMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,6 +382,18 @@ BEGIN_PROPERTY(CBUTTON_radio)
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
|
BEGIN_PROPERTY(CBUTTON_autoresize)
|
||||||
|
|
||||||
|
if (READ_PROPERTY)
|
||||||
|
GB.ReturnBoolean(THIS->autoresize);
|
||||||
|
else if (THIS->autoresize != VPROP(GB_BOOLEAN))
|
||||||
|
{
|
||||||
|
THIS->autoresize = VPROP(GB_BOOLEAN);
|
||||||
|
WIDGET->calcMinimumSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
END_PROPERTY
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
BEGIN_PROPERTY(CBUTTON_stretch)
|
BEGIN_PROPERTY(CBUTTON_stretch)
|
||||||
|
|
||||||
|
@ -433,7 +445,7 @@ GB_DESC CButtonDesc[] =
|
||||||
GB_PROPERTY("Default", "b", CBUTTON_default),
|
GB_PROPERTY("Default", "b", CBUTTON_default),
|
||||||
GB_PROPERTY("Cancel", "b", CBUTTON_cancel),
|
GB_PROPERTY("Cancel", "b", CBUTTON_cancel),
|
||||||
GB_PROPERTY("Value", "b", CBUTTON_value),
|
GB_PROPERTY("Value", "b", CBUTTON_value),
|
||||||
//GB_PROPERTY("Stretch", "b", CBUTTON_stretch),
|
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||||
|
|
||||||
BUTTON_DESCRIPTION,
|
BUTTON_DESCRIPTION,
|
||||||
|
|
||||||
|
@ -456,7 +468,7 @@ GB_DESC CToggleButtonDesc[] =
|
||||||
//GB_PROPERTY("Flat", "b", CBUTTON_flat),
|
//GB_PROPERTY("Flat", "b", CBUTTON_flat),
|
||||||
GB_PROPERTY("Border", "b", CTOGGLEBUTTON_border),
|
GB_PROPERTY("Border", "b", CTOGGLEBUTTON_border),
|
||||||
GB_PROPERTY("Radio", "b", CTOGGLEBUTTON_radio),
|
GB_PROPERTY("Radio", "b", CTOGGLEBUTTON_radio),
|
||||||
//GB_PROPERTY("Stretch", "b", CTOGGLEBUTTON_stretch),
|
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||||
|
|
||||||
TOGGLEBUTTON_DESCRIPTION,
|
TOGGLEBUTTON_DESCRIPTION,
|
||||||
|
|
||||||
|
@ -480,7 +492,7 @@ GB_DESC CToolButtonDesc[] =
|
||||||
GB_PROPERTY("Toggle", "b", CTOOLBUTTON_toggle),
|
GB_PROPERTY("Toggle", "b", CTOOLBUTTON_toggle),
|
||||||
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
GB_PROPERTY("Border", "b", CTOOLBUTTON_border),
|
||||||
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
GB_PROPERTY("Radio", "b", CTOOLBUTTON_radio),
|
||||||
//GB_PROPERTY("Stretch", "b", CTOOLBUTTON_stretch),
|
GB_PROPERTY("AutoResize", "b", CBUTTON_autoresize),
|
||||||
|
|
||||||
TOOLBUTTON_DESCRIPTION,
|
TOOLBUTTON_DESCRIPTION,
|
||||||
|
|
||||||
|
@ -496,7 +508,7 @@ GB_DESC CToolButtonDesc[] =
|
||||||
MyPushButton::MyPushButton(QWidget *parent) :
|
MyPushButton::MyPushButton(QWidget *parent) :
|
||||||
QPushButton(parent)
|
QPushButton(parent)
|
||||||
{
|
{
|
||||||
calcMinimumHeight();
|
calcMinimumSize();
|
||||||
top = 0;
|
top = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,14 +526,17 @@ MyPushButton::~MyPushButton()
|
||||||
return QSize(width(), height());
|
return QSize(width(), height());
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void MyPushButton::fontChange(const QFont &font)
|
void MyPushButton::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
QWidget::fontChange(font);
|
QWidget::changeEvent(e);
|
||||||
calcMinimumHeight();
|
if (e->type() == QEvent::FontChange)
|
||||||
|
calcMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPushButton::calcMinimumHeight()
|
void MyPushButton::calcMinimumSize()
|
||||||
{
|
{
|
||||||
|
CBUTTON *_object = (CBUTTON *)CWidget::get(this);
|
||||||
|
|
||||||
if (text().length() > 0)
|
if (text().length() > 0)
|
||||||
{
|
{
|
||||||
QFontMetrics fm = fontMetrics();
|
QFontMetrics fm = fontMetrics();
|
||||||
|
@ -530,6 +545,11 @@ void MyPushButton::calcMinimumHeight()
|
||||||
else
|
else
|
||||||
setMinimumHeight(0);
|
setMinimumHeight(0);
|
||||||
|
|
||||||
|
if (THIS->autoresize)
|
||||||
|
setMinimumWidth(sizeHint().width());
|
||||||
|
else
|
||||||
|
setMinimumWidth(0);
|
||||||
|
|
||||||
//qDebug("%p: %s: %d", this, text().latin1(), minimumHeight());
|
//qDebug("%p: %s: %d", this, text().latin1(), minimumHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,20 +564,21 @@ void MyPushButton::resizeEvent(QResizeEvent *e)
|
||||||
MyToolButton::MyToolButton(QWidget *parent) :
|
MyToolButton::MyToolButton(QWidget *parent) :
|
||||||
QToolButton(parent)
|
QToolButton(parent)
|
||||||
{
|
{
|
||||||
calcMinimumHeight();
|
calcMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
MyToolButton::~MyToolButton()
|
MyToolButton::~MyToolButton()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyToolButton::fontChange(const QFont &font)
|
void MyToolButton::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
QToolButton::fontChange(font);
|
QWidget::changeEvent(e);
|
||||||
calcMinimumHeight();
|
if (e->type() == QEvent::FontChange)
|
||||||
|
calcMinimumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyToolButton::calcMinimumHeight()
|
void MyToolButton::calcMinimumSize()
|
||||||
{
|
{
|
||||||
if (text().length() > 0)
|
if (text().length() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef
|
||||||
CPICTURE *picture;
|
CPICTURE *picture;
|
||||||
int last_size;
|
int last_size;
|
||||||
unsigned radio : 1;
|
unsigned radio : 1;
|
||||||
unsigned stretch : 1;
|
unsigned autoresize : 1;
|
||||||
}
|
}
|
||||||
CBUTTON;
|
CBUTTON;
|
||||||
|
|
||||||
|
@ -71,9 +71,8 @@ public:
|
||||||
|
|
||||||
MyPushButton(QWidget *parent);
|
MyPushButton(QWidget *parent);
|
||||||
~MyPushButton();
|
~MyPushButton();
|
||||||
//QSize sizeHint(void) const;
|
virtual void changeEvent(QEvent *e);
|
||||||
virtual void fontChange(const QFont &);
|
void calcMinimumSize();
|
||||||
void calcMinimumHeight();
|
|
||||||
virtual void resizeEvent(QResizeEvent *e);
|
virtual void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
CWINDOW *top;
|
CWINDOW *top;
|
||||||
|
@ -88,9 +87,8 @@ public:
|
||||||
|
|
||||||
MyToolButton(QWidget *parent);
|
MyToolButton(QWidget *parent);
|
||||||
~MyToolButton();
|
~MyToolButton();
|
||||||
//QSize sizeHint(void) const;
|
virtual void changeEvent(QEvent *e);
|
||||||
virtual void fontChange(const QFont &);
|
void calcMinimumSize();
|
||||||
void calcMinimumHeight();
|
|
||||||
virtual void resizeEvent(QResizeEvent *e);
|
virtual void resizeEvent(QResizeEvent *e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,10 @@ DECLARE_EVENT(EVENT_Insert);
|
||||||
DECLARE_EVENT(EVENT_BeforeArrange);
|
DECLARE_EVENT(EVENT_BeforeArrange);
|
||||||
DECLARE_EVENT(EVENT_Arrange);
|
DECLARE_EVENT(EVENT_Arrange);
|
||||||
|
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
static int _count_move, _count_resize, _count_set_geom;
|
||||||
|
#endif
|
||||||
|
|
||||||
static QWidget *get_next_widget(QObjectList &list, int &index)
|
static QWidget *get_next_widget(QObjectList &list, int &index)
|
||||||
{
|
{
|
||||||
QObject *ob;
|
QObject *ob;
|
||||||
|
@ -70,27 +74,37 @@ static QWidget *get_next_widget(QObjectList &list, int &index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _count = 0;
|
|
||||||
|
|
||||||
static void move_widget(QWidget *wid, int x, int y)
|
static void move_widget(QWidget *wid, int x, int y)
|
||||||
{
|
{
|
||||||
qDebug("%d", ++_count);
|
|
||||||
if (wid->x() != x || wid->y() != y)
|
if (wid->x() != x || wid->y() != y)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_move++;
|
||||||
|
#endif
|
||||||
wid->move(x, y);
|
wid->move(x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize_widget(QWidget *wid, int w, int h)
|
static void resize_widget(QWidget *wid, int w, int h)
|
||||||
{
|
{
|
||||||
qDebug("%d", ++_count);
|
|
||||||
if (wid->width() != w || wid->height() != h)
|
if (wid->width() != w || wid->height() != h)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_resize++;
|
||||||
|
#endif
|
||||||
wid->resize(w, h);
|
wid->resize(w, h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
static void move_resize_widget(QWidget *wid, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
qDebug("%d", ++_count);
|
|
||||||
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
if (wid->x() != x || wid->y() != y || wid->width() != w || wid->height() != h)
|
||||||
|
{
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
_count_set_geom++;
|
||||||
|
#endif
|
||||||
wid->setGeometry(x, y, w, h);
|
wid->setGeometry(x, y, w, h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
|
@ -113,7 +127,8 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
#define IS_DESIGN(_object) (CWIDGET_test_flag(_object, WF_DESIGN) && CWIDGET_test_flag(_object, WF_DESIGN_LEADER))
|
#define IS_DESIGN(_object) (CWIDGET_test_flag(_object, WF_DESIGN) && CWIDGET_test_flag(_object, WF_DESIGN_LEADER))
|
||||||
#define IS_WIDGET_VISIBLE(_widget) (_widget)->isVisible()
|
#define IS_WIDGET_VISIBLE(_widget) (_widget)->isVisible()
|
||||||
|
|
||||||
#define CAN_ARRANGE(_object) ((_object) && (IS_WIDGET_VISIBLE(GET_CONTAINER(_object)) || IS_WIDGET_VISIBLE(GET_WIDGET(_object))))
|
#define CAN_ARRANGE(_object) ((_object) && ((CWIDGET *)(_object))->flag.shown)
|
||||||
|
//(IS_WIDGET_VISIBLE(GET_CONTAINER(_object)) || IS_WIDGET_VISIBLE(GET_WIDGET(_object))))
|
||||||
|
|
||||||
#define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) \
|
#define GET_WIDGET_CONTENTS(_widget, _x, _y, _w, _h) \
|
||||||
_x = (_widget)->contentsRect().x(); \
|
_x = (_widget)->contentsRect().x(); \
|
||||||
|
@ -152,27 +167,36 @@ static void resize_container(QWidget *wid, QWidget *cont, int w, int h)
|
||||||
|
|
||||||
#define DESKTOP_SCALE MAIN_scale
|
#define DESKTOP_SCALE MAIN_scale
|
||||||
|
|
||||||
|
#if DEBUG_CONTAINER
|
||||||
|
#define FUNCTION_NAME CCONTAINER_arrange_real
|
||||||
|
#else
|
||||||
#define FUNCTION_NAME CCONTAINER_arrange
|
#define FUNCTION_NAME CCONTAINER_arrange
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gb.form.arrangement.h"
|
#include "gb.form.arrangement.h"
|
||||||
|
|
||||||
extern void qt_x11_set_global_double_buffer(bool);
|
#if DEBUG_CONTAINER
|
||||||
|
void CCONTAINER_arrange(void *_object)
|
||||||
/*void CCONTAINER_arrange(void *_object)
|
|
||||||
{
|
{
|
||||||
static int level = 0;
|
static int level = 0;
|
||||||
|
|
||||||
if (!level)
|
if (!level)
|
||||||
qt_x11_set_global_double_buffer(false);
|
{
|
||||||
|
_count_move = _count_resize = _count_set_geom = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
level++;
|
level++;
|
||||||
CCONTAINER_arrange2(_object);
|
CCONTAINER_arrange_real(_object);
|
||||||
level--;
|
level--;
|
||||||
|
|
||||||
if (!level)
|
if (!level)
|
||||||
qt_x11_set_global_double_buffer(true);
|
{
|
||||||
}*/
|
if (_count_move || _count_resize || _count_set_geom)
|
||||||
|
qDebug("CCONTAINER_arrange: (%s %s): move = %d resize = %d setGeometry = %d", GB.GetClassName(THIS), THIS->widget.name, _count_move, _count_resize, _count_set_geom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int max_w, max_h;
|
static int max_w, max_h;
|
||||||
|
|
||||||
|
@ -278,9 +302,18 @@ void MyContainer::resizeEvent(QResizeEvent *e)
|
||||||
|
|
||||||
void MyContainer::showEvent(QShowEvent *e)
|
void MyContainer::showEvent(QShowEvent *e)
|
||||||
{
|
{
|
||||||
|
void *_object = CWidget::get(this);
|
||||||
//qDebug("MyContainer::showEvent %p %s", CWidget::get(this), GB.GetClassName(CWidget::get(this)));
|
//qDebug("MyContainer::showEvent %p %s", CWidget::get(this), GB.GetClassName(CWidget::get(this)));
|
||||||
QFrame::showEvent(e);
|
QFrame::showEvent(e);
|
||||||
arrange_now(this);
|
THIS->widget.flag.shown = TRUE;
|
||||||
|
CCONTAINER_arrange(THIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyContainer::hideEvent(QHideEvent *e)
|
||||||
|
{
|
||||||
|
void *_object = CWidget::get(this);
|
||||||
|
QFrame::hideEvent(e);
|
||||||
|
THIS->widget.flag.shown = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void MyContainer::childEvent(QChildEvent *e)
|
/*void MyContainer::childEvent(QChildEvent *e)
|
||||||
|
@ -481,7 +514,7 @@ BEGIN_PROPERTY(CCONTAINER_y)
|
||||||
|
|
||||||
QRect r = getRect(THIS); // _CONTAINER);
|
QRect r = getRect(THIS); // _CONTAINER);
|
||||||
QPoint p(r.x(), r.y());
|
QPoint p(r.x(), r.y());
|
||||||
|
|
||||||
GB.ReturnInteger(CONTAINER->mapTo(WIDGET, p).y());
|
GB.ReturnInteger(CONTAINER->mapTo(WIDGET, p).y());
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
|
@ -117,6 +117,7 @@ protected:
|
||||||
virtual void resizeEvent(QResizeEvent *);
|
virtual void resizeEvent(QResizeEvent *);
|
||||||
//virtual void childEvent(QChildEvent *);
|
//virtual void childEvent(QChildEvent *);
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *);
|
||||||
|
virtual void hideEvent(QHideEvent *);
|
||||||
//virtual bool eventFilter(QObject *, QEvent *);
|
//virtual bool eventFilter(QObject *, QEvent *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ DECLARE_EVENT(EVENT_Hide);
|
||||||
|
|
||||||
DECLARE_METHOD(CCONTROL_window);
|
DECLARE_METHOD(CCONTROL_window);
|
||||||
DECLARE_METHOD(CCONTROL_name);
|
DECLARE_METHOD(CCONTROL_name);
|
||||||
|
DECLARE_METHOD(CMENU_hide);
|
||||||
|
|
||||||
static int check_menu(void *_object)
|
static int check_menu(void *_object)
|
||||||
{
|
{
|
||||||
|
@ -81,8 +82,6 @@ static void delete_menu(CMENU *_object)
|
||||||
if (THIS->deleted)
|
if (THIS->deleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//qDebug("delete_menu: THIS = %p", _object);
|
|
||||||
|
|
||||||
if (THIS->menu)
|
if (THIS->menu)
|
||||||
{
|
{
|
||||||
delete THIS->menu;
|
delete THIS->menu;
|
||||||
|
@ -91,9 +90,7 @@ static void delete_menu(CMENU *_object)
|
||||||
|
|
||||||
CMenu::dict.remove(ACTION);
|
CMenu::dict.remove(ACTION);
|
||||||
|
|
||||||
//delete ACTION;
|
|
||||||
THIS->widget.widget = 0;
|
THIS->widget.widget = 0;
|
||||||
|
|
||||||
THIS->deleted = true;
|
THIS->deleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,13 +423,18 @@ END_METHOD
|
||||||
BEGIN_METHOD_VOID(CMENU_clear)
|
BEGIN_METHOD_VOID(CMENU_clear)
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
CMENU *menu;
|
||||||
|
|
||||||
if (THIS->menu)
|
if (THIS->menu)
|
||||||
{
|
{
|
||||||
QList<QAction *> list = THIS->menu->actions();
|
QList<QAction *> list = THIS->menu->actions();
|
||||||
|
|
||||||
for (i = 0; i < list.count(); i++)
|
for (i = 0; i < list.count(); i++)
|
||||||
delete_menu(CMenu::dict[list.at(i)]);
|
{
|
||||||
|
menu = CMenu::dict[list.at(i)];
|
||||||
|
delete ((QAction *)(menu->widget.widget));
|
||||||
|
delete_menu(menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
|
@ -64,10 +64,10 @@ BEGIN_METHOD(CHSPLIT_new, GB_OBJECT parent)
|
||||||
wid->setOrientation(Qt::Horizontal);
|
wid->setOrientation(Qt::Horizontal);
|
||||||
wid->setOpaqueResize(true);
|
wid->setOpaqueResize(true);
|
||||||
|
|
||||||
CWIDGET_new(wid, (void *)_object);
|
|
||||||
|
|
||||||
THIS->container = wid;
|
THIS->container = wid;
|
||||||
|
|
||||||
|
CWIDGET_new(wid, (void *)_object);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,13 +75,12 @@ BEGIN_METHOD(CVSPLIT_new, GB_OBJECT parent)
|
||||||
|
|
||||||
QSplitter *wid = new MySplitter(QCONTAINER(VARG(parent)));
|
QSplitter *wid = new MySplitter(QCONTAINER(VARG(parent)));
|
||||||
|
|
||||||
CWIDGET_new(wid, (void *)_object);
|
|
||||||
|
|
||||||
THIS->container = wid;
|
THIS->container = wid;
|
||||||
|
|
||||||
wid->setOrientation(Qt::Vertical);
|
wid->setOrientation(Qt::Vertical);
|
||||||
wid->setOpaqueResize(true);
|
wid->setOpaqueResize(true);
|
||||||
wid->show();
|
|
||||||
|
CWIDGET_new(wid, (void *)_object);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
|
@ -151,13 +151,14 @@ void MyTabWidget::setEnabled(bool e)
|
||||||
|
|
||||||
void MyTabWidget::forceLayout()
|
void MyTabWidget::forceLayout()
|
||||||
{
|
{
|
||||||
/*bool b = isVisible();
|
bool b = isVisible();
|
||||||
QShowEvent e;
|
QShowEvent e;
|
||||||
|
|
||||||
setWState(WState_Visible);
|
setAttribute(Qt::WA_WState_Visible, true);
|
||||||
qApp->sendEvent(this, &e);
|
qApp->sendEvent(this, &e);
|
||||||
if (!b)
|
if (!b)
|
||||||
clearWState(WState_Visible);*/
|
setAttribute(Qt::WA_WState_Visible, false);
|
||||||
|
|
||||||
//qDebug("Y = %d", tabBar()->height());
|
//qDebug("Y = %d", tabBar()->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,24 +191,24 @@ static void set_name(CWIDGET *_object, const char *name)
|
||||||
GB.NewString(&THIS->name, name, 0);
|
GB.NewString(&THIS->name, name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CWIDGET *get_parent_control(CWIDGET *_object)
|
void *CWIDGET_get_parent(void *_object)
|
||||||
{
|
{
|
||||||
QWidget *parent = WIDGET->parentWidget();
|
QWidget *parent = WIDGET->parentWidget();
|
||||||
|
|
||||||
if (!parent || WIDGET->isWindow())
|
if (!parent || (GB.Is(THIS, CLASS_Window) && ((CWINDOW *)_object)->toplevel))
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return CWidget::get(parent);
|
return CWidget::get(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void arrange_parent(CWIDGET *_object)
|
static void arrange_parent(CWIDGET *_object)
|
||||||
{
|
{
|
||||||
CWIDGET *parent = get_parent_control(THIS); //CWidget::get(WIDGET->parentWidget());
|
void *parent = CWIDGET_get_parent(THIS);
|
||||||
if (parent)
|
if (!parent)
|
||||||
CCONTAINER_arrange(parent);
|
return;
|
||||||
|
CCONTAINER_arrange(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CWIDGET_update_design(CWIDGET *_object)
|
void CWIDGET_update_design(CWIDGET *_object)
|
||||||
{
|
{
|
||||||
if (!CWIDGET_test_flag(THIS, WF_DESIGN) && !CWIDGET_test_flag(THIS, WF_DESIGN_LEADER))
|
if (!CWIDGET_test_flag(THIS, WF_DESIGN) && !CWIDGET_test_flag(THIS, WF_DESIGN_LEADER))
|
||||||
|
@ -261,13 +261,10 @@ void CWIDGET_new(QWidget *w, void *_object, bool no_show, bool no_filter, bool n
|
||||||
//THIS->flag.fillBackground = GB.Is(THIS, CLASS_Container);
|
//THIS->flag.fillBackground = GB.Is(THIS, CLASS_Container);
|
||||||
w->setAutoFillBackground(THIS->flag.fillBackground);
|
w->setAutoFillBackground(THIS->flag.fillBackground);
|
||||||
|
|
||||||
CCONTAINER_insert_child(THIS);
|
CCONTAINER_insert_child(THIS);
|
||||||
|
|
||||||
if (!no_show)
|
if (!no_show)
|
||||||
{
|
CWIDGET_set_visible(THIS, true);
|
||||||
THIS->flag.visible = true;
|
|
||||||
w->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -624,42 +621,46 @@ END_METHOD
|
||||||
|
|
||||||
static bool is_visible(void *_object)
|
static bool is_visible(void *_object)
|
||||||
{
|
{
|
||||||
return THIS->flag.visible; //|| !QWIDGET(_object)->isHidden();
|
return THIS->flag.visible; // || !QWIDGET(_object)->isHidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_visible(void *_object, bool v)
|
void CWIDGET_set_visible(CWIDGET *_object, bool v)
|
||||||
{
|
{
|
||||||
THIS->flag.visible = v;
|
THIS->flag.visible = v;
|
||||||
if (THIS->flag.visible)
|
if (THIS->flag.visible)
|
||||||
|
{
|
||||||
QWIDGET(_object)->show();
|
QWIDGET(_object)->show();
|
||||||
|
if (GB.Is(THIS, CLASS_Container))
|
||||||
|
CCONTAINER_arrange(THIS);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
QWIDGET(_object)->hide();
|
QWIDGET(_object)->hide();
|
||||||
|
arrange_parent(THIS);
|
||||||
arrange_parent(THIS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(CCONTROL_visible)
|
BEGIN_PROPERTY(CCONTROL_visible)
|
||||||
|
|
||||||
if (READ_PROPERTY)
|
if (READ_PROPERTY)
|
||||||
GB.ReturnBoolean(is_visible(THIS));
|
GB.ReturnBoolean(is_visible(THIS));
|
||||||
else
|
else
|
||||||
set_visible(THIS, VPROP(GB_BOOLEAN));
|
CWIDGET_set_visible(THIS, VPROP(GB_BOOLEAN));
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CCONTROL_show)
|
BEGIN_METHOD_VOID(CCONTROL_show)
|
||||||
|
|
||||||
set_visible(THIS, true);
|
CWIDGET_set_visible(THIS, true);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
||||||
BEGIN_METHOD_VOID(CCONTROL_hide)
|
BEGIN_METHOD_VOID(CCONTROL_hide)
|
||||||
|
|
||||||
set_visible(THIS, false);
|
CWIDGET_set_visible(THIS, false);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
@ -972,7 +973,7 @@ static QWidget *get_color_widget(QWidget *w)
|
||||||
|
|
||||||
int get_real_background(CWIDGET *_object)
|
int get_real_background(CWIDGET *_object)
|
||||||
{
|
{
|
||||||
CWIDGET *parent = get_parent_control(THIS);
|
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||||
if (THIS->bg == COLOR_DEFAULT && parent)
|
if (THIS->bg == COLOR_DEFAULT && parent)
|
||||||
return get_real_background(parent);
|
return get_real_background(parent);
|
||||||
else
|
else
|
||||||
|
@ -981,7 +982,7 @@ int get_real_background(CWIDGET *_object)
|
||||||
|
|
||||||
int get_real_foreground(CWIDGET *_object)
|
int get_real_foreground(CWIDGET *_object)
|
||||||
{
|
{
|
||||||
CWIDGET *parent = get_parent_control(THIS);
|
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||||
if (THIS->fg == COLOR_DEFAULT && parent)
|
if (THIS->fg == COLOR_DEFAULT && parent)
|
||||||
return get_real_foreground(parent);
|
return get_real_foreground(parent);
|
||||||
else
|
else
|
||||||
|
@ -998,7 +999,7 @@ void CWIDGET_reset_color(CWIDGET *_object)
|
||||||
|
|
||||||
if (THIS->bg == COLOR_DEFAULT && THIS->fg == COLOR_DEFAULT)
|
if (THIS->bg == COLOR_DEFAULT && THIS->fg == COLOR_DEFAULT)
|
||||||
{
|
{
|
||||||
CWIDGET *parent = get_parent_control(THIS);
|
CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
|
||||||
if (parent)
|
if (parent)
|
||||||
w->setPalette(parent->widget->palette());
|
w->setPalette(parent->widget->palette());
|
||||||
else
|
else
|
||||||
|
@ -1108,7 +1109,7 @@ END_PROPERTY
|
||||||
|
|
||||||
BEGIN_PROPERTY(CCONTROL_parent)
|
BEGIN_PROPERTY(CCONTROL_parent)
|
||||||
|
|
||||||
GB.ReturnObject(get_parent_control(THIS));
|
GB.ReturnObject(CWIDGET_get_parent(THIS));
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
|
@ -1206,7 +1207,7 @@ END_METHOD
|
||||||
BEGIN_METHOD(CCONTROL_reparent, GB_OBJECT container; GB_INTEGER x; GB_INTEGER y)
|
BEGIN_METHOD(CCONTROL_reparent, GB_OBJECT container; GB_INTEGER x; GB_INTEGER y)
|
||||||
|
|
||||||
QPoint p(WIDGET->pos());
|
QPoint p(WIDGET->pos());
|
||||||
bool showIt = !WIDGET->isHidden();
|
bool show;
|
||||||
|
|
||||||
if (!MISSING(x) && !MISSING(y))
|
if (!MISSING(x) && !MISSING(y))
|
||||||
{
|
{
|
||||||
|
@ -1217,9 +1218,12 @@ BEGIN_METHOD(CCONTROL_reparent, GB_OBJECT container; GB_INTEGER x; GB_INTEGER y)
|
||||||
if (GB.CheckObject(VARG(container)))
|
if (GB.CheckObject(VARG(container)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
show = is_visible(THIS);
|
||||||
|
CWIDGET_set_visible(THIS, false);
|
||||||
WIDGET->setParent(QCONTAINER(VARG(container)));
|
WIDGET->setParent(QCONTAINER(VARG(container)));
|
||||||
WIDGET->move(p);
|
WIDGET->move(p);
|
||||||
if (showIt) WIDGET->show();
|
CCONTAINER_insert_child(THIS);
|
||||||
|
CWIDGET_set_visible(THIS, show);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,8 @@ typedef
|
||||||
unsigned notified : 1;
|
unsigned notified : 1;
|
||||||
unsigned visible : 1;
|
unsigned visible : 1;
|
||||||
unsigned fillBackground : 1;
|
unsigned fillBackground : 1;
|
||||||
unsigned _reserved : 10;
|
unsigned shown : 1; // for containers
|
||||||
|
unsigned _reserved : 9;
|
||||||
} flag;
|
} flag;
|
||||||
GB_VARIANT_VALUE tag;
|
GB_VARIANT_VALUE tag;
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -69,7 +70,7 @@ typedef
|
||||||
struct {
|
struct {
|
||||||
CWIDGET widget;
|
CWIDGET widget;
|
||||||
QWidget *container;
|
QWidget *container;
|
||||||
int arrangement;
|
int32_t arrangement;
|
||||||
}
|
}
|
||||||
CCONTAINER;
|
CCONTAINER;
|
||||||
|
|
||||||
|
@ -186,6 +187,8 @@ void CWIDGET_set_color(CWIDGET *_object, int bg, int fg);
|
||||||
void CWIDGET_reset_color(CWIDGET *_object);
|
void CWIDGET_reset_color(CWIDGET *_object);
|
||||||
int CWIDGET_get_background(CWIDGET *_object);
|
int CWIDGET_get_background(CWIDGET *_object);
|
||||||
int CWIDGET_get_foreground(CWIDGET *_object);
|
int CWIDGET_get_foreground(CWIDGET *_object);
|
||||||
|
void *CWIDGET_get_parent(void *_object);
|
||||||
|
void CWIDGET_set_visible(CWIDGET *_object, bool v);
|
||||||
|
|
||||||
void CACTION_register(void *control, const char *key);
|
void CACTION_register(void *control, const char *key);
|
||||||
void CACTION_raise(void *control);
|
void CACTION_raise(void *control);
|
||||||
|
|
|
@ -281,7 +281,7 @@ static void show_later(CWINDOW *_object)
|
||||||
if (!THIS->hidden && WIDGET)
|
if (!THIS->hidden && WIDGET)
|
||||||
{
|
{
|
||||||
if (!emit_open_event(THIS))
|
if (!emit_open_event(THIS))
|
||||||
WIDGET->show();
|
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||||
}
|
}
|
||||||
GB.Unref(POINTER(&_object));
|
GB.Unref(POINTER(&_object));
|
||||||
}
|
}
|
||||||
|
@ -377,8 +377,10 @@ BEGIN_METHOD(CWINDOW_new, GB_OBJECT parent)
|
||||||
CWindow::list.append(THIS);
|
CWindow::list.append(THIS);
|
||||||
CWindow::count = CWindow::list.count();
|
CWindow::count = CWindow::list.count();
|
||||||
|
|
||||||
|
#if DEBUG_WINDOW
|
||||||
qDebug("CWindow::count = %d (%p %s %s)", CWindow::count, _object, THIS->widget.name, THIS->embedded ? "E" : "W");
|
qDebug("CWindow::count = %d (%p %s %s)", CWindow::count, _object, THIS->widget.name, THIS->embedded ? "E" : "W");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (CWINDOW_Main == 0)
|
if (CWINDOW_Main == 0)
|
||||||
{
|
{
|
||||||
//qDebug("CWINDOW_Main -> %p", THIS);
|
//qDebug("CWINDOW_Main -> %p", THIS);
|
||||||
|
@ -601,7 +603,7 @@ BEGIN_METHOD_VOID(CWINDOW_raise)
|
||||||
if (!THIS->toplevel)
|
if (!THIS->toplevel)
|
||||||
{
|
{
|
||||||
if (!WIDGET->isVisible())
|
if (!WIDGET->isVisible())
|
||||||
WIDGET->show();
|
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||||
WIDGET->raise();
|
WIDGET->raise();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -622,7 +624,7 @@ BEGIN_METHOD_VOID(CWINDOW_show)
|
||||||
|
|
||||||
if (!THIS->toplevel)
|
if (!THIS->toplevel)
|
||||||
{
|
{
|
||||||
WIDGET->show();
|
CWIDGET_set_visible((CWIDGET *)THIS, true);
|
||||||
#ifndef NO_X_WINDOW
|
#ifndef NO_X_WINDOW
|
||||||
if (THIS->xembed)
|
if (THIS->xembed)
|
||||||
XEMBED->show();
|
XEMBED->show();
|
||||||
|
@ -646,7 +648,7 @@ BEGIN_METHOD_VOID(CWINDOW_hide)
|
||||||
do_close(THIS, 0);
|
do_close(THIS, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WINDOW->hide();
|
CWIDGET_set_visible((CWIDGET *)THIS, false);
|
||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
@ -1514,7 +1516,9 @@ static void remove_window_check_quit(CWINDOW *ob)
|
||||||
CWindow::list.removeAll(ob);
|
CWindow::list.removeAll(ob);
|
||||||
|
|
||||||
CWindow::count = CWindow::list.count();
|
CWindow::count = CWindow::list.count();
|
||||||
|
#if DEBUG_WINDOW
|
||||||
qDebug("~MyMainWindow: CWindow::count = %d (%p %s %s)", CWindow::count, ob, ob->widget.name, ob->embedded ? "E" : "W");
|
qDebug("~MyMainWindow: CWindow::count = %d (%p %s %s)", CWindow::count, ob, ob->widget.name, ob->embedded ? "E" : "W");
|
||||||
|
#endif
|
||||||
|
|
||||||
MAIN_check_quit();
|
MAIN_check_quit();
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2103,9 @@ static bool closeAll()
|
||||||
CWINDOW *win;
|
CWINDOW *win;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#if DEBUG_WINDOW
|
||||||
qDebug("CLOSE ALL");
|
qDebug("CLOSE ALL");
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < list.count(); i++)
|
for (i = 0; i < list.count(); i++)
|
||||||
{
|
{
|
||||||
|
@ -2351,7 +2357,7 @@ void MyMainWindow::doReparent(QWidget *parent, Qt::WindowFlags f, const QPoint &
|
||||||
}
|
}
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
qDebug("doReparent: setActiveWindow");
|
//qDebug("doReparent: setActiveWindow");
|
||||||
setActiveWindow();
|
setActiveWindow();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -593,7 +593,8 @@ void GEditor::paintCell(QPainter * painter, int row, int)
|
||||||
|
|
||||||
p.fillRect(0, 0, cellWidth(), cellHeight(), color);
|
p.fillRect(0, 0, cellWidth(), cellHeight(), color);
|
||||||
|
|
||||||
p.setFont(painter->font());
|
p.setFont(font());
|
||||||
|
//p.setFont(painter->font());
|
||||||
//p.translate(-ur.left(), 0);
|
//p.translate(-ur.left(), 0);
|
||||||
|
|
||||||
// Procedure separation
|
// Procedure separation
|
||||||
|
|
|
@ -493,7 +493,9 @@ static void unrelease_grab()
|
||||||
|
|
||||||
static bool must_quit(void)
|
static bool must_quit(void)
|
||||||
{
|
{
|
||||||
|
#if DEBUG_WINDOW
|
||||||
qDebug("must_quit: Window = %d Watch = %d in_event_loop = %d", CWindow::count, CWatch::count, in_event_loop);
|
qDebug("must_quit: Window = %d Watch = %d in_event_loop = %d", CWindow::count, CWatch::count, in_event_loop);
|
||||||
|
#endif
|
||||||
return CWindow::count == 0 && CWatch::count == 0 && in_event_loop;
|
return CWindow::count == 0 && CWatch::count == 0 && in_event_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +632,7 @@ static void hook_timer(GB_TIMER *timer, bool on)
|
||||||
{
|
{
|
||||||
if (timer->id)
|
if (timer->id)
|
||||||
{
|
{
|
||||||
delete (MyTimer *)(timer->id);
|
((MyTimer *)(timer->id))->deleteLater();
|
||||||
timer->id = 0;
|
timer->id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,8 +196,11 @@ static void post_event(void *object, int event)
|
||||||
|
|
||||||
PUBLIC void EVENT_post_event(void *object, int event)
|
PUBLIC void EVENT_post_event(void *object, int event)
|
||||||
{
|
{
|
||||||
if (!GB_CanRaise(object, event))
|
/*if (!GB_CanRaise(object, event))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "EVENT_post_event: cannot raise event\n");
|
||||||
return;
|
return;
|
||||||
|
}*/
|
||||||
|
|
||||||
GB_Ref(object);
|
GB_Ref(object);
|
||||||
post((void (*)())post_event, 2, (intptr_t)object, (intptr_t)event);
|
post((void (*)())post_event, 2, (intptr_t)object, (intptr_t)event);
|
||||||
|
|
|
@ -36,6 +36,7 @@ EXTERN int MEMORY_count;
|
||||||
#if DEBUG_MEMORY
|
#if DEBUG_MEMORY
|
||||||
|
|
||||||
EXTERN int MEMORY_size;
|
EXTERN int MEMORY_size;
|
||||||
|
EXTERN FILE *MEMORY_log;
|
||||||
|
|
||||||
#define ALLOC(_ptr, _size, _src) MEMORY_alloc((void *)_ptr, _size, _src)
|
#define ALLOC(_ptr, _size, _src) MEMORY_alloc((void *)_ptr, _size, _src)
|
||||||
#define ALLOC_ZERO(_ptr, _size, _src) MEMORY_alloc_zero((void *)_ptr, _size, _src)
|
#define ALLOC_ZERO(_ptr, _size, _src) MEMORY_alloc_zero((void *)_ptr, _size, _src)
|
||||||
|
|
|
@ -57,7 +57,8 @@ PUBLIC int MEMORY_size = 0;
|
||||||
|
|
||||||
static int _id = 0;
|
static int _id = 0;
|
||||||
ALLOC *_alloc = NULL;
|
ALLOC *_alloc = NULL;
|
||||||
extern void DEBUG_where(void);
|
extern char *DEBUG_get_current_position(void);
|
||||||
|
FILE *MEMORY_log;
|
||||||
|
|
||||||
#elif OPTIMIZE_MEMORY
|
#elif OPTIMIZE_MEMORY
|
||||||
|
|
||||||
|
@ -70,25 +71,30 @@ int THROW_MEMORY()
|
||||||
|
|
||||||
PUBLIC void MEMORY_init(void)
|
PUBLIC void MEMORY_init(void)
|
||||||
{
|
{
|
||||||
/*mcheck(NULL);*/
|
#if DEBUG_MEMORY
|
||||||
/*#if DEBUG_MEMORY
|
char path[256];
|
||||||
# ifdef __GNU_LIBRARY__
|
sprintf(path, "/tmp/gambas-memory-%d-%d.log", getuid(), getpid());
|
||||||
mtrace();
|
MEMORY_log = fopen(path, "w+");
|
||||||
if (getenv("LD_PRELOAD"))
|
#endif
|
||||||
unsetenv("MALLOC_TRACE");
|
|
||||||
mcheck(NULL);
|
|
||||||
# endif
|
|
||||||
#endif*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC void MEMORY_exit(void)
|
PUBLIC void MEMORY_exit(void)
|
||||||
{
|
{
|
||||||
#if DEBUG_MEMORY
|
#if DEBUG_MEMORY
|
||||||
while (_alloc)
|
if (MEMORY_count)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "<%d>\n", _alloc->id);
|
fprintf(MEMORY_log, "\n*************************************************\n");
|
||||||
_alloc = _alloc->next;
|
fprintf(MEMORY_log, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
|
||||||
}
|
while (_alloc)
|
||||||
|
{
|
||||||
|
fprintf(MEMORY_log, "<%d>\n", _alloc->id);
|
||||||
|
_alloc = _alloc->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(MEMORY_log);
|
||||||
|
#else
|
||||||
|
if (MEMORY_count)
|
||||||
|
fprintf(stderr, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +126,11 @@ PUBLIC void MEMORY_alloc(void *p_ptr, size_t size, const char *src)
|
||||||
MEMORY_size += size;
|
MEMORY_size += size;
|
||||||
|
|
||||||
#ifndef DO_NOT_PRINT_MEMORY
|
#ifndef DO_NOT_PRINT_MEMORY
|
||||||
DEBUG_where();
|
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||||
fprintf(stderr, "<%d> %s: MEMORY_alloc(%d) -> %p\n", _id, src, (int)size, (char *)alloc + sizeof(ALLOC));
|
fprintf(MEMORY_log, "<%d> %s: MEMORY_alloc(%d) -> %p\n", _id, src, (int)size, (char *)alloc + sizeof(ALLOC));
|
||||||
fflush(stderr);
|
fflush(MEMORY_log);
|
||||||
|
//if (_id == 1621)
|
||||||
|
// sleep(60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -185,9 +193,9 @@ PUBLIC void MEMORY_realloc(void *p_ptr, size_t size, const char *src)
|
||||||
alloc->next->prev = alloc;
|
alloc->next->prev = alloc;
|
||||||
|
|
||||||
#ifndef DO_NOT_PRINT_MEMORY
|
#ifndef DO_NOT_PRINT_MEMORY
|
||||||
DEBUG_where();
|
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||||
fprintf(stderr, "<%d> %s: MEMORY_realloc(%p, %d) -> %p\n", alloc->id, src, *((void **)p_ptr), (int)size, (char *)alloc + sizeof(ALLOC));
|
fprintf(MEMORY_log, "<%d> %s: MEMORY_realloc(%p, %d) -> %p\n", alloc->id, src, *((void **)p_ptr), (int)size, (char *)alloc + sizeof(ALLOC));
|
||||||
fflush(stderr);
|
fflush(MEMORY_log);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*((void **)p_ptr) = (char *)alloc + sizeof(ALLOC);
|
*((void **)p_ptr) = (char *)alloc + sizeof(ALLOC);
|
||||||
|
@ -224,9 +232,9 @@ PUBLIC void MEMORY_free(void *p_ptr, const char *src)
|
||||||
_alloc = alloc->next;
|
_alloc = alloc->next;
|
||||||
|
|
||||||
#ifndef DO_NOT_PRINT_MEMORY
|
#ifndef DO_NOT_PRINT_MEMORY
|
||||||
DEBUG_where();
|
fprintf(MEMORY_log, "%s: ", DEBUG_get_current_position());
|
||||||
fprintf(stderr, "<%d> %s: MEMORY_free(%p)\n", alloc->id, src, (char *)alloc + sizeof(ALLOC));
|
fprintf(MEMORY_log, "<%d> %s: MEMORY_free(%p)\n", alloc->id, src, (char *)alloc + sizeof(ALLOC));
|
||||||
fflush(stderr);
|
fflush(MEMORY_log);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MEMORY_size -= alloc->size;
|
MEMORY_size -= alloc->size;
|
||||||
|
|
Loading…
Reference in a new issue