Skip to content

Commit

Permalink
add menu option for retaining color on strand selection
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinChang24 committed Nov 6, 2023
1 parent 58cd26e commit d291063
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/src/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,25 @@ abstract class DisablePngCachingDnaSequencesSet
_$disablePngCachingDnaSequencesSetSerializer;
}

abstract class RetainStrandColorOnSelectionSet
with BuiltJsonSerializable
implements Action, Built<RetainStrandColorOnSelectionSet, RetainStrandColorOnSelectionSetBuilder> {
bool get retain_strand_color_on_selection;

/************************ begin BuiltValue boilerplate ************************/
factory RetainStrandColorOnSelectionSet(bool retain_strand_color_on_selection) =>
RetainStrandColorOnSelectionSet.from(
(b) => b..retain_strand_color_on_selection = retain_strand_color_on_selection);

factory RetainStrandColorOnSelectionSet.from(
[void Function(RetainStrandColorOnSelectionSetBuilder) updates]) = _$RetainStrandColorOnSelectionSet;

RetainStrandColorOnSelectionSet._();

static Serializer<RetainStrandColorOnSelectionSet> get serializer =>
_$retainStrandColorOnSelectionSetSerializer;
}

abstract class DisplayReverseDNARightSideUpSet
with BuiltJsonSerializable
implements Action, Built<DisplayReverseDNARightSideUpSet, DisplayReverseDNARightSideUpSetBuilder> {
Expand Down
4 changes: 4 additions & 0 deletions lib/src/reducers/app_ui_state_reducer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ int slice_bar_offset_set_reducer(int _, actions.SliceBarOffsetSet action) => act
bool disable_png_caching_dna_sequences_reducer(bool _, actions.DisablePngCachingDnaSequencesSet action) =>
action.disable_png_caching_dna_sequences;

bool retain_strand_color_on_selection_reducer(bool _, actions.RetainStrandColorOnSelectionSet action) =>
action.retain_strand_color_on_selection;

bool display_reverse_DNA_right_side_up_reducer(bool _, actions.DisplayReverseDNARightSideUpSet action) =>
action.display_reverse_DNA_right_side_up;

Expand Down Expand Up @@ -434,6 +437,7 @@ AppUIStateStorables app_ui_state_storable_local_reducer(AppUIStateStorables stor
..show_slice_bar = TypedReducer<bool, actions.ShowSliceBarSet>(show_slice_bar_reducer)(storables.show_slice_bar, action)
..slice_bar_offset = TypedReducer<int, actions.SliceBarOffsetSet>(slice_bar_offset_set_reducer)(storables.slice_bar_offset, action)
..disable_png_caching_dna_sequences = TypedReducer<bool, actions.DisablePngCachingDnaSequencesSet>(disable_png_caching_dna_sequences_reducer)(storables.disable_png_caching_dna_sequences, action)
..retain_strand_color_on_selection = TypedReducer<bool, actions.RetainStrandColorOnSelectionSet>(retain_strand_color_on_selection_reducer)(storables.retain_strand_color_on_selection, action)
..display_reverse_DNA_right_side_up = TypedReducer<bool, actions.DisplayReverseDNARightSideUpSet>(display_reverse_DNA_right_side_up_reducer)(storables.display_reverse_DNA_right_side_up, action)
..local_storage_design_choice = TypedReducer<LocalStorageDesignChoice, actions.LocalStorageDesignChoiceSet>(local_storage_design_choice_reducer)(storables.local_storage_design_choice, action).toBuilder()
..clear_helix_selection_when_loading_new_design = TypedReducer<bool, actions.ClearHelixSelectionWhenLoadingNewDesignSet>(clear_helix_selection_when_loading_new_design_set_reducer)(storables.clear_helix_selection_when_loading_new_design, action)
Expand Down
1 change: 1 addition & 0 deletions lib/src/serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ part 'serializers.g.dart';
SetDisplayMajorTickWidthsAllHelices,
SliceBarOffsetSet,
DisablePngCachingDnaSequencesSet,
RetainStrandColorOnSelectionSet,
DisplayReverseDNARightSideUpSet,
SliceBarMoveStart,
SliceBarMoveStop,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/state/app_ui_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ abstract class AppUIState with BuiltJsonSerializable implements Built<AppUIState

bool get disable_png_caching_dna_sequences => storables.disable_png_caching_dna_sequences;

bool get retain_strand_color_on_selection => storables.retain_strand_color_on_selection;

bool get display_reverse_DNA_right_side_up => storables.display_reverse_DNA_right_side_up;

bool get show_mouseover_data => storables.show_mouseover_data;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/state/app_ui_state_storables.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ abstract class AppUIStateStorables

bool get disable_png_caching_dna_sequences;

bool get retain_strand_color_on_selection;

bool get display_reverse_DNA_right_side_up;

bool get selection_box_intersection;
Expand Down Expand Up @@ -173,6 +175,7 @@ abstract class AppUIStateStorables
b.show_slice_bar = false;
b.slice_bar_offset = null;
b.disable_png_caching_dna_sequences = false;
b.retain_strand_color_on_selection = false;
b.display_reverse_DNA_right_side_up = false;
b.local_storage_design_choice = LocalStorageDesignChoice().toBuilder();
b.clear_helix_selection_when_loading_new_design = false;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/view/design_main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ UiFactory<DesignMainProps> ConnectedDesignMain = connect<AppState, DesignMainPro
..invert_y = state.ui_state.invert_y
..selection_rope = state.ui_state.selection_rope
..disable_png_caching_dna_sequences = state.ui_state.disable_png_caching_dna_sequences
..retain_strand_color_on_selection = state.ui_state.retain_strand_color_on_selection
..display_reverse_DNA_right_side_up = state.ui_state.display_reverse_DNA_right_side_up);
}
},
Expand Down Expand Up @@ -137,6 +138,7 @@ mixin DesignMainPropsMixin on UiProps {
String displayed_group_name;
SelectionRope selection_rope;
bool disable_png_caching_dna_sequences;
bool retain_strand_color_on_selection;
bool display_reverse_DNA_right_side_up;
BuiltMap<int, Point<num>> helix_idx_to_svg_position_map;
bool invert_y;
Expand Down Expand Up @@ -263,6 +265,7 @@ class DesignMainComponent extends UiComponent2<DesignMainProps> {
..only_display_selected_helices = props.only_display_selected_helices
..helix_idx_to_svg_position_map = props.helix_idx_to_svg_position_map
..disable_png_caching_dna_sequences = props.disable_png_caching_dna_sequences
..retain_strand_color_on_selection = props.retain_strand_color_on_selection
..display_reverse_DNA_right_side_up = props.display_reverse_DNA_right_side_up
..key = 'dna-sequences')(),

Expand Down
1 change: 1 addition & 0 deletions lib/src/view/design_main_dna_sequences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mixin DesignMainDNASequencesProps on UiProps {
bool only_display_selected_helices;
BuiltMap<int, Point<num>> helix_idx_to_svg_position_map;
bool disable_png_caching_dna_sequences;
bool retain_strand_color_on_selection;
bool display_reverse_DNA_right_side_up;
}

Expand Down
15 changes: 15 additions & 0 deletions lib/src/view/menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ UiFactory<MenuProps> ConnectedMenu = connect<AppState, MenuProps>(
..show_slice_bar = state.ui_state.show_slice_bar
..show_mouseover_data = state.ui_state.show_mouseover_data
..disable_png_caching_dna_sequences = state.ui_state.disable_png_caching_dna_sequences
..retain_strand_color_on_selection = state.ui_state.retain_strand_color_on_selection
..display_reverse_DNA_right_side_up = state.ui_state.display_reverse_DNA_right_side_up
..local_storage_design_choice = state.ui_state.local_storage_design_choice
..clear_helix_selection_when_loading_new_design =
Expand Down Expand Up @@ -151,6 +152,7 @@ mixin MenuPropsMixin on UiProps {
bool show_loopout_extension_length;
bool show_mouseover_data;
bool disable_png_caching_dna_sequences;
bool retain_strand_color_on_selection;
bool display_reverse_DNA_right_side_up;
bool default_crossover_type_scaffold_for_setting_helix_rolls;
bool default_crossover_type_staple_for_setting_helix_rolls;
Expand Down Expand Up @@ -1141,6 +1143,19 @@ debugging, but be warned that it will be very slow to render a large number of D
props.dispatch(actions.DisablePngCachingDnaSequencesSet(!props.disable_png_caching_dna_sequences));
}
..key = 'disable-png-caching-dna-sequences')(),
(MenuBoolean()
..value = props.retain_strand_color_on_selection
..display = 'Retain strand color on selection'
..tooltip = '''\
Selected strands are normally highlighted in hot pink, which overrides the strand's color.
Select this option to not override the strand's color when it is selected.
A highlighting effect will still appear.
'''
..name = 'retain-strand-color-on-selection'
..onChange = (_) {
props.dispatch(actions.RetainStrandColorOnSelectionSet(!props.retain_strand_color_on_selection));
}
..key = 'retain-strand-color-on-selection')(),
];
}

Expand Down

0 comments on commit d291063

Please sign in to comment.