Fix the project code style, as it is not consistent. (#236)

Fixes #202
This PR fixes code style for the project files.

The Problem
Different files in the project use different code style. That is not consistent and leads to harder maintenance of the project.

Description of the changes:
Have investigated and determined the most used code style across the given codebase
Have configured IDE and applied code style to all project files.
Have crafted clang-formatter config.
see https://clang.llvm.org/docs/ClangFormat.html
https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Some cases were fixed manually
How changes were validated:
manual/ad-hoc testing, automated testing

All tests pass as before because these are only code style changes.
Additional
Please review, and let me know if I have any mistake in the code style. In case of any mistake, I will change the configuration and re-apply it to the project.
This commit is contained in:
Oleg Abrazhaev
2019-05-02 20:59:19 +02:00
committed by Daniel Belcher
parent c77f1de84c
commit 2826d37056
237 changed files with 12824 additions and 11843 deletions

View File

@@ -24,26 +24,28 @@ AspectRatioTrigger::~AspectRatioTrigger()
UnregisterSizeChanged(Source);
}
void AspectRatioTrigger::OnSourcePropertyChanged(FrameworkElement^ oldValue, FrameworkElement^ newValue)
void AspectRatioTrigger::OnSourcePropertyChanged(FrameworkElement ^ oldValue, FrameworkElement ^ newValue)
{
UnregisterSizeChanged(oldValue);
RegisterSizeChanged(newValue);
}
void AspectRatioTrigger::RegisterSizeChanged(FrameworkElement^ element)
void AspectRatioTrigger::RegisterSizeChanged(FrameworkElement ^ element)
{
if (element == nullptr) { return; }
if (element == nullptr)
{
return;
}
if (element != Source)
{
UnregisterSizeChanged(Source);
}
m_sizeChangedToken =
element->SizeChanged += ref new SizeChangedEventHandler(this, &AspectRatioTrigger::OnSizeChanged);
m_sizeChangedToken = element->SizeChanged += ref new SizeChangedEventHandler(this, &AspectRatioTrigger::OnSizeChanged);
}
void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement^ element)
void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement ^ element)
{
if ((element != nullptr) && (m_sizeChangedToken.Value != 0))
{
@@ -52,7 +54,7 @@ void AspectRatioTrigger::UnregisterSizeChanged(FrameworkElement^ element)
}
}
void AspectRatioTrigger::OnSizeChanged(Object^ sender, SizeChangedEventArgs^ e)
void AspectRatioTrigger::OnSizeChanged(Object ^ sender, SizeChangedEventArgs ^ e)
{
UpdateIsActive(e->NewSize);
}

View File

@@ -13,13 +13,15 @@
namespace CalculatorApp::Views::StateTriggers
{
public enum class Aspect
public
enum class Aspect
{
Height,
Width
};
public ref class AspectRatioTrigger sealed : public Windows::UI::Xaml::StateTriggerBase
public
ref class AspectRatioTrigger sealed : public Windows::UI::Xaml::StateTriggerBase
{
public:
AspectRatioTrigger();
@@ -27,7 +29,7 @@ namespace CalculatorApp::Views::StateTriggers
DEPENDENCY_PROPERTY_OWNER(AspectRatioTrigger);
/* The source for which this class will respond to size changed events. */
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::FrameworkElement^, Source);
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::FrameworkElement ^, Source);
/* Either Height or Width. The property will determine which aspect is used as the numerator when calculating
the aspect ratio. */
@@ -42,11 +44,11 @@ namespace CalculatorApp::Views::StateTriggers
private:
~AspectRatioTrigger();
void OnSourcePropertyChanged(Windows::UI::Xaml::FrameworkElement^ oldValue, Windows::UI::Xaml::FrameworkElement^ newValue);
void OnSourcePropertyChanged(Windows::UI::Xaml::FrameworkElement ^ oldValue, Windows::UI::Xaml::FrameworkElement ^ newValue);
void RegisterSizeChanged(Windows::UI::Xaml::FrameworkElement^ element);
void UnregisterSizeChanged(Windows::UI::Xaml::FrameworkElement^ element);
void OnSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e);
void RegisterSizeChanged(Windows::UI::Xaml::FrameworkElement ^ element);
void UnregisterSizeChanged(Windows::UI::Xaml::FrameworkElement ^ element);
void OnSizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
void UpdateIsActive(Windows::Foundation::Size sourceSize);