Skip to content

Commit

Permalink
Add shortcuts to toggle antialiasing (ArturKovacs#149)
Browse files Browse the repository at this point in the history
* Add shortcuts to toggle antialiasing

* Update help image

* Store antialiasing setting in cfg.toml

* Revert "Update help image"

This reverts commit bb05065.

* Update help popup

* "previous" value to preserve antialiasing setting
when reopening emulsion

* Use constant for texel size threshold
  • Loading branch information
Aloso authored Aug 24, 2020
1 parent 2ffe266 commit 1a84ac2
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 55 deletions.
87 changes: 38 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified resource/usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resource_dev/Emulsion Usage.odt
Binary file not shown.
23 changes: 23 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,31 @@ impl Theme {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum Antialias {
#[serde(rename = "auto")]
Auto,
#[serde(rename = "always")]
Always,
#[serde(rename = "never")]
Never,
}

impl Default for Antialias {
fn default() -> Self {
Antialias::Auto
}
}

#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
pub struct CacheImageSection {
pub fit_stretches: bool,
pub antialiasing: Antialias,
}

#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
pub struct ConfigImageSection {
pub antialiasing: Option<String>,
}

#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -196,6 +218,7 @@ pub struct Configuration {
pub commands: Option<Vec<Command>>,
pub updates: Option<ConfigUpdateSection>,
pub title: Option<TitleSection>,
pub image: Option<ConfigImageSection>,
}

impl Configuration {
Expand Down
4 changes: 4 additions & 0 deletions src/input_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub static PAN_NAME: &str = "pan";
pub static PLAY_ANIM_NAME: &str = "play_anim";
pub static PLAY_PRESENT_NAME: &str = "play_present";
pub static PLAY_PRESENT_RND_NAME: &str = "play_present_rnd";
pub static TOGGLE_ANTIALIAS: &str = "toggle_antialias";
pub static SET_AUTOMATIC_ANTIALIAS: &str = "automatic_antialias";

lazy_static! {
pub static ref DEFAULT_BINDINGS: HashMap<&'static str, Vec<&'static str>> = {
Expand All @@ -35,6 +37,8 @@ lazy_static! {
m.insert(PLAY_ANIM_NAME, vec!["Alt+A", "Alt+V"]);
m.insert(PLAY_PRESENT_NAME, vec!["P"]);
m.insert(PLAY_PRESENT_RND_NAME, vec!["Alt+P"]);
m.insert(TOGGLE_ANTIALIAS, vec!["S"]);
m.insert(SET_AUTOMATIC_ANTIALIAS, vec!["Alt+S"]);
m
};
}
Expand Down
Loading

0 comments on commit 1a84ac2

Please sign in to comment.