Commit graph

88 commits

Author SHA1 Message Date
Kp 6285878c4c Add color_palette_index type alias, to note palette-related uint8_t 2020-07-16 02:31:04 +00:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 3170b11997 Modernize typedefs for std::array types
Use `using x = y;` instead of `typedef y x;`.
2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 7bcbaae230 Tighten protection against grs_bitmap bm_data confusion
Bitmaps based on grs_main_bitmap own their data.  Bitmaps based on
grs_bitmap do not.  Adjust prototypes to prevent initializing a
grs_main_bitmap with data it will not own.
2019-02-02 18:36:39 +00:00
Kp 4cfd5f3324 Pass canvas to menubar_init 2017-09-26 04:15:50 +00:00
Kp 9421c31b5a Replace "compiler-type_traits.h" with <type_traits>
Delete stub "compiler-type_traits.h" header.  Redirect all uses to the
standard <type_traits> header.

git grep -wlz 'compiler-type_traits.h' -- '*.cpp' '*.h' | xargs -0 perl -p -i <<EOF
    BEGIN {
	    $i = 0;
    }
    if (($i == 1 && $_ eq "\n") || ($i < 2 && /^#include "/)) {
	    # First blank line or first user-include after a system-include.
	    # Print, then never again for this file.
	    print "#include <type_traits>\n";
	    $i = 2;
    } elsif ($i == 0) {
	    $i = 1 if (/^#include </);
    } elsif ($_ eq "#include \"compiler-type_traits.h\"\n") {
	    # Remove this line if found.
	    $_ = '';
    }
    # Reset state machine when moving to next file.
    $i = 0 if eof;
EOF
2017-06-25 20:46:03 +00:00
Kp adcf02e454 Expand tt:: indirection to std::
All supported compilers have an acceptable <type_traits>.  Commit
4cb3d46148 ("Move <type_traits> test to Cxx11RequiredFeature") made
<type_traits> support mandatory in August and no one has objected.
Remove the indirection and use namespace std directly for type_traits
members.
2017-06-25 20:46:03 +00:00
Kp 842bd7a649 Pass canvas to ui_string_centered 2017-02-11 21:42:36 +00:00
Kp aa9b9a8346 Pass canvas to ui_draw_box_in 2017-02-11 21:42:36 +00:00
Kp 04c7f7c790 Pass canvas to ui_draw_box_out 2017-02-11 21:42:35 +00:00
Kp a51b071053 Pass canvas to ui_draw_frame 2017-02-11 21:42:35 +00:00
Kp 5636a85f3c Pass canvas to ui_draw_shad 2017-02-11 21:42:35 +00:00
Kp cf1f5df3cc Pass canvas to Vline 2017-02-11 21:42:35 +00:00
Kp f9cb598b0f Pass canvas to Hline 2017-02-11 21:42:35 +00:00
Kp 554daa61cc Pass font to ui_get_button_size 2017-02-11 21:42:34 +00:00
Kp c16b7763e9 Remove unused ui_draw_line_in 2017-02-08 23:34:41 +00:00
Chris Taylor ac438f4cc2 Allow the user to carry on as usual if any of the editor files are missing (i.e. before editor was loaded).
If a game was playing, continue playing. If it was in the main menu, return to the main menu. (If all files are put in place the editor can load again.)
2016-11-11 16:09:57 +08:00
Chris Taylor 46297c151e Remove ui_gadget_delete_all
As the UI_DIALOG client is now responsible for freeing all gadgets (via unique_ptr's), this function now causes issues where it attempts to access freed gadgets (resulting in std::runtime_error("unknown gadget kind") exception when closing the AI Properties dialog on my Macbook, for example). Removing the offending function fixes the issue.
2016-11-11 16:09:57 +08:00
Chris Taylor 9631d319f6 Allow dcx::UI_DIALOG struct to be subclassed - step 3
Allow dcx::UI_DIALOG struct to be subclassed step 3. This step adds the destructor and makes sure the dialog is only deleted within the main dialog handler if the specific handler didn't return window_event_result::deleted.
2016-10-04 16:09:21 +08:00
Chris Taylor db665d8c33 Allow dcx::UI_DIALOG struct to be subclassed - step 2
Allow dcx::UI_DIALOG struct to be subclassed step 2. Make all the UI_DIALOG handlers return a window_event_result like everyone else.
2016-10-04 15:58:20 +08:00
Chris Taylor 4d9eb4e743 Allow dcx::UI_DIALOG struct to be subclassed - step 1
Allow dcx::UI_DIALOG struct to be subclassed step 1. This step renames and reconfigures untyped_ui_dialog_create in dialog.cpp to be the main constructor. Also adds a template constructor that allows an event handler that takes a subclass of UI_DIALOG.
2016-10-04 11:29:19 +08:00
Chris Taylor ca35a8091f Declare dcx::window with class keyword to clarify its intended use.
Also removes the need for the private keyword in the definition.
2016-10-03 11:15:22 +08:00
Kp 53deef077a Prefer make_unique over raw new 2016-08-06 19:55:24 +00:00
Kp 2e88fec559 Flatten some ui type hierarchy 2016-08-06 19:55:24 +00:00
Kp 37ec5e25d4 Declare ~UI_GADGET as protected
UI_GADGET subclasses should always be deleted through the subtype
pointer.
2016-08-06 19:55:23 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp e09a590e6f Pass color to Vline 2016-02-12 04:02:28 +00:00
Kp 76d0e01b6e Pass color to Hline 2016-02-12 04:02:28 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 22bd3ce8d8 Use inline namespace dcx for common/ui 2015-12-05 22:57:24 +00:00
Kp ed55763603 Remove unused symbols 2015-12-04 03:36:31 +00:00
Kp 166d203474 Use fwd-gr.h instead of repeated grs_canvas declarations 2015-11-26 02:56:55 +00:00
Kp 78de0ac119 Add fwd-event.h with forward declarations of event.h 2015-10-09 02:46:10 +00:00
Kp 302e344979 Warn when UI_GADGET_* are immediately freed 2015-06-13 22:42:19 +00:00
Kp 63cea8bb23 Fix gcc-4.6 ui build
gcc-4.6 chokes on `static constexpr type value{};`, but accepts
`static constexpr auto value = type{};`

Fixes: 95e3ac1e5b ("Use integral_constant for UI kind")
2015-05-22 03:33:19 +00:00
Kp b124b3d75f Shorten Hline/Vline 2015-05-09 17:38:59 +00:00
Kp bdee338e34 Preserve array size for ui_get_filename 2015-05-09 17:38:58 +00:00
Kp 95e3ac1e5b Use integral_constant for UI kind 2015-04-02 02:36:54 +00:00
Kp f88eaf43ac Make UI_GADGET_LISTBOX char* const 2015-04-02 02:36:54 +00:00
Kp 92b6cd3883 Replace ui_create_dialog specialization with helper
Rename ui_create_dialog<void *> specialization with free function
untyped_ui_create_dialog.  GCC 4.6 incorrectly considers a
specialization to be a redundant declaration, causing a
-Wredundant-decls failure with the specialization form.

Fixes: be041a9cfc ("Add type checking for ui_create_dialog")
2015-04-02 02:36:52 +00:00
Kp d04e7902ee Make file_get*list static 2015-03-22 18:49:21 +00:00
Kp 4c8f3a47b5 Convert frequently used casts to C++ casts 2015-02-05 03:03:49 +00:00
Kp f38aec1212 Remove string copying in GetKeyDescription 2015-01-29 04:27:35 +00:00
Kp 71ec47b32e Refactor ui_pad_activate 2015-01-29 04:27:35 +00:00
Kp ff4a0ccd70 Fix RAIIdmem array usage
Some RAIIdmem instances managed a T[], but were declared to manage a T.
2015-01-28 03:42:53 +00:00
Kp a9998476a9 Use ntstring for UI_KEYPAD description 2014-12-22 04:35:48 +00:00
Kp 0e45146202 Return unique_ptr from ui_gadget_add 2014-12-20 04:36:12 +00:00