home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / Sessions / Traut / ZStrings / Source / MacOS / GraphicalTool / MacZStringWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  4.0 KB  |  150 lines

  1. /*==================================================================
  2.     File:        MacZStringWindow.h
  3.  
  4.     Contains:    Primary window class for the Mac ZString tool
  5.                 (based on the PowerPlant framework)
  6.  
  7.     Written by:    Eric Traut
  8.  
  9.     Copyright:    2000-2001 Connectix Corporation
  10.     
  11.     This source has been placed into the public domain by
  12.     Connectix Corporation. You have the right to modify, 
  13.     distribute or use this code without any legal limitations
  14.     or finanicial/licensing requirements. Connectix is not 
  15.     liable for any problems that result from the use of this 
  16.     code.
  17.     
  18.     If you have comments, feedback, questions, or would like
  19.     to submit bug fixes or updates to this code, please email
  20.     opensource@connectix.com.
  21. ==================================================================*/
  22.  
  23. #ifndef _H_MacZStringWindow
  24. #define _H_MacZStringWindow
  25. #pragma once
  26.  
  27. #include <LWindow.h>
  28. #include <LListener.h>
  29.  
  30. #include "MacZStringFileSpec.h"
  31. #include "ZStringParser.h"
  32.  
  33. const PaneIDT            pane_AllowSemicolonCheckbox            = FOUR_CHAR_CODE('SmCl');
  34. const PaneIDT            pane_SortOutputCheckbox                = FOUR_CHAR_CODE('Srt ');
  35. const PaneIDT            pane_OutputDuplErrorCheckbox        = FOUR_CHAR_CODE('Dupl');
  36. const PaneIDT            pane_PrintWarningCheckbox            = FOUR_CHAR_CODE('Warn');
  37. const PaneIDT            pane_ConvertHighASCIICheckbox        = FOUR_CHAR_CODE('Cvrt');
  38. const PaneIDT            pane_LanguagePopup                    = FOUR_CHAR_CODE('LnPp');
  39. const PaneIDT            pane_LanguageResourceTextBox        = FOUR_CHAR_CODE('LnRs');
  40. const PaneIDT            pane_NumericOutputRadioButton        = FOUR_CHAR_CODE('OtNm');
  41. const PaneIDT            pane_AlphaOutputRadioButton            = FOUR_CHAR_CODE('OtAl');
  42.  
  43. const PaneIDT            pane_SourceGroupBox                    = FOUR_CHAR_CODE('SrGr');
  44. const PaneIDT            pane_SourceFileIcon                    = FOUR_CHAR_CODE('SrIc');
  45. const PaneIDT            pane_SourceFileNameStaticText        = FOUR_CHAR_CODE('SrFl');
  46. const PaneIDT            pane_SourceFileChooseButton            = FOUR_CHAR_CODE('SrCh');
  47. const PaneIDT            pane_CompareGroupBox                = FOUR_CHAR_CODE('CmGr');
  48. const PaneIDT            pane_CompareFileIcon                = FOUR_CHAR_CODE('CmIc');
  49. const PaneIDT            pane_CompareFileNameStaticText        = FOUR_CHAR_CODE('CmFl');
  50. const PaneIDT            pane_CompareFileChooseButton        = FOUR_CHAR_CODE('CmCh');
  51. const PaneIDT            pane_DestGroupBox                    = FOUR_CHAR_CODE('DsGr');
  52. const PaneIDT            pane_DestFileIcon                    = FOUR_CHAR_CODE('DsIc');
  53. const PaneIDT            pane_DestFileNameStaticText            = FOUR_CHAR_CODE('DsFl');
  54. const PaneIDT            pane_DestFileChooseButton            = FOUR_CHAR_CODE('DsCh');
  55.  
  56. const PaneIDT            pane_ExtractButton                    = FOUR_CHAR_CODE('Extr');
  57. const PaneIDT            pane_CompareButton                    = FOUR_CHAR_CODE('Comp');
  58. const PaneIDT            pane_OverrideButton                    = FOUR_CHAR_CODE('Ovrd');
  59. const PaneIDT            pane_QuitButton                        = FOUR_CHAR_CODE('Quit');
  60.  
  61. const ResIDT            ALRT_Error                            = 256;
  62.  
  63.  
  64. class MacZStringWindow : public LWindow, public LListener
  65. {
  66.     public:
  67.         enum { class_ID = FOUR_CHAR_CODE('ZStW') };
  68.  
  69.         MacZStringWindow(
  70.             LStream *        inStream);
  71.         
  72.         virtual
  73.         ~MacZStringWindow();
  74.  
  75.         virtual void
  76.         FinishCreateSelf();
  77.  
  78.     protected:
  79.         void
  80.         DoExtract();
  81.  
  82.         void
  83.         DoCompare();
  84.  
  85.         void
  86.         DoCreateOverride();
  87.  
  88.         void
  89.         SelectFile(
  90.             PaneIDT                    inTextID,
  91.             PaneIDT                    inIconID,
  92.             MacZStringFileSpec &    outFileSpec,
  93.             Boolean                    inExistingFile);
  94.  
  95.         void
  96.         SetFile(
  97.             PaneIDT                    inTextID,
  98.             PaneIDT                    inIconID,
  99.             const FSSpec &            inFileSpec,
  100.             MacZStringFileSpec &    outFileSpec);
  101.  
  102.         void
  103.         GetUserOptions(
  104.             ZToolOptions &        outOptions);
  105.  
  106.     private:
  107.         virtual void
  108.         ListenToMessage(
  109.             MessageT        inMessage,
  110.             void *            ioParam);
  111.  
  112.         void
  113.         RegisterWidgets();
  114.  
  115.         void
  116.         UpdateButtonStatus();
  117.  
  118.         void
  119.         UpdateFileIcons();
  120.  
  121.         Boolean
  122.         ReadBinaryImage(
  123.             const FSSpec &    inFileSpec,
  124.             char * &        outMemoryImage,
  125.             UInt32 &        outLength);
  126.  
  127.         void
  128.         DisplayError(
  129.             StringPtr            inErrorString);
  130.         
  131.         void
  132.         DisplaySuccess(
  133.             StringPtr            inSuccessString);
  134.         
  135.         OSErr
  136.         SetTypeAndCreator(
  137.             const FSSpec &        inFileSpec,
  138.             OSType                inType,
  139.             OSType                inCreator);
  140.  
  141.         MacZStringFileSpec            mSourceFileSpec;
  142.         MacZStringFileSpec            mCompareFileSpec;
  143.         MacZStringFileSpec            mDestFileSpec;
  144. };
  145.  
  146. #endif // _H_MacZStringWindow
  147.  
  148.         
  149.  
  150.