LCOV - code coverage report
Current view: top level - src/utils/foxtools - MFXSevenSegment.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 57.7 % 392 226
Test Date: 2026-03-26 16:31:35 Functions: 62.5 % 32 20

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2004-2026 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    MFXSevenSegment.cpp
      15              : /// @author  Mathew Robertson
      16              : /// @author  Daniel Krajzewicz
      17              : /// @author  Michael Behrisch
      18              : /// @date    2004-03-19
      19              : ///
      20              : //
      21              : /****************************************************************************/
      22              : #include <config.h>
      23              : 
      24              : #include <utils/gui/div/GUIDesigns.h>
      25              : 
      26              : #include "MFXSevenSegment.h"
      27              : 
      28              : 
      29              : /// @brief note: this class may change into FXLCDsegment, so as to support 7 or 14 segment display
      30              : #define ASCII_ZERO 48
      31              : 
      32              : // ===========================================================================
      33              : // FOX callback mapping
      34              : // ===========================================================================
      35              : 
      36              : FXDEFMAP(MFXSevenSegment) MFXSevenSegmentMap[] = {
      37              :     FXMAPFUNC(SEL_PAINT,    0,                              MFXSevenSegment::onPaint),
      38              :     FXMAPFUNC(SEL_COMMAND,  FXWindow::ID_SETVALUE,          MFXSevenSegment::onCmdSetValue),
      39              :     FXMAPFUNC(SEL_COMMAND,  FXWindow::ID_SETINTVALUE,       MFXSevenSegment::onCmdSetIntValue),
      40              :     FXMAPFUNC(SEL_COMMAND,  FXWindow::ID_GETINTVALUE,       MFXSevenSegment::onCmdGetIntValue),
      41              :     FXMAPFUNC(SEL_COMMAND,  FXWindow::ID_SETSTRINGVALUE,    MFXSevenSegment::onCmdSetStringValue),
      42              :     FXMAPFUNC(SEL_COMMAND,  FXWindow::ID_GETSTRINGVALUE,    MFXSevenSegment::onCmdGetStringValue),
      43              :     //FXMAPFUNC(SEL_UPDATE, FXWindow::ID_QUERY_TIP,         MFXSevenSegment::onQueryTip),
      44              :     //FXMAPFUNC(SEL_UPDATE, FXWindow::ID_QUERY_HELP,        MFXSevenSegment::onQueryHelp),
      45              : };
      46              : 
      47              : // Object implementation
      48    199048901 : FXIMPLEMENT(MFXSevenSegment, FXFrame, MFXSevenSegmentMap, ARRAYNUMBER(MFXSevenSegmentMap))
      49              : 
      50              : 
      51              : // ===========================================================================
      52              : // method definitions
      53              : // ===========================================================================
      54              : 
      55       579224 : MFXSevenSegment::MFXSevenSegment(FXComposite* p, FXObject* tgt, FXSelector sel, FXuint opts, FXint pl, FXint pr, FXint pt, FXint pb) :
      56              :     FXFrame(p, opts, 0, 0, 0, 0, pl, pr, pt, pb),
      57       579224 :     myValue(' '),
      58       579224 :     myLCDTextColor(FXRGB(0, 255, 0)),
      59       579224 :     myBackGroundColor(GUIDesignTextColorBlack),
      60       579224 :     myHorizontalSegmentLength(8),
      61       579224 :     myVerticalSegmentLength(8),
      62       579224 :     mySegmentThickness(3),
      63       579224 :     myGroove(1) {
      64              :     setTarget(tgt);
      65              :     setSelector(sel);
      66       579224 :     enable();
      67       579224 : }
      68              : 
      69              : 
      70              : FXint
      71      6854859 : MFXSevenSegment::getDefaultWidth() {
      72      6854859 :     return padleft + (myGroove << 1) + myHorizontalSegmentLength + padright + (border << 1);
      73              : }
      74              : 
      75              : 
      76              : FXint
      77      6529777 : MFXSevenSegment::getDefaultHeight() {
      78      6529777 :     return padtop + (myGroove << 2) + (myVerticalSegmentLength << 1) + padbottom + (border << 1);
      79              : }
      80              : 
      81              : 
      82              : void
      83     16436192 : MFXSevenSegment::setText(FXchar val) {
      84     16436192 :     if (FXString(val, 1).upper() != FXString(myValue, 1).upper()) {
      85      1390485 :         myValue = val;
      86      1390485 :         recalc();
      87      1390485 :         update();
      88              :     }
      89     16436192 : }
      90              : 
      91              : 
      92              : void
      93            0 : MFXSevenSegment::setFgColor(const FXColor clr) {
      94            0 :     if (myLCDTextColor != clr) {
      95            0 :         myLCDTextColor = clr;
      96            0 :         recalc();
      97            0 :         update();
      98              :     }
      99            0 : }
     100              : 
     101              : 
     102              : void
     103            0 : MFXSevenSegment::setBgColor(const FXColor clr) {
     104            0 :     if (myBackGroundColor != clr) {
     105            0 :         myBackGroundColor = clr;
     106            0 :         recalc();
     107            0 :         update();
     108              :     }
     109            0 : }
     110              : 
     111              : 
     112              : void
     113       579224 : MFXSevenSegment::setHorizontal(const FXint len) {
     114       579224 :     if (len != myHorizontalSegmentLength) {
     115       579224 :         myHorizontalSegmentLength = (FXshort)len;
     116       579224 :         checkSize();
     117       579224 :         recalc();
     118       579224 :         update();
     119              :     }
     120       579224 : }
     121              : 
     122              : 
     123              : void
     124       579224 : MFXSevenSegment::setVertical(const FXint len) {
     125       579224 :     if (len != myVerticalSegmentLength) {
     126       579224 :         myVerticalSegmentLength = (FXshort)len;
     127       579224 :         checkSize();
     128       579224 :         recalc();
     129       579224 :         update();
     130              :     }
     131       579224 : }
     132              : 
     133              : 
     134              : void
     135       579224 : MFXSevenSegment::setThickness(const FXint w) {
     136       579224 :     if (w != mySegmentThickness) {
     137       579224 :         mySegmentThickness = (FXshort)w;
     138       579224 :         checkSize();
     139       579224 :         recalc();
     140       579224 :         update();
     141              :     }
     142       579224 : }
     143              : 
     144              : 
     145              : void
     146       579224 : MFXSevenSegment::setGroove(const FXint w) {
     147       579224 :     if (w != myGroove) {
     148       579224 :         myGroove = (FXshort)w;
     149       579224 :         checkSize();
     150       579224 :         recalc();
     151       579224 :         update();
     152              :     }
     153       579224 : }
     154              : 
     155              : 
     156              : long
     157      1379177 : MFXSevenSegment::onPaint(FXObject*, FXSelector, void* ptr) {
     158              :     FXEvent* event = (FXEvent*) ptr;
     159      1379177 :     FXDCWindow dc(this, event);
     160      1379177 :     drawFrame(dc, 0, 0, width, height);
     161      1379177 :     dc.setForeground(myBackGroundColor);
     162      1379177 :     dc.fillRectangle(border, border, width - (border << 1), height - (border << 1));
     163      1379177 :     dc.setForeground(myLCDTextColor);
     164      1379177 :     drawFigure(dc, myValue);
     165      1379177 :     return 1;
     166      1379177 : }
     167              : 
     168              : 
     169              : long
     170            0 : MFXSevenSegment::onCmdSetValue(FXObject*, FXSelector, void* ptr) {
     171              :     FXchar* c = (FXchar*)ptr;
     172            0 :     if (c[0] != '\0') {
     173            0 :         setText(c[0]);
     174              :     }
     175            0 :     return 1;
     176              : }
     177              : 
     178              : 
     179              : long
     180            0 : MFXSevenSegment::onCmdGetIntValue(FXObject* sender, FXSelector, void*) {
     181            0 :     FXint i = myValue - ASCII_ZERO;
     182            0 :     if (i < 0) {
     183            0 :         i = 0;
     184              :     }
     185            0 :     if (i > 9) {
     186            0 :         i = 9;
     187              :     }
     188            0 :     sender->handle(this, FXSEL(SEL_COMMAND, ID_SETINTVALUE), (void*)&i);
     189            0 :     return 1;
     190              : }
     191              : 
     192              : 
     193              : long
     194            0 : MFXSevenSegment::onCmdSetIntValue(FXObject*, FXSelector, void* ptr) {
     195            0 :     FXint i = *((FXint*)ptr);
     196              :     if (i < 0) {
     197              :         i = 0;
     198              :     }
     199            0 :     if (i > 9) {
     200              :         i = 9;
     201              :     }
     202            0 :     setText((FXchar)(i + ASCII_ZERO));
     203            0 :     return 1;
     204              : }
     205              : 
     206              : 
     207              : long
     208            0 : MFXSevenSegment::onCmdGetStringValue(FXObject* sender, FXSelector, void*) {
     209            0 :     FXString s(myValue, 1);
     210            0 :     sender->handle(this, FXSEL(SEL_COMMAND, ID_SETSTRINGVALUE), (void*)&s);
     211            0 :     return 1;
     212            0 : }
     213              : 
     214              : 
     215              : long
     216            0 : MFXSevenSegment::onCmdSetStringValue(FXObject*, FXSelector, void* ptr) {
     217              :     FXString* s = (FXString*)ptr;
     218            0 :     if (s->length()) {
     219            0 :         setText(s->at(0));
     220              :     }
     221            0 :     return 1;
     222              : }
     223              : 
     224              : 
     225              : void
     226            0 : MFXSevenSegment::save(FXStream& store) const {
     227            0 :     FXFrame::save(store);
     228            0 :     store << myValue;
     229            0 :     store << myLCDTextColor;
     230            0 :     store << myBackGroundColor;
     231            0 :     store << myHorizontalSegmentLength;
     232            0 :     store << myVerticalSegmentLength;
     233            0 :     store << mySegmentThickness;
     234            0 :     store << myGroove;
     235            0 : }
     236              : 
     237              : 
     238              : void
     239            0 : MFXSevenSegment::load(FXStream& store) {
     240            0 :     FXFrame::load(store);
     241            0 :     store >> myValue;
     242            0 :     store >> myLCDTextColor;
     243            0 :     store >> myBackGroundColor;
     244            0 :     store >> myHorizontalSegmentLength;
     245            0 :     store >> myVerticalSegmentLength;
     246            0 :     store >> mySegmentThickness;
     247            0 :     store >> myGroove;
     248            0 : }
     249              : 
     250              : 
     251              : long
     252            0 : MFXSevenSegment::onQueryTip(FXObject* sender, FXSelector sel, void* ptr) {
     253            0 :     if (getParent()) {
     254            0 :         return getParent()->handle(sender, sel, ptr);
     255              :     }
     256              :     return 0;
     257              : }
     258              : 
     259              : 
     260              : long
     261            0 : MFXSevenSegment::onQueryHelp(FXObject* sender, FXSelector sel, void* ptr) {
     262            0 :     if (getParent()) {
     263            0 :         return getParent()->handle(sender, sel, ptr);
     264              :     }
     265              :     return 0;
     266              : }
     267              : 
     268              : 
     269              : void
     270       933849 : MFXSevenSegment::drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     271              :     FXPoint points[4];
     272       933849 :     points[0].x = x;
     273       933849 :     points[0].y = y;
     274       933849 :     points[1].x = x + myHorizontalSegmentLength;
     275       933849 :     points[1].y = y;
     276       933849 :     points[2].x = x + myHorizontalSegmentLength - mySegmentThickness;
     277       933849 :     points[2].y = y + mySegmentThickness;
     278       933849 :     points[3].x = x + mySegmentThickness;
     279       933849 :     points[3].y = y + mySegmentThickness;
     280       933849 :     dc.fillPolygon(points, 4);
     281       933849 : }
     282              : 
     283              : 
     284              : void
     285       713661 : MFXSevenSegment::drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     286              :     FXPoint points[4];
     287       713661 :     points[0].x = x;
     288       713661 :     points[0].y = y;
     289       713661 :     points[1].x = x + mySegmentThickness;
     290       713661 :     points[1].y = y + mySegmentThickness;
     291       713661 :     points[2].x = x + mySegmentThickness;
     292       713661 :     points[2].y = y + myVerticalSegmentLength - (mySegmentThickness >> 1);
     293       713661 :     points[3].x = x;
     294       713661 :     points[3].y = y + myVerticalSegmentLength;
     295       713661 :     dc.fillPolygon(points, 4);
     296       713661 : }
     297              : 
     298              : 
     299              : void
     300       916106 : MFXSevenSegment::drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     301              :     FXPoint points[4];
     302       916106 :     points[0].x = x + mySegmentThickness;
     303       916106 :     points[0].y = y;
     304       916106 :     points[1].x = x + mySegmentThickness;
     305       916106 :     points[1].y = y + myVerticalSegmentLength;
     306       916106 :     points[2].x = x;
     307       916106 :     points[2].y = y + myVerticalSegmentLength - (mySegmentThickness >> 1);
     308       916106 :     points[3].x = x;
     309       916106 :     points[3].y = y + mySegmentThickness;
     310       916106 :     dc.fillPolygon(points, 4);
     311       916106 : }
     312              : 
     313              : 
     314              : void
     315       921211 : MFXSevenSegment::drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     316              :     FXPoint points[6];
     317       921211 :     points[0].x = x + mySegmentThickness;
     318       921211 :     points[0].y = y;
     319       921211 :     points[1].x = x + myHorizontalSegmentLength - mySegmentThickness;
     320       921211 :     points[1].y = y;
     321       921211 :     points[2].x = x + myHorizontalSegmentLength;
     322       921211 :     points[2].y = y + (mySegmentThickness >> 1);
     323       921211 :     points[3].x = x + myHorizontalSegmentLength - mySegmentThickness;
     324       921211 :     points[3].y = y + mySegmentThickness;
     325       921211 :     points[4].x = x + mySegmentThickness;
     326       921211 :     points[4].y = y + mySegmentThickness;
     327       921211 :     points[5].x = x;
     328       921211 :     points[5].y = y + (mySegmentThickness >> 1);
     329       921211 :     dc.fillPolygon(points, 6);
     330       921211 : }
     331              : 
     332              : 
     333              : void
     334       487219 : MFXSevenSegment::drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     335              :     FXPoint points[4];
     336       487219 :     points[0].x = x;
     337       487219 :     points[0].y = y;
     338       487219 :     points[1].x = x + mySegmentThickness;
     339       487219 :     points[1].y = y + (mySegmentThickness >> 1);
     340       487219 :     points[2].x = x + mySegmentThickness;
     341       487219 :     points[2].y = y + myVerticalSegmentLength - mySegmentThickness;
     342       487219 :     points[3].x = x;
     343       487219 :     points[3].y = y + myVerticalSegmentLength;
     344       487219 :     dc.fillPolygon(points, 4);
     345       487219 : }
     346              : 
     347              : 
     348              : void
     349      1036006 : MFXSevenSegment::drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     350              :     FXPoint points[4];
     351      1036006 :     points[0].x = x + mySegmentThickness;
     352      1036006 :     points[0].y = y;
     353      1036006 :     points[1].x = x + mySegmentThickness;
     354      1036006 :     points[1].y = y + myVerticalSegmentLength;
     355      1036006 :     points[2].x = x;
     356      1036006 :     points[2].y = y + myVerticalSegmentLength - mySegmentThickness;
     357      1036006 :     points[3].x = x;
     358      1036006 :     points[3].y = y + (mySegmentThickness >> 1);
     359      1036006 :     dc.fillPolygon(points, 4);
     360      1036006 : }
     361              : 
     362              : 
     363              : void
     364       825393 : MFXSevenSegment::drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y) {
     365              :     FXPoint points[4];
     366       825393 :     points[0].x = x + mySegmentThickness;
     367       825393 :     points[0].y = y;
     368       825393 :     points[1].x = x + myHorizontalSegmentLength - mySegmentThickness;
     369       825393 :     points[1].y = y;
     370       825393 :     points[2].x = x + myHorizontalSegmentLength;
     371       825393 :     points[2].y = y + mySegmentThickness;
     372       825393 :     points[3].x = x;
     373       825393 :     points[3].y = y + mySegmentThickness;
     374       825393 :     dc.fillPolygon(points, 4);
     375       825393 : }
     376              : 
     377              : 
     378              : void
     379      1379177 : MFXSevenSegment::drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7) {
     380      1379177 :     FXshort sx = (FXshort)(border + padleft), sy = (FXshort)(border + padtop);
     381              :     FXshort x, y;
     382      1379177 :     if (options & LAYOUT_FILL) {
     383            0 :         if (options & LAYOUT_FILL_X) {
     384            0 :             myHorizontalSegmentLength = (FXshort)(width - padleft - padright - (border << 1));
     385            0 :             if (myHorizontalSegmentLength < 4) {
     386            0 :                 myHorizontalSegmentLength = 4;
     387              :             }
     388              :         }
     389            0 :         if (options & LAYOUT_FILL_Y) {
     390            0 :             myVerticalSegmentLength = (FXshort)(height - padtop - padbottom - (border << 1)) >> 1;
     391            0 :             if (myVerticalSegmentLength < 4) {
     392            0 :                 myVerticalSegmentLength = 4;
     393              :             }
     394              :         }
     395            0 :         mySegmentThickness = FXMIN(myHorizontalSegmentLength, myVerticalSegmentLength) / 4;
     396            0 :         myGroove = mySegmentThickness / 4;
     397            0 :         if (mySegmentThickness < 1) {
     398            0 :             mySegmentThickness = 1;
     399              :         }
     400            0 :         if (myGroove < 1) {
     401            0 :             myGroove = 1;
     402              :         }
     403            0 :         if (options & LAYOUT_FILL_X) {
     404            0 :             myHorizontalSegmentLength -= myGroove << 1;
     405              :         }
     406            0 :         if (options & LAYOUT_FILL_Y) {
     407            0 :             myVerticalSegmentLength -= myGroove << 1;
     408              :         }
     409              :     }
     410      1379177 :     if (s1) {
     411       933849 :         x = sx + myGroove;
     412              :         y = sy;
     413       933849 :         drawTopSegment(dc, x, y);
     414              :     }
     415      1379177 :     if (s2) {
     416              :         x = sx;
     417       713661 :         y = sy + myGroove;
     418       713661 :         drawLeftTopSegment(dc, x, y);
     419              :     }
     420      1379177 :     if (s3) {
     421       916106 :         x = sx + myGroove + myHorizontalSegmentLength - mySegmentThickness + myGroove;
     422       916106 :         y = sy + myGroove;
     423       916106 :         drawRightTopSegment(dc, x, y);
     424              :     }
     425      1379177 :     if (s4) {
     426       921211 :         x = sx + myGroove;
     427       921211 :         y = sy + myGroove + myVerticalSegmentLength - (mySegmentThickness >> 1) + myGroove;
     428       921211 :         drawMiddleSegment(dc, x, y);
     429              :     }
     430      1379177 :     if (s5) {
     431              :         x = sx;
     432       487219 :         y = sy + (myGroove << 1) + myVerticalSegmentLength + myGroove;
     433       487219 :         drawLeftBottomSegment(dc, x, y);
     434              :     }
     435      1379177 :     if (s6) {
     436      1036006 :         x = sx + myGroove + myHorizontalSegmentLength - mySegmentThickness + myGroove;
     437      1036006 :         y = sy + (myGroove << 1) + myVerticalSegmentLength + myGroove;
     438      1036006 :         drawRightBottomSegment(dc, x, y);
     439              :     }
     440      1379177 :     if (s7) {
     441       825393 :         x = sx + myGroove;
     442       825393 :         y = sy + (myGroove << 1) + myVerticalSegmentLength + myGroove + myVerticalSegmentLength + myGroove - mySegmentThickness;
     443       825393 :         drawBottomSegment(dc, x, y);
     444              :     }
     445      1379177 : }
     446              : 
     447              : 
     448              : void
     449      1379177 : MFXSevenSegment::drawFigure(FXDCWindow& dc, FXchar figure) {
     450      1379177 :     switch (figure) {
     451        91850 :         case ' ' :
     452        91850 :             drawSegments(dc, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
     453        91850 :             break;
     454            0 :         case '(' :
     455            0 :             drawSegments(dc, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE);
     456            0 :             break;
     457            0 :         case ')' :
     458            0 :             drawSegments(dc, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE);
     459            0 :             break;
     460            0 :         case '[' :
     461            0 :             drawSegments(dc, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE);
     462            0 :             break;
     463            0 :         case ']' :
     464            0 :             drawSegments(dc, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE);
     465            0 :             break;
     466            0 :         case '=' :
     467            0 :             drawSegments(dc, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE);
     468            0 :             break;
     469              : //    case '+' : drawSegments (dc, FALSE,FALSE,FALSE,TRUE ,FALSE,FALSE,FALSE); break;
     470       133119 :         case '-' :
     471              :         case ':' :
     472       133119 :             drawSegments(dc, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE);
     473       133119 :             break;
     474          704 :         case '_' :
     475              :         case '.' :
     476              :         case ',' :
     477          704 :             drawSegments(dc, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE);
     478          704 :             break;
     479       148075 :         case '0' :
     480       148075 :             drawSegments(dc, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE);
     481       148075 :             break;
     482       108177 :         case '1' :
     483       108177 :             drawSegments(dc, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE);
     484       108177 :             break;
     485       117498 :         case '2' :
     486       117498 :             drawSegments(dc, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE);
     487       117498 :             break;
     488       105008 :         case '3' :
     489       105008 :             drawSegments(dc, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE);
     490       105008 :             break;
     491       111478 :         case '4' :
     492       111478 :             drawSegments(dc, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE);
     493       111478 :             break;
     494       126643 :         case '5' :
     495       126643 :             drawSegments(dc, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE);
     496       126643 :             break;
     497       110755 :         case '6' :
     498       110755 :             drawSegments(dc, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE);
     499       110755 :             break;
     500       109160 :         case '7' :
     501       109160 :             drawSegments(dc, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE);
     502       109160 :             break;
     503       110891 :         case '8' :
     504       110891 :             drawSegments(dc, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
     505       110891 :             break;
     506       105819 :         case '9' :
     507       105819 :             drawSegments(dc, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE);
     508       105819 :             break;
     509            0 :         case 'a' :
     510              :         case 'A' :
     511            0 :             drawSegments(dc, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
     512            0 :             break;
     513            0 :         case 'b' :
     514              :         case 'B' :
     515            0 :             drawSegments(dc, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE);
     516            0 :             break;
     517            0 :         case 'c' :
     518              :         case 'C' :
     519            0 :             drawSegments(dc, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE);
     520            0 :             break;
     521            0 :         case 'd' :
     522              :         case 'D' :
     523            0 :             drawSegments(dc, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE);
     524            0 :             break;
     525            0 :         case 'e' :
     526              :         case 'E' :
     527            0 :             drawSegments(dc, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE);
     528            0 :             break;
     529            0 :         case 'f' :
     530              :         case 'F' :
     531            0 :             drawSegments(dc, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE);
     532            0 :             break;
     533            0 :         case 'g' :
     534              :         case 'G' :
     535            0 :             drawSegments(dc, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE);
     536            0 :             break;
     537            0 :         case 'h' :
     538              :         case 'H' :
     539            0 :             drawSegments(dc, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE);
     540            0 :             break;
     541            0 :         case 'i' :
     542              :         case 'I' :
     543            0 :             drawSegments(dc, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE);
     544            0 :             break;
     545            0 :         case 'j' :
     546              :         case 'J' :
     547            0 :             drawSegments(dc, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE);
     548            0 :             break;
     549              : //    case 'k' :
     550              : //    case 'k' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
     551            0 :         case 'l' :
     552              :         case 'L' :
     553            0 :             drawSegments(dc, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE);
     554            0 :             break;
     555              : //    case 'm' :
     556              : //    case 'M' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
     557            0 :         case 'n' :
     558              :         case 'N' :
     559            0 :             drawSegments(dc, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE);
     560            0 :             break;
     561            0 :         case 'o' :
     562              :         case 'O' :
     563            0 :             drawSegments(dc, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE);
     564            0 :             break;
     565            0 :         case 'p' :
     566              :         case 'P' :
     567            0 :             drawSegments(dc, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE);
     568            0 :             break;
     569            0 :         case 'q' :
     570              :         case 'Q' :
     571            0 :             drawSegments(dc, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE);
     572            0 :             break;
     573            0 :         case 'r' :
     574              :         case 'R' :
     575            0 :             drawSegments(dc, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE);
     576            0 :             break;
     577            0 :         case 's' :
     578              :         case 'S' :
     579            0 :             drawSegments(dc, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE);
     580            0 :             break;
     581            0 :         case 't' :
     582              :         case 'T' :
     583            0 :             drawSegments(dc, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE);
     584            0 :             break;
     585            0 :         case 'u' :
     586              :         case 'U' :
     587            0 :             drawSegments(dc, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE);
     588            0 :             break;
     589              : //    case 'v' :
     590              : //    case 'V' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
     591              : //    case 'w' :
     592              : //    case 'W' : drawSegments (dc, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE); break;
     593            0 :         case 'x' :
     594              :         case 'X' :
     595            0 :             drawSegments(dc, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE);
     596            0 :             break;
     597            0 :         case 'y' :
     598              :         case 'Y' :
     599            0 :             drawSegments(dc, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE);
     600            0 :             break;
     601              : //    case 'z' :
     602              : //    case 'Z' :
     603            0 :         default  :
     604            0 :             fxerror("MFXSevenSegment doesn't support: %c\n", figure);
     605              :     }
     606      1379177 : }
     607              : 
     608              : 
     609              : void
     610      2316896 : MFXSevenSegment::checkSize() {
     611      2316896 :     if (myHorizontalSegmentLength < 3) {
     612       579224 :         myHorizontalSegmentLength = 3;
     613       579224 :         mySegmentThickness = 1;
     614              :     }
     615      2316896 :     if (myVerticalSegmentLength < 3) {
     616            0 :         myVerticalSegmentLength = 3;
     617            0 :         mySegmentThickness = 1;
     618              :     }
     619      2316896 :     if (mySegmentThickness < 1) {
     620            0 :         mySegmentThickness = 1;
     621              :     }
     622      2316896 :     if (myHorizontalSegmentLength < (mySegmentThickness << 1)) {
     623       579224 :         myHorizontalSegmentLength = (mySegmentThickness << 1) + 1;
     624              :     }
     625      2316896 :     if (myVerticalSegmentLength < (mySegmentThickness << 1)) {
     626            0 :         myVerticalSegmentLength = (mySegmentThickness << 1) + 1;
     627              :     }
     628      2316896 :     if (myHorizontalSegmentLength < 8 || myVerticalSegmentLength < 8) {
     629      2316896 :         myGroove = 2;
     630              :     }
     631      2316896 :     if (myHorizontalSegmentLength < 1 || myVerticalSegmentLength < 3 || mySegmentThickness < 3) {
     632      2316896 :         myGroove = 1;
     633              :     }
     634      2316896 :     if (myGroove >= mySegmentThickness) {
     635      1158448 :         myGroove = mySegmentThickness - 1;
     636              :     }
     637      2316896 : }
        

Generated by: LCOV version 2.0-1