Added correctly formatted code comments

The newer SDK support tooltips to show the function prototype and help text, so best to make good use of it.
This commit is contained in:
Philip Abbey
2025-07-04 16:57:25 +01:00
parent 6b2aa3135a
commit f2d65aa6e3
22 changed files with 831 additions and 316 deletions

View File

@ -11,35 +11,36 @@
//
// J D Abbey & P A Abbey, 28 December 2022
//
//
// Description:
//
// A view with added methods to scale from percentages of scrren size to pixels.
//
//-----------------------------------------------------------------------------------
using Toybox.Lang;
using Toybox.WatchUi;
using Toybox.Math;
//! A view that provides a common method 'pixelsForScreen' to make Views easier to layout on different
//! sized watch screens.
//
class ScalableView extends WatchUi.View {
//! Retain the local screen width for efficiency
private var mScreenWidth;
//! Class Constructor
//
function initialize() {
View.initialize();
mScreenWidth = System.getDeviceSettings().screenWidth;
}
// Convert a fraction expressed as a percentage (%) to a number of pixels for the
// screen's dimensions.
//
// Parameters:
// * dc - Device context
// * pc - Percentage (%) expressed as a number in the range 0.0..100.0
//
// Uses screen width rather than screen height as rectangular screens tend to have
// height > width.
//
//! Convert a fraction expressed as a percentage (%) to a number of pixels for the
//! screen's dimensions.
//!
//! Uses screen width rather than screen height as rectangular screens tend to have
//! height > width.
//!
//! @param pc Percentage (%) expressed as a number in the range 0.0..100.0
//!
//! @return Number of pixels for the screen's dimensions for a fraction expressed as a percentage (%).
//!
function pixelsForScreen(pc as Lang.Float) as Lang.Number {
return Math.round(pc * mScreenWidth) / 100;
}