#include <CtrlLib/CtrlLib.h> #define LAYOUTFILE <Gui16b/dlg.lay> #include <CtrlCore/lay.h> struct MyAppWindow : public WithDlgLayout<TopWindow> { // Upp:: prefix no longer need and it should... MyAppWindow() { CtrlLayout(*this, "MyDialog"); } }; GUI_APP_MAIN { TopWindow top; // Upp:: prefix no longer required here... MyAppWindow().Run(); }
In file included from /home/klugier/upp/.cache/upp.out/tutorial/CtrlLib/GCC.Debug.Debug_Full.Gui.Shared/CtrlLib$blitz.cpp:238: /home/klugier/upp/git/uppsrc/CtrlLib/PrinterJob.cpp:228:7: warning: 'Upp::PrinterDlg' has a base 'Upp::{anonymous}::WithPrinterLayout<Upp::TopWindow>' whose type uses the ano nymous namespace [-Wsubobject-linkage] 228 | class PrinterDlg : public WithPrinterLayout<TopWindow> { |
Hello Mirek,
It seems that with new approach Upp namespace is populated. Here is tutorial/Gui16b/main.cpp file that compiles fine and it shouldn't:
#include <CtrlLib/CtrlLib.h> #define LAYOUTFILE <Gui16b/dlg.lay> #include <CtrlCore/lay.h> struct MyAppWindow : public WithDlgLayout<TopWindow> { // Upp:: prefix no longer need and it should... MyAppWindow() { CtrlLayout(*this, "MyDialog"); } }; GUI_APP_MAIN { TopWindow top; // Upp:: prefix no longer required here... MyAppWindow().Run(); }
In context of placing anonymous namespace in header file, a lot of linters detect this as an warning. More info here. BTW, I compiled with CLANG and GCC. The second compiler produces a lot of warnings:
In file included from /home/klugier/upp/.cache/upp.out/tutorial/CtrlLib/GCC.Debug.Debug_Full.Gui.Shared/CtrlLib$blitz.cpp:238: /home/klugier/upp/git/uppsrc/CtrlLib/PrinterJob.cpp:228:7: warning: 'Upp::PrinterDlg' has a base 'Upp::{anonymous}::WithPrinterLayout<Upp::TopWindow>' whose type uses the ano nymous namespace [-Wsubobject-linkage] 228 | class PrinterDlg : public WithPrinterLayout<TopWindow> { |
IMO, we shouldn't add this warning to the blacklist like we did for "-Wno-logical-op-parentheses" for Clang.
Can not we just follow old approach, but add new types (frames) like requested in #73? Anonymous namespace approach seems to have a lot of drawbacks.
Klugier
ITEM(Upp::EditString, text, SetFrame(InsetFrame()).LeftPosZ(48, 92).TopPosZ(8, 19)) // Should be... ITEM(Upp::EditString, text, SetFrame(Upp::InsetFrame()).LeftPosZ(48, 92).TopPosZ(8, 19))
Hello Mirek,
Basic scenario works correctly (Gui16b), however bugs raised on GitHub are still present. When you switch from default frame to InsetFrame in Layout designer it leads to compilation error. The reason is simple, layout designer just do not prefix InsetFrame() function:
ITEM(Upp::EditString, text, SetFrame(InsetFrame()).LeftPosZ(48, 92).TopPosZ(8, 19)) // Should be... ITEM(Upp::EditString, text, SetFrame(Upp::InsetFrame()).LeftPosZ(48, 92).TopPosZ(8, 19))
Just cosmetic - could we change "default" -> "Default" for default frames. All frames start from capital letter.
Do you also plan to fix #74? In my opinion for empty class it should have no properties (just empty area) like for empty ctrl entry in usc file.
Klugier