1use super::{RESET_BUTTONS_HEIGHT, RESET_BUTTONS_WIDTH};
2
3use crate::{
4 GlobalState,
5 hud::{ChatTab, Show, TEXT_COLOR, TEXT_GRAY_COLOR, UI_HIGHLIGHT_0, UI_MAIN, img_ids::Imgs},
6 session::settings_change::{Chat as ChatChange, Chat::*},
7 settings::chat::MAX_CHAT_TABS,
8 ui::{ImageSlider, ToggleButton, fonts::Fonts},
9};
10use conrod_core::{
11 Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon, color,
12 position::Relative,
13 widget::{self, Button, DropDownList, Image, Rectangle, Text, TextEdit},
14 widget_ids,
15};
16use i18n::Localization;
17use std::cmp::Ordering;
18
19widget_ids! {
20 struct Ids {
21 window,
22 window_r,
23 general_txt,
24 transp_text,
25 transp_slider,
26 transp_value,
27 lock_chat_text,
28 lock_chat_button,
29 char_name_text,
30 char_name_button,
31 reset_chat_button,
32
33 tabs_frame,
35 tabs_bg,
36 tabs_text,
37 tab_align,
38 tab_add,
39 tabs[],
40
41 tab_content_align,
43 tab_content_align_r,
44 tab_label_text,
45 tab_label_input,
46 tab_label_bg,
47 btn_tab_delete,
48
49 text_messages,
50 btn_messages_all,
51 text_messages_all,
52 btn_messages_world,
53 text_messages_world,
54 icon_messages_world,
55 btn_messages_region,
56 text_messages_region,
57 icon_messages_region,
58 btn_messages_faction,
59 text_messages_faction,
60 icon_messages_faction,
61 btn_messages_group,
62 text_messages_group,
63 icon_messages_group,
64 btn_messages_say,
65 text_messages_say,
66 icon_messages_say,
67
68 text_activity,
69 list_activity,
70
71 text_death,
72 list_death,
73 }
74}
75
76#[derive(WidgetCommon)]
77pub struct Chat<'a> {
78 global_state: &'a GlobalState,
79 show: &'a Show,
80 imgs: &'a Imgs,
81 fonts: &'a Fonts,
82 localized_strings: &'a Localization,
83 #[conrod(common_builder)]
84 common: widget::CommonBuilder,
85}
86impl<'a> Chat<'a> {
87 pub fn new(
88 global_state: &'a GlobalState,
89 show: &'a Show,
90 imgs: &'a Imgs,
91 fonts: &'a Fonts,
92 localized_strings: &'a Localization,
93 ) -> Self {
94 Self {
95 global_state,
96 show,
97 imgs,
98 fonts,
99 localized_strings,
100 common: widget::CommonBuilder::default(),
101 }
102 }
103}
104
105pub struct State {
106 ids: Ids,
107}
108pub enum Event {
109 ChangeChatSettingsTab(Option<usize>),
110 ChatChange(ChatChange),
111}
112
113impl Widget for Chat<'_> {
114 type Event = Vec<Event>;
115 type State = State;
116 type Style = ();
117
118 fn init_state(&self, id_gen: widget::id::Generator) -> Self::State {
119 State {
120 ids: Ids::new(id_gen),
121 }
122 }
123
124 fn style(&self) -> Self::Style {}
125
126 fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
127 common_base::prof_span!("Chat::update");
128 let widget::UpdateArgs { state, ui, .. } = args;
129
130 let mut events = Vec::new();
131 let chat_settings = &self.global_state.settings.chat;
132 Rectangle::fill_with(args.rect.dim(), color::TRANSPARENT)
135 .xy(args.rect.xy())
136 .graphics_for(args.id)
137 .scroll_kids()
138 .scroll_kids_vertically()
139 .set(state.ids.window, ui);
140 Rectangle::fill_with([args.rect.w() / 2.0, args.rect.h()], color::TRANSPARENT)
142 .top_right_of(state.ids.window)
143 .set(state.ids.window_r, ui);
144
145 Text::new(&self.localized_strings.get_msg("hud-settings-general"))
147 .top_left_with_margins_on(state.ids.window, 5.0, 5.0)
148 .font_size(self.fonts.cyri.scale(18))
149 .font_id(self.fonts.cyri.conrod_id)
150 .color(TEXT_COLOR)
151 .set(state.ids.general_txt, ui);
152
153 Text::new(
155 &self
156 .localized_strings
157 .get_msg("hud-settings-background_opacity"),
158 )
159 .down_from(state.ids.general_txt, 20.0)
160 .font_size(self.fonts.cyri.scale(14))
161 .font_id(self.fonts.cyri.conrod_id)
162 .color(TEXT_COLOR)
163 .set(state.ids.transp_text, ui);
164 if let Some(new_val) = ImageSlider::continuous(
165 chat_settings.chat_opacity,
166 0.0,
167 1.0,
168 self.imgs.slider_indicator,
169 self.imgs.slider,
170 )
171 .w_h(104.0, 22.0)
172 .down_from(state.ids.transp_text, 10.0)
173 .track_breadth(12.0)
174 .slider_length(10.0)
175 .pad_track((5.0, 5.0))
176 .set(state.ids.transp_slider, ui)
177 {
178 events.push(Event::ChatChange(Transparency(new_val)));
179 }
180
181 Text::new(&format!("{:.2}", chat_settings.chat_opacity,))
182 .right_from(state.ids.transp_slider, 8.0)
183 .font_size(self.fonts.cyri.scale(14))
184 .graphics_for(state.ids.transp_slider)
185 .font_id(self.fonts.cyri.conrod_id)
186 .color(TEXT_COLOR)
187 .set(state.ids.transp_value, ui);
188
189 Text::new(&self.localized_strings.get_msg("hud-settings-lock_chat"))
191 .down_from(state.ids.transp_slider, 10.0)
192 .font_size(self.fonts.cyri.scale(14))
193 .font_id(self.fonts.cyri.conrod_id)
194 .color(TEXT_COLOR)
195 .set(state.ids.lock_chat_text, ui);
196
197 if chat_settings.lock_chat
198 != ToggleButton::new(
199 chat_settings.lock_chat,
200 self.imgs.checkbox,
201 self.imgs.checkbox_checked,
202 )
203 .w_h(18.0, 18.0)
204 .right_from(state.ids.lock_chat_text, 10.0)
205 .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
206 .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
207 .set(state.ids.lock_chat_button, ui)
208 {
209 events.push(Event::ChatChange(LockChat(!chat_settings.lock_chat)));
210 }
211
212 Text::new(
214 &self
215 .localized_strings
216 .get_msg("hud-settings-chat_character_name"),
217 )
218 .down_from(state.ids.lock_chat_text, 10.0)
219 .font_size(self.fonts.cyri.scale(14))
220 .font_id(self.fonts.cyri.conrod_id)
221 .color(TEXT_COLOR)
222 .set(state.ids.char_name_text, ui);
223
224 if chat_settings.chat_character_name
225 != ToggleButton::new(
226 chat_settings.chat_character_name,
227 self.imgs.checkbox,
228 self.imgs.checkbox_checked,
229 )
230 .w_h(18.0, 18.0)
231 .right_from(state.ids.char_name_text, 10.0)
232 .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
233 .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
234 .set(state.ids.char_name_button, ui)
235 {
236 events.push(Event::ChatChange(CharName(
237 !chat_settings.chat_character_name,
238 )));
239 }
240
241 if Button::image(self.imgs.button)
243 .w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT)
244 .hover_image(self.imgs.button_hover)
245 .press_image(self.imgs.button_press)
246 .down_from(state.ids.char_name_text, 20.0)
247 .label(&self.localized_strings.get_msg("hud-settings-reset_chat"))
248 .label_font_size(self.fonts.cyri.scale(14))
249 .label_color(TEXT_COLOR)
250 .label_font_id(self.fonts.cyri.conrod_id)
251 .label_y(Relative::Scalar(2.0))
252 .set(state.ids.reset_chat_button, ui)
253 .was_clicked()
254 {
255 events.push(Event::ChatChange(ResetChatSettings));
256 }
257
258 Text::new(&self.localized_strings.get_msg("hud-settings-chat_tabs"))
260 .top_left_with_margins_on(state.ids.window_r, 5.0, 5.0)
261 .font_size(self.fonts.cyri.scale(18))
262 .font_id(self.fonts.cyri.conrod_id)
263 .color(TEXT_COLOR)
264 .set(state.ids.tabs_text, ui);
265
266 Image::new(self.imgs.chat_tab_settings_bg)
268 .w_h(390.0, 270.0)
269 .color(Some(UI_MAIN))
270 .down_from(state.ids.tabs_text, 20.0)
271 .set(state.ids.tabs_bg, ui);
272
273 Image::new(self.imgs.chat_tab_settings_frame)
274 .w_h(390.0, 270.0)
275 .color(Some(UI_HIGHLIGHT_0))
276 .down_from(state.ids.tabs_text, 20.0)
277 .set(state.ids.tabs_frame, ui);
278
279 Rectangle::fill_with([390.0, 20.0], color::TRANSPARENT)
281 .down_from(state.ids.tabs_text, 20.0)
282 .set(state.ids.tab_align, ui);
283
284 Rectangle::fill_with([390.0, 250.0], color::TRANSPARENT)
286 .down_from(state.ids.tab_align, 0.0)
287 .set(state.ids.tab_content_align, ui);
288 Rectangle::fill_with([195.0, 250.0], color::TRANSPARENT)
289 .top_right_of(state.ids.tab_content_align)
290 .set(state.ids.tab_content_align_r, ui);
291
292 let chat_tabs = &chat_settings.chat_tabs;
293 if state.ids.tabs.len() < chat_tabs.len() {
294 state.update(|s| {
295 s.ids
296 .tabs
297 .resize(chat_tabs.len(), &mut ui.widget_id_generator())
298 });
299 }
300 for (i, chat_tab) in chat_tabs.iter().enumerate() {
301 let is_selected = self
302 .show
303 .chat_tab_settings_index
304 .map(|index| index == i)
305 .unwrap_or(false);
306
307 let button = Button::image(if is_selected {
308 self.imgs.selection
309 } else {
310 self.imgs.nothing
311 })
312 .w_h(390.0 / (MAX_CHAT_TABS as f64), 19.0)
313 .hover_image(self.imgs.selection_hover)
314 .press_image(self.imgs.selection_press)
315 .image_color(color::rgba(1.0, 0.82, 0.27, 1.0))
316 .label(chat_tab.label.as_str())
317 .label_font_size(self.fonts.cyri.scale(12))
318 .label_font_id(self.fonts.cyri.conrod_id)
319 .label_color(TEXT_COLOR)
320 .label_y(Relative::Scalar(1.0));
321
322 let button = if i == 0 {
323 button.top_left_with_margins_on(state.ids.tab_align, 1.0, 1.0)
324 } else {
325 button.right_from(state.ids.tabs[i - 1], 0.0)
326 };
327 if button.set(state.ids.tabs[i], ui).was_clicked() {
328 events.push(Event::ChangeChatSettingsTab(if is_selected {
329 None
330 } else {
331 Some(i)
332 }));
333 }
334 }
335 if chat_tabs.len() < MAX_CHAT_TABS {
337 let add_tab_button = Button::image(self.imgs.settings_plus)
338 .hover_image(self.imgs.settings_plus_hover)
339 .press_image(self.imgs.settings_plus_press)
340 .w_h(19.0, 19.0);
341
342 let add_tab_button = if chat_tabs.is_empty() {
343 add_tab_button.top_left_with_margins_on(state.ids.tab_align, 1.0, 1.0)
344 } else {
345 add_tab_button.right_from(state.ids.tabs[chat_tabs.len() - 1], 0.0)
346 };
347
348 if add_tab_button.set(state.ids.tab_add, ui).was_clicked() {
349 let index = chat_tabs.len();
350 events.push(Event::ChatChange(ChatTabInsert(index, ChatTab::default())));
351 events.push(Event::ChangeChatSettingsTab(Some(index)));
352 }
353 }
354
355 if let Some((index, chat_tab)) = self
357 .show
358 .chat_tab_settings_index
359 .and_then(|i| chat_tabs.get(i).map(|ct| (i, ct)))
360 {
361 let mut updated_chat_tab = chat_tab.clone();
362
363 Text::new(&self.localized_strings.get_msg("hud-settings-label"))
364 .top_left_with_margins_on(state.ids.tab_content_align, 5.0, 25.0)
365 .font_size(self.fonts.cyri.scale(16))
366 .font_id(self.fonts.cyri.conrod_id)
367 .color(TEXT_COLOR)
368 .set(state.ids.tab_label_text, ui);
369
370 Rectangle::fill([90.0, 20.0])
371 .right_from(state.ids.tab_label_text, 5.0)
372 .color(color::rgba(0.0, 0.0, 0.0, 0.7))
373 .set(state.ids.tab_label_bg, ui);
374
375 if let Some(label) = TextEdit::new(chat_tab.label.as_str())
376 .right_from(state.ids.tab_label_text, 10.0)
377 .y_relative_to(state.ids.tab_label_text, -3.0)
378 .w_h(75.0, 20.0)
379 .font_id(self.fonts.cyri.conrod_id)
380 .font_size(self.fonts.cyri.scale(14))
381 .color(TEXT_COLOR)
382 .set(state.ids.tab_label_input, ui)
383 {
384 updated_chat_tab.label = label;
385 }
386
387 if Button::image(self.imgs.button)
388 .hover_image(self.imgs.button_hover)
389 .press_image(self.imgs.button_press)
390 .w_h(100.0, 30.0)
391 .label(&self.localized_strings.get_msg("hud-settings-delete"))
392 .label_font_size(self.fonts.cyri.scale(14))
393 .label_font_id(self.fonts.cyri.conrod_id)
394 .label_color(TEXT_COLOR)
395 .label_y(Relative::Scalar(1.0))
396 .bottom_right_with_margins_on(state.ids.tab_content_align, 10.0, 10.0)
397 .set(state.ids.btn_tab_delete, ui)
398 .was_clicked()
399 {
400 events.push(Event::ChatChange(ChatTabRemove(index)));
401 events.push(Event::ChangeChatSettingsTab(None));
402
403 if let Some(chat_tab_index) = chat_settings.chat_tab_index {
404 match chat_tab_index.cmp(&index) {
405 Ordering::Equal => {
406 events.push(Event::ChatChange(ChangeChatTab(None)));
407 },
408 Ordering::Greater => {
409 events.push(Event::ChatChange(ChangeChatTab(Some(index - 1))));
410 },
411 _ => {},
412 }
413 }
414 }
415
416 let create_toggle = |selected, enabled| {
419 ToggleButton::new(selected, self.imgs.checkbox, self.imgs.checkbox_checked)
420 .and(|button| {
421 if enabled {
422 button
423 .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
424 .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
425 } else {
426 button.image_colors(TEXT_GRAY_COLOR, TEXT_GRAY_COLOR)
427 }
428 })
429 .w_h(16.0, 16.0)
430 };
431
432 let create_toggle_text = |text, enabled| {
433 Text::new(text)
434 .font_id(self.fonts.cyri.conrod_id)
435 .font_size(self.fonts.cyri.scale(14))
436 .color(if enabled { TEXT_COLOR } else { TEXT_GRAY_COLOR })
437 };
438
439 let create_toggle_icon = |img, enabled: bool| {
440 Image::new(img)
441 .and_if(!enabled, |image| image.color(Some(TEXT_GRAY_COLOR)))
442 .w_h(18.0, 18.0)
443 };
444
445 Text::new(&self.localized_strings.get_msg("hud-settings-messages"))
447 .font_id(self.fonts.cyri.conrod_id)
448 .font_size(self.fonts.cyri.scale(16))
449 .color(TEXT_COLOR)
450 .top_left_with_margins_on(state.ids.tab_content_align, 35.0, 15.0)
451 .set(state.ids.text_messages, ui);
452
453 if chat_tab.filter.message_all
455 != ToggleButton::new(
456 chat_tab.filter.message_all,
457 self.imgs.checkbox,
458 self.imgs.checkbox_checked,
459 )
460 .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
461 .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
462 .w_h(18.0, 18.0)
463 .down_from(state.ids.text_messages, 10.0)
464 .set(state.ids.btn_messages_all, ui)
465 {
466 updated_chat_tab.filter.message_all = !chat_tab.filter.message_all;
467 };
468
469 Text::new(&self.localized_strings.get_msg("hud-settings-show_all"))
470 .font_id(self.fonts.cyri.conrod_id)
471 .font_size(self.fonts.cyri.scale(16))
472 .color(TEXT_COLOR)
473 .right_from(state.ids.btn_messages_all, 5.0)
474 .set(state.ids.text_messages_all, ui);
475
476 if chat_tab.filter.message_group
478 != create_toggle(chat_tab.filter.message_group, !chat_tab.filter.message_all)
479 .down_from(state.ids.btn_messages_all, 10.0)
480 .set(state.ids.btn_messages_group, ui)
481 && !chat_tab.filter.message_all
482 {
483 updated_chat_tab.filter.message_group = !chat_tab.filter.message_group;
484 }
485
486 let group_text = self.localized_strings.get_msg("hud-settings-group");
487 create_toggle_text(&group_text, !chat_tab.filter.message_all)
488 .right_from(state.ids.btn_messages_group, 5.0)
489 .set(state.ids.text_messages_group, ui);
490
491 create_toggle_icon(self.imgs.chat_group_small, !chat_tab.filter.message_all)
492 .right_from(state.ids.text_messages_group, 5.0)
493 .set(state.ids.icon_messages_group, ui);
494
495 if chat_tab.filter.message_faction
497 != create_toggle(
498 chat_tab.filter.message_faction,
499 !chat_tab.filter.message_all,
500 )
501 .down_from(state.ids.btn_messages_group, 10.0)
502 .set(state.ids.btn_messages_faction, ui)
503 && !chat_tab.filter.message_all
504 {
505 updated_chat_tab.filter.message_faction = !chat_tab.filter.message_faction;
506 }
507
508 let faction_text = self.localized_strings.get_msg("hud-settings-faction");
509 create_toggle_text(&faction_text, !chat_tab.filter.message_all)
510 .right_from(state.ids.btn_messages_faction, 5.0)
511 .set(state.ids.text_messages_faction, ui);
512
513 create_toggle_icon(self.imgs.chat_faction_small, !chat_tab.filter.message_all)
514 .right_from(state.ids.text_messages_faction, 5.0)
515 .set(state.ids.icon_messages_faction, ui);
516
517 if chat_tab.filter.message_world
519 != create_toggle(chat_tab.filter.message_world, !chat_tab.filter.message_all)
520 .down_from(state.ids.btn_messages_faction, 10.0)
521 .set(state.ids.btn_messages_world, ui)
522 && !chat_tab.filter.message_all
523 {
524 updated_chat_tab.filter.message_world = !chat_tab.filter.message_world;
525 }
526
527 let world_text = self.localized_strings.get_msg("hud-settings-world");
528 create_toggle_text(&world_text, !chat_tab.filter.message_all)
529 .right_from(state.ids.btn_messages_world, 5.0)
530 .set(state.ids.text_messages_world, ui);
531
532 create_toggle_icon(self.imgs.chat_world_small, !chat_tab.filter.message_all)
533 .right_from(state.ids.text_messages_world, 5.0)
534 .set(state.ids.icon_messages_world, ui);
535
536 if chat_tab.filter.message_region
538 != create_toggle(chat_tab.filter.message_region, !chat_tab.filter.message_all)
539 .down_from(state.ids.btn_messages_world, 10.0)
540 .set(state.ids.btn_messages_region, ui)
541 && !chat_tab.filter.message_all
542 {
543 updated_chat_tab.filter.message_region = !chat_tab.filter.message_region;
544 }
545
546 let region_text = self.localized_strings.get_msg("hud-settings-region");
547 create_toggle_text(®ion_text, !chat_tab.filter.message_all)
548 .right_from(state.ids.btn_messages_region, 5.0)
549 .set(state.ids.text_messages_region, ui);
550
551 create_toggle_icon(self.imgs.chat_region_small, !chat_tab.filter.message_all)
552 .right_from(state.ids.text_messages_region, 5.0)
553 .set(state.ids.icon_messages_region, ui);
554
555 if chat_tab.filter.message_say
557 != create_toggle(chat_tab.filter.message_say, !chat_tab.filter.message_all)
558 .down_from(state.ids.btn_messages_region, 10.0)
559 .set(state.ids.btn_messages_say, ui)
560 && !chat_tab.filter.message_all
561 {
562 updated_chat_tab.filter.message_say = !chat_tab.filter.message_say;
563 }
564
565 let say_text = self.localized_strings.get_msg("hud-settings-say");
566 create_toggle_text(&say_text, !chat_tab.filter.message_all)
567 .right_from(state.ids.btn_messages_say, 5.0)
568 .set(state.ids.text_messages_say, ui);
569
570 create_toggle_icon(self.imgs.chat_say_small, !chat_tab.filter.message_all)
571 .right_from(state.ids.text_messages_say, 5.0)
572 .set(state.ids.icon_messages_say, ui);
573
574 Text::new(&self.localized_strings.get_msg("hud-settings-activity"))
576 .top_left_with_margins_on(state.ids.tab_content_align_r, 0.0, 5.0)
577 .align_middle_y_of(state.ids.text_messages)
578 .font_size(self.fonts.cyri.scale(16))
579 .font_id(self.fonts.cyri.conrod_id)
580 .color(TEXT_COLOR)
581 .set(state.ids.text_activity, ui);
582
583 if let Some(clicked) = DropDownList::new(
584 &[
585 &self.localized_strings.get_msg("hud-settings-none"),
586 &self.localized_strings.get_msg("hud-settings-all"),
587 &self.localized_strings.get_msg("hud-settings-group_only"),
588 ],
589 Some(if chat_tab.filter.activity_all {
590 1
592 } else if chat_tab.filter.activity_group {
593 2
595 } else {
596 0
598 }),
599 )
600 .w_h(100.0, 20.0)
601 .color(color::hsl(0.0, 0.0, 0.1))
602 .label_color(TEXT_COLOR)
603 .label_font_id(self.fonts.cyri.conrod_id)
604 .label_font_size(self.fonts.cyri.scale(14))
605 .label_y(Relative::Scalar(1.0))
606 .down_from(state.ids.text_activity, 10.0)
607 .set(state.ids.list_activity, ui)
608 {
609 match clicked {
610 0 => {
611 updated_chat_tab.filter.activity_all = false;
612 updated_chat_tab.filter.activity_group = false;
613 },
614 1 => {
615 updated_chat_tab.filter.activity_all = true;
616 },
617 2 => {
618 updated_chat_tab.filter.activity_all = false;
619 updated_chat_tab.filter.activity_group = true;
620 },
621 _ => unreachable!(),
622 }
623 }
624
625 Text::new(&self.localized_strings.get_msg("hud-settings-death"))
627 .down_from(state.ids.list_activity, 20.0)
628 .font_size(self.fonts.cyri.scale(16))
629 .font_id(self.fonts.cyri.conrod_id)
630 .color(TEXT_COLOR)
631 .set(state.ids.text_death, ui);
632
633 if let Some(clicked) = DropDownList::new(
634 &[
635 &self.localized_strings.get_msg("hud-settings-none"),
636 &self.localized_strings.get_msg("hud-settings-all"),
637 &self.localized_strings.get_msg("hud-settings-group_only"),
638 ],
639 Some(if chat_tab.filter.death_all {
640 1
642 } else if chat_tab.filter.death_group {
643 2
645 } else {
646 0
648 }),
649 )
650 .w_h(100.0, 20.0)
651 .color(color::hsl(0.0, 0.0, 0.1))
652 .label_color(TEXT_COLOR)
653 .label_font_id(self.fonts.cyri.conrod_id)
654 .label_font_size(self.fonts.cyri.scale(14))
655 .label_y(Relative::Scalar(1.0))
656 .down_from(state.ids.text_death, 10.0)
657 .set(state.ids.list_death, ui)
658 {
659 match clicked {
660 0 => {
661 updated_chat_tab.filter.death_all = false;
662 updated_chat_tab.filter.death_group = false;
663 },
664 1 => {
665 updated_chat_tab.filter.death_all = true;
666 },
667 2 => {
668 updated_chat_tab.filter.death_all = false;
669 updated_chat_tab.filter.death_group = true;
670 },
671 _ => unreachable!(),
672 }
673 }
674
675 if chat_tab != &updated_chat_tab {
676 events.insert(0, Event::ChatChange(ChatTabUpdate(index, updated_chat_tab)));
678 }
679 }
680
681 events
682 }
683}