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 >
Wrap
Text File
|
1995-02-07
|
5KB
|
168 lines
//******************************************************************************
//* *
//* Macintosh プログラム作成の勉強 *
//* This Program is lesson for Macintohs. *
//* *
//* 1994/ 1/26 By SAGAWA KAZUYOSHI *
//* 1994/ 4/26 By SAGAWA KAZUYOSHI *
//* 1994/ 9/20 By SAGAWA KAZUYOSHI *
//* *
//******************************************************************************
/*
* インクルード
*/
#include "Constants.h"
#include "ListPrint.h"
//**************************************************************************
//*
//* 本モジュールの中だけで使用されている関数プロトタイプ宣言
//*
//**************************************************************************
void ListPrint_window_SetUpWindows(void);
void ListPrint_window_SetUpMenus (void);
void ListPrint_window_SetUpTedit (void);
//#########################################################################
//
// FUC 初期配置(配備・組立)
//
// IN 無し
// OT 正常終了 NULL
// 異常終了 NULL以外
// EX CurrentWindow wRecord fontItemNow sizeItemNow tabsItemNow
//
//#########################################################################
int ListPrint_window_SetUp(void)
{
int r;
short fontID; /* フォント */
long sizeID; /* サイズ */
Str255 fontName, sizeName, theString;
r = 1;
ListPrint_window_SetUpWindows(); /* SetUp */
if ( CurrentWindow ) {
GetIndString(theString, tabsFontSTRid, 2); /* 初期項目番号設定 */
fontItemNow = theString[1] & 0x0f; /* 初期値は一桁 */
GetIndString(theString, tabsFontSTRid, 3);
sizeItemNow = theString[1] & 0x0f;
GetIndString(theString, tabsFontSTRid, 4);
tabsItemNow = theString[1] & 0x0f;
ListPrint_window_SetUpMenus(); /* SetUp */
ListPrint_window_SetUpTedit();
ScrollListSetUp();
GetItem(GetMHandle(fontMenuID), fontItemNow, fontName);
GetFNum(fontName, &fontID); /* フォント */
// TextFont(fontID);
CheckFontMenu(fontItemNow);
GetItem(GetMHandle(sizeMenuID), sizeItemNow, sizeName);
StringToNum(sizeName, &sizeID); /* サイズ */
// TextSize( sizeID );
CheckSizeMenu(sizeItemNow);
r = (int)NULL;
}
else {
SysBeep(20),SysBeep(30);
}
return( r );
}
/**************************************************************************
*
* FUC ウィンドウ配置
*
* IN 無し
* OT 無し
* EX CurrentWindow wRecord
*
*************************************************************************/
void ListPrint_window_SetUpWindows(void)
{
SetPort((CurrentWindow = GetNewWindow( windowID, /* */
&wRecord, /* */
(WindowPtr) -1L))); /* */
// masterWindow = CurrentWindow;
}
/**************************************************************************
*
* FUC メニューバー配置
*
* IN 無し
* OT 無し
* EX fontItemNow sizeItemNow tabsItemNow
*
*************************************************************************/
void ListPrint_window_SetUpMenus(void)
{
unsigned char AppMenu[2]; //####Changed for TC6
MenuHandle AppMenuHandle, FileMenuHandle, StyleMenuHandle,
FontMenuHandle, SizeMenuHandle, SourceMenuHandle;
MenuHandle SubMenu;
AppMenu[0] = 1; AppMenu[1] = appleMark;
AppMenuHandle = NewMenu(appleMenuID, AppMenu);
AppendMenu(AppMenuHandle, "¥pabout this program...;-");
AddResMenu(AppMenuHandle, 'DRVR'); /* アップルメニューが作られる */
InsertMenu(AppMenuHandle, 0);
FileMenuHandle = GetMenu(fileMenuID);
InsertMenu(FileMenuHandle, 0);
StyleMenuHandle = GetMenu(styleMenuID);
InsertMenu(StyleMenuHandle, 0);
FontMenuHandle = GetMenu(fontMenuID); /* NewMenu(fontMenuID,"¥pFont") も可能 */
AddResMenu(FontMenuHandle, 'FONT');
InsertMenu(FontMenuHandle, 0);
SizeMenuHandle = GetMenu(sizeMenuID);
AppendMenu(SizeMenuHandle, "¥p9;10;12;14;18;24;");
InsertMenu(SizeMenuHandle, 0);
SourceMenuHandle = GetMenu(sourceMenuID);
InsertMenu(SourceMenuHandle, 0);
/***** 階層化メニュー設定 *****/
SubMenu = GetMenu(fontMenuID), InsertMenu(SubMenu, -1);
SubMenu = GetMenu(sizeMenuID), InsertMenu(SubMenu, -1);
DrawMenuBar();
}
/**************************************************************************
*
* FUC テキストエディット配置
*
* IN 無し
* OT 無し
* EX TEHtab destRect viewRect
*
*************************************************************************/
void ListPrint_window_SetUpTedit(void)
{
char theChar;
viewRect = destRect; // memcpy(&viewRect, &destRect, sizeof(Rect));
InsetRect(&viewRect, 2, 5);
TEHtab = TENew(&destRect, &viewRect);
TEFeatureFlag(teFAutoScr, TEBitSet, TEHtab); /* オートスクロール */
theChar = tabsItemNow + '0';
TEKey(theChar, TEHtab); /* 初期値を設定する */
// TESetText(&theChar, 1, TEHtab); これだと表示位置がずれる
// FrameRect(&destRect); /* 箱を描く */
// TESetSelect(0L, 0L, TEHtab); /* */
// TEActivate(TEHtab); /* */
// InvalRect(&destRect); /* アップデート領域に追加 */
}