mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-30 11:38:26 -07:00
Add preview tag to Graphing feature (#907)
* Add preview tag to Graphing * Fix Graph Settings button in dark mode
This commit is contained in:
parent
4ac76c66da
commit
f9c049a84b
11 changed files with 200 additions and 35 deletions
|
@ -58,6 +58,7 @@ void ApplicationViewModel::Mode::set(ViewMode value)
|
|||
{
|
||||
PreviousMode = m_mode;
|
||||
m_mode = value;
|
||||
IsModePreview = NavCategory::IsViewModePreview(m_mode);
|
||||
SetDisplayNormalAlwaysOnTopOption();
|
||||
OnModeChanged();
|
||||
RaisePropertyChanged(ModePropertyName);
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace CalculatorApp
|
|||
OBSERVABLE_PROPERTY_RW(UnitConverterViewModel ^, ConverterViewModel);
|
||||
OBSERVABLE_PROPERTY_RW(CalculatorApp::Common::ViewMode, PreviousMode);
|
||||
OBSERVABLE_PROPERTY_R(bool, IsAlwaysOnTop);
|
||||
OBSERVABLE_PROPERTY_R(bool, IsModePreview);
|
||||
OBSERVABLE_NAMED_PROPERTY_RW(Platform::String ^, CategoryName);
|
||||
|
||||
// Indicates whether calculator is currently in standard mode _and_ supports CompactOverlay _and_ is not in Always-on-Top mode
|
||||
|
|
|
@ -118,7 +118,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::Number1,
|
||||
L"1",
|
||||
SUPPORTS_ALL,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Scientific,
|
||||
SCIENTIFIC_ID,
|
||||
L"Scientific",
|
||||
|
@ -128,7 +129,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::Number2,
|
||||
L"2",
|
||||
SUPPORTS_ALL,
|
||||
true } };
|
||||
true,
|
||||
false } };
|
||||
|
||||
int currentIndex = 3;
|
||||
bool supportGraphingCalculator = IsGraphingModeAvailable();
|
||||
|
@ -144,7 +146,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::Number3,
|
||||
L"3",
|
||||
SUPPORTS_ALL,
|
||||
isEnabled });
|
||||
isEnabled,
|
||||
true });
|
||||
++currentIndex;
|
||||
}
|
||||
res.insert(
|
||||
|
@ -158,7 +161,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
supportGraphingCalculator ? MyVirtualKey::Number4 : MyVirtualKey::Number3,
|
||||
towchar_t(currentIndex++),
|
||||
SUPPORTS_ALL,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Date,
|
||||
DATE_ID,
|
||||
L"Date",
|
||||
|
@ -168,7 +172,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
supportGraphingCalculator ? MyVirtualKey::Number5 : MyVirtualKey::Number4,
|
||||
towchar_t(currentIndex++),
|
||||
SUPPORTS_ALL,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Currency,
|
||||
CURRENCY_ID,
|
||||
L"Currency",
|
||||
|
@ -178,7 +183,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Volume,
|
||||
VOLUME_ID,
|
||||
L"Volume",
|
||||
|
@ -188,7 +194,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Length,
|
||||
LENGTH_ID,
|
||||
L"Length",
|
||||
|
@ -198,7 +205,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Weight,
|
||||
WEIGHT_ID,
|
||||
L"Weight and Mass",
|
||||
|
@ -208,7 +216,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Temperature,
|
||||
TEMPERATURE_ID,
|
||||
L"Temperature",
|
||||
|
@ -218,7 +227,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
SUPPORTS_NEGATIVE,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Energy,
|
||||
ENERGY_ID,
|
||||
L"Energy",
|
||||
|
@ -228,7 +238,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Area,
|
||||
AREA_ID,
|
||||
L"Area",
|
||||
|
@ -238,7 +249,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Speed,
|
||||
SPEED_ID,
|
||||
L"Speed",
|
||||
|
@ -248,7 +260,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Time,
|
||||
TIME_ID,
|
||||
L"Time",
|
||||
|
@ -258,7 +271,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Power,
|
||||
POWER_ID,
|
||||
L"Power",
|
||||
|
@ -268,7 +282,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
SUPPORTS_NEGATIVE,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Data,
|
||||
DATA_ID,
|
||||
L"Data",
|
||||
|
@ -278,7 +293,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Pressure,
|
||||
PRESSURE_ID,
|
||||
L"Pressure",
|
||||
|
@ -288,7 +304,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
POSITIVE_ONLY,
|
||||
true },
|
||||
true,
|
||||
false },
|
||||
NavCategoryInitializer{ ViewMode::Angle,
|
||||
ANGLE_ID,
|
||||
L"Angle",
|
||||
|
@ -298,7 +315,8 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
|
|||
MyVirtualKey::None,
|
||||
nullptr,
|
||||
SUPPORTS_NEGATIVE,
|
||||
true } });
|
||||
true,
|
||||
false } });
|
||||
return res;
|
||||
}();
|
||||
|
||||
|
@ -522,7 +540,8 @@ NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupIniti
|
|||
groupMode,
|
||||
categoryInitializer.viewMode,
|
||||
categoryInitializer.supportsNegative,
|
||||
categoryInitializer.isEnabled));
|
||||
categoryInitializer.isEnabled,
|
||||
categoryInitializer.isPreview));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -546,3 +565,15 @@ NavCategoryGroup ^ NavCategoryGroup::CreateConverterCategory()
|
|||
return ref new NavCategoryGroup(
|
||||
NavCategoryGroupInitializer{ CategoryGroupType::Converter, L"ConverterModeTextCaps", L"ConverterModeText", L"ConverterModePluralText" });
|
||||
}
|
||||
|
||||
bool NavCategory::IsViewModePreview(ViewMode mode)
|
||||
{
|
||||
auto iter =
|
||||
find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode](const NavCategoryInitializer& initializer) { return initializer.viewMode == mode; });
|
||||
|
||||
if (iter != s_categoryManifest.end())
|
||||
{
|
||||
return iter->isPreview;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ namespace CalculatorApp
|
|||
MyVirtualKey vKey,
|
||||
wchar_t const* aKey,
|
||||
bool categorySupportsNegative,
|
||||
bool enabled)
|
||||
bool enabled,
|
||||
bool isPreview)
|
||||
: viewMode(mode)
|
||||
, serializationId(id)
|
||||
, friendlyName(name)
|
||||
|
@ -80,6 +81,7 @@ namespace CalculatorApp
|
|||
, accessKey(aKey)
|
||||
, supportsNegative(categorySupportsNegative)
|
||||
, isEnabled(enabled)
|
||||
, isPreview(isPreview)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -93,6 +95,7 @@ namespace CalculatorApp
|
|||
const wchar_t* const accessKey;
|
||||
const bool supportsNegative;
|
||||
const bool isEnabled;
|
||||
const bool isPreview;
|
||||
};
|
||||
|
||||
private
|
||||
|
@ -123,6 +126,7 @@ namespace CalculatorApp
|
|||
PROPERTY_R(Platform::String ^, AccessKey);
|
||||
PROPERTY_R(bool, SupportsNegative);
|
||||
PROPERTY_R(bool, IsEnabled);
|
||||
PROPERTY_R(bool, IsPreview);
|
||||
|
||||
property Platform::String
|
||||
^ AutomationId { Platform::String ^ get() { return m_Mode.ToString(); } }
|
||||
|
@ -138,7 +142,7 @@ namespace CalculatorApp
|
|||
static bool IsGraphingCalculatorViewMode(ViewMode mode);
|
||||
static bool IsDateCalculatorViewMode(ViewMode mode);
|
||||
static bool IsConverterViewMode(ViewMode mode);
|
||||
|
||||
static bool IsViewModePreview(ViewMode mode);
|
||||
static Platform::String ^ GetFriendlyName(ViewMode mode);
|
||||
static Platform::String ^ GetNameResourceKey(ViewMode mode);
|
||||
static CategoryGroupType GetGroupType(ViewMode mode);
|
||||
|
@ -159,7 +163,8 @@ namespace CalculatorApp
|
|||
Platform::String ^ mode,
|
||||
ViewMode viewMode,
|
||||
bool supportsNegative,
|
||||
bool isEnabled)
|
||||
bool isEnabled,
|
||||
bool isPreview)
|
||||
: m_Name(name)
|
||||
, m_AutomationName(automationName)
|
||||
, m_Glyph(glyph)
|
||||
|
@ -168,6 +173,7 @@ namespace CalculatorApp
|
|||
, m_Mode(viewMode)
|
||||
, m_SupportsNegative(supportsNegative)
|
||||
, m_IsEnabled(isEnabled)
|
||||
, m_IsPreview(isPreview)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue