/* * ***************************************************************** * * * * * 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 保存画像一覧 IMAGLIST.C */ /*[作成者]H.Yagi */ /* 目的: 関数: 履歴: Ver 1.0 99/08/18 注記: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_affine.h" #include "f_gray.h" #include "f_file.h" /* * Include CSC90X common local */ #include "m_menu.h" /* * プロトタイプ宣言 */ void main( void ); void main_menu_disp( void ); void disp_help( void ); void exec( void ); int select_imag_load( int ); static void disp_fname( int, char *, int, int, int ); static void disp_page_cnt_menu( void ); static void page_change( int, int, int, int *, char *, int, int, int *, int *, int *, int *, 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] = { { "IMAG LIST ", " 画像一覧 " }, { " 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(); /*試行*/ 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; /* 終了 */ } } } } /* * メインメニュー表示 */ 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, "【機能\概要】        IMAGLIST" ); Lib_chrdisp( 11, 10, "保存されている画像を一覧表\示します。" ); Lib_chrdisp( 11, 12, "FS0ディレクトリ上にあるファイルでサイズが" ); Lib_chrdisp( 11, 14, "245760バイトのものを512×480画像とみなします。" ); Lib_chrdisp( 11, 16, "1ページに16画像を表\示します。" ); Lib_chrdisp( 11, 18, "読み込める画像枚数は確保中のグレイメモリ枚数" ); Lib_chrdisp( 11, 20, "に依存します。GRAYMEM0.SYSのみ確保している場" ); Lib_chrdisp( 11, 22, "合は最大224ファイルまで処理できます。" ); } /************************************************************************/ /* 試行 */ /************************************************************************/ void exec() { int mem_no; Lib_freeze( NOT_TRANSMIT ); mem_no = 0; if ( ERROR_RETURN == select_imag_load( mem_no )) /*一覧から選択して画像読み込み*/ { Lib_display_message( 70, 200, "エラー", "画像ファイルがありません" ); } } /************************************************************************/ /* 一覧から選択して画像読み込み */ /************************************************************************/ #define IMAG_SIZE (512*480) /*対象画像サイズ */ #define DIVIDE_X 4 /*分割数X */ #define DIVIDE_Y 4 /*分割数Y */ #define IMAG_NUM_PER_PAGE 16 /*1ページ表示画像数 */ #define FNBUFF_SIZE 13 /*ファイル名バッファサイズ */ #define BACK_MENU_X 450 /*[前頁]ボタン表示位置X */ #define BACK_MENU_YS 0 /*[前頁]ボタン表示位置YS */ #define BACK_MENU_YE 22 /*[前頁]ボタン表示位置YE */ #define NEXT_MENU_X 480 /*[次頁]ボタン表示位置X */ #define NEXT_MENU_YS 0 /*[次頁]ボタン表示位置YS */ #define NEXT_MENU_YE 22 /*[次頁]ボタン表示位置YE */ int select_imag_load( memory_no ) int memory_no; /*入力:画像を読み込むグレイメモリNo*/ /*戻り値:NORMAL_RETURN 正常終了  ERROR_RETURN 異常終了(メモリ不足または画像ファイルがありません) */ { int i; char ss[30]; int status; int mem_no[MAX_NUBER_OF_FRAME_MEMORY]; int file_num; char fname[FNBUFF_SIZE]; char fname_tbl[IMAG_NUM_PER_PAGE*14][FNBUFF_SIZE]; int size, read, write, random; int imag_count; int block_x, block_y; int x, y; int sts; int xpos; int ypos; int s_xpos; int s_ypos; int select_pos, s_select_pos; /*0〜15*/ int page; /*1〜14*/ int yuko_page; int alloc_cnt; /* グレイメモリ確保 */ mem_no[0] = Lib_alloc_gray_memory(); if ( ERROR_RETURN == mem_no[0] ) { Lib_display_message( 70, 200, "グレイメモリ アロケーションエラー(1)", "処理打ち切り" ); return( ERROR_RETURN ); } else { Lib_gray_memory_cls( mem_no[0] ); alloc_cnt=1; } mem_no[1] = Lib_alloc_gray_memory(); if ( ERROR_RETURN == mem_no[1] ) { Lib_display_message( 70, 200, "グレイメモリ アロケーションエラー(2)", "処理打ち切り" ); Lib_free_gray_memory( mem_no[0] ); return( ERROR_RETURN ); } else { Lib_gray_memory_cls( mem_no[1] ); alloc_cnt++; } Lib_chrdisp( 1, 30, "画像を検索中..." ); Lib_erase_cursor(); Lib_display_control( LINE_PLANE | CHAR_PLANE ); imag_count=0; page=1; /*一覧ページ(1 〜 MAX14ページ)*/ block_x = Lib_get_dx_size()/DIVIDE_X; block_y = Lib_get_dy_size()/DIVIDE_Y; file_num = Lib_get_reg_files( "FS0" ); for( i=0; i BACK_MENU_X && xpos < NEXT_MENU_X && ypos > BACK_MENU_YS && ypos < BACK_MENU_YE ) /*前*/ { if ( 1 < page ) { page--; page_change( page, yuko_page, imag_count, mem_no, &fname_tbl[0][0], block_x, block_y, &xpos, &ypos, &s_xpos, &s_ypos, &select_pos, &s_select_pos ); } } else if ( xpos > NEXT_MENU_X && xpos < Lib_get_dx_size() && ypos > NEXT_MENU_YS && ypos < NEXT_MENU_YE ) /*次*/ { if ( page < yuko_page ) { page++; page_change( page, yuko_page, imag_count, mem_no, &fname_tbl[0][0], block_x, block_y, &xpos, &ypos, &s_xpos, &s_ypos, &select_pos, &s_select_pos ); } } else /*画像*/ { if ( select_pos+1 <= ( imag_count - IMAG_NUM_PER_PAGE*(page-1) )) { Lib_memory_clear( LINE_PLANE | CHAR_PLANE ); Lib_sprintf( ss, "%s", "\\FS0\\" ); strcat( ss, &fname_tbl[IMAG_NUM_PER_PAGE*(page-1) + select_pos][0] ); Lib_load_gray_memory( memory_no, ss ); /*画像読み込み*/ Lib_xvideo_transmit( memory_no, GRAY_PLANE ); /*選択画像表示*/ Lib_chrdisp( 1, 1, &fname_tbl[IMAG_NUM_PER_PAGE*(page-1) + select_pos][0] ); /*選択したファイル名表示*/ if( PAD_EXECUTE == Lib_display_message2( 100, 100, "確認", "よければ[実行]を押下" ) ) { status = NORMAL_RETURN; break; } else { page_change( page, yuko_page, imag_count, mem_no, &fname_tbl[0][0], block_x, block_y, &xpos, &ypos, &s_xpos, &s_ypos, &select_pos, &s_select_pos ); } } } } } } else status = ERROR_RETURN; for( i=0; i