home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / powervww / pvstddlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-05  |  19.5 KB  |  877 lines

  1. //  ____________________________________________________
  2. // |                                                    |
  3. // |  Project:     POWER VIEW INTERFACE                 |
  4. // |  File:        PVSTDDLG.CPP                         |
  5. // |  Compiler:    WPP386 (10.6)                        |
  6. // |                                                    |
  7. // |  Subject:     Standard dialog boxes implementation |
  8. // |                                                    |
  9. // |  Author:      Emil Dotchevski                      |
  10. // |____________________________________________________|
  11. //
  12. // E-mail: zajo@geocities.com
  13. // URL:    http://www.geocities.com/SiliconValley/Bay/3577
  14.  
  15. #define uses_fcntl
  16. #define uses_stdarg
  17. #define uses_stdio
  18. #define uses_string
  19. #define uses_app
  20. #define uses_desk
  21. #define uses_dialog
  22. #define uses_help
  23. #define uses_icons
  24. #define uses_input
  25. #define uses_stddlg
  26. #define uses_system
  27. #define uses_txt
  28.  
  29. #define DECLARE_PVSTDDLG
  30. #include "PVuses.h"
  31. #undef DECLARE_PVSTDDLG
  32.  
  33. #define _ICON_NOTHING   1
  34. #define _ICON_WARNING   2
  35. #define _ICON_QUESTION  3
  36. #define _ICON_INFO      4
  37.  
  38. uint test_file_exist( char *path )
  39. {
  40.   int handle;
  41.   if( !_dos_open( path, O_RDONLY, &handle ) )
  42.   {
  43.     char s[_MAX_PATH];
  44.     _dos_close( handle );
  45.     strcpy( s, path );
  46.     fexpand( s ); min_path( s ); short_path( s, 29 );
  47.     _iwarning();
  48. #ifdef CYR
  49.     return ync( "éÑ╖Ñ ▒║╣Ñ▒▓ó│óá ┤á⌐½ %s.\n\nçá¼┐¡á ¡á ▒║╣Ñ▒▓ó│óá╣¿┐ ┤á⌐½?", s );
  50. #else
  51.     return ync( "File %s already exists.\n\nReplace existing file?", s );
  52. #endif
  53.   }
  54.   return 0;
  55. }
  56.  
  57. //OPEN FILE DIALOG
  58.  
  59. static char dir[_MAX_DIR+_MAX_DRIVE];
  60. static char filter[_MAX_FNAME];
  61. static Tlist_box *files=NULL;
  62. static Tlist_box *dirs;
  63. static Tcombo_box *filters;
  64. static Tcombo_box *drives;
  65. static Tinput *item_name;
  66. static Tdtext *show_dir;
  67. static Tdtext *show_info;
  68. static boolean new_file_fl;
  69. static boolean overflow;
  70.  
  71. struct Tfile_rec
  72. {
  73.   char attr;
  74.   uint time;
  75.   uint date;
  76.   long size;
  77. };
  78.  
  79. static void get_info_str( Tfile_rec &d, char *result )
  80. {
  81.   char m[14];
  82.   uint year;
  83.   char month, day, hours, minutes, seconds;
  84. #ifndef CYR
  85.   char *am;
  86. #endif
  87.  
  88.   if( d.attr & _A_SUBDIR )
  89. #ifdef CYR
  90.     strcpy( result, "ÅỬᠠ  " );
  91. #else
  92.     strcpy( result, "Directory" );
  93. #endif
  94.   else
  95.     sprintf( result, "%-9lu", d.size );
  96.   unpack_time( d.time, hours, minutes, seconds );
  97.   unpack_date( d.date, year, month, day );
  98.   if( month ) month--;
  99.   memcpy( m, months[month], 3 ); m[3] = 0;
  100. #ifdef CYR
  101.   sprintf( result + 9, " %2d %s, %4d %2d:%02d", day, m, year, hours, minutes );
  102. #else
  103.   if( hours < 12 )
  104.     am = "am";
  105.   else
  106.   {
  107.     am = "pm";
  108.     hours -= 12;
  109.   }
  110.   if( !hours ) hours = 12;
  111.   sprintf( result + 9, " %s %2d, %4d %2d:%02d%s", m, day, year, hours, minutes, am );
  112. #endif
  113. }
  114.  
  115. static void file_change( void )
  116. {
  117.   char s[_MAX_PATH], *p;
  118.   int i;
  119.   Tfile_rec d;
  120.  
  121.   if( !files->vcount ) return;
  122.   files->gettxt( files->vcurrent, s );
  123.   item_name->set_txt( s );
  124.   files->getdata( files->vcurrent, &d );
  125.   p  = strchr( s, 0 );
  126.   for( i = 0; i < ( _MAX_FNAME + _MAX_EXT ); i++ )
  127.     *(p++) = ' ';
  128.   get_info_str( d, s + _MAX_FNAME + _MAX_EXT );
  129.   show_info->set_txt( s );
  130. }
  131.  
  132. static void dir_change( void )
  133. {
  134.   char s[_MAX_PATH], r[_MAX_PATH], *p;
  135.   int i;
  136.   Tfile_rec d;
  137.  
  138.   if( !dirs->vcount ) return;
  139.   dirs->gettxt( dirs->vcurrent, s );
  140.   sprintf( r, "%s\\%s", s, filter );
  141.   item_name->set_txt( r );
  142.   dirs->getdata( dirs->vcurrent, &d );
  143.   p  = strchr( s, 0 );
  144.   for( i = 0; i < ( _MAX_FNAME + _MAX_EXT ); i++ )
  145.     *(p++) = ' ';
  146.   get_info_str( d, s + _MAX_FNAME + _MAX_EXT );
  147.   show_info->set_txt( s );
  148. }
  149.  
  150. static void reread( void )
  151. {
  152.   struct find_t dir_info;
  153.   char tmp_drive[_MAX_DRIVE];
  154.   char tmp_path[_MAX_PATH];
  155.   char tmp_name[_MAX_FNAME];
  156.   char tmp_ext[_MAX_EXT];
  157.   char path[_MAX_PATH];
  158.   char *p;
  159.   int done;
  160.   uint index;
  161.   Tfile_rec fd;
  162.  
  163.   item_name->get_txt( path );
  164.   while( ( p = strchr( path, ' ' ) ) != NULL )
  165.     strcpy( p, p+1 );
  166.   if( ( *path == 0 ) || ( ( path[0] != '\\' ) && ( path[1] != ':' ) ) )
  167.   {
  168.     strcpy( tmp_path, path );
  169.     strcpy( path, dir );
  170.     strcat( path, tmp_path );
  171.   }
  172.   fexpand( path );
  173.   _splitpath( path, tmp_drive, dir, tmp_name, tmp_ext );
  174.   if( ( *tmp_name != 0 ) || ( *tmp_ext != 0 ) )
  175.   {
  176.     strcpy( filter, tmp_name );
  177.     strcat( filter, tmp_ext );
  178.   }
  179.   strcpy( path, tmp_drive );
  180.   strcat( path, dir );
  181.   strcat( path, filter );
  182.   short_path( path, 48 );
  183.   show_dir->set_txt( path );
  184.   strcpy( path, dir );
  185.   strcpy( dir, tmp_drive );
  186.   strcat( dir, path );
  187.   strcpy( path, filter );
  188.   item_name->set_txt( path );
  189.   show_info->set_txt( "" );
  190.   for( ;; )
  191.   {
  192.     strcpy( tmp_path, dir );
  193.     strcat( tmp_path, filter );
  194.     files->clear();
  195.     critical_error();
  196.     for( done=_dos_findfirst(tmp_path,_A_NORMAL,&dir_info);
  197.          !done;
  198.          done=_dos_findnext(&dir_info) )
  199.     {
  200.       fd.attr = dir_info.attrib;
  201.       fd.time = dir_info.wr_time;
  202.       fd.date = dir_info.wr_date;
  203.       fd.size = dir_info.size;
  204.       _ldata( &fd ); files->add( dir_info.name );
  205.     }
  206.     files->sort();
  207.     files->top();
  208.     if( files->overflow ) overflow = 1;
  209.  
  210.     strcpy( tmp_path, dir );
  211.     strcat( tmp_path, "*.*" );
  212.     dirs->clear();
  213.     for( done=_dos_findfirst(tmp_path,_A_SUBDIR,&dir_info);
  214.          !done;
  215.          done=_dos_findnext(&dir_info) )
  216.       if( ( strcmp( dir_info.name, "." ) && ( dir_info.attrib & _A_SUBDIR ) ) )
  217.       {
  218.         fd.attr = dir_info.attrib;
  219.         fd.time = dir_info.wr_time;
  220.         fd.date = dir_info.wr_date;
  221.         fd.size = dir_info.size;
  222.         _ldata( &fd ); dirs->add( dir_info.name );
  223.       }
  224.     dirs->sort();
  225.     dirs->top();
  226.     if( dirs->overflow ) overflow = 1;
  227.  
  228.     sprintf( tmp_path, "[-%c-]", tmp_drive[0] );
  229.     if( ( index = drives->findft( tmp_path ) ) != (uint) -1 )
  230.       drives->set_data( index );
  231.     if( done!=18 )
  232.       if( critical_error() )
  233.       {
  234.         files->clear();
  235.         dirs->clear();
  236.         if( drive_error( tmp_drive[0] ) ) continue;
  237.       }
  238.       else
  239.       {
  240.         _terror();
  241.         ok( "Cant read disk directory.\n\n(Does such directory exist?)" );
  242.       }
  243.     break;
  244.   }
  245.   if( current() == dirs )
  246.     dir_change();
  247.   else
  248.     if( current() == files )
  249.       file_change();
  250.     else
  251.       focus( files );
  252.   modal_broadcast( cmDLG_RESET );
  253. }
  254.  
  255. static void open_file_handler( Titem *p )
  256. {
  257.   char s[_MAX_PATH], *n;
  258.  
  259.   if( p == files )
  260.     file_change();
  261.   else
  262.     if( p == dirs )
  263.       dir_change();
  264.     else
  265.       if( p == drives )
  266.       {
  267.         drives->get_data( s );
  268.         *dir = s[2];
  269.         strcpy( dir+1, ":\\" );
  270.         item_name->set_txt( "" );
  271.         reread();
  272.       }
  273.       else
  274.         if( p == filters )
  275.         {
  276.           filters->get_data( s );
  277.           n = strchr( s, '(' ) + 1;
  278.           *strchr( n, ')' ) = 0;
  279.           item_name->set_txt( n );
  280.           reread();
  281.         }
  282. }
  283.  
  284. static boolean open_file_validator( uint x )
  285. {
  286.   char path[_MAX_PATH];
  287.   char tmp_drive[_MAX_DRIVE];
  288.   char tmp_dir[_MAX_DIR];
  289.   char tmp_name[_MAX_FNAME];
  290.   char tmp_ext[_MAX_EXT];
  291.   char *l;
  292.   uint xx;
  293.  
  294.   switch( x )
  295.   {
  296.     case cmVALID:
  297.       return !overflow;
  298.     case cmOK:
  299.       item_name->get_txt( path );
  300.       l = strchr( path, 0 );
  301.       if( *(l - 1) == ':' )
  302.       {
  303.         *(l++) = '\\';
  304.         *l = 0;
  305.       }
  306.       if( ( strchr( path, '*') == NULL ) && ( strchr( path, '?' ) == NULL ) && ( *( strchr( path, 0 ) - 1 ) != '\\' ) )
  307.       {
  308.         _splitpath( path, tmp_drive, tmp_dir, tmp_name, tmp_ext );
  309.         if( !*tmp_dir && !*tmp_drive )
  310.         {
  311.           strcpy( tmp_dir, dir+2 );
  312.           *tmp_drive = *dir;
  313.         }
  314.         if( !*tmp_ext ) strcpy( tmp_ext, strchr( filter, '.' ) );
  315.         if( ( strchr( tmp_ext, '*' ) != NULL ) || ( strchr( tmp_ext, '?' ) != NULL ) ) strcpy( tmp_ext, "." );
  316.         _makepath( path, tmp_drive, tmp_dir, tmp_name, tmp_ext );
  317.         fexpand( path );
  318.         if( new_file_fl && (xx=test_file_exist(path)) )
  319.         {
  320.           if( xx == cmCANCEL ) *path = 0;
  321.           item_name->set_txt( path );
  322.           if( xx != cmNO ) return 1;
  323.           focus( item_name );
  324.           return 0;
  325.         }
  326.         item_name->set_txt( path );
  327.       }
  328.       else
  329.       {
  330.         item_name->set_txt( path );
  331.         reread();
  332.         return 0;
  333.       }
  334.   }
  335.   return 1;
  336. }
  337.  
  338. uint get_file( char *title, char *result )
  339. {
  340.   unsigned drive_svd, maxdrives;
  341.   uint i;
  342.   char s[_MAX_PATH], *p, *f;
  343.   char path[_MAX_PATH];
  344.   uint i_files, i_dirs, i_filters, i_drives;
  345.   char *dir_svd;
  346.   uint *filter_svd;
  347.  
  348.   if( files!=NULL )
  349.   {
  350.   qqq:
  351.     while( files->vcount && !files->checked(0) ) files->del(0);
  352.     if( !files->vcount )
  353.     {
  354.       DELETE(files); files=NULL;
  355.       return 0;
  356.     }
  357.     else
  358.     {
  359.       strcpy( result, dir );
  360.       files->gettxt( 0, strchr(result,0) );
  361.       files->del(0);
  362.       return 1;
  363.     }
  364.   }
  365.   __get_file_svd( &dir_svd, &filter_svd );
  366.   i_filters = 0; i_drives = 0; i_dirs = 0; i_files = 0;
  367.   overflow = 0;
  368.   new_file_fl = __new_file();
  369. #ifndef NOHELP
  370.   _help( htD_SELECT_FILE );
  371. #endif
  372.   dialog( title );
  373.   hspacing( 1 );
  374.   handler( open_file_handler ); validator( open_file_validator );
  375.   *path = 0;
  376.   _focused();
  377. #ifndef NOHIST
  378.   _history( ( dir_svd == NULL )? get_file : (void *) dir_svd );
  379. #endif
  380. #ifdef CYR
  381.   item_name = input( "|~ê¼Ñ:", path, 79, 26 );
  382.   filters = combo_box( "|~Æ¿»:", i_filters, 27 );
  383. #else
  384.   item_name = input( "|~Name: ", path, 79, 24 );
  385.   filters = combo_box( "|~Types:", i_filters, 25 );
  386. #endif
  387.   push();
  388.   i = desktop->yl/3+1;
  389.   _lsize( sizeof( Tfile_rec ) );
  390. #ifdef CYR
  391.   _lsize( sizeof( Tfile_rec ) );
  392.   files = list_box( "|~öá⌐½«óÑ", i_files, 12, i );
  393.   nc();
  394.   _lsize( sizeof( Tfile_rec ) );
  395.   dirs = list_box( "|~ä¿░Ѭ▓«░¿¿", i_dirs, 12, i - 2 );
  396.   drives = combo_box( "  ä¿|~▒¬:", i_drives, 5 );
  397. #else
  398.   _lsize( sizeof( Tfile_rec ) );
  399.   files = list_box( "|~Files", i_files, 12, i );
  400.   nc();
  401.   _lsize( sizeof( Tfile_rec ) );
  402.   dirs = list_box( "|~Directories", i_dirs, 12, i - 2 );
  403.   drives = combo_box( "Dri|~ves:", i_drives, 5 );
  404. #endif
  405.   files->set_flags( ifSTAY, 1 );
  406.   files->set_flags( lfMULTIPLY_SELECTION, __multi_files() );
  407.   _dos_getdrive( &drive_svd );
  408.   _dos_setdrive( 3, &maxdrives);
  409.   for( unsigned n = 0; n < 26; n++ )
  410.   {
  411.     unsigned drv;
  412.  
  413.     _dos_setdrive( n, &maxdrives );
  414.     _dos_getdrive( &drv );
  415.     if( drv == n )
  416.     {
  417.       sprintf( s, "[-%c-]", drv + ( 'A' - 1 ) );
  418.       drives->add( s );
  419.     }
  420.   }
  421.   _dos_setdrive( drive_svd, &maxdrives );
  422.   drives->top();
  423.   drives->combo->open_yl = drives->vcount;
  424.   pop();
  425.   nc();
  426. #ifdef CYR
  427.   kbutton( " Ä'¬Ñ⌐ " );
  428.   cbutton( " Ä▓¬áº " );
  429.   hbutton( " Å«¼«╣ " );
  430. #else
  431.   kbutton( "  OK  " );
  432.   cbutton( "Cancel" );
  433.   hbutton( " Help " );
  434. #endif
  435.   nl();
  436.   _tselected(); show_dir  = dtext( 46,1 );
  437.   _tselected(); show_info = dtext( 46,1 );
  438.   f = __filters();
  439.   if( f != NULL )
  440.   {
  441.     f--;
  442.     do
  443.     {
  444.       f++;
  445.       p = s;
  446.       while( *f && ( *f != '|' ) ) *(p++) = *(f++);
  447.       *p = 0;
  448.       filters->add( s );
  449.     }
  450.     while( *f );
  451.   }
  452. #ifdef CYR
  453.   filters->add( "é▒¿╖¬¿ ┤á⌐½«óÑ (*.*)" );
  454. #else
  455.   filters->add( "Any file (*.*)" );
  456. #endif
  457.   filters->set_data( 0 );
  458.   filters->gettxt( 0, s );
  459.   if( filter_svd != NULL )
  460.   {
  461.     filters->set_data( *filter_svd );
  462.     filters->gettxt( *filter_svd, s );
  463.   }
  464.   p = strchr( s, '(' ) + 1; *strchr( p, ')' ) = 0;
  465.   item_name->set_txt( p );
  466.  
  467.   *dir = 0;
  468.   if( dir_svd != NULL ) strcpy( dir, dir_svd );
  469.   reread();
  470.   if( run()==cmOK && *path )
  471.   {
  472.     if( dir_svd != NULL ) min_path( strcpy( dir_svd, dir ) );
  473.     if( filter_svd != NULL ) *filter_svd = filters->cursor();
  474.     for( int q=0; q<files->vcount; q++ )
  475.       if( files->checked(q) ) goto qqq;
  476.     strcpy( result, fexpand(path) );
  477.     DELETE(files); files=NULL;
  478.     return cmOK;
  479.   }
  480.   DELETE(files); files=NULL;
  481.   return 0;
  482. }
  483.  
  484. static Tdialog *msg( char *txt, va_list argptr )
  485. {
  486.   char i;
  487.   Tstext *t;
  488.   Tdialog *result;
  489.  
  490.   result = dialog( __title() );
  491.   i = __icon();
  492.   if( i && ( i != _ICON_NOTHING ) )
  493.   {
  494.     switch( i )
  495.     {
  496.       case _ICON_WARNING:
  497.         t = NEW( Tstext( i_warning, 7 ) ); break;
  498.       case _ICON_QUESTION:
  499.         t = NEW( Tstext( i_question, 7 ) ); break;
  500.       case _ICON_INFO:
  501.         t = NEW( Tstext( i_info, 7 ) );
  502.     }
  503.     t->align = _TALIGN_LEFT;
  504.     t->color = _TATTR_SELECTED;
  505.     put_item( t, 8, t->yl );
  506.     nc();
  507.   }
  508.   vstext( txt, 36, argptr );
  509.   return result;
  510. }
  511.  
  512. static Tdialog *current_action = NULL;
  513.  
  514. Tdialog *action( char *txt, ... )
  515. {
  516.   va_list argptr;
  517.   int dx, dy;
  518.  
  519.   done_action();
  520.   _inothing();
  521. #ifdef CYR
  522.   _title( "┐ »«╖á¬á⌐▓Ñ" );
  523. #else
  524.   _title( "Please stand by" );
  525. #endif
  526.   va_start( argptr, txt );
  527.   _tacenter();
  528.   current_action = msg( txt, argptr );
  529.   va_end( argptr );
  530.   end_of_dialog();
  531.   current_action->set_state( isON_TOP, 1 );
  532.   current_action->set_flags( ifCLOSEABLE, 0 );
  533.   __dialog_xy( dx, dy );
  534.   insert_window( current_action, dx, dy );
  535.   hide_cursor();
  536.   application->refresh_screen();
  537.   return current_action;
  538. }
  539.  
  540. void done_action( void )
  541. {
  542.   if( current_action != NULL )
  543.   {
  544.     done_dialog();
  545.     current_action = NULL;
  546.     show_cursor();
  547.     application->update_cursor();
  548.   }
  549. }
  550.  
  551. void ok( char *txt, ... )
  552. {
  553.   va_list argptr;
  554.   char buffer[256];
  555.  
  556.   va_start( argptr, txt );
  557.   if( con_messages )
  558.   {
  559.     vsprintf( buffer, txt, argptr );
  560.     printf( "%s: %s\n", __title(), buffer );
  561.   }
  562.   else
  563.   {
  564.     _iinfo();
  565.     msg(txt,argptr);
  566.     key( kESC, cmOK );
  567.     bok();
  568.   }
  569.   va_end( argptr );
  570. }
  571.  
  572. boolean kc( char *txt, ... )
  573. {
  574.   va_list argptr;
  575.  
  576.   _iwarning(); _tconfirm();
  577.   va_start( argptr, txt );
  578.   msg( txt, argptr );
  579.   va_end( argptr );
  580.   _focused(); return bkc();
  581. }
  582.  
  583. boolean kch( char *txt, ... )
  584. {
  585.   va_list argptr;
  586.  
  587.   _iwarning(); _tconfirm();
  588.   va_start( argptr, txt );
  589.   msg( txt, argptr );
  590.   va_end( argptr );
  591.   _focused(); return bkch();
  592. }
  593.  
  594. boolean yn( char *txt, ... )
  595. {
  596.   va_list argptr;
  597.  
  598.   _tconfirm();
  599.   va_start( argptr, txt );
  600.   msg( txt, argptr );
  601.   va_end( argptr );
  602.   _focused(); return byn();
  603. }
  604.  
  605. boolean ynh( char *txt, ... )
  606. {
  607.   va_list argptr;
  608.  
  609.   _tconfirm();
  610.   va_start( argptr, txt );
  611.   msg( txt, argptr );
  612.   va_end( argptr );
  613.   _focused(); return bynh();
  614. }
  615.  
  616. uint ync( char *txt, ... )
  617. {
  618.   va_list argptr;
  619.  
  620.   _tconfirm();
  621.   va_start( argptr, txt );
  622.   msg( txt, argptr );
  623.   va_end( argptr );
  624.   _focused(); return bync();
  625. }
  626.  
  627. uint ynch( char *txt, ... )
  628. {
  629.   va_list argptr;
  630.  
  631.   _tconfirm();
  632.   va_start( argptr, txt );
  633.   msg( txt, argptr );
  634.   va_end( argptr );
  635.   _focused(); return bynch();
  636. }
  637.  
  638. boolean ra( char *txt, ... )
  639. {
  640.   va_list argptr;
  641.  
  642.   _terror();
  643.   va_start( argptr, txt );
  644.   msg( txt, argptr );
  645.   va_end( argptr );
  646.   _focused(); return bra();
  647. }
  648.  
  649. boolean rah( char *txt, ... )
  650. {
  651.   va_list argptr;
  652.  
  653.   _terror();
  654.   va_start( argptr, txt );
  655.   msg( txt, argptr );
  656.   va_end( argptr );
  657.   _focused(); return brah();
  658. }
  659.  
  660. boolean drive_error( int drv )
  661. {
  662. #ifdef CYR
  663.   return ra( "â░Ñ╕¬á »░¿ ñ«▒▓║» ñ« │▒▓░«⌐▒▓ó« %c:\n\n┐ »░«óÑ░Ñ▓Ñ ñ὿ ó░á▓¿╖¬á▓á ¡á │▒▓░«⌐▒▓ó«▓« Ñ ºá▓ó«░ѡᠿ ╖Ñ ñ¿▒¬║▓ Ñ ┤«░¼á▓¿░á¡ ¿ íѺ ú░Ñ╕¬¿.", drv );
  664. #else
  665.   return ra( "Cannot access drive %c:\n\nPlease verify the drive door is closed and that the disk is formatted and free of errors.", drv );
  666. #endif
  667. }
  668.  
  669. //PREFIXES
  670.  
  671. static boolean new_file_ = 0;
  672. static boolean multi_files_ = 0;
  673. static char *filters_ = NULL;
  674. static char *title_ = NULL;
  675. static char icon_ = 0;
  676. static char *get_file_dir_ = NULL;
  677. static uint *get_file_filter_ = 0;
  678.  
  679. /*
  680.   Description:
  681.     Specify select file dialog box to ask for overwriting if the user
  682.     selected an existing file. Call just before a call to get_file.
  683. */
  684. void _new_file( void )
  685. {
  686.   new_file_ = 1;
  687. }
  688.  
  689. boolean __new_file( void )
  690. {
  691.   boolean result;
  692.  
  693.   result = new_file_;
  694.   new_file_ = 0;
  695.   return result;
  696. }
  697.  
  698. /*
  699.   Description:
  700.     Specify select file dialog box can select multiply files. Call just
  701.     before a call to get_file. After get_file call get_file_list to obtain
  702.     pointer to the files list box. Don't forget to delete the list box.
  703. */
  704. void _multi_files( void )
  705. {
  706.   multi_files_ = 1;
  707. }
  708.  
  709. boolean __multi_files( void )
  710. {
  711.   boolean result;
  712.  
  713.   result = multi_files_;
  714.   multi_files_ = 0;
  715.   return result;
  716. }
  717.  
  718. /*
  719.   Description:
  720.     Specify filters for the select file dialog box. Call just before a call
  721.     to get_file. if you do not specify filters, *.* is assumed.
  722.   Entry:
  723.     f - string with the following structure:
  724.         "description1 ( wildcard1 )|description2 ( wildcard2 )|....".
  725. */
  726. void _filters( char *f )
  727. {
  728.   filters_ = f;
  729. }
  730.  
  731. char *__filters( void )
  732. {
  733.   char *result;
  734.  
  735.   result = filters_;
  736.   filters_ = NULL;
  737.   return result;
  738. }
  739.  
  740. /*
  741.   Description:
  742.     Specify directory & filter hold areas for get_file.
  743.   Entry:
  744.     get_file_dir    - area for directory (char *)
  745.     get_file_filter - area for filter    (uint *)
  746. */
  747. void _get_file_svd( char *get_file_dir, uint &get_file_filter )
  748. {
  749.   if( get_file_dir_    == NULL ) get_file_dir_    = get_file_dir;
  750.   if( get_file_filter_ == NULL ) get_file_filter_ = &get_file_filter;
  751. }
  752.  
  753. void __get_file_svd( char **get_file_dir, uint **get_file_filter )
  754. {
  755.   *get_file_dir    = get_file_dir_;
  756.   *get_file_filter = get_file_filter_;
  757.   get_file_dir_    = NULL;
  758.   get_file_filter_ = NULL;
  759. }
  760.  
  761. /*
  762.   Description:
  763.     Specify title for a message dialog. Call just before a call to
  764.     'ok','kc','ra', etc.
  765. */
  766. void _title( char *t )
  767. {
  768.   if( title_ == NULL ) title_ = t;
  769. }
  770.  
  771. /*
  772.   Description:
  773.     Specify 'Message' title for a message dialog. Call just before a call to
  774.     'ok','kc','ra', etc.
  775. */
  776. void _tmessage( void )
  777. {
  778. #ifdef CYR
  779.   if( title_ == NULL ) title_ = "æ║«í╣Ñ¡¿Ñ";
  780. #else
  781.   if( title_ == NULL ) title_ = "Message";
  782. #endif
  783. }
  784.  
  785. /*
  786.   Description:
  787.     Specify 'Error' title, alert palette, and warning icon for a message
  788.     dialog. Call just before a call to 'ok','kc','ra', etc.
  789. */
  790. void _terror( void )
  791. {
  792. #ifdef CYR
  793.   if( title_ == NULL ) title_ = "â░Ñ╕¬á";
  794. #else
  795.   if( title_ == NULL ) title_ = "Error";
  796. #endif
  797.   _iwarning();
  798. }
  799.  
  800. /*
  801.   Description:
  802.     Specify 'Confirm' title and warning icon for a message dialog. Call just
  803.     before a call to 'ok','kc','ra', etc.
  804. */
  805. void _tconfirm( void )
  806. {
  807. #ifdef CYR
  808.   if( title_ == NULL ) title_ = "Å«▓ó║░ñÑ▓Ñ";
  809. #else
  810.   if( title_ == NULL ) title_ = "Confirm";
  811. #endif
  812.   _iquestion();
  813. }
  814.  
  815. char *__title( void )
  816. {
  817. #ifdef CYR
  818.   char *result = "æ║«í╣Ñ¡¿Ñ";
  819. #else
  820.   char *result = "Message";
  821. #endif
  822.  
  823.   if( title_ != NULL ) result = title_;
  824.   title_ = NULL;
  825.   return result;
  826. }
  827.  
  828. /*
  829.   Description:
  830.     Specify warning icon for a message dialog. Call just before a call
  831.     to 'ok','kc','ra', etc.
  832. */
  833. void _iwarning( void )
  834. {
  835.   _palert();
  836.   if( !icon_ ) icon_ = _ICON_WARNING;
  837. }
  838.  
  839. /*
  840.   Description:
  841.     Specify question icon for a message dialog. Call just before a call
  842.     to 'ok','kc','ra', etc.
  843. */
  844. void _iquestion( void )
  845. {
  846.   if( !icon_ ) icon_ = _ICON_QUESTION;
  847. }
  848.  
  849. /*
  850.   Description:
  851.     Specify info icon for a message dialog. Call just before a call
  852.     to 'ok','kc','ra', etc.
  853. */
  854. void _iinfo( void )
  855. {
  856.   if( !icon_ ) icon_ = _ICON_INFO;
  857. }
  858.  
  859. /*
  860.   Description:
  861.     Specify no icon for a message dialog. Call just before a call
  862.     to 'ok','kc','ra', etc.
  863. */
  864. void _inothing( void )
  865. {
  866.   if( !icon_ ) icon_ = _ICON_NOTHING;
  867. }
  868.  
  869. char __icon( void )
  870. {
  871.   char result = _ICON_NOTHING;
  872.  
  873.   if( icon_ ) result = icon_;
  874.   icon_ = 0;
  875.   return result;
  876. }
  877.