home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / ListPrint.sit / ListPrint / windows.c < prev    next >
Text File  |  1995-02-07  |  5KB  |  168 lines

  1. //******************************************************************************
  2. //*                                            *
  3. //*    Macintosh プログラム作成の勉強                    *
  4. //*    This Program is lesson for Macintohs.                    *
  5. //*                                            *
  6. //*    1994/ 1/26 By SAGAWA KAZUYOSHI                        *
  7. //*    1994/ 4/26 By SAGAWA KAZUYOSHI                        *
  8. //*    1994/ 9/20 By SAGAWA KAZUYOSHI                        *
  9. //*                                            *
  10. //******************************************************************************
  11. /*
  12.  *    インクルード
  13.  */
  14. #include    "Constants.h"
  15. #include    "ListPrint.h"
  16.  
  17.  
  18. //**************************************************************************
  19. //*
  20. //*    本モジュールの中だけで使用されている関数プロトタイプ宣言
  21. //*
  22. //**************************************************************************
  23. void    ListPrint_window_SetUpWindows(void);
  24. void    ListPrint_window_SetUpMenus    (void);
  25. void    ListPrint_window_SetUpTedit    (void);
  26.  
  27.  
  28. //#########################################################################
  29. //
  30. //    FUC    初期配置(配備・組立)
  31. //
  32. //    IN    無し
  33. //    OT    正常終了    NULL
  34. //        異常終了    NULL以外
  35. //    EX    CurrentWindow wRecord fontItemNow sizeItemNow tabsItemNow
  36. //
  37. //#########################################################################
  38. int    ListPrint_window_SetUp(void)
  39. {
  40.     int    r;
  41.     short    fontID;                        /* フォント            */
  42.     long    sizeID;                        /* サイズ            */
  43.     Str255    fontName, sizeName, theString;
  44.  
  45.     r = 1;
  46.     ListPrint_window_SetUpWindows();            /* SetUp */
  47.     if ( CurrentWindow ) {
  48.         GetIndString(theString, tabsFontSTRid, 2);    /* 初期項目番号設定        */
  49.         fontItemNow = theString[1] & 0x0f;        /* 初期値は一桁        */
  50.         GetIndString(theString, tabsFontSTRid, 3);
  51.         sizeItemNow = theString[1] & 0x0f;
  52.         GetIndString(theString, tabsFontSTRid, 4);
  53.         tabsItemNow = theString[1] & 0x0f;
  54.  
  55.         ListPrint_window_SetUpMenus();        /* SetUp */
  56.         ListPrint_window_SetUpTedit();
  57.         ScrollListSetUp();
  58.  
  59.         GetItem(GetMHandle(fontMenuID), fontItemNow, fontName);
  60.         GetFNum(fontName, &fontID);            /* フォント            */
  61. //        TextFont(fontID);    
  62.         CheckFontMenu(fontItemNow);
  63.  
  64.         GetItem(GetMHandle(sizeMenuID), sizeItemNow, sizeName);
  65.         StringToNum(sizeName, &sizeID);        /* サイズ            */
  66. //        TextSize( sizeID );    
  67.         CheckSizeMenu(sizeItemNow);
  68.  
  69.         r = (int)NULL;
  70.     }
  71.     else {
  72.         SysBeep(20),SysBeep(30);
  73.     }
  74.     return( r );
  75. }
  76.  
  77. /**************************************************************************
  78.  *
  79.  *    FUC    ウィンドウ配置
  80.  *
  81.  *    IN    無し
  82.  *    OT    無し
  83.  *    EX    CurrentWindow wRecord
  84.  *
  85.  *************************************************************************/
  86. void    ListPrint_window_SetUpWindows(void)
  87. {
  88.     SetPort((CurrentWindow = GetNewWindow( windowID,        /* */
  89.                                              &wRecord,        /* */
  90.                                              (WindowPtr) -1L)));    /* */
  91.  
  92. //    masterWindow = CurrentWindow;
  93. }
  94.  
  95. /**************************************************************************
  96.  *
  97.  *    FUC    メニューバー配置
  98.  *
  99.  *    IN    無し
  100.  *    OT    無し
  101.  *    EX    fontItemNow sizeItemNow tabsItemNow
  102.  *
  103.  *************************************************************************/
  104. void    ListPrint_window_SetUpMenus(void)
  105. {
  106.     unsigned char    AppMenu[2];    //####Changed for TC6
  107.     MenuHandle    AppMenuHandle,  FileMenuHandle, StyleMenuHandle,
  108.             FontMenuHandle, SizeMenuHandle, SourceMenuHandle;
  109.     MenuHandle    SubMenu;
  110.  
  111.     AppMenu[0] = 1;    AppMenu[1] = appleMark;
  112.     AppMenuHandle = NewMenu(appleMenuID, AppMenu);
  113.     AppendMenu(AppMenuHandle, "¥pabout this program...;-");
  114.     AddResMenu(AppMenuHandle, 'DRVR');        /* アップルメニューが作られる        */
  115.     InsertMenu(AppMenuHandle, 0);
  116.  
  117.     FileMenuHandle = GetMenu(fileMenuID);
  118.     InsertMenu(FileMenuHandle, 0);
  119.  
  120.     StyleMenuHandle = GetMenu(styleMenuID);
  121.     InsertMenu(StyleMenuHandle, 0);
  122.  
  123.     FontMenuHandle = GetMenu(fontMenuID);    /* NewMenu(fontMenuID,"¥pFont") も可能    */
  124.     AddResMenu(FontMenuHandle, 'FONT');
  125.     InsertMenu(FontMenuHandle, 0);
  126.  
  127.     SizeMenuHandle = GetMenu(sizeMenuID);
  128.     AppendMenu(SizeMenuHandle, "¥p9;10;12;14;18;24;");
  129.     InsertMenu(SizeMenuHandle, 0);
  130.  
  131.     SourceMenuHandle = GetMenu(sourceMenuID);
  132.     InsertMenu(SourceMenuHandle, 0);
  133.  
  134.     /*****        階層化メニュー設定            *****/
  135.         SubMenu = GetMenu(fontMenuID),    InsertMenu(SubMenu, -1);
  136.         SubMenu = GetMenu(sizeMenuID),    InsertMenu(SubMenu, -1);
  137.  
  138.     DrawMenuBar();
  139. }
  140.  
  141. /**************************************************************************
  142.  *
  143.  *    FUC    テキストエディット配置
  144.  *
  145.  *    IN    無し
  146.  *    OT    無し
  147.  *    EX    TEHtab destRect viewRect 
  148.  *
  149.  *************************************************************************/
  150. void    ListPrint_window_SetUpTedit(void)
  151. {
  152.     char    theChar;
  153.  
  154.     viewRect    = destRect;    // memcpy(&viewRect, &destRect, sizeof(Rect));
  155.     InsetRect(&viewRect, 2, 5);
  156.     TEHtab        = TENew(&destRect, &viewRect);
  157.     TEFeatureFlag(teFAutoScr, TEBitSet, TEHtab);        /* オートスクロール    */
  158.  
  159.     theChar = tabsItemNow + '0';
  160.     TEKey(theChar, TEHtab);                /* 初期値を設定する        */
  161. //    TESetText(&theChar, 1, TEHtab);              これだと表示位置がずれる
  162.  
  163. //    FrameRect(&destRect);        /* 箱を描く    */
  164. //    TESetSelect(0L, 0L, TEHtab);    /* */
  165. //    TEActivate(TEHtab);        /* */
  166. //    InvalRect(&destRect);        /* アップデート領域に追加    */
  167. }
  168.