[Done] PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post bugs related to the IDE here
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

[Done] PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

OS: Raspberry Bookworm

The gadget positions in the IDE dialogs are not correct. Position Top/Left are partly zero.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Bug found in the C-optimization.

As I recompile the IDE for pb v6.04 and v6.10 with the fix for EditHistory.pb and LinuxMisc.pb, I noticed the following.

With C optimization the positioning of the gadget in IDE diaglogs fails.
Without C-optimization the gadget positions in the IDE diaglogs are correct.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

The margin calculation in function DlgBinBase_CalculateChildSize is optimized away with compiler c-optimization at ARM
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by Fred »

Wait, it removes some code?
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Very strange.

Only happens on ARM (Raspberry) without debugger and active optmimized.
To check, I have output the X,Y position in the GADGET_ErrorLog.

Once in DlgGadget_SizeApply(...) before ResizeGadget.
And once in DlgBinBase_CalculateChildSize(...)
As soon as you activate the ErrorLog output in DlgBinBase_CalculateChildSize(...), the X,Y position is correct.

I also tried to transfer the ByRef variables to local variables first. Didn't work either

Object_Gadget.pb

Code: Select all

Procedure DlgGadget_SizeApply(*THIS.DlgGadget, x.l, y.l, Width.l, Height.l)
  
  ; On windows, when resizing a text, checkbox, option higher than it needs to be, its
  ; text is not put in the center (vertically) as it is on linux, so this looks bad when
  ; a text/checkbox is put next to a String/Combobox for example.
  ; actually, centering only is not good either. For windows it is needed to offset
  ; the textgadget 2px down to look good... what an ugly hack!
  ;
  ; Note: it's exactly the same issue on OS X cocoa, so enable the hack as well (works perfectly)
  ;
  ; Note: here on Ubuntu 12.04 (x64) and gtk 2.24.10 it seems to be needed as well
  ;       so I enable this for all OS (needs to be checked on other Linux distros)
  ;
  ;CompilerIf #CompileWindows Or #CompileMacCocoa
  
  If *THIS\StaticData\Type = #DIALOG_Text And *THIS\StaticData\Flags & #PB_Text_Border = 0
    NeededHeight = Max(*THIS\StaticData\MinHeight, GetRequiredHeight(*THIS\Gadget, *THIS\StaticData\Flags))
    If NeededHeight <= Height-2
      ResizeGadget(*THIS\Gadget, x, y+2, Width, Height-2)
      ProcedureReturn
    EndIf
  EndIf
  ;CompilerEndIf
  If IsGadget(#GADGET_ErrorLog)
    AddGadgetItem(#GADGET_ErrorLog, -1, "Gadget SizeApple x = " + x + ", y = " + y)
    SetGadgetState(#GADGET_ErrorLog, CountGadgetItems(#GADGET_ErrorLog) -1)
  EndIf
  
  ResizeGadget(*THIS\Gadget, x, y, Width, Height)
EndProcedure
Object_BinBase.pb

Code: Select all

Procedure DlgBinBase_CalculateChildSize(*THIS.DlgBinBase, *x.LONG, *y.LONG, *Width.LONG, *Height.LONG)
  *x\l + *THIS\lMargin
  *y\l + *THIS\tMargin
  *Width\l  - *THIS\lMargin - *THIS\rMargin
  *Height\l - *THIS\tMargin - *THIS\bMargin
  FullWidth  = *Width\l
  FullHeight = *Height\l
  
  If FullWidth > *THIS\RequestedWidth
    If *THIS\hExpand = #False
      *Width\l = *THIS\RequestedWidth
    ElseIf *THIS\hExpandMax > 0 And *THIS\hExpandMax < FullWidth
      *Width\l = Max(*THIS\RequestedWidth, *THIS\hExpandMax)
    EndIf
    
    If *THIS\hAlign = #Dlg_Align_Center
      *x\l + (FullWidth - *Width\l) / 2
    ElseIf *THIS\hAlign = #Dlg_Align_Bottom
      *x\l + FullWidth - *Width\l
    EndIf
  EndIf
  
  If FullHeight > *THIS\RequestedHeight
    If *THIS\vExpand = #False
      *Height\l = *THIS\RequestedHeight
    ElseIf *THIS\vExpandMax > 0 And *THIS\vExpandMax < FullHeight
      *Height\l = Max(*THIS\RequestedHeight, *THIS\vExpandMax)
    EndIf
    
    If *THIS\vAlign = #Dlg_Align_Center
      *y\l + (FullHeight - *Height\l) / 2
    ElseIf *THIS\vAlign = #Dlg_Align_Bottom
      *y\l + FullHeight - *Height\l
    EndIf
  EndIf
  
;   If IsGadget(#GADGET_ErrorLog)
;     AddGadgetItem(#GADGET_ErrorLog, -1, "Gadget Calculate x = " + *x\l + ", y = " + *y\l)
;     SetGadgetState(#GADGET_ErrorLog, CountGadgetItems(#GADGET_ErrorLog) -1)
;   EndIf
   
EndProcedure
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

The compiler still seems to optimize a bit too much.

To quickly recompile the PB-IDE under Raspberry I have adapted the Makefile in the PureBasicIDE folder.
- Optimization switched off
- For gtk2 compilation automatically extended the IDE name '_gtk2'.

Makefile of PureBasicIDE

Code: Select all


ifeq ($(PB_JAVASCRIPT),1)
	HOME=$(SPIDERBASIC_HOME)
	IDENAME=SpiderBasic
	ICOFILE=data/SpiderBasic/Logo.ico
	ICOSOURCEFILE=data/SpiderBasic/Logo.ico
	OSXICOFILE=data/SpiderBasic/Logo.icns
else
	HOME=$(PUREBASIC_HOME)
	IDENAME=PureBasic
	ICOFILE=data/PBLogoBig.ico
	ICOSOURCEFILE=data/PBSourceFile.ico
	OSXICOFILE=data/logo/PB3D_MacIcon.icns
endif


ifeq ($(PB_WINDOWS),1)
	PBCOMPILER = $(PUREBASIC_HOME)/compilers/pbcompiler /QUIET
	IDE = $(HOME)/$(IDENAME).exe
	IDEFLAGS = /THREAD /UNICODE /XP /USER /ICON $(ICOFILE) /DPIAWARE /OPTIMIZER
	MAKEEXE = /EXE
	MAKEBUILDINFO = Build/makebuildinfo.exe
	TOOLFLAGS = /LINENUMBERING /CONSOLE
	DEBUGFLAGS = /LINENUMBERING /DEBUGGER /CONSOLE
	VERSIONFLAG = /RESOURCE Build/VersionInfo.rc
	CONSTANT = /CONSTANT
	PURIFIER = /PURIFIER
	DEBUGSYMBOLS =
	CPUMONITORLIB =
	DIALOGCOMPILER = ../DialogManager/Build/DialogCompiler.exe
	MACPLIST =
	MACPLISTCOMMAND =
	ONERROR = /LINENUMBERING
	COLORTABLE = $(HOME)/Catalogs/ColorTable.xml
	ECHOQUOTE =
	ICON = ico
	THEMEFOLDER = $(HOME)/Themes

else
	PBCOMPILER = pbcompiler -q

ifeq ($(PB_MACOS),1)
	IDE = $(HOME)/$(IDENAME).app
	IDEFLAGS = --thread --unicode -n "$(OSXICOFILE)" --optimizer --dpiaware
	MACPLIST = Build/macplist
	MACPLISTCOMMAND = Build/macplist $(HOME)/$(IDENAME).app

	ifeq ($(PB_CARBON),1)
		IDEFLAGS += --subsystem carbon
	endif
else
	IDENAME_LOWERCASE = $(shell echo $(IDENAME) | tr A-Z a-z)
	IDEFLAGS = --thread --unicode
	MACPLIST =
	MACPLISTCOMMAND =
	ifeq ($(PB_GTK),2)
		IDE = "$(HOME)/compilers/$(IDENAME_LOWERCASE)_gtk2"
		IDEFLAGS += --subsystem gtk2
	else
		IDE = "$(HOME)/compilers/$(IDENAME_LOWERCASE)"
	endif
endif

	CONSTANT = --constant
	PURIFIER = --purifier
	MAKEEXE = -e
	MAKEBUILDINFO = Build/makebuildinfo
	TOOLFLAGS =
	DEBUGFLAGS = -d
	DEBUGSYMBOLS = -ds
	VERSIONFLAG =
	CPUMONITORLIB =
	DIALOGCOMPILER = ../DialogManager/Build/dialogcompiler
	ONERROR = --linenumbering
	COLORTABLE = $(HOME)/catalogs/ColorTable.xml
	ECHOQUOTE = "
	ICON = png
	THEMEFOLDER = $(HOME)/themes

endif

PACKLEVEL = -q -l4

THEMES = \
	Build/DefaultTheme.zip \
	$(THEMEFOLDER)/SilkTheme.zip

DIALOGS = \
Build/Find.pb \
Build/Grep.pb \
Build/Goto.pb \
Build/CompilerOptions.pb \
Build/AddTools.pb \
Build/About.pb \
Build/Preferences.pb \
Build/Templates.pb \
Build/StructureViewer.pb \
Build/Projects.pb \
Build/Build.pb \
Build/Diff.pb \
Build/FileMonitor.pb \
Build/History.pb \
Build/HistoryShutdown.pb \
Build/CreateApp.pb \
Build/Updates.pb

DEPENDENCIES = \
	$(COLORTABLE) \
	*.pb \
	../PureBasicDebugger/*.pb \
	$(DIALOGS) \
	$(VERSIONINFO) \
	$(CPUMONITORLIB) \
	$(MACPLIST) \
	$(THEMES) \
	$(MAKEBUILDINFO)


ifeq ($(PB_JAVASCRIPT),1)
	IDEFLAGS+=$(CONSTANT) SpiderBasic=1
endif

#
# default target
#
ide : VERSION $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(VERSIONFLAG)
	$(MACPLISTCOMMAND)

#
# demo version of the IDE
#
demo : VERSION_DEMO $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(VERSIONFLAG) $(CONSTANT) DEMO=1
	$(MACPLISTCOMMAND)

#
# debug version (with linenumbering / gtk error messages)
#
debug : VERSION_DEBUG $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(DEBUGFLAGS) $(DEBUGSYMBOLS) $(VERSIONFLAG) $(CONSTANT) DEBUG=1
	$(MACPLISTCOMMAND)

#
# debug version + Purifier
#
purifier : VERSION_DEBUG $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(DEBUGFLAGS) $(DEBUGSYMBOLS) $(PURIFIER) $(VERSIONFLAG) $(CONSTANT) DEBUG=1
	$(MACPLISTCOMMAND)

#
# default target, but without stripping debug symbols (for gdk debugging)
#
symbols : VERSION $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(DEBUGSYMBOLS) $(VERSIONFLAG)
	$(MACPLISTCOMMAND)

#
# default target, but with onerror support
#
onerror : VERSION $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build
	$(PBCOMPILER) PureBasic.pb $(MAKEEXE) $(IDE) $(IDEFLAGS) $(VERSIONFLAG) $(ONERROR)
	$(MACPLISTCOMMAND)

#
# special target to build all needed files, but not the IDE itself. (good for testing from inside the ide)
#
nocompile :  Build/dummy VERSION  $(DEPENDENCIES)
	$(MAKEBUILDINFO) Build

#
# required other targets
#

$(MAKEBUILDINFO) : tools/makebuildinfo.pb Build/dummy
	$(PBCOMPILER) tools/makebuildinfo.pb $(MAKEEXE) $(MAKEBUILDINFO) $(TOOLFLAGS)

Build/%.pb : dialogs/%.xml $(DIALOGCOMPILER) Build/dummy
	$(DIALOGCOMPILER) $< $@

# theme targets (-mkdir suppresses errors if the directory exists)
#
Build/DefaultTheme.zip: data/DefaultTheme/*
	rm -f Build/DefaultTheme.zip
	zip -jq Build/DefaultTheme.zip data/DefaultTheme/*

# Use "mkdir" instead on mkdir, so on Windows it search mkdir.exe on the PATH instead of using the internal CMD mkdir.
# It works on Linux and OS X as well.
#
$(THEMEFOLDER)/SilkTheme.zip: data/SilkTheme/*
	"mkdir" -p "$(THEMEFOLDER)"
	rm -f "$(THEMEFOLDER)/SilkTheme.zip"
	zip -jq "$(THEMEFOLDER)/SilkTheme.zip" data/SilkTheme/*

$(COLORTABLE): data/ColorTable.xml
	cp -f data/ColorTable.xml "$(COLORTABLE)"

# this also works on windows
#
$(DIALOGCOMPILER) : ../DialogManager/DialogCompiler.pb Build/dummy
	make --directory ../DialogManager


#
# Windows only: create version information resource
#
ifeq ($(PB_WINDOWS),1)

Build/makeversion.exe : tools/makeversion.pb Build/dummy
	$(PBCOMPILER) tools/makeversion.pb /EXE Build/makeversion.exe /CONSOLE

VERSION: Build/makeversion.exe Build/dummy
	Build/makeversion.exe ide Build/VersionInfo.rc $(shell PWD)/$(ICOSOURCEFILE)

VERSION_DEBUG: Build/makeversion.exe Build/dummy
	Build/makeversion.exe debug Build/VersionInfo.rc $(shell PWD)/$(ICOSOURCEFILE)

VERSION_DEMO: Build/makeversion.exe Build/dummy
	Build/makeversion.exe demo Build/VersionInfo.rc $(shell PWD)/$(ICOSOURCEFILE)

# Windows only: Syntax highlighting dll
dll : tools/HighlightingDll.pb
	$(PBCOMPILER) tools/HighlightingDll.pb /dll /exe "$(HOME)/SDK/Syntax Highlighting/SyntaxHighlighting.dll" /CONSTANT MAKEFILE=1
	cp "tools\HighlightingDll_example.pb" "$(HOME)/SDK/Syntax Highlighting/Example.pb"

#
# For other os: dummy version targets
#
else

VERSION:
VERSION_DEBUG:
VERSION_DEMO:
dll:
sdk:

endif

#
# Special target for the program that creates the Info.plist for mac.
# On the other OS this is not needed
#
ifeq ($(PB_MACOS),1)

$(MACPLIST) : tools/macplist.pb Build/dummy
	$(PBCOMPILER) tools/macplist.pb -e $(MACPLIST)

endif

Build/dummy:
	mkdir "Build"
	touch Build/dummy

clean:
	rm -rf Build
	make clean --directory ../DialogManager
P.S.
With the new Raspberry PI 5 this is compiled very fast ;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by Fred »

Do you have a screenshot (please try with the IDE found in the official package) ? I just tried here and it seems fine.
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by Fred »

Forget it, I can actually reproduce it on Windows as well. After some investigation, it's the "-fstrict-aliasing" optimization which is doing this issue, so I disabled it (should work on Raspberry as well I guess, to be confirmed with the next beta).
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Screenshot IDE removed:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Fred wrote: Sat Mar 09, 2024 5:17 pm Forget it, I can actually reproduce it on Windows as well. After some investigation, it's the "-fstrict-aliasing" optimization which is doing this issue, so I disabled it (should work on Raspberry as well I guess, to be confirmed with the next beta).
That worked.
With Beta 8 the problem is solved

Thanks ;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Oops,
Raspberry Beta 7 and Beta 8
The gadgets are not all visible in the Session History dialog. Only if you adjust the size of the window.
Last edited by mk-soft on Thu Mar 14, 2024 12:00 am, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Repaired ...

EditHistory.pb will be uploaded tomorrow
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [Done] PB v6.10 - PB-IDE Dialogs Gadget Positions on Raspberry

Post by mk-soft »

Pull request created with start-up difficulties.
I still can't really get to grips with GitHub. Probably due to my bad English.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply