/* * ***************************************************************** * * * * * 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 リスト(表形式GUI)のサンプル list_gui.c */ /*[作成者]Y.Hori */ /* 目的:リストGUIのサンプルプログラム 関数: 履歴:Ver 1.0 97/07/3 注記: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 "f_guix.h" #include "f_search.h" /****************************************************************** ** Include CSC90X common local ** ******************************************************************/ #include "m_menu.h" /****************************************************************** ** define 定義 ** ******************************************************************/ #define LANG_N 2 #define MAIN_MENU_N 4 #define INIT_CUR_POS_X 255 #define INIT_CUR_POS_Y 239 #define CELL_NUM_X 4 #define CELL_NUM_Y 13 #define CELL_1PAGE_NUM_Y 4 /****************************************************************** ** プロトタイプ宣言 ** ******************************************************************/ void main ( void ); void main_menu_disp ( void ); void disp_help ( void ); extern int message_note( void ); static void exec_list1 ( void ); void fnTitle ( void ); void fnCell ( int, int, int ); /****************************************************************** ** メニュー項目 ** ******************************************************************/ static const char *str_main_menu[MAIN_MENU_N][LANG_N] = { { " EXEC ", " 試 行 " } }; /****************************************************************** ** メイン ** ******************************************************************/ void main( void ) { int sts; int xpos; int ypos; int s_xpos; int s_ypos; PRIVATE WORD wXs, wYs, wXe, wYe; /* 初期メッセージ表示 */ 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(); Lib_get_stage_window( &wXs, &wYs, &wXe, &wYe ); /* メインメニューの表示 */ 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_list1( ); /* * 処理1の呼出し */ Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); main_menu_disp(); } else if ( xpos > MENU_2_XS && xpos < MENU_2_XE && ypos > MENU_2_YS && ypos < MENU_2_YE ) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); /* * 処理2の呼出し */ Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); 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; /* 終了 */ } } } Lib_set_stage_window( wXs, wYs, wXe, wYe ); } /****************************************************************** ** メインメニュー表示 ** ******************************************************************/ 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( 8, 8, "【機能\概要】 LIST_GUI" ); Lib_chrdisp( 9, 10, "このプログラムは、表\形式GUIのサンプルプログラムです。" ); Lib_chrdisp( 9, 11, "機能\は特にありません"); Lib_chrdisp( 9, 12, "セルをクリックした場合とタイトルを右クリック時にメッ"); Lib_chrdisp( 9, 13, "セージが表\示されます。ただし、セルの1行目はクリック"); Lib_chrdisp( 9, 14, "しても、なにも表\示されません。"); } /****************************************************************** ** 試行 ** ******************************************************************/ static void exec_list1( void ) { int wList_id; int wCell_size_x[CELL_NUM_X]; int wCell_size_y; int wCell_size_x2; int i, j; int wPage, wY; char str[64]; if( -1 != ( wList_id = Lib_list_open( )) ) { /* セルサイズの設定 */ Lib_get_standard_key_size( &wCell_size_x2, &wCell_size_y ); for( i = 0; i < CELL_NUM_X; i++ ) wCell_size_x[i] = wCell_size_x2; /* セルサイズ、横 */ wCell_size_y = wCell_size_y; /* セルサイズ、縦 */ /* リストのサイズ設定 */ if( NORMAL_RETURN == Lib_list_set_size( wList_id, 40, 40, wCell_size_x, wCell_size_y, CELL_NUM_X, CELL_NUM_Y, CELL_1PAGE_NUM_Y )) { /* リストタイトル設定 */ Lib_list_set_title( wList_id, "サンプルプログラム", fnTitle ); /* セルの登録 */ for( j = 0; j < CELL_NUM_Y; j++ ) { for( i = 0; i < CELL_NUM_X; i++ ) { if( j == 0 ) { Lib_sprintf( str, "%d列目", i ); Lib_list_set_null( wList_id, i, j, str, NULL ); } else { wPage = ( j - 1 ) / CELL_1PAGE_NUM_Y + 1; wY = j - ( wPage - 1 ) * CELL_1PAGE_NUM_Y; Lib_sprintf( str, "p.%d, (%d,%d)", wPage, i, wY ); Lib_list_set_null( wList_id, i, j, str, fnCell ); } } } /* リスト表示ページの設定 */ Lib_list_set_start_page( wList_id, 1 ); /* リストの表示と制御 */ if( NORMAL_RETURN != Lib_list_draw( wList_id ) ) Lib_display_message( 70, 150, "エラー", "異常終了しました" ); } else Lib_display_message( 150, 150, "エラー", "異常終了しました" ); Lib_list_close( wList_id ); } } /****************************************************************** ** タイトルが右クリックされた場合 ** ******************************************************************/ void fnTitle( ) { Lib_display_message( 100, 150, "確認", "タイトルがクリックされました" ); } /****************************************************************** ** セルがクリックされた場合 ** ******************************************************************/ void fnCell( int wCursorStatus, int wRow, int wColumn ) { int wPage; int wY; char str[64]; wPage = (wColumn - 1 ) / CELL_1PAGE_NUM_Y + 1; wY = wColumn - ( wPage - 1 ) * CELL_1PAGE_NUM_Y; Lib_sprintf( str, "%dページ目 セル位置(%d, %d)", wPage, wRow, wY ); Lib_display_message( 100, 150, "確認", str ); }