Commit Graph

17 Commits

Author SHA1 Message Date
Charles Dang
dfa09cd9d9 GUI2: refactored styled_widget canvas initialization process
Back in 515f450432 I attempted to optimize this, but I didn't do it right. Since I didn't
define a move ctor for canvas, that std::move call was useless and the copy ctor was being called
anyway. Though, that change wasn't a total waste. It still reduced the number of canvases created
from (I think) 3 to 2, since the code was no longer going default-construction
and copy-assignment from the state struct.

These new changes completely remove the canvas object from the state struct. Nothing particularity
special was being done there, only a call to canvas::set_cfg. Instead, the canvas config is saved
in the state objects and then styled_widget initializes the canvas itself. This does mean there's
config copying going on here, sadly, but it's unavoidable given the current design.

This also removes the definition_load_configuration function from styled_widget. Its contents were
moved to the ctor. This ensures only the exact number of canvas objects needed are created. No
copying from the state objects, no reallocations. This also means we can delete the copy ctor (see
below).

A move ctor was added to canvas (though it admittedly isn't needed now since no canvas moving
occurs), and the copy ctor deleted.
2017-12-07 19:18:42 +11:00
Charles Dang
2101353d36 Convert include guards to the shorter #pragma once
Turns out I mistook @celticminstrel's opinion that we should use include guards over pragma (737916e).
Since all major compilers support `#pragma once`, there's no reason not to use it.

For future mergability reasons, this excludes src/spirit_po and src/xBRZ. It also excludes src/boost-patched.
2017-05-09 19:41:37 +11:00
Charles Dang
f8d13b3f56 GUI2: deployed emplace_back en-masse where appropriate
Note that like in 8bf345c, using emplace_back with config_of doesn't actually allow for in-place construction,
but does allow for use of the move ctor, which is more efficient.
2017-04-04 18:41:46 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
adb5ef90ad Demote can_shrink key from global widget scope to label-only
It was causing problems being enabled for all labels (ie, some labels being shrunken when it wasn't desirable),
and it didn't make much sense for all widgets anyway.
2017-03-17 06:21:13 +11:00
Charles Dang
22eebc6983 GUI2: allow labels to shrink to avoid scrollbars
This adds a new can_shrink key to widgets that allows the 'no label' codepath of styled_widget::request_reduce_width to be called.
In this case, it allows labels to shrink without forcing window scrollbars.
2017-02-25 07:52:00 +11:00
Jyrki Vesterinen
575326c74d Move linked group definition to a shared location
@Vultraz suggested this change.
2017-01-31 20:29:02 +02:00
Jyrki Vesterinen
6f94a8ffed Allow composite widgets to inject linked groups 2017-01-28 17:59:36 +02:00
Celtic Minstrel
ed206daf23 Rename control -> styled_widget 2016-11-09 22:09:09 -05:00
Celtic Minstrel
f9609c4bb1 Rename GUI2 widget support classes to drop t- prefix 2016-11-09 01:24:25 -05:00
Celtic Minstrel
749f68716d Rename GUI2 canvas classes to avoid t- prefix 2016-11-09 01:17:14 -05:00
Celtic Minstrel
77cace19db Rename ttext class to avoid t- prefix 2016-11-09 01:17:14 -05:00
Charles Dang
188231cd03 Refactored SDL_TTF constants out of ttext
Do note that for some reason using the default_bold label definition with this change made an underline
appear. I changed the style checks to use == instead of & (bitwise AND) and that fixed the problem. If
that's wrong, someone feel free to fix that.
2016-10-17 20:53:48 +11:00
Chris Beck
1336306884 move font_options, text.?pp to font folder
also fix indentation in previous commit
2016-10-15 06:32:37 -04:00
Charles Dang
563947e1b3 Refactored GUI2's uses of boost::intrusive_ptr 2016-07-25 09:28:43 +11:00
Celtic Minstrel
982394fe3a Remove custom FOREACH macro in favour of range-for 2016-04-01 12:08:05 -04:00
Celtic Minstrel
6307b9459c Move most of gui/auxiliary to gui/core to reflect its true nature 2016-03-20 23:18:48 -04:00