/* * ***************************************************************** * * * * * Copyright (c) Fast Corporation, 1997 * * * * * * All Rights Reserved. Unpublished rights reserved under * * * the copyright laws of the Japan. * * * * * * The software contained on this media is proprietary to * * * and embodies the confidential technology of Fast * * * Corporation. Possession, use, duplication or * * * dissemination of the software and media is authorized only * * * pursuant to a valid written license from Fast Corporation. * * * * * ***************************************************************** */ /* CSC90X 背景を黒くした各種文字列表示 BLACKCHR.C */ /*[作成者]H.Yagi */ /* 目的: 関数: 履歴: Ver 1.0 97/09/02 注記:m_menu.hをインクルードして下さい。 m_menu.c及びm_note.cをリンクして下さい。 */ /* * Include compiler runtime library */ #include #include /* * Include CSC90X library */ #include "f_stdlib.h" #include "f_time.h" #include "f_gui.h" #include "f_stdio.h" #include "f_graph.h" #include "f_image.h" #include "f_pinf.h" #include "f_video.h" #include "f_system.h" /* * Include CSC90X common local */ #include "m_menu.h" /* * プロトタイプ宣言 */ void main( void ); void main_menu_disp( void ); void disp_help( void ); void exec( void ); void XXblackback_chrdisp( int, int, char *, int ); void XXblackback_kanjishift( int, int, char *, int, int ); void XXblackback_display_comment( int, int, char *, int ); void XXblackback_display_key( int, int, char *, int, int ); extern int message_note( void ); /* * メニュー項目 */ #define LANG_N 2 #define MAIN_MENU_N 4 static const char *str_main_menu[MAIN_MENU_N][LANG_N] = { { " EXEC ", " デ モ " }, { " PROC2 ", " 処理2 " }, { " PROC3 ", " 処理3 " }, { " PROC4 ", " 処理4 " } }; #define INIT_CUR_POS_X 255 #define INIT_CUR_POS_Y 239 /* * メイン */ void main( void ) { int sts; int xpos; int ypos; int s_xpos; int s_ypos; /* 初期メッセージ表示 */ if( NORMAL_RETURN != message_note() ) return; /* パラメタ初期化 */ xpos = INIT_CUR_POS_X; ypos = INIT_CUR_POS_Y; s_xpos = INIT_CUR_POS_X; s_ypos = INIT_CUR_POS_Y; /* 入力ビデオ制御 */ Lib_input_video_control( GRAY_PLANE ); /* ビデオ出力表示項目制御 */ Lib_display_control( GRAY_PLANE | LINE_PLANE | CHAR_PLANE ); /* ビデオ表示項目クリア */ Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); /* カーソル初期化 */ Lib_init_cursor(); /* メインメニューの表示 */ main_menu_disp(); /* マウスカーソルの表示 */ Lib_draw_cursor( INIT_CUR_POS_X, INIT_CUR_POS_Y ); /* メニュー制御 */ for (;;) { sts = 0; /* マウス位置読みとり */ sts = Lib_see_current_position( &xpos, &ypos ); if ( s_xpos != xpos || s_ypos != ypos ) { /* マウス表示位置移動 */ Lib_move_cursor( xpos, ypos ); s_xpos = xpos; s_ypos = ypos; } /* 処理振り分け */ if( CURSOR_EXECUTE == sts ) { if ( xpos > MENU_1_XS && xpos < MENU_1_XE && ypos > MENU_1_YS && ypos < MENU_1_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); exec( ); /* デモ */ main_menu_disp(); } else if ( xpos > MENU_H_XS && xpos < MENU_H_XE && ypos > MENU_H_YS && ypos < MENU_H_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); disp_help(); /* ヘルプ */ main_menu_disp(); } else if ( xpos > MENU_E_XS && xpos < MENU_E_XE && ypos > MENU_E_YS && ypos < MENU_E_YE ) { break; /* 終了 */ } } } } /* * メインメニュー表示 */ static void main_menu_disp( void ) { int iLanguage; /* 日本語/英語表示文字列切替情報取得 */ iLanguage = Lib_get_disp_language(); /* 整列キー表示 -> ( m_menu.c ) */ SUB_menu_disp4he( (char *)str_main_menu[0][iLanguage], (char *)NULL, (char *)NULL, (char *)NULL ); } /* * ヘルプ表示 */ static void disp_help( void ) { Lib_chrdisp( 10, 8, "【機能\概要】 BLACKCHR" ); Lib_chrdisp( 11, 10, "背景を黒くした各種文字列表\示" ); } /************************************************************************/ /* デモ */ /************************************************************************/ void exec() { static char ss[70]; int xpos, ypos; int type; Lib_sprintf( ss, "FAST Corporation..." ); xpos = 30; ypos = 2; XXblackback_chrdisp( xpos, ypos, ss, GRAPH_DRAW ); /*背景黒くした文字列表示(カラム・行指定)*/ Lib_time_delay( 1000 ); XXblackback_chrdisp( xpos, ypos, ss, GRAPH_ERAS ); /*背景黒くした文字列表示の消去(カラム・行指定)*/ Lib_time_delay( 1000 ); xpos = 100; ypos = 300; XXblackback_kanjishift( xpos, ypos, ss, DOUBLE_FONT, GRAPH_DRAW ); /*背景黒くした文字列表示(座標指定)*/ Lib_time_delay( 1000 ); XXblackback_kanjishift( xpos, ypos, ss, DOUBLE_FONT, GRAPH_ERAS ); /*背景黒くした文字列表示の消去(座標指定)*/ Lib_time_delay( 1000 ); XXblackback_display_comment( xpos, ypos, ss, GRAPH_DRAW ); /*背景黒くした枠つきの文字列表示*/ Lib_time_delay( 1000 ); XXblackback_display_comment( xpos, ypos, ss, GRAPH_ERAS ); /*背景黒くした枠つきの文字列消去*/ Lib_time_delay( 1000 ); type = 2; XXblackback_display_key( xpos, ypos, ss, type, GRAPH_DRAW ); /*背景黒くしたキーの表示*/ Lib_time_delay( 1000 ); XXblackback_display_key( xpos, ypos, ss, type, GRAPH_ERAS ); /*背景黒くしたキーの消去*/ Lib_time_delay( 1000 ); } /************************************************************************/ /* 背景黒くした文字列表示(カラム・行指定) */ /************************************************************************/ void XXblackback_chrdisp( xpos, ypos, string, mode ) int xpos; /*表示カラム(1〜64)*/ int ypos; /*表示行  (1〜30)*/ char *string; /*文字列        */ int mode; /*表示モードGRAPH_DRAW=表示, GRAPH_ERAS=消去*/ { int xs, ys, xe, ye; int len; len = strlen( string ); xs = (xpos - 1)*8; ys = (ypos - 1)*16; xe = xs + len*8; ye = ys + 16; if ( GRAPH_DRAW == mode ) { Lib_view( xs, ys, xe, ye, GRAPH_ERAS ); Lib_chrdisp( xpos, ypos, string ); } else { Lib_view( xs, ys, xe, ye, GRAPH_DRAW ); Lib_box_cls( xs, ys, xe, ye, CHAR_PLANE, BLACK_COLOR ); } } /************************************************************************/ /* 背景黒くした文字列表示(座標指定) */ /************************************************************************/ void XXblackback_kanjishift( xpos, ypos, string, dbl_f, mode ) int xpos; /*X表示座標*/ int ypos; /*Y表示座標*/ char *string; /*文字列  */ int dbl_f; /*倍角表示 */ int mode; /*表示モードGRAPH_DRAW=表示, GRAPH_ERAS=消去*/ { int xs, ys, xe, ye; int xsize; int len; len = strlen( string ); xs = xpos; ys = ypos-16; xe = xs + len*8; ye = ys + 16; xsize = xe - xs + 1; if ( DOUBLE_FONT == dbl_f ) { xe += xsize; ye += 16; } if ( GRAPH_DRAW == mode ) { if ( DOUBLE_FONT == dbl_f ) Lib_kanjishift( NORMAL_FONT, DOUBLE_FONT, 0, xs, ye, string ); else Lib_kanjishift( NORMAL_FONT, NORMAL_FONT, 0, xs, ye, string ); Lib_view( xs, ys, xe, ye, GRAPH_ERAS ); } else { Lib_box_cls( xs, ys, xe, ye, CHAR_PLANE, BLACK_COLOR ); Lib_view( xs, ys, xe, ye, GRAPH_DRAW ); } } /************************************************************************/ /* 背景黒くした枠つきの文字列表示 */ /************************************************************************/ void XXblackback_display_comment( xpos, ypos, string, mode ) int xpos; /*X表示座標*/ int ypos; /*Y表示座標*/ char *string; /*文字列  */ int mode; /*表示モードGRAPH_DRAW=表示, GRAPH_ERAS=消去*/ { int xs, ys, xe, ye; int len; int width, height; len = strlen( string ); Lib_get_key_size( len, &width, &height ); xs = xpos; ys = ypos; xe = xs + width - 1; ye = ys + height - 1; if ( GRAPH_DRAW == mode ) { Lib_view( xs, ys, xe, ye, GRAPH_ERAS ); Lib_display_comment( xpos, ypos, string ); } else { Lib_view( xs, ys, xe, ye, GRAPH_DRAW ); Lib_box_cls( xs, ys, xe, ye, CHAR_PLANE, BLACK_COLOR ); } } /************************************************************************/ /* 背景黒くしたキーの表示 */ /************************************************************************/ void XXblackback_display_key( xpos, ypos, string, type, mode ) int xpos; /*X表示座標*/ int ypos; /*Y表示座標*/ char *string; /*文字列  */ int type; /*表示タイプ*/ int mode; /*表示モードGRAPH_DRAW=表示, GRAPH_ERAS=消去*/ { int xs, ys, xe, ye; int len; int width, height; len = strlen( string ); Lib_get_key_size( len, &width, &height ); xs = xpos; ys = ypos; xe = xs + width - 1; ye = ys + height - 1; if ( GRAPH_DRAW == mode ) { Lib_view( xs, ys, xe, ye, GRAPH_ERAS ); Lib_display_key( xpos, ypos, string, mode ); } else { Lib_view( xs, ys, xe, ye, GRAPH_DRAW ); Lib_box_cls( xs, ys, xe, ye, CHAR_PLANE, BLACK_COLOR ); } }