Commit 3f2645e5 authored by Meade's avatar Meade

Added version 7.0.0.

parent da81adb5
Pipeline #25072192 passed with stage
in 5 minutes and 25 seconds
## New In 7.0.0
* Implemented `binary_search_by()` in `increaseABV`, which greatly increases efficiency.
* `const` all the thiiings!!! Anything that could be made a constant was in this release.
* Slight restructuring of where things are located (like structs and enums).
* Fixed brix ranges in `if` statements.
## New In 6.2.0
* * Annotated types to all variables
* * Cleaned up unnecessary logic in `realABVFormatting()`
* * Updated tests to include all logic cases
* Annotated types to all variables
* Cleaned up unnecessary logic in `realABVFormatting()`
* Updated tests to include all logic cases
## New In 6.1.0
* * Made use lines explicit
* * Fixed strict floating point comparisons
* * Changed `.validInput()` to return NAN instead of 0.0. Also changed all logic to use `.is_nan()` to match.
* Made use lines explicit
* Fixed strict floating point comparisons
* Changed `.validInput()` to return NAN instead of 0.0. Also changed all logic to use `.is_nan()` to match.
## New In 6.0.2
* Changed BrewStilleryIcon to be an svg. Also changed all corresponding files to match. Fixed install script permissions.
......
This diff is collapsed.
[package]
name = "BrewStillery"
version = "6.2.0"
version = "7.0.0"
authors = ["Meade <thedarkula2049@gmail.com>", "Emily <marleybrush5@gmail.com>"]
description = "BrewStillery is a brewer's, vintner's, and distiller's calculator. It has a multitude of great functions, such as calculating ABV, determining carbonation, and total sparge water needed."
# documentation to come
......
......@@ -4,10 +4,11 @@ It has a multitude of great functions, such as calculating ABV, determining carb
Written in Rust, using GTK3
## New In 6.2.0
* * Annotated types to all variables
* * Cleaned up unnecessary logic in `realABVFormatting()`
* * Updated tests to include all logic cases
## New In 7.0.0
* Implemented `binary_search_by()` in `increaseABV`, which greatly increases efficiency.
* `const` all the thiiings!!! Anything that could be made a constant was in this release.
* Slight restructuring of where things are located (like structs and enums).
* Fixed brix ranges in `if` statements.
## Full Changelog
* [Available Here](CHANGELOG.md)
......
use gdk::RGBA;
pub const FINAL_GRAVITY_IDEAL: f64 = 1.01627;
// when finalGravity is unknown, this constant is ideal. it is the average of all BJCP styles
pub const FINAL_BRIX_IDEAL: f64 = 4.1480675;
// when finalBrix is unknown, this constant is ideal. it is the average of all BJCP styles
//const fn validBrixRange() -> [f64; 65] {
// let mut validBrixRange: [f64; 65] = [0.0; 65];
//
// validBrixRange[0] = 4.1480675;
//
// for index in 1..65 {
// validBrixRange[index] = validBrixRange[index - 1] + 0.435186445;
// }
//
// validBrixRange
//}
//
//const VALID_BRIX_RANGE: [f64; 65] = validBrixRange();
// this will change to the above const fn when it is stabilised
// we will also make the range much larger since we don't have to do it by hand. probably
// something along the line of 1300
// This constant is the range of valid brix values divided by 64. It spans from 4.1480675 to 32.0
// stepped in 0.435186445 increments.
//pub const VALID_BRIX_RANGE: [f64; 65] = [4.1480675, 4.5833, 5.0184, 5.4536, 5.8888, 6.324, 6.7592,
// 7.1944, 7.6296, 8.0647, 8.4999, 8.9351, 9.3703, 9.8055, 10.2407, 10.6759, 11.1111, 11.5462,
// 11.9814, 12.4166, 12.8518, 13.287, 13.7222, 14.1574, 14.5925, 15.0277, 15.4629, 15.8981,
// 16.3333, 16.7685, 17.2037, 17.6388, 18.074, 18.5092, 18.9444, 19.3796, 19.8148, 20.25, 20.6852,
// 21.1203, 21.5555, 21.9907, 22.4259, 22.8611, 23.2963, 23.7315, 24.1666, 24.6018, 25.037,
// 25.4722, 25.9074, 26.3426, 26.7778, 27.2129, 27.6481, 28.0833, 28.5185, 28.9537, 29.3889,
// 29.8241, 30.2593, 30.6944, 31.1296, 31.5648, 32.0];
//const fn increaseABVRange() -> [f64; 65] {
// let mut increaseABVRange: [f64; 65] = [0.0; 65];
//
// for index in 0..65 {
// increaseABVRange[index] = realABVAndAttenuation(VALID_BRIX_RANGE[index], FINAL_BRIX_IDEAL).0;
// }
//
// increaseABVRange
//}
//
//const INCREASE_ABV_RANGE: [f64; 65] = increaseABVRange();
//
// this will change to the above const fn when it is stabilised
// we will also make the range much larger since we don't have to do it by hand. probably
// something along the line of 1300
pub const INCREASE_ABV_RANGE: [f64; 65] = [-0.1348856155168731, 0.20586246761765334,
0.5403883178643303, 0.8691933787858869, 1.1925297585800612, 1.5107344751707097,
1.824151601109058, 2.133132001641415, 2.4380330904114156, 2.7391497954226844, 3.036990307286312,
3.331860779077896, 3.624142736241799, 3.91422330556268, 4.202495082675534, 4.489356019261316,
4.7752093302447625, 5.060397913058511, 5.345466323601995, 5.630767614763457, 5.916725536618083,
6.203768949919566, 6.492331860245709, 6.782853474518989, 7.075710661797258, 7.371487821851506,
7.670573317934343, 7.9734281866281576, 8.280519297040431, 8.592319549466605, 8.909308099127761,
9.2318957748972, 9.56072320243907, 9.89621642909807, 10.238882381640952, 10.589235751309095,
10.947799377006664, 11.315104656642905, 11.691691987103164, 12.078021270151682,
12.474829810938145, 12.882600294130459, 13.301914099322984, 13.733364251490372,
14.177556043212824, 14.635107689117666, 15.106541005822404, 15.592718722725715,
16.094195355613905, 16.61164801191682, 17.145770496135004, 17.69727416958545, 18.26688884647521,
18.855226282659537, 19.463326322877748, 20.091846861303424, 20.741601228216282,
21.41342625449159, 22.108183399420824, 22.82675991958092, 23.570070079484363,
24.338876684430492, 25.134505021041107, 25.957784353371128, 26.809749938584304];
pub const ZERO_RGBA: RGBA = RGBA {
red: 255.0,
green: 255.0,
blue: 255.0,
alpha: 1.0,
};
\ No newline at end of file
pub mod generalConstants;
\ No newline at end of file
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum imperialOrMetric {
imperialGB,
imperialUS,
metric,
}
\ No newline at end of file
pub mod generalEnums;
\ No newline at end of file
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput};
use functions::commonFunctions::{inputMatching, singleInput};
use enums::generalEnums::imperialOrMetric;
pub fn champagneCarbonationPrep(champagneCarbonationBuilder: &gtk::Builder) {
let champagneCarbonationVolume: gtk::Entry = champagneCarbonationBuilder.get_object("champagneCarbonationVolume").expect("champagneCarbonationPrep(), champagneCarbonationVolume");
......
use std::f64::consts::E;
use gtk;
use gdk::RGBA;
use std::f64::NAN;
pub const FINAL_GRAVITY_IDEAL: f64 = 1.01627;
// when finalGravity is unknown, this constant is ideal. it is the average of all BJCP styles
pub const FINAL_BRIX_IDEAL: f64 = 4.1480675;
// when finalBrix is unknown, this constant is ideal. it is the average of all BJCP styles
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum imperialOrMetric {
imperialGB,
imperialUS,
metric,
}
#[derive(Clone, Debug)]
pub struct colourOverlay {
pub overlay: gtk::Overlay,
pub colourOutput: gtk::ColorButton,
pub dimplePint: gtk::Image,
pub nonickPint: gtk::Image,
pub tulipPint: gtk::Image,
pub pilsner: gtk::Image,
pub mafs: gtk::Image,
pub dimpleHalfPint: gtk::Image,
pub nonickHalfPint: gtk::Image,
pub tulipHalfPint: gtk::Image,
}
use structs::generalStructs::colourOverlay;
use enums::generalEnums::imperialOrMetric;
pub trait allOverlays {
fn new(&self) -> colourOverlay;
......@@ -268,14 +242,4 @@ pub fn grainToGravity(volumeInGallonsUS: f64, weightInPounds: f64, grainGravity:
} else {
originalGravity
}
}
// when const fn hits stable, we can create a constant called RGBA_ZERO that uses zeroRGBA()
pub fn zeroRGBA() -> RGBA {
RGBA {
red: 255.0,
green: 255.0,
blue: 255.0,
alpha: 1.0,
}
}
\ No newline at end of file
use gtk;
use gtk::prelude::*;
use gdk::RGBA;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, zeroRGBA, grainToGravity, FINAL_BRIX_IDEAL, realABVAndAttenuation};
use functions::commonFunctions::{inputMatching, singleInput, grainToGravity, realABVAndAttenuation};
use constants::generalConstants::{FINAL_BRIX_IDEAL, ZERO_RGBA};
use light::lightFunctions::{singleMCU, beerSRM, grainSRMToLAB, grainLABToXYZ, grainXYZToRGBA};
use functions::commonFunctions::colourOverlay;
use structs::generalStructs::colourOverlay;
use enums::generalEnums::imperialOrMetric;
#[derive(Debug)]
pub struct grainABVData {
......@@ -215,15 +217,15 @@ pub fn grainToABVPrep(allOverlays: &colourOverlay, grainABVBuilder: &gtk::Builde
if allInputs.wortAmount.is_nan() {
grainABVFinalBrix.set_text("Enter a Wort Volume");
grainABVFinalABV.set_text("");
allOverlays.colourOutput.set_rgba(&zeroRGBA());
allOverlays.colourOutput.set_rgba(&ZERO_RGBA);
} else if allInputs.wortAmount <= 0.0 || allInputs.firstGrainAmount <= 0.0 {
grainABVFinalBrix.set_text("Enter a positive number");
grainABVFinalABV.set_text("");
allOverlays.colourOutput.set_rgba(&zeroRGBA());
allOverlays.colourOutput.set_rgba(&ZERO_RGBA);
} else if allInputs.firstGrainAmount.is_nan() {
grainABVFinalBrix.set_text("Enter at least");
grainABVFinalABV.set_text("1 grain amount");
allOverlays.colourOutput.set_rgba(&zeroRGBA());
allOverlays.colourOutput.set_rgba(&ZERO_RGBA);
} else {
grainToABVOutput(allInputs, allOverlays, grainABVBuilder);
}
......@@ -332,7 +334,7 @@ pub fn grainToABVColour(allInputs: &grainABVData) -> RGBA {
let (lOut, aOut, bOut) = grainSRMToLAB(allInputs.glassSize, beerSRM);
let (xOut, yOut, zOut) = grainLABToXYZ(lOut, aOut, bOut);
let rgbaOutput: RGBA = if allInputs.abvFinal > 26.0 || allInputs.abvFinal <= 0.0 {
zeroRGBA()
ZERO_RGBA
} else {
grainXYZToRGBA(xOut, yOut, zOut)
};
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{inputMatching, realABVAndAttenuation, FINAL_BRIX_IDEAL};
use functions::commonFunctions::{inputMatching, realABVAndAttenuation};
use constants::generalConstants::FINAL_BRIX_IDEAL;
pub fn guestimateABVPrep(guestimatorBuilder: &gtk::Builder) {
let guestimatorStartingBrix: gtk::Entry = guestimatorBuilder.get_object("guestimatorStartingBrix").expect("guestimateABVPrep(), guestimatorStartingBrix");
......@@ -10,10 +11,10 @@ pub fn guestimateABVPrep(guestimatorBuilder: &gtk::Builder) {
if startingBrix.is_nan() {
guestimatorTemporaryOutput.set_text("Enter a number");
} else if startingBrix < 2.57 {
guestimatorTemporaryOutput.set_text("Enter a Brix greater than 2.57");
} else if startingBrix > 49.48 {
guestimatorTemporaryOutput.set_text("Enter a Brix less than 49.48");
} else if startingBrix < 4.1480675 {
guestimatorTemporaryOutput.set_text("Enter a Brix greater than 4.1480675");
} else if startingBrix > 32.0 {
guestimatorTemporaryOutput.set_text("Enter a Brix less than 32");
} else {
guestimateABVOutput(startingBrix, guestimatorBuilder);
}
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, realIBU};
use functions::commonFunctions::{inputMatching, singleInput, realIBU};
use enums::generalEnums::imperialOrMetric;
#[derive(Debug)]
pub struct guestimateIBUData {
......@@ -146,10 +147,10 @@ pub fn guestimateIBUPrep(IBUBuilder: &gtk::Builder) {
let temporaryIBUOutput: gtk::Entry = IBUBuilder.get_object("totalIBUFinal").expect("guestimateIBUPrep(), temporaryIBUOutput");
if allInputs.preBoilBrix < 2.57 {
temporaryIBUOutput.set_text("Enter a Pre-Boil Brix greater than 2.57");
} else if allInputs.preBoilBrix > 49.48 {
temporaryIBUOutput.set_text("Enter a Pre-Boil Brix less than 49.48");
if allInputs.preBoilBrix < 4.1480675 {
temporaryIBUOutput.set_text("Enter a Pre-Boil Brix greater than 4.1480675");
} else if allInputs.preBoilBrix > 32.0 {
temporaryIBUOutput.set_text("Enter a Pre-Boil Brix less than 32");
} else if allInputs.preBoilBrix.is_nan() || allInputs.wortVolume.is_nan() || allInputs.firstHopAlpha.is_nan() || allInputs.firstHopAmount.is_nan() || allInputs.firstHopBoilTime.is_nan() {
temporaryIBUOutput.set_text("Enter at least the first 5 inputs");
} else if allInputs.preBoilBrix <= 0.0 || allInputs.wortVolume <= 0.0 || allInputs.firstHopAlpha <= 0.0 || allInputs.firstHopAmount <= 0.0 || allInputs.firstHopBoilTime <= 0.0 {
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, FINAL_GRAVITY_IDEAL};
use functions::commonFunctions::{inputMatching, singleInput};
use enums::generalEnums::imperialOrMetric;
use constants::generalConstants::FINAL_GRAVITY_IDEAL;
#[derive(Debug)]
pub struct gyleData {
......@@ -30,10 +32,10 @@ pub fn gyleCarbonationPrep(gyleBuilder: &gtk::Builder) {
let gyleCarbonationUnitsBuffer: String = gyleCarbonationUnits.get_active_id().expect("gyleCarbonationPrep(), gyleCarbonationUnitsBuffer");
let imperialOrMetric: imperialOrMetric = gyleCarbonationUnitsBuffer.unitMatch();
if startingBrix < 2.57 {
gyleTemporaryOutput.set_text("Enter a Starting Brix greater than 2.57");
} else if startingBrix > 49.48 {
gyleTemporaryOutput.set_text("Enter a Starting Brix less than 49.48");
if startingBrix < 4.1480675 {
gyleTemporaryOutput.set_text("Enter a Starting Brix greater than 4.1480675");
} else if startingBrix > 32.0 {
gyleTemporaryOutput.set_text("Enter a Starting Brix less than 32");
} else if startingBrix.is_nan() || desiredCO2LevelTemp.is_nan() || finalVolumeTemp.is_nan() {
gyleTemporaryOutput.set_text("Enter all 3 inputs");
} else if startingBrix <= 0.0 || desiredCO2LevelTemp <= 0.0 || finalVolumeTemp <= 0.0 {
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput, realABVAndAttenuation, FINAL_BRIX_IDEAL};
use functions::commonFunctions::{inputMatching, singleInput, realABVAndAttenuation};
use constants::generalConstants::{FINAL_BRIX_IDEAL, INCREASE_ABV_RANGE};
use enums::generalEnums::imperialOrMetric;
#[derive(Debug)]
pub struct increaseABVData {
......@@ -48,12 +50,16 @@ pub fn increaseABVPrep(increaseABVBuilder: &gtk::Builder) {
imperialOrMetric: increaseABVUnitsBuffer.unitMatch(),
};
if allInputs.startingBrix < 2.57 {
increaseABVFinalBrix.set_text("Enter a brix greater than 2.57");
if allInputs.startingBrix < 4.1480675 {
increaseABVFinalBrix.set_text("Enter a brix greater than 4.1480675");
increaseABVSugar.set_text("");
increaseABVHoney.set_text("");
} else if allInputs.startingBrix > 49.48 {
increaseABVFinalBrix.set_text("Enter a brix less than 49.48");
} else if allInputs.startingBrix > 32.0 {
increaseABVFinalBrix.set_text("Enter a brix less than 32");
increaseABVSugar.set_text("");
increaseABVHoney.set_text("");
} else if allInputs.desiredABV < 1.0 || allInputs.desiredABV > 32.0 {
increaseABVFinalBrix.set_text("Enter an ABV between 1 and 32");
increaseABVSugar.set_text("");
increaseABVHoney.set_text("");
} else if allInputs.startingBrix.is_nan() || allInputs.desiredABV.is_nan() || allInputs.currentVolume.is_nan() {
......@@ -71,7 +77,17 @@ pub fn increaseABVPrep(increaseABVBuilder: &gtk::Builder) {
pub fn increaseABVMaths(allInputs: &increaseABVData) -> finalSugarFloat {
let mut newStartingBrix: f64 = allInputs.startingBrix;
let mut newEstimatedABV: f64 = realABVAndAttenuation(newStartingBrix, FINAL_BRIX_IDEAL).0;
let binarySearchResult: Result<usize, usize> = INCREASE_ABV_RANGE.binary_search_by(|closureArray| {
closureArray.partial_cmp(&allInputs.desiredABV).expect("increaseABVMaths(), binarySearchResult")
});
let startingIndex: usize = match binarySearchResult {
Ok(index) => index,
Err(indexToCorrect) => indexToCorrect - 1,
};
let mut newEstimatedABV: f64 = INCREASE_ABV_RANGE[startingIndex];
while newEstimatedABV <= allInputs.desiredABV {
newStartingBrix = newStartingBrix + 0.001;
......@@ -96,7 +112,7 @@ pub fn increaseABVMaths(allInputs: &increaseABVData) -> finalSugarFloat {
finalOutputFloat.honeyToAdd = sugarInOunces.sugarToHoney().ouncesToPounds();
} else if allInputs.imperialOrMetric == imperialOrMetric::metric {
finalOutputFloat.sugarToAdd = (allInputs.currentVolume * 10.0 * differenceBrix).gramsToKilograms();
// Add 10g of sugar for every liter to raise 1°Bx
// Add 10g of sugar for every litre to raise 1°Bx
finalOutputFloat.honeyToAdd = finalOutputFloat.sugarToAdd.sugarToHoney();
}
finalOutputFloat
......@@ -109,7 +125,12 @@ pub fn increaseABVFormatting(allInputs: &increaseABVData, finalOutputFloat: fina
honeyAmount: String::from(""),
};
if allInputs.imperialOrMetric == imperialOrMetric::imperialGB || allInputs.imperialOrMetric == imperialOrMetric::imperialUS {
// the reason for the allInputs.startingBrix.fract() + 0.001 is because rust interprets numbers
// like 12.0 (after doing our maths) as 12.001.
if allInputs.startingBrix.trunc() == finalOutputFloat.newStartingBrixFinal.trunc() && allInputs.startingBrix.fract() + 0.001 >= finalOutputFloat.newStartingBrixFinal.fract() {
finalOutput.sugarAmount = String::from("No need to");;
finalOutput.honeyAmount = String::from("add any sugar");;
} else if allInputs.imperialOrMetric == imperialOrMetric::imperialGB || allInputs.imperialOrMetric == imperialOrMetric::imperialUS {
if finalOutputFloat.sugarToAdd < 0.995 {
finalOutput.sugarAmount = format!("{:.2} oz", finalOutputFloat.sugarToAdd.remainingOunces());
} else if finalOutputFloat.sugarToAdd >= 0.995 && finalOutputFloat.sugarToAdd < 1.005 {
......
......@@ -23,12 +23,12 @@ pub fn realABVPrep(realABVBuilder: &gtk::Builder) {
} else if startingBrix <= finalBrix {
realABVFinalABV.set_text("Starting Brix must be");
realABVRealAttenuation.set_text("greater than Final Brix");
} else if finalBrix < 2.57 {
} else if finalBrix < 4.1480675 {
realABVFinalABV.set_text("Enter a Final Brix");
realABVRealAttenuation.set_text("greater than 2.57");
} else if startingBrix > 49.48 {
realABVRealAttenuation.set_text("greater than 4.1480675");
} else if startingBrix > 32.0 {
realABVFinalABV.set_text("Enter a Starting Brix");
realABVRealAttenuation.set_text("less than 49.48");
realABVRealAttenuation.set_text("less than 32");
} else {
realABVOutput(startingBrix, finalBrix, realABVBuilder);
}
......
use gtk;
use gtk::prelude::*;
use functions::commonFunctions::{imperialOrMetric, inputMatching, singleInput};
use functions::commonFunctions::{inputMatching, singleInput};
use enums::generalEnums::imperialOrMetric;
#[derive(Debug)]
pub struct waterSpargeData {
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<!-- interface-css-provider-path BrewStillery.css -->
......@@ -10,6 +10,18 @@
<property name="default_width">610</property>
<property name="default_height">720</property>
<property name="icon">/usr/share/BrewStillery/BrewStilleryLogo.png</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="titleBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">BrewStillery</property>
<property name="subtitle">7.0.0</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
......@@ -2657,7 +2669,7 @@
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Version 6.2.0</property>
<property name="label" translatable="yes">Version 7.0.0</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -2681,13 +2693,13 @@
</packing>
</child>
<child>
<object class="GtkLinkButton" id="githubLink">
<property name="label" translatable="yes">Visit Us On github</property>
<object class="GtkLinkButton" id="gitlabLink">
<property name="label" translatable="yes">Visit Us On gitlab</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="uri">https://github.com/MonkeyLog/BrewStillery</property>
<property name="uri">https://gitlab.com/MonkeyLog/BrewStillery</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -2735,17 +2747,5 @@
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="titleBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">BrewStillery</property>
<property name="subtitle">6.2.0</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
use gtk;
use gtk::prelude::*;
use functions::grainToABV::grainToABVPrep;
use functions::commonFunctions::{allOverlays, zeroRGBA};
use functions::commonFunctions::allOverlays;
use constants::generalConstants::ZERO_RGBA;
pub fn grainToABVGUI(builder: &gtk::Builder) {
let allOverlays = allOverlays::new(builder);
......@@ -9,7 +10,7 @@ pub fn grainToABVGUI(builder: &gtk::Builder) {
allOverlays.colourOutput.set_tooltip_text("Expected Colour");
allOverlays.colourOutput.set_sensitive(false);
allOverlays.colourOutput.set_property_show_editor(false);
allOverlays.colourOutput.set_rgba(&zeroRGBA());
allOverlays.colourOutput.set_rgba(&ZERO_RGBA);
allOverlays.overlay.add_overlay(&allOverlays.colourOutput);
allOverlays.overlay.add_overlay(&allOverlays.dimplePint);
......
......@@ -14,7 +14,7 @@ use gui::champagneCarbonationGUI;
pub fn startGTK(application: &gtk::Application) {
let builder = gtk::Builder::new_from_string(include_str!("BrewStillery.glade"));
let builder: gtk::Builder = gtk::Builder::new_from_string(include_str!("BrewStillery.glade"));
let mainWindow: gtk::ApplicationWindow = builder.get_object("mainWindow").expect("startGTK(), mainWindow");
......
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const S0DATA: [f64; 81] = [63.4, 64.57, 65.8, 80.2792, 94.8, 99.7661, 104.8, 105.315, 105.9,
101.311, 96.8, 105.316, 113.9, 119.716, 125.6, 125.517, 125.5, 123.374, 121.3, 121.278, 121.3,
117.381, 113.5, 113.29, 113.1, 111.943, 110.8, 108.636, 106.5, 107.634, 108.8, 107.048, 105.3,
104.859, 104.4, 102.205, 100.0, 98.0026, 96.0, 95.5526, 95.1, 92.0954, 89.1, 89.7912, 90.5,
90.4067, 90.3, 89.3643, 88.4, 86.2438, 84.0, 84.5715, 85.1, 83.5103, 81.9, 82.261, 82.6,
83.7675, 84.9, 83.1278, 81.3, 76.615, 71.9, 73.1032, 74.3, 75.3699, 76.4, 69.8669, 63.3,
67.5106, 71.7, 74.3716, 77.0, 71.1065, 65.2, 56.4494, 47.7, 58.1607, 68.6, 66.8261, 65.0];
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const S1DATA: [f64; 81] = [38.5, 36.7197, 35.0, 39.1826, 43.4, 44.8198, 46.3, 45.0678, 43.9,
40.457, 37.1, 36.8683, 36.7, 36.2634, 35.9, 34.2172, 32.6, 30.2237, 27.9, 26.0773, 24.3,
22.1786, 20.1, 18.1439, 16.2, 14.6931, 13.2, 10.8855, 8.6, 7.3335, 6.1, 5.14509, 4.02, 3.06089,
1.9, 0.95719, 0.0, -0.799798, -1.6, -2.54817, -3.5, -3.50781, -3.5, -4.6624, -5.8, -6.49392,
-7.2, -7.88752, -8.6, -8.99616, -9.5, -10.1766, -10.9, -10.7874, -10.7, -11.3421, -12.0,
-12.9832, -14.0, -13.7695, -13.6, -12.7878, -12.0, -12.6495, -13.3, -13.081, -12.9, -11.7326,
-10.6, -11.0881, -11.6, -11.8814, -12.2, -11.1934, -10.2, -9.00448, -7.8, -9.49051, -11.2,
-10.7704, -10.4];
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const S2DATA: [f64; 81] = [3.0, 2.07775, 1.2, 0.0346091, -1.1, -0.826626, -0.5, -0.633722, -0.7,
-0.983801, -1.2, -1.92608, -2.6, -2.78054, -2.9, -2.87901, -2.8, -2.72715, -2.6, -2.6183, -2.6,
-2.21726, -1.8, -1.65943, -1.5, -1.4082, -1.3, -1.26653, -1.2, -1.11805, -1.0, -0.754386, -0.5,
-0.39099, -0.3, -0.140248, 0.0, 0.100186, 0.2, 0.35715, 0.5, 1.29542, 2.1, 2.63633, 3.2,
3.66154, 4.1, 4.41708, 4.7, 4.94332, 5.1, 5.92495, 6.7, 7.01589, 7.3, 7.96399, 8.6, 9.22161,
9.8, 10.0336, 10.2, 9.27166, 8.3, 8.95222, 9.6, 9.07544, 8.5, 7.7646, 7.0, 7.31548, 7.6,
7.82121, 8.0, 7.35542, 6.7, 5.94741, 5.2, 6.31681, 7.4, 7.1323, 6.8];
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const X2DATA: [f64; 81] = [0.0014, 0.0022, 0.0042, 0.0076, 0.0143, 0.0232, 0.0435, 0.0776, 0.1344,
0.2148, 0.2839, 0.3285, 0.3483, 0.3481, 0.3362, 0.3187, 0.2908, 0.2511, 0.1954, 0.1421, 0.0956,
0.058, 0.032, 0.0147, 0.0049, 0.0024, 0.0093, 0.0291, 0.0633, 0.1096, 0.1655, 0.2257, 0.2904,
0.3597, 0.4334, 0.5121, 0.5945, 0.6784, 0.7621, 0.8425, 0.9163, 0.9786, 1.0263, 1.0567, 1.0622,
1.0456, 1.0026, 0.9384, 0.8544, 0.7514, 0.6424, 0.5419, 0.4479, 0.3608, 0.2835, 0.2187, 0.1649,
0.1212, 0.0874, 0.0636, 0.0468, 0.0329, 0.0227, 0.0158, 0.0114, 0.0081, 0.0058, 0.0041, 0.0029,
0.002, 0.0014, 0.001, 0.0007, 0.0005, 0.0003, 0.0002, 0.0002, 0.0001, 0.0001, 0.0001, 0.0];
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const Y2DATA: [f64; 81] = [0.0, 0.0001, 0.0001, 0.0002, 0.0004, 0.0006, 0.0012, 0.0022, 0.004,
0.0073, 0.0116, 0.0168, 0.023, 0.0298, 0.038, 0.048, 0.06, 0.0739, 0.091, 0.1126, 0.139, 0.1693,
0.208, 0.2586, 0.323, 0.4073, 0.503, 0.6082, 0.71, 0.7932, 0.862, 0.9149, 0.954, 0.9803, 0.995,
1.0, 0.995, 0.9786, 0.952, 0.9154, 0.87, 0.8163, 0.757, 0.6949, 0.631, 0.5668, 0.503, 0.4412,
0.381, 0.321, 0.265, 0.217, 0.175, 0.1382, 0.107, 0.0816, 0.061, 0.0446, 0.032, 0.0232, 0.017,
0.0119, 0.0082, 0.0057, 0.0041, 0.0029, 0.0021, 0.0015, 0.001, 0.0007, 0.0005, 0.0004, 0.0002,
0.0002, 0.0001, 0.0001, 0.0001, 0.0, 0.0, 0.0, 0.0];
// index is wavelengths of light, stepped by 5, from 380 to 780
pub const Z2DATA: [f64; 81] = [0.0065, 0.0105, 0.0201, 0.0362, 0.0679, 0.1102, 0.2074, 0.3713,
0.6456, 1.0391, 1.3856, 1.623, 1.7471, 1.7826, 1.7721, 1.7441, 1.6692, 1.5281, 1.2876, 1.0419,
0.813, 0.6162, 0.4652, 0.3533, 0.272, 0.2123, 0.1582, 0.1117, 0.0782, 0.0573, 0.0422, 0.0298,
0.0203, 0.0134, 0.0087, 0.0057, 0.0039, 0.0027, 0.0021, 0.0018, 0.0017, 0.0014, 0.0011, 0.001,
0.0008, 0.0006, 0.0003, 0.0002, 0.0002, 0.0001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0];
// Unused data since we only use the average, but if it's ever needed, it's here
// index is wavelengths of light, stepped by 5, from 380 to 780
//pub const ILLUMINANT_A_DATA: [f64; 81] = [9.8, 10.9, 12.09, 13.35, 14.71, 16.15, 17.68, 19.29, 20.99, 22.79,
// 24.67, 26.64, 28.7, 30.85, 33.09, 35.41, 37.81, 40.3, 42.87, 45.52, 48.24, 51.04, 53.91, 56.85,
// 59.86, 62.93, 66.06, 69.25, 72.5, 75.79, 79.13, 82.52, 85.95, 89.41, 92.91, 96.44, 100.0,
// 103.58, 107.18, 110.8, 114.44, 118.08, 121.73, 125.39, 129.04, 132.7, 136.35, 139.99, 143.62,
// 147.24, 150.84, 154.42, 157.98, 161.52, 165.03, 168.51, 171.96, 175.38, 178.77, 182.12, 185.43,
// 188.7, 191.93, 195.12, 198.26, 201.36, 204.41, 207.41, 210.36, 213.27, 216.2, 218.92, 221.67,
// 224.36, 227.0, 229.59, 232.12, 234.59, 237.01, 239.37, 241.68];
// index is wavelengths of light, stepped by 5, from 380 to 780
//pub const ILLUMINANT_C_DATA: [f64; 81] = [33.0, 39.92, 47.4, 55.17, 63.3, 71.81, 80.6, 89.53, 98.1,
// 105.8, 112.4, 117.75, 121.5, 123.45, 124.0, 123.6, 123.1, 123.3, 123.8, 124.09, 123.9, 122.92,
// 120.7, 116.9, 112.1, 106.98, 102.3, 98.81, 96.9, 96.78, 98.0, 99.94, 102.1, 103.95, 105.2,
// 105.67, 105.3, 104.11, 102.3, 100.15, 97.8, 95.43, 93.2, 91.22, 89.7, 88.83, 88.4, 88.19, 88.1,
// 88.06, 88.0, 87.86, 87.8, 87.99, 88.2, 88.2, 87.9, 87.22, 86.3, 85.3, 84.0, 82.21, 80.2, 78.24,
// 76.3, 74.36, 72.4, 70.4, 68.3, 66.3, 64.4, 62.8, 61.5, 60.2, 59.2, 58.5, 58.1, 58.0, 58.2, 58.5,
// 59.1];
// index is wavelengths of light, stepped by 5, from 380 to 780
//pub const X10DATA: [f64; 81] = [0.000159952, 0.00066244, 0.0023616, 0.0072423, 0.0191097, 0.0434,
// 0.084736, 0.140638, 0.204492, 0.264737, 0.314679, 0.357719, 0.383734, 0.386726, 0.370702,
// 0.342957, 0.302273, 0.254085, 0.195618, 0.132349, 0.080507, 0.041072, 0.016172, 0.005132,
// 0.003816, 0.015444, 0.037465, 0.071358, 0.117749, 0.172953, 0.236491, 0.304213, 0.376772,
// 0.451584, 0.529826, 0.616053, 0.705224, 0.793832, 0.878655, 0.951162, 1.01416, 1.0743, 1.11852,
// 1.1343, 1.12399, 1.0891, 1.03048, 0.95074, 0.856297, 0.75493, 0.647467, 0.53511, 0.431567,
// 0.34369, 0.268329, 0.2043, 0.152568, 0.11221, 0.0812606, 0.05793, 0.0408508, 0.028623,
// 0.0199413, 0.013842, 0.00957688, 0.0066052, 0.00455263, 0.0031447, 0.00217496, 0.0015057,
// 0.00104476, 0.00072745, 0.000508258, 0.00035638, 0.000250969, 0.00017773, 0.00012639, 9.02E-05,
// 6.45E-05, 4.63E-05, 3.34E-05];
// index is wavelengths of light, stepped by 5, from 380 to 780
//pub const Y10DATA: [f64; 81] = [1.74E-05, 7.16E-05, 0.0002534, 0.0007685, 0.0020044, 0.004509,
// 0.008756, 0.014456, 0.021391, 0.029497, 0.038676, 0.049602, 0.062077, 0.074704, 0.089456,
// 0.106256, 0.128201, 0.152761, 0.18519, 0.21994, 0.253589, 0.297665, 0.339133, 0.395379,
// 0.460777, 0.53136, 0.606741, 0.68566, 0.761757, 0.82333, 0.875211, 0.92381, 0.961988, 0.9822,
// 0.991761, 0.99911, 0.99734, 0.98238, 0.955552, 0.915175, 0.868934, 0.825623, 0.777405, 0.720353,
// 0.658341, 0.593878, 0.527963, 0.461834, 0.398057, 0.339554, 0.283493, 0.228254, 0.179828,
// 0.140211, 0.107633, 0.081187, 0.060281, 0.044096, 0.0318004, 0.0226017, 0.0159051, 0.0111303,
// 0.0077488, 0.0053751, 0.00371774, 0.00256456, 0.00176847, 0.00122239, 0.00084619, 0.00058644,
// 0.00040741, 0.000284041, 0.00019873, 0.00013955, 9.84E-05, 6.98E-05, 4.97E-05, 3.55E-05,
// 2.55E-05, 1.83E-05, 1.32E-05];