Improve SavePrimitive in TG classes#18038
Conversation
While it used to store string args in C++ macro, replace these delimiter together with backslah \ and double quote " symbols
Use lambda to append produced string
Call MapSubwindows, Resize and MapWindow to produce reasonable output at the end of macro
Simplify connected singals saving Remap color signal
Use TString::ReplaceSpecialCppChars when store text
Test Results 20 files 20 suites 4d 17h 1m 32s ⏱️ Results for commit 445cdb3. ♻️ This comment has been updated with latest results. |
Save custom brackground color if necessary and create extra args string which typically appears in the end of the constructor args. Will helps to simplify saving of constructor
Use new SaveCtorArgs to simpligy code
In TGSlider::GetTypeString ensure that at least 0 is returned
In some classes with custom color also font and pixmap must be initialized
Add additional checks in TGButton.cxx to init font and pixmap
parGC and parFont has default value
Create interim variables based on gROOT->ClassSaved(Class())
In several classes default background is WhitePixColor Therefore this value should be checked when storing color
Use ReplaceSpecialCppChars, avoid quote, apply clang-format
Reduce dynamic vars, use local variables, remove includes optimization
Simplify text conversion, avoid plain char* allocation Do not try to save void* pointer stored in fUserData Correctly store picture for all menu entry kinds
Use clear API to save items and list of items Use more unique variable names for items and pictures to avoid clashes Add images already with AddItem invocation
Not always ROOTSYS is set
bellenot
left a comment
There was a problem hiding this comment.
LGTM, thanks. FYI, one way of testing if it works properly would be to run stressgui before and after these changes
stressGUI creates macros but not execute them. I checked - this PR does not affect stressGUI |
One should execute |
Is all about PNG image sizes. |
|
Oh yes, sorry, you're right... |
TGFrame::SaveCrtrArgsmethod to prepare options and custom color for use in saved constructor. There are many places in code where such combination handled with many if statements\nand quote by\"Fix several problems where with custom colors also font and, not necessaryuGC->GetGC()must be initialized. Otherwise when saved into the macro arguments will remain emptyTGFrame::GetOptionString()Tested with several macros from tutorials like calendar.C or listBox.C or statusBar.C