Kitchen Sink

Started by billarhos, 10 June 2019, 15:00:11

texus

- SFML_libs.hpp is specific to Visual Studio and should indeed be removed once this gets integrated with the TGUI examples which compile and link with cmake.
- defines.hpp should be removed. Not because the file is so small, but because I actually don't want to see SAFE_DELETE being used. TGUI tries to be a modern c++ library, it already requires c++14 as a minimum, so it would be best if the examples didn't use new and delete. Based on a quick glance at the code I think it could be replaced with std::unique_ptr.
- Why was defineImprovedEnum.h used? Are there places where it is used where a normal enum was be too limited?

Some minor comments:
- gnu-freefont_freeserif.zip and flags/Thumb.db in the resources folder can be removed I guess.
- Text colors of radio buttons in "Buttons" tab aren't the same (only the first one is really readable)
- The themed knob doesn't move correctly. ImageRotation in gui.txt should be 90, the current value seems to be a copy-paste error.
- I don't really like the horizontal scrollbar for ScrollablePanel as there is no contents to the right. Calling panel->setHorizontalScrollbarPolicy(Scrollbar::Policy::Never) would probably be better in this case (or changing the content width to not include the vertical scrollbar).
- A label with scrollbar would really look great on the first tab :)

I'll put a link to this forum topic on discord tomorrow so that your work gets a few more views.

billarhos

Great.

I 'll make all the changes-corrections tomorrow.
Don't bother the others till i finished. They can see it completely. (As far as i can go it..)

Thanks Texus.

billarhos

#27
http://www.mediafire.com/file/56yxedvzmigbq32/KitchenSink.rar/file

Well i made all the changes.
I added "gnu-freefont_freeserif.zip" because it contains credit file for author and maybe it should added in resources.
Png flags file are mine so it will be no problem.
Also added some cool key events for each tab (space, left arrow, right arrow or enter depending on each tab).
You can select next tab with "Tab" key.

I really can not figure out why the label with scroll bar do not show the beginning of the text.
Also, i can't set min max form size on a message box.



texus

#28
QuoteI added "gnu-freefont_freeserif.zip" because it contains credit file for author and maybe it should added in resources.
I agree that the credits should be included, but that zip contains several different fonts of which only one is needed, so it is wasted space. Maybe the font should be moved to a new subfolder which would contain the README, FreeSerifBold.otf, CREDITS, COPYING and AUTHORS files. I don't think we need to keep the INSTALL, CHANGELOG and other font files. I would keep the README just because it contains the exception that allows the font to be used without requiring the program to be licensed under GPL.

QuoteI really can not figure out why the label with scroll bar do not show the beginning of the text.
I can't reproduce this. If I don't call setScrollbarPolicy then it only shows the start of the text as expected, but I don't know in what situation it would only show the end of the text.
Edit: I didn't look at the program yet, so I didn't see you already included the label. I'll have a look at the code later to figure out why it is happening.
Edit2: The issue is with setVerticalAlignment(Center), but you probably shouldn't be using that anyway when you have a vertical scrollbar.
Edit3: Fixed.

QuoteAlso, i can't set min max form size on a message box.
Message box wasn't supposed to be resized and it's size would depend on the contents. A maximum size would be useful as it would allow word-wrapping on the text. For the label the behavior is simple, but I'm not sure what to do if the buttons exceed the size. The whole widget probably needs an overhaul, maybe also making the sizes of the buttons and the spaces between them configurable. So this probably isn't something that I would implement on short-term.

billarhos

Well, ok we leave knob and messagebox for later time.
Forgot to mention my theme knob doesn't behave correct, meaning it can't follow the mouse events as the non theme knob follows.

Apart from knob issue, i am done. I am open to any additions or changes. Please do not hesitate. If really something is not fitting in my code i would gladly change it.

texus

The issue with the knob not responding has been fixed, but you also need to add "ImageRotation = 90;" to the theme to make it point in the right direction.

Maybe you could make a base class with virtual functions for all these tabs? Then you could get rid of the switch cases in processEvents, update and on top of loadTab in cKitchenSink.
Are the cases in cVirtualKeyboard::handleEvent needed? Can't you just check if "index != -1"?

I'm happy with how it looks. The code style and naming of variables isn't exactly the same as used internally in TGUI, but that is fine for example code, everyone is going to have their own convention anyway.
I've only briefly looked at the code. Some code improvements could be made such as replacing raw arrays with std::array and using more modern c++ for randoms, but those aren't important changes, I'm fine with the code being like it is now. The code can always be improved in the future.

billarhos

Quote"ImageRotation = 90;"
Ok i changed the png to point to 0 degrees.

Quotecases in cVirtualKeyboard::handleEvent needed?
Ok done.

Quotemake a base class with virtual functions for all these tabs
ok will be ready soon.


billarhos

http://www.mediafire.com/file/qh6jds5g9z3jdfp/KitchenSink.rar/file

Now we have something, i think. 8)
Make all changes, added a  custom message box on exit.
Some fixes made.
Added opacity on disabled where needed. However there is a problem with menubar and opacity of texts color when they get enabled.
Also a setopacitydisable value in gui.txt for messagebox gave me an exception.

texus

QuoteHowever there is a problem with menubar and opacity of texts color when they get enabled.
It definitely looks like that with the White theme, but if the issue you were seeing is the one that I just fixed then the problem was actually just the text color, not the opacity.

QuoteAlso a setopacitydisable value in gui.txt for messagebox gave me an exception.
Did you make a typo when making the forum post or are you actually using "setopacitydisable"? Because it should be "opacitydisabled" (without "set" in front and with a "d" at the end).

QuoteNow we have something, i think. 8)
Yep, you did a great job.
Now we just need to get it integrated with TGUI.

Do you think there should be a downloadable exe for the example on the website? If so, maybe you could build the executable statically (including linking statically to standard library) so that it can run on any computer. It would require rebuilding SFML with SFML_USE_STATIC_STD_LIBS and TGUI with TGUI_USE_STATIC_STD_LIBS.

Something should still be done about gnu-freefont_freeserif.zip. The KitchenSink folder is 6.2MB of which 4.3MB is an unused zip file. Whether you keep all the files or except for the font files or whether you do what I suggested earlier ("Maybe the font should be moved to a new subfolder which would contain the README, FreeSerifBold.otf, CREDITS, COPYING and AUTHORS files.") is up to you. When the example gets included with TGUI, every download is going to increase by the size of that KitchenSink folder. For this reason it might also be better to not ship the gui.psd file with the project either, it almost takes up half of the size if you remove the zip. If there is going to be a page on the website about the example I can still put the psd file there.
(I know my tests folder is a few MB too where it could also be argued that it shouldn't be in the project either if I want to keep things small, but that isn't an excuse to add even more bloat than there already is).

billarhos

Quotewas actually just the text color,
Yes it fixed. :o

My mistake. Sometimes when i am in hurry i act like a drunk. I was meant "ChildWindow"
In gui.txt just add "OpacityDisabled = 0.3" in ChildWindow section and the code will hung  in "mGuiTheme.load("resources/gui.txt");"

QuoteDo you think there should be a downloadable exe
No. I was sending the executable to you because i was thinking that it could help you in the process.
Just like builder-gui, it should be compiled in user side.

For all other stuff like where should be this or that, is really up to you. You can use another free font (smaller) if you like. You can change everything you like. You can put psd in website as you mention if that suits you.

Please act as yours.


texus

QuoteIn gui.txt just add "OpacityDisabled = 0.3" in ChildWindow section and the code will hung  in "mGuiTheme.load("resources/gui.txt");"
I can't reproduce hanging, but last time you said "gave me an exception" so I'm assuming that is still what you mean. The reason is probably because you forgot a semi-colon behind the line (if you catch the tgui::Exception that gets thrown it will likely tell you that parsing failed on that line, maybe even mentioning which character it read). You forgot this for all widgets, but the parser is more forgiving when it is the very last line in the section.

billarhos

QuoteYou forgot this for all widgets

;D