Skip to content

Commit 2e106a8

Browse files
FiveTechSoftclaude
andcommitted
refactor: TForm/TControl/TButton/... props to Hungarian notation
Migrate Delphi-style property names to Harbour Hungarian on every public control class. Drops dual-name aliases (Glyph/Picture, Color/nClrPane) and lines up samples, code generators, parsers, and DSL xcommands. Class accessors renamed (source/core/classes.prg + bundled copy): - TControl/TForm: Name/Left/Top/Width/Height/Text/Enabled/Color/Title/ AppTitle/FontName/FontSize/BorderStyle/Position/Cursor/Sizable/ AppBar/ToolWindow/KeyPreview/ShowHint/Hint/AutoScroll/DoubleBuffered/ AlphaBlend/ClientWidth/ClientHeight/ModalResult/ControlAlign - TButton/TBitBtn: Default/Cancel/Kind/ModalResult/Glyph (dropped, use cPicture) - TSpeedButton: Kind/Flat/Glyph (dropped) - TImage: Picture (dropped, use cPicture) - TShape: Shape/PenColor/PenWidth - TBevel: Shape/Style - TEarthView/TMap: Lat/Lon/Zoom/MapType - TStringGrid: ColCount/RowCount/FixedRows/FixedCols - TMaskEdit: EditMask/MaskKind - TCheckBox/TRadioButton: Checked - TTimer: Enabled - TApplication: Title -> cTitle Preserved: OnXxx event setters and semantic Value alias on TEdit/TMemo/ TComboBox/TListBox. Code generators in source/hbbuilder_{win,macos,linux}.prg emit the new names; RestoreFormFromCode parsers recognize them. include/hbbuilder.ch DSL (DEFINE FORM, BUTTON, CHECKBOX, RADIOBUTTON) expands to the new setters so the IDE stops crashing at startup with TFORM:_FONTNAME on the FONT clause. bin/hbbuilder_win.exe rebuilt. .gitignore now excludes build_out.txt. Samples (test_oop, maps, earth, printer) updated for the renamed props. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bd84e68 commit 2e106a8

100 files changed

Lines changed: 1902 additions & 1032 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ tests/gtk3_core.o
6262
hbbuilder.ini
6363

6464
# Misc generated
65+
build_out.txt
6566
samples/prefs.json
6667
samples/canvas.html
6768
samples/form.html

bin/HbBuilder.app/Contents/Resources/backends/cocoa/hbbuilder_macos.prg

Lines changed: 841 additions & 68 deletions
Large diffs are not rendered by default.

bin/HbBuilder.app/Contents/Resources/classes.prg

Lines changed: 249 additions & 142 deletions
Large diffs are not rendered by default.

bin/HbBuilder.app/Contents/Resources/hbbuilder.ch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@
136136
[ <toolwin: TOOLWINDOW> ] ;
137137
=> ;
138138
<oForm> := TForm():New( <cTitle>, <nWidth>, <nHeight> ) ;
139-
[; <oForm>:FontName := <cFont> ] ;
140-
[; <oForm>:FontSize := <nSize> ] ;
141-
[; <oForm>:Sizable := <.sizable.> ] ;
142-
[; <oForm>:AppBar := <.appbar.> ] ;
143-
[; <oForm>:ToolWindow := <.toolwin.> ]
139+
[; <oForm>:cFontName := <cFont> ] ;
140+
[; <oForm>:nFontSize := <nSize> ] ;
141+
[; <oForm>:lSizable := <.sizable.> ] ;
142+
[; <oForm>:lAppBar := <.appbar.> ] ;
143+
[; <oForm>:lToolWindow := <.toolwin.> ]
144144

145145
#xcommand ACTIVATE FORM <oForm> [ <center: CENTERED> ] => ;
146146
<oForm>:Activate()
@@ -176,8 +176,8 @@
176176
[ <cancel: CANCEL> ] ;
177177
=> ;
178178
<oCtrl> := TButton():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth>, <nHeight> ) ;
179-
[; <oCtrl>:Default := <.default.> ] ;
180-
[; <oCtrl>:Cancel := <.cancel.> ]
179+
[; <oCtrl>:lDefault := <.default.> ] ;
180+
[; <oCtrl>:lCancel := <.cancel.> ]
181181

182182
// BitBtn (button with image/kind)
183183
#xcommand @ <nTop>, <nLeft> BITBTN <oCtrl> ;
@@ -346,7 +346,7 @@
346346
[ <checked: CHECKED> ] ;
347347
=> ;
348348
<oCtrl> := TCheckBox():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth> ) ;
349-
[; <oCtrl>:Checked := <.checked.> ]
349+
[; <oCtrl>:lChecked := <.checked.> ]
350350

351351
// ComboBox
352352
#xcommand @ <nTop>, <nLeft> COMBOBOX <oCtrl> ;
@@ -365,7 +365,7 @@
365365
[ <checked: CHECKED> ] ;
366366
=> ;
367367
<oCtrl> := TRadioButton():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth> ) ;
368-
[; <oCtrl>:Checked := <.checked.> ]
368+
[; <oCtrl>:lChecked := <.checked.> ]
369369

370370
// ListBox
371371
#xcommand @ <nTop>, <nLeft> LISTBOX <oCtrl> ;

bin/hbbuilder_win.exe

426 KB
Binary file not shown.

include/hbbuilder.ch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@
136136
[ <toolwin: TOOLWINDOW> ] ;
137137
=> ;
138138
<oForm> := TForm():New( <cTitle>, <nWidth>, <nHeight> ) ;
139-
[; <oForm>:FontName := <cFont> ] ;
140-
[; <oForm>:FontSize := <nSize> ] ;
141-
[; <oForm>:Sizable := <.sizable.> ] ;
142-
[; <oForm>:AppBar := <.appbar.> ] ;
143-
[; <oForm>:ToolWindow := <.toolwin.> ]
139+
[; <oForm>:cFontName := <cFont> ] ;
140+
[; <oForm>:nFontSize := <nSize> ] ;
141+
[; <oForm>:lSizable := <.sizable.> ] ;
142+
[; <oForm>:lAppBar := <.appbar.> ] ;
143+
[; <oForm>:lToolWindow := <.toolwin.> ]
144144

145145
#xcommand ACTIVATE FORM <oForm> [ <center: CENTERED> ] => ;
146146
<oForm>:Activate()
@@ -176,8 +176,8 @@
176176
[ <cancel: CANCEL> ] ;
177177
=> ;
178178
<oCtrl> := TButton():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth>, <nHeight> ) ;
179-
[; <oCtrl>:Default := <.default.> ] ;
180-
[; <oCtrl>:Cancel := <.cancel.> ]
179+
[; <oCtrl>:lDefault := <.default.> ] ;
180+
[; <oCtrl>:lCancel := <.cancel.> ]
181181

182182
// BitBtn (button with image/kind)
183183
#xcommand @ <nTop>, <nLeft> BITBTN <oCtrl> ;
@@ -346,7 +346,7 @@
346346
[ <checked: CHECKED> ] ;
347347
=> ;
348348
<oCtrl> := TCheckBox():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth> ) ;
349-
[; <oCtrl>:Checked := <.checked.> ]
349+
[; <oCtrl>:lChecked := <.checked.> ]
350350

351351
// ComboBox
352352
#xcommand @ <nTop>, <nLeft> COMBOBOX <oCtrl> ;
@@ -365,7 +365,7 @@
365365
[ <checked: CHECKED> ] ;
366366
=> ;
367367
<oCtrl> := TRadioButton():New( <oParent>, <cText>, <nLeft>, <nTop>, <nWidth> ) ;
368-
[; <oCtrl>:Checked := <.checked.> ]
368+
[; <oCtrl>:lChecked := <.checked.> ]
369369

370370
// ListBox
371371
#xcommand @ <nTop>, <nLeft> LISTBOX <oCtrl> ;

resources/palette.bmp

0 Bytes
Binary file not shown.

samples/bench.prg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function Main()
9595
t6 := Seconds()
9696

9797
for i := 1 to N_PROPGETS
98-
xDummy := oBtn:Left
99-
xDummy := oBtn:Top
98+
xDummy := oBtn:nLeft
99+
xDummy := oBtn:nTop
100100
next
101101

102102
t6 := Seconds() - t6

samples/hbbuilder_macos.prg

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ static function GenerateProjectCode()
550550
cCode += " local oApp" + e
551551
cCode += e
552552
cCode += " oApp := TApplication():New()" + e
553-
cCode += ' oApp:Title := "Project1"' + e
553+
cCode += ' oApp:cTitle := "Project1"' + e
554554

555555
for i := 1 to Len( aForms )
556556
cCode += " oApp:CreateForm( T" + aForms[i][1] + "():New() )" + e
@@ -729,13 +729,13 @@ static function RegenerateFormCode( cName, hForm )
729729
cCode += e
730730
cCode += "METHOD CreateForm() CLASS " + cClass + e
731731
cCode += e
732-
cCode += ' ::Title := "' + cTitle + '"' + e
733-
cCode += " ::Left := " + LTrim(Str(nFL)) + e
734-
cCode += " ::Top := " + LTrim(Str(nFT)) + e
735-
cCode += " ::Width := " + LTrim(Str(nW)) + e
736-
cCode += " ::Height := " + LTrim(Str(nH)) + e
732+
cCode += ' ::cTitle := "' + cTitle + '"' + e
733+
cCode += " ::nLeft := " + LTrim(Str(nFL)) + e
734+
cCode += " ::nTop := " + LTrim(Str(nFT)) + e
735+
cCode += " ::nWidth := " + LTrim(Str(nW)) + e
736+
cCode += " ::nHeight := " + LTrim(Str(nH)) + e
737737
if nClr != 15790320 // non-default color
738-
cCode += " ::Color := " + LTrim(Str(nClr)) + e
738+
cCode += " ::nClrPane := " + LTrim(Str(nClr)) + e
739739
endif
740740
if ! Empty( cCreate )
741741
cCode += e
@@ -769,8 +769,8 @@ static function RestoreFormFromCode( hForm, cCode )
769769
cLine := aLines[i]
770770
cTrim := AllTrim( cLine )
771771

772-
// Parse form properties: ::Title, ::Width, ::Height, ::Left, ::Top
773-
if '::Title' $ cTrim .and. ':=' $ cTrim
772+
// Parse form properties: ::cTitle, ::nWidth, ::nHeight, ::nLeft, ::nTop
773+
if '::cTitle' $ cTrim .and. ':=' $ cTrim
774774
nPos := At( '"', cTrim )
775775
nPos2 := RAt( '"', cTrim )
776776
if nPos > 0 .and. nPos2 > nPos
@@ -779,23 +779,23 @@ static function RestoreFormFromCode( hForm, cCode )
779779
endif
780780
loop
781781
endif
782-
if '::Width' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
782+
if '::nWidth' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
783783
UI_SetProp( hForm, "nWidth", Val( AllTrim( SubStr( cTrim, At( ":=", cTrim ) + 2 ) ) ) )
784784
loop
785785
endif
786-
if '::Height' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
786+
if '::nHeight' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
787787
UI_SetProp( hForm, "nHeight", Val( AllTrim( SubStr( cTrim, At( ":=", cTrim ) + 2 ) ) ) )
788788
loop
789789
endif
790-
if '::Left' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
790+
if '::nLeft' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
791791
UI_SetProp( hForm, "nLeft", Val( AllTrim( SubStr( cTrim, At( ":=", cTrim ) + 2 ) ) ) )
792792
loop
793793
endif
794-
if '::Top' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
794+
if '::nTop' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
795795
UI_SetProp( hForm, "nTop", Val( AllTrim( SubStr( cTrim, At( ":=", cTrim ) + 2 ) ) ) )
796796
loop
797797
endif
798-
if '::Color' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
798+
if '::nClrPane' $ cTrim .and. ':=' $ cTrim .and. ! "::o" $ cTrim
799799
UI_SetProp( hForm, "nClrPane", Val( AllTrim( SubStr( cTrim, At( ":=", cTrim ) + 2 ) ) ) )
800800
loop
801801
endif

samples/prefs.prg

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,74 +29,74 @@ function BuildPrefsForm()
2929
oForm := UIForm():New()
3030
oForm:Init( nil )
3131
oForm:cName := "frmPrefs"
32-
oForm:Text := "Preferencias"
33-
oForm:Width := 471
34-
oForm:Height := 405
32+
oForm:cText := "Preferencias"
33+
oForm:nWidth := 471
34+
oForm:nHeight := 405
3535

3636
// GroupBox: General
3737
o := UIGroupBox():New(); o:Init( oForm )
38-
o:cName := "grpGeneral"; o:Text := "General"
39-
o:Left := 12; o:Top := 13; o:Width := 431; o:Height := 122
38+
o:cName := "grpGeneral"; o:cText := "General"
39+
o:nLeft := 12; o:nTop := 13; o:nWidth := 431; o:nHeight := 122
4040

4141
// Idioma
4242
o := UILabel():New(); o:Init( oForm )
43-
o:cName := "lblIdioma"; o:Text := "Idioma:"
44-
o:Left := 26; o:Top := 43; o:Width := 79
43+
o:cName := "lblIdioma"; o:cText := "Idioma:"
44+
o:nLeft := 26; o:nTop := 43; o:nWidth := 79
4545

4646
o := UIComboBox():New(); o:Init( oForm )
4747
o:cName := "cboIdioma"
48-
o:Left := 112; o:Top := 39; o:Width := 175
48+
o:nLeft := 112; o:nTop := 39; o:nWidth := 175
4949
o:SetProp( "Items", { "Espanol", "English", "Portugues", "Deutsch" } )
5050

5151
// Ruta
5252
o := UILabel():New(); o:Init( oForm )
53-
o:cName := "lblRuta"; o:Text := "Ruta:"
54-
o:Left := 26; o:Top := 77; o:Width := 79
53+
o:cName := "lblRuta"; o:cText := "Ruta:"
54+
o:nLeft := 26; o:nTop := 77; o:nWidth := 79
5555

5656
o := UIEdit():New(); o:Init( oForm )
57-
o:cName := "edtRuta"; o:Text := "C:\Projects"
58-
o:Left := 112; o:Top := 73; o:Width := 312; o:Height := 24
57+
o:cName := "edtRuta"; o:cText := "C:\Projects"
58+
o:nLeft := 112; o:nTop := 73; o:nWidth := 312; o:nHeight := 24
5959

6060
// GroupBox: Apariencia
6161
o := UIGroupBox():New(); o:Init( oForm )
62-
o:cName := "grpApariencia"; o:Text := "Apariencia"
63-
o:Left := 12; o:Top := 146; o:Width := 431; o:Height := 150
62+
o:cName := "grpApariencia"; o:cText := "Apariencia"
63+
o:nLeft := 12; o:nTop := 146; o:nWidth := 431; o:nHeight := 150
6464

6565
// Fuente
6666
o := UILabel():New(); o:Init( oForm )
67-
o:cName := "lblFuente"; o:Text := "Fuente:"
68-
o:Left := 26; o:Top := 176; o:Width := 79
67+
o:cName := "lblFuente"; o:cText := "Fuente:"
68+
o:nLeft := 26; o:nTop := 176; o:nWidth := 79
6969

7070
o := UIComboBox():New(); o:Init( oForm )
7171
o:cName := "cboFuente"
72-
o:Left := 112; o:Top := 173; o:Width := 210
72+
o:nLeft := 112; o:nTop := 173; o:nWidth := 210
7373
o:SetProp( "Items", { "Segoe UI", "Tahoma", "Arial", "Consolas" } )
7474

7575
// Checkboxes
7676
o := UICheckBox():New(); o:Init( oForm )
77-
o:cName := "chkToolbar"; o:Text := "Mostrar barra de herramientas"
78-
o:Left := 112; o:Top := 210; o:Width := 245
77+
o:cName := "chkToolbar"; o:cText := "Mostrar barra de herramientas"
78+
o:nLeft := 112; o:nTop := 210; o:nWidth := 245
7979
o:SetProp( "Checked", .t. )
8080

8181
o := UICheckBox():New(); o:Init( oForm )
82-
o:cName := "chkStatus"; o:Text := "Mostrar barra de estado"
83-
o:Left := 112; o:Top := 234; o:Width := 245
82+
o:cName := "chkStatus"; o:cText := "Mostrar barra de estado"
83+
o:nLeft := 112; o:nTop := 234; o:nWidth := 245
8484
o:SetProp( "Checked", .t. )
8585

8686
o := UICheckBox():New(); o:Init( oForm )
87-
o:cName := "chkConfirm"; o:Text := "Confirmar al salir"
88-
o:Left := 112; o:Top := 259; o:Width := 245
87+
o:cName := "chkConfirm"; o:cText := "Confirmar al salir"
88+
o:nLeft := 112; o:nTop := 259; o:nWidth := 245
8989
o:SetProp( "Checked", .t. )
9090

9191
// Buttons
9292
o := UIButton():New(); o:Init( oForm )
93-
o:cName := "btnAceptar"; o:Text := "&Aceptar"
94-
o:Left := 170; o:Top := 326
93+
o:cName := "btnAceptar"; o:cText := "&Aceptar"
94+
o:nLeft := 170; o:nTop := 326
9595
o:SetProp( "Default", .t. )
9696

9797
o := UIButton():New(); o:Init( oForm )
98-
o:cName := "btnCancelar"; o:Text := "&Cancelar"
99-
o:Left := 266; o:Top := 326
98+
o:cName := "btnCancelar"; o:cText := "&Cancelar"
99+
o:nLeft := 266; o:nTop := 326
100100
o:SetProp( "Cancel", .t. )
101101

102102
return oForm

0 commit comments

Comments
 (0)