now we can make PluginCtx just once

This commit is contained in:
Dustin Carlino 2018-12-24 18:52:58 -08:00
parent 8913ea44e3
commit 8708bc750b
2 changed files with 10 additions and 31 deletions

View File

@ -585,7 +585,6 @@ Plugin styles are blocking or ambient. And some can conflict...
- probably dont need all those methods in UIState. just a way to get the main state.
- dont recreate PluginCtx so many times? changing plugin API or something should help.
- probably change Plugin APIs... ambient_event and one event() indicating done or not. dont express blockingness in that API.
- actually, take away Plugin trait entirely? Except for the stuff that gets all boxed up?

View File

@ -104,18 +104,18 @@ impl UIState for DefaultUIState {
cs: &mut ColorScheme,
canvas: &mut Canvas,
) {
let mut ctx = PluginCtx {
primary: &mut self.primary,
secondary: &mut self.secondary,
canvas,
cs,
input,
hints,
recalculate_current_selection,
};
// Exclusive blocking plugins first
{
let mut ctx = PluginCtx {
primary: &mut self.primary,
secondary: &mut self.secondary,
canvas,
cs,
input,
hints,
recalculate_current_selection,
};
// Special cases of weird blocking exclusive plugins!
if self
.primary_plugins
@ -212,16 +212,6 @@ impl UIState for DefaultUIState {
// Exclusive nonblocking plugins
{
let mut ctx = PluginCtx {
primary: &mut self.primary,
secondary: &mut self.secondary,
canvas,
cs,
input,
hints,
recalculate_current_selection,
};
if self.exclusive_nonblocking_plugin.is_some() {
if !self
.exclusive_nonblocking_plugin
@ -243,16 +233,6 @@ impl UIState for DefaultUIState {
}
// Stackable modal plugins
let mut ctx = PluginCtx {
primary: &mut self.primary,
secondary: &mut self.secondary,
canvas,
cs,
input,
hints,
recalculate_current_selection,
};
if self.show_score.is_some() {
if !self
.show_score