home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / fli106c / examples / dds.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-25  |  8.0 KB  |  251 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.02
  4. // Copyright (C) 1990, 1991
  5. // Software Dimensions
  6. //
  7. // Dialog Development System
  8. //
  9. // Main Module
  10. //
  11.  
  12. #include "fliwin.h"
  13. #include "colors.h"
  14. #include "dds.h"
  15.  
  16. #include <stdio.h>
  17. #include <alloc.h>
  18. #include <stdlib.h>
  19. #include <time.h>
  20. #include <string.h>
  21.  
  22. InfoBox *Welcome;
  23.  
  24. int OverrideBlaze=0;
  25. int OmitComments=0;
  26.  
  27. extern int PanelAutoEngaged;
  28.  
  29. //-------------------------------------------------------------------------
  30. //
  31. // Current Time Displayer (GlobalLive)
  32. //
  33. //-------------------------------------------------------------------------
  34.  
  35. void MemoryFree()
  36. {
  37.   static BlazeClass Blaze;
  38.   static int Clicker=0;
  39.  
  40.   Blaze.Window(0,0,Blaze.WhatWidth(),Blaze.WhatHeight());
  41.  
  42.   struct tm *time_now;
  43.   time_t secs_now;
  44.  
  45.   char TimeClock[30];
  46.  
  47.   tzset();
  48.   time(&secs_now);
  49.   time_now=localtime(&secs_now);
  50.  
  51.   strftime(TimeClock,15,"%I:%M %p ",time_now);
  52.   strcat(TimeClock,(Clicker)?"\x9":"\x7");
  53.  
  54.   Blaze (Blaze.WhatWidth()-11,0)
  55.     << Colors.MenuBarNormal
  56.     << TimeClock;
  57.  
  58.   Clicker=(Clicker)?0:1;
  59. }
  60.  
  61. //-------------------------------------------------------------------------
  62. //
  63. // Main startup module
  64. //
  65. //-------------------------------------------------------------------------
  66.  
  67. void main()
  68. {
  69.   BlazeClass Blaze;
  70.  
  71.   //-------------------------------------------------------------------------
  72.   //
  73.   // Alter the colors if in the color mode -- switches bars to blue
  74.   // background instead of white, since the screen is white enough
  75.   // because of the dialog.  This only happens if there isn't a panel
  76.   // settings file saved onto the disk -- since the user may have altered
  77.   // the settings and we don't want to mess up the settings.
  78.   //
  79.   //-------------------------------------------------------------------------
  80.  
  81.   if (!PanelAutoEngaged)
  82.   {
  83.     if (!Blaze.IsBlackWhite())
  84.     {
  85.       Colors.PromptLineBold=fYellow|bBlue;
  86.       Colors.PromptLineNormal=fWhite|bBlue;
  87.       Colors.MenuBarBold=fYellow|bBlue;
  88.       Colors.MenuBarNormal=fWhite|bBlue;
  89.     }
  90.  
  91.     FusionShadowing=1;
  92.   }
  93.  
  94.     FLIVideoProtect++;
  95.  
  96.     FusionHelp::DefineHelp("DDS.HLP");
  97.   FusionHelp::DisableHelp(); // help system shut off
  98.  
  99.     Blaze.FreshWorkSpace();
  100.  
  101.   //-------------------------------------------------------------------------
  102.   //
  103.   // Set up global live function (time displayer)
  104.   //
  105.   //-------------------------------------------------------------------------
  106.  
  107.     Event::GlobalLive(MemoryFree);
  108.   Event::SetLiveTime(20);
  109.  
  110.   //-------------------------------------------------------------------------
  111.   //
  112.   // Define the info box that tells about the program and version
  113.   //
  114.   // It is a violation of Software Dimensions copyright to remove or alter
  115.   // the information contained in this information box.  Any alterations
  116.   // made to this dialog box can only be made with express written
  117.   // permission from Software Dimensions and Robert Miller.
  118.   //
  119.   //-------------------------------------------------------------------------
  120.  
  121.     Welcome = new InfoBox;
  122.     (*Welcome) + "Fusion Dialog Development System"
  123.                     + ""
  124.           + "Software Version 1.02"
  125.           + "Production Dated: "__DATE__" "__TIME__
  126.           + "Compiled Under Large Model"
  127.           + ""
  128.           + "Developed by Robert Miller"
  129.           + "Copyright (C) 1991 by Software Dimensions"
  130.           + "───────"
  131.           + "\"Beyond the Future\"";
  132.   Welcome->UseInfoBox();
  133.  
  134.   //-------------------------------------------------------------------------
  135.   //
  136.   // Define workspace and global help code
  137.   //
  138.   //-------------------------------------------------------------------------
  139.  
  140.   FusionWindow &Window=*new DesignerWindow();
  141.  
  142.   Window.GlobalHelp(1500);
  143.  
  144.   //-------------------------------------------------------------------------
  145.   //
  146.   // Define the file menu (other menus displayed when window is opened)
  147.   //
  148.   //-------------------------------------------------------------------------
  149.  
  150.   Window.NewMenu("≡","Control Panel",kbAltSpace,winControlPanel);
  151.     Window.Option("Con~trol Panel ...","A control panel to customize mouse and menu settings",winControlPanel);
  152.     Window.Option("A~bout ...","About the designer",winAbout);
  153.  
  154.   Window.NewMenu("~File","File management features",kbAltF);
  155.         Window.Option("~New","Open a new dialog window",winNew);
  156.     Window.Option("~Open ...","Open a dialog",winOpen);
  157.         Window.Option("~Save","Save this dialog",winSave);
  158.         Window.Available(Window.NumberOfWindows);
  159.         Window.HotKey("F2",kbF2);
  160.         Window.Option("Save ~As ...","Change the file save name",winSaveAs);
  161.         Window.Available(Window.NumberOfWindows);
  162.         Window.Option("~Change Directory","Change the current directory",winChDir);
  163.         Window.BlankLine();
  164.         Window.Option("~Generate C++ Code","Generate C++ source code");
  165.     Window.Available(Window.NumberOfWindows);
  166.     Window.SubMenu();
  167.  
  168.       Window.Option("~Override Blaze Colors","Should the colors that you have selected be overridden?");
  169.       Window.CheckMark(OverrideBlaze);
  170.       Window.Option("Omit ~Comments","Should the usage instructions be omitted from the C++ file?");
  171.       Window.CheckMark(OmitComments);
  172.       Window.BlankLine();
  173.       Window.Option("~Generate C++ Code","Generate C++ source code",winGenCPP);
  174.  
  175.     Window.EndSubMenu();
  176.     Window.BlankLine();
  177.     Window.Option("~DOS Shell","Suspend the Dialog Designer and shell to DOS",winDOSShell);
  178.     Window.Option("E~xit Dialog Designer","Leave the designer",winExit);
  179.     Window.HotKey("Alt-X",kbAltX);
  180.  
  181.   //-------------------------------------------------------------------------
  182.   //
  183.   // Define all keys that will show up on the prompt line
  184.   //
  185.   //-------------------------------------------------------------------------
  186.  
  187.   Window.DefineNormKey("F2","Save",winSave);
  188.   Window.DefineNormKey("F3","Del",manipDeletePiece);
  189.   Window.DefineNormKey("F4","Color",drawColor);
  190.   Window.DefineNormKey("F5","Back",manipBack);
  191.   Window.DefineNormKey("F6","Front",manipForward);
  192.   Window.DefineNormKey("F7","Size/Edit",manipSize);
  193.   Window.DefineNormKey("F8","Move",manipMove);
  194.   Window.DefineNormKey("F9","Copy",manipCopy);
  195.   Window.DefineNormKey("F10","Menu",winCallMenu,kbF10);
  196.  
  197.   Window.DefineAltKey("B","Box",drawBox);
  198.   Window.DefineAltKey("I","Filled",drawFillBox);
  199.   Window.DefineAltKey("H","HLine",drawHLine);
  200.   Window.DefineAltKey("V","VLine",drawVLine);
  201.   Window.DefineAltKey("S","Shadow",drawShadow);
  202.   Window.DefineAltKey("R","Erase",drawErase);
  203.   Window.DefineAltKey("P","Plop",drawPlop);
  204.   Window.DefineAltKey("N","Trans",drawTrans);
  205.   Window.DefineAltKey("T","Test",layoutTest);
  206.   Window.DefineAltKey("X","Exit",winExit);
  207.  
  208.   Window.DefineCtrlKey("C","Char",elementChar);
  209.   Window.DefineCtrlKey("I","Int",elementInt);
  210.   Window.DefineCtrlKey("L","Long",elementLong);
  211.   Window.DefineCtrlKey("F","Float",elementFloat);
  212.   Window.DefineCtrlKey("D","Double",elementDouble);
  213.   Window.DefineCtrlKey("B","Bcd",elementBcd);
  214.   Window.DefineCtrlKey("V","Vert",elementVRadio);
  215.   Window.DefineCtrlKey("Z","Horiz",elementHRadio);
  216.   Window.DefineCtrlKey("K","Check",elementCheck);
  217.   Window.DefineCtrlKey("U","Button",elementPush);
  218.  
  219.   //-------------------------------------------------------------------------
  220.   //
  221.   // Define maximum allowed windows and engage the DDS!
  222.   // Global event handler can be found in GLOBAL.CPP
  223.   //
  224.   //-------------------------------------------------------------------------
  225.  
  226.   Window.MaximumWindows(1);
  227.  
  228.   Window.EngageFusion();
  229.  
  230.   delete &Window;
  231.   delete Welcome;
  232. }
  233.  
  234. //-------------------------------------------------------------------------
  235. //
  236. // Goodbye Message!
  237. //
  238. //-------------------------------------------------------------------------
  239.  
  240. void AAAA_GoodBye()
  241. {
  242.   puts("Thank you for using the Dialog Development System\n\r"
  243.     "Brought to you by Robert M Miller and Software Dimensions");
  244. }
  245.  
  246. // The docs say to stay away from priorities below 64, but this
  247. // is safe and we *WANT* to make sure that our goodbye message displays
  248. // at program exists.
  249.  
  250. #pragma exit AAAA_GoodBye 0
  251.