mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-03 19:39:07 +08:00
suit code style
This commit is contained in:
parent
004ddd0827
commit
85c8ca2a98
@ -69,7 +69,8 @@ MonitorInfo MonitorInfo::GetFromPoint(int32_t x, int32_t y)
|
||||
return MonitorInfo::MonitorInfo(monitor);
|
||||
}
|
||||
|
||||
MonitorInfo::Size MonitorInfo::GetSize(const MONITORINFOEX& monitorInfoEx) {
|
||||
MonitorInfo::Size MonitorInfo::GetSize(const MONITORINFOEX& monitorInfoEx)
|
||||
{
|
||||
Size size = {};
|
||||
|
||||
auto device_name = PCTSTR(monitorInfoEx.szDevice);
|
||||
|
@ -19,17 +19,17 @@ namespace
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case MeasureToolState::Mode::Cross:
|
||||
return { true, true };
|
||||
case MeasureToolState::Mode::Cross:
|
||||
return { true, true };
|
||||
|
||||
case MeasureToolState::Mode::Vertical:
|
||||
return { false, true };
|
||||
case MeasureToolState::Mode::Vertical:
|
||||
return { false, true };
|
||||
|
||||
case MeasureToolState::Mode::Horizontal:
|
||||
return { true, false };
|
||||
case MeasureToolState::Mode::Horizontal:
|
||||
return { true, false };
|
||||
|
||||
default:
|
||||
throw std::runtime_error("Unknown MeasureToolState Mode");
|
||||
default:
|
||||
throw std::runtime_error("Unknown MeasureToolState Mode");
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ namespace
|
||||
CopyToClipboard(window, *toolState);
|
||||
|
||||
auto& perScreen = toolState->perScreen[window];
|
||||
|
||||
|
||||
const bool shiftPress = GetKeyState(VK_SHIFT) & 0x8000;
|
||||
if (shiftPress && perScreen.measuredEdges)
|
||||
{
|
||||
|
@ -95,8 +95,7 @@ Measurement::PrintResult Measurement::Print(wchar_t* buf,
|
||||
auto print = [=, &result](Measurement::Unit unit, const bool paren) {
|
||||
if (paren)
|
||||
{
|
||||
result.strLen += swprintf_s(buf + result.strLen, bufSize - result.strLen,
|
||||
printWidth && printHeight ? L"\n(" : L" (");
|
||||
result.strLen += swprintf_s(buf + result.strLen, bufSize - result.strLen, printWidth && printHeight ? L"\n(" : L" (");
|
||||
}
|
||||
if (printWidth)
|
||||
{
|
||||
@ -150,8 +149,10 @@ Measurement::PrintResult Measurement::Print(wchar_t* buf,
|
||||
|
||||
int count = 0;
|
||||
const Measurement::Unit allUnits[] = {
|
||||
Measurement::Unit::Pixel, Measurement::Unit::Millimetre,
|
||||
Measurement::Unit::Inch, Measurement::Unit::Centimetre,
|
||||
Measurement::Unit::Pixel,
|
||||
Measurement::Unit::Millimetre,
|
||||
Measurement::Unit::Inch,
|
||||
Measurement::Unit::Centimetre,
|
||||
};
|
||||
// We only use two units at most, it would be to long otherwise.
|
||||
for each (Measurement::Unit unit in allUnits)
|
||||
@ -159,7 +160,8 @@ Measurement::PrintResult Measurement::Print(wchar_t* buf,
|
||||
if ((unit & units) == unit)
|
||||
{
|
||||
count += 1;
|
||||
if (count > 2) break;
|
||||
if (count > 2)
|
||||
break;
|
||||
print(unit, count != 1);
|
||||
}
|
||||
}
|
||||
@ -205,4 +207,3 @@ void Measurement::PrintToStream(std::wostream& stream,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ struct Measurement
|
||||
const int units) const;
|
||||
|
||||
void PrintToStream(std::wostream& stream,
|
||||
const bool prependNewLine,
|
||||
const bool printWidth,
|
||||
const bool printHeight,
|
||||
const Unit units) const;
|
||||
const bool prependNewLine,
|
||||
const bool printWidth,
|
||||
const bool printHeight,
|
||||
const Unit units) const;
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ namespace winrt::PowerToys::MeasureToolCore::implementation
|
||||
wil::shared_event _stopMouseCaptureThreadSignal;
|
||||
std::thread _mouseCaptureThread;
|
||||
std::vector<std::thread> _screenCaptureThreads;
|
||||
|
||||
|
||||
std::vector<std::unique_ptr<OverlayUIState>> _overlayUIStates;
|
||||
Serialized<MeasureToolState> _measureToolState;
|
||||
BoundsToolState _boundsToolState;
|
||||
|
@ -79,6 +79,6 @@ Settings Settings::LoadFromFile()
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsCard x:Uid="MeasureTool_UnitsOfMeasure" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<ComboBox SelectedIndex="{x:Bind Path=ViewModel.UnitsOfMeasure, Mode=TwoWay}" MinWidth="{StaticResource SettingActionControlMinWidth}">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.UnitsOfMeasure, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Pixels" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Inches" />
|
||||
<ComboBoxItem x:Uid="MeasureTool_UnitsOfMeasure_Centimeters" />
|
||||
|
Loading…
Reference in New Issue
Block a user