Skip to content

Commit d804056

Browse files
committed
stuff
1 parent 975c186 commit d804056

5 files changed

Lines changed: 33 additions & 13 deletions

File tree

res/ruis_res/style_light.tml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version{1}
2+
// TODO: support inherit
3+
ruis{
4+
color_background{0xffd5d5d5}
5+
color_middleground{0xffc2c2c2}
6+
color_foreground{0xffb0b0b0}
7+
8+
color_text_normal{0xff000000}
9+
color_text_selection_bg{0xff80b0b0}
10+
11+
color_highlight{0xffad9869}
12+
13+
color_cursor{0xffff8080}
14+
15+
// TODO: support include
16+
dim_tree_view_item_indent{17pp}
17+
18+
font_size_normal{12pp}
19+
font_face_normal{ruis_fnt_normal}
20+
}
21+
user{}

src/ruis/gui.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void gui::init_standard_widgets(const fsif::file& fi)
7070
fi.set_path(s);
7171
this->context.get().loader().mount_res_pack(fi);
7272
} catch (std::runtime_error&) {
73-
// utki::logcat_debug("could not mount respack: ", s, '\n');
7473
continue;
7574
}
7675

src/ruis/style/style_provider.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ void style_provider::store_to_cache(
9090
std::weak_ptr<style_value_base> v
9191
) const
9292
{
93-
ASSERT(!utki::contains(this->cache, id))
93+
utki::assert(!utki::contains(this->cache, id));
9494

9595
[[maybe_unused]] auto res = this->cache.insert(std::make_pair(
9696
std::string(id), //
9797
std::move(v)
9898
));
9999

100-
ASSERT(res.second) // insert took place
100+
// insert took place
101+
utki::assert(res.second);
101102
}
102103

103104
styled<color> style_provider::get_color_background() const

src/ruis/style/style_provider.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,10 @@ template <typename value_type>
118118
styled<value_type> style_provider::get(std::string_view id) const
119119
{
120120
if (auto svb = this->get_from_cache(id)) {
121-
auto sv = std::dynamic_pointer_cast<const typename styled<value_type>::style_value>(svb);
122-
if (!sv) {
123-
throw std::invalid_argument("style::get(id): requested value_type does not match the one stored in cache");
121+
if (auto sv = std::dynamic_pointer_cast<const typename styled<value_type>::style_value>(svb)) {
122+
return {utki::shared_ref<const typename styled<value_type>::style_value>(std::move(sv))};
124123
}
125-
return {utki::shared_ref<const typename styled<value_type>::style_value>(std::move(sv))};
124+
throw std::invalid_argument("style::get(id): requested value_type does not match the one stored in cache");
126125
}
127126

128127
const auto* desc = this->cur_style_sheet.get().get(id);

src/ruis/style/styled.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ class styled
133133

134134
const style_value_ref_type& get_ref() const noexcept
135135
{
136-
ASSERT(!this->value.valueless_by_exception())
137-
ASSERT(this->is_from_style())
136+
utki::assert(!this->value.valueless_by_exception());
137+
utki::assert(this->is_from_style());
138138
// use std::get_if() to avoid throwing exceptions
139139
const auto* r = std::get_if<style_value_ref_type>(&this->value);
140-
ASSERT(r)
140+
utki::assert(r);
141141
return *r;
142142
}
143143

144144
const actual_value_type& get_value() const noexcept
145145
{
146-
ASSERT(!this->value.valueless_by_exception())
147-
ASSERT(!this->is_from_style())
146+
utki::assert(!this->value.valueless_by_exception());
147+
utki::assert(!this->is_from_style());
148148
// use std::get_if() to avoid throwing exceptions
149149
const auto* v = std::get_if<actual_value_type>(&this->value);
150-
ASSERT(v)
150+
utki::assert(v);
151151
return *v;
152152
}
153153

0 commit comments

Comments
 (0)