Changes between Version 1 and Version 2 of Docs/825gen2/Dev/UpdatingLegacyAppsToNewLook


Ignore:
Timestamp:
02/08/24 11:31:10 (10 months ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/825gen2/Dev/UpdatingLegacyAppsToNewLook

    v1 v2  
    11= Updating Legacy Apps to New Look =
     2
     3Consider if the app to be changed only has minor changes from one of the standard apps. In this case it may be easier to use the code from the new style standard app and merge the changes into it.
     4
     5Otherwise, the follow the below steps.
     61. Copy the files apphelpers.cpp, apphelpers.h, and appinfo.h from one of the new standard projects such as ID storage into the project to update.
     72. Copy code for main screen features such as below:
     8{{{
     9#if ARM64
     10
     11#define NUM_WT_INDEXES  3 // Gross, tare, net
     12#define WT_INDEX_GROSS  0
     13#define WT_INDEX_TARE   1
     14#define WT_INDEX_NET    2
     15
     16CFormRect rectWtLbl[NUM_WT_INDEXES]; // Location for gross, tare, net labels
     17CFormRect rectWt[NUM_WT_INDEXES];
     18CFormRect rectWtUnits[NUM_WT_INDEXES];
     19CFormRect rectWtStatus;
     20CFormRect rectCapacity[2]; // If OIML needs two lines
     21CFormRect rectErrorMsg;
     22CFormRect rectLargeMsg; // Size of all weight rects, used for "WEIGHT ERROR", or "OVER CAPACITY"
     23CFormRect rectManTare;
     24CFormRect rectBelowButtons;
     25CFormRect rectWeightBackground;
     26
     27void SetupDisplayLocations(void)
     28{
     29        int n;
     30
     31        CFormRect rect;
     32        CFormAdvanceY advanceY;
     33
     34        // Weight status below capacity with is fontIndexSmallPrompt,multiplier 1.0 plus fixed DrawBorder  height FONT_HEIGHT + 16
     35        rect.SetTopBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.0, BORDER_BOX_HEIGHT);
     36        rect.SetHeightBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.0);
     37        rect.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.26, 0.25); // Show above of gross weight value
     38
     39        rectWtStatus = rect;
     40        rectWtStatus.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.0, 0.30);
     41        rectWtStatus.SetTopBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.7, BORDER_BOX_HEIGHT);
     42
     43        for(n = 0; n < 2; n++)
     44        {
     45                if(n == 0)
     46                {
     47                        rectCapacity[n].SetY(BORDER_BOX_HEIGHT);
     48                }
     49                else
     50                {
     51                        rectCapacity[n].SetTopBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), BORDER_BOX_HEIGHT);
     52                }
     53                rectCapacity[n].SetX(0);
     54                rectCapacity[n].SetLeftAndWidthBasedOnDspArea(&dspMain, 0.01, 0.41);
     55                rectCapacity[n].SetHeightBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.0);
     56        }
     57
     58        advanceY.SetBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.0, 0);
     59
     60        rect += advanceY;
     61
     62        rectManTare = rect;
     63        rectManTare.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.31, 0.20);
     64        rectManTare.SetTopBasedOnFont(formFontSet.GetFont(fontIndexSmallPrompt), 1.7, BORDER_BOX_HEIGHT);
     65
     66        // Setup weight label, value, and units locations
     67        // horizontal coordinates based on display area width
     68        // vertical coordinates based on font heights
     69        //
     70        //  Header
     71        // Capacity 1
     72        // Capacity 2
     73        //
     74        //   |- 0% 25% -|- 26% - 51%  -|- 55% 70% -|
     75        //
     76        //                wt status
     77        //    Gross          120000       lb
     78        //
     79        //    Tare            40000       lb
     80        //
     81        //    Net             80000       lb
     82        //
     83        //   Error message
     84        //   ----- Buttons -------
     85
     86        rect.SetHeightBasedOnFont(fontBigLabel, 1.0);
     87        // move Y position down to 1/4 of font height.
     88        int heightNZ = fontBigLabel.GetFont(0).GetHeight();
     89        heightNZ = heightNZ / 2;
     90        int heightZ = fontBigLabel.GetFont(1).GetHeight();
     91        heightZ = heightZ / 2;
     92        advanceY.SetBasedOnFont(fontBigLabel, 1.0);
     93        rect.GetRect(0).SetY(rect.GetRect(0).GetY() + heightNZ);
     94        rect.GetRect(1).SetY(rect.GetRect(1).GetY() + heightZ);
     95
     96        for(n = 0; n < NUM_WT_INDEXES; n++)
     97        {
     98                rect.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.01, 0.24);
     99                rectWtLbl[n] = rect;
     100
     101                rect.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.26, 0.25);
     102                rectWt[n] = rect;
     103
     104                rect.SetLeftAndWidthBasedOnDspArea(&dspMain, 0.55, 0.15);
     105                rectWtUnits[n] = rect;
     106
     107                rect += advanceY;
     108        }
     109
     110        // Large message such as "WEIGHT ERROR" upper left is set same as weight label "Gross", lower right is same as net weight units label.
     111        rectLargeMsg.SetLocationAndSizeFrom(rectWtLbl[WT_INDEX_GROSS], rectWtUnits[WT_INDEX_NET]);
     112
     113        rectWeightBackground.SetLocationAndSizeFrom(rectWtLbl[WT_INDEX_GROSS], rectWtLbl[WT_INDEX_GROSS]);
     114        rectWeightBackground.SetX(0);
     115        rectWeightBackground.SetWidth(dspMain.GetWidth() - 1);
     116
     117        rect.SetTopBasedOnFont(formFontSetSmall.GetFont(fontIndexPrompt), 12.0);
     118        rect.SetHeightBasedOnFont(formFontSetSmall.GetFont(fontIndexPrompt), 1.0);
     119        rect.SetX(0);
     120        rect.SetWidth((dspMain.GetWidth() / 2) - 1);
     121        rectErrorMsg = rect;
     122}
     123
     124#endif
     125
     126}}}