This plug-in allow a navigation in filter and flat mode This plug-in is connected on the navigation module. The filter mode includes in the file list directories, sub directories and only files and sub files corresponding at a extension
Definition in file nav_filterflat.c.
#include "conf_explorer.h"
#include "navigation.h"
#include "nav_filterlist.h"
#include "file.h"
#include "ctrl_access.h"
Go to the source code of this file.
Functions | |
Bool | nav_filterflat_cd (void) |
This function enters in the selected directory. | |
Bool | nav_filterflat_findname (const FS_STRING sz_name, Bool b_match_case) |
This function searches a file name in file list filtered. | |
U16 | nav_filterflat_get (void) |
This function returns the position of selected file in filtered file list. | |
Bool | nav_filterflat_goto (U16 u16_newpos) |
This function goes to a position in filtered file list. | |
Bool | nav_filterflat_gotoparent (void) |
This function goes to at the parent directory. | |
Bool | nav_filterflat_mount (void) |
This function mounts the selected partition. | |
U16 | nav_filterflat_nb (void) |
This function computes the number of files and directories in filtered file list. | |
Bool | nav_filterflat_next (void) |
This function goes to the next position in the filtered file list. | |
Bool | nav_filterflat_previous (void) |
This function goes to the previous position in filtered file list. | |
Bool | nav_filterflat_reset (void) |
This function resets the pointer of selection, so "no file selected" in filtered file list. | |
Bool | nav_filterflat_root (void) |
This function initializes the file filtered list on the root directory. |
Bool nav_filterflat_cd | ( | void | ) |
This function enters in the selected directory.
TRUE otherwise
Definition at line 298 of file nav_filterflat.c.
References fs_g_nav, nav_dir_cd(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
00299 { 00300 if( !nav_dir_cd() ) 00301 return FALSE; 00302 fs_g_nav.u8_flat_dir_level = 0; 00303 fs_g_nav.u16_flat_pos_offset = 0; 00304 return TRUE; 00305 }
Bool nav_filterflat_findname | ( | const FS_STRING | sz_name, | |
Bool | b_match_case | |||
) |
This function searches a file name in file list filtered.
sz_name | name to search (UNICODE or ASCII) The name must end with NULL or '*' value | |
b_match_case | FALSE to ignore the case |
TRUE otherwise
//! This function starts a search at the next position of the current in filtered file list //!
Definition at line 252 of file nav_filterflat.c.
References FS_NAME_CHECK, nav_file_name(), and nav_filterflat_next().
00253 { 00254 while( 1 ) 00255 { 00256 if ( !nav_filterflat_next() ) 00257 return FALSE; 00258 if ( nav_file_name( sz_name , 0 , FS_NAME_CHECK , b_match_case )) 00259 return TRUE; 00260 } 00261 }
U16 nav_filterflat_get | ( | void | ) |
This function returns the position of selected file in filtered file list.
FS_NO_SEL, in case of no file selected
Definition at line 201 of file nav_filterflat.c.
References fs_g_nav, nav_filterlist_get(), and Fs_management::u16_flat_pos_offset.
Referenced by nav_filterflat_goto(), and nav_filterflat_nb().
00202 { 00203 return (fs_g_nav.u16_flat_pos_offset + nav_filterlist_get()); 00204 }
Bool nav_filterflat_goto | ( | U16 | u16_newpos | ) |
This function goes to a position in filtered file list.
u16_newpos | new position to select (0 is the first position) |
TRUE otherwise
Definition at line 214 of file nav_filterflat.c.
References FS_NO_SEL, nav_filterflat_get(), nav_filterflat_next(), nav_filterflat_previous(), and nav_filterflat_reset().
Referenced by nav_filterflat_nb().
00215 { 00216 if (u16_newpos < (nav_filterflat_get()/2)) 00217 { 00218 // Restart at the beginning of list to accelerate search 00219 if (!nav_filterflat_reset()) 00220 return FALSE; 00221 } 00222 if( FS_NO_SEL == nav_filterflat_get() ) 00223 if( !nav_filterflat_next() ) 00224 return FALSE; // No file available 00225 while( u16_newpos > nav_filterflat_get()) 00226 { 00227 if( !nav_filterflat_next()) 00228 return FALSE; // End of list, position is bad 00229 } 00230 while(u16_newpos < nav_filterflat_get()) 00231 { 00232 if( !nav_filterflat_previous()) 00233 return FALSE; // Position error 00234 } 00235 return TRUE; 00236 }
Bool nav_filterflat_gotoparent | ( | void | ) |
This function goes to at the parent directory.
TRUE otherwise
//! After the selected file is the first entry //!
Definition at line 317 of file nav_filterflat.c.
References fs_g_nav, nav_dir_gotoparent(), nav_filterflat_next(), nav_filterlist_reset(), nav_getindex(), nav_gotoindex(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
00318 { 00319 _MEM_TYPE_SLOW_ Fs_index index; 00320 index = nav_getindex(); 00321 while( 0 != fs_g_nav.u8_flat_dir_level ) 00322 { 00323 fs_g_nav.u8_flat_dir_level--; 00324 nav_dir_gotoparent(); 00325 } 00326 if( !nav_dir_gotoparent() ) 00327 { 00328 nav_gotoindex( &index ); 00329 return FALSE; 00330 } 00331 // go to the beginning of FLAT list 00332 fs_g_nav.u8_flat_dir_level = 0; 00333 fs_g_nav.u16_flat_pos_offset = 0; 00334 nav_filterlist_reset(); 00335 nav_filterflat_next(); 00336 return TRUE; 00337 }
Bool nav_filterflat_mount | ( | void | ) |
This function mounts the selected partition.
TRUE otherwise
//! If the FS_MULTI_PARTITION option is disabled //! then the mount routine selects the first partition supported by file system. <br> //! After mount, the file list contains files and directories of ROOT directory //!
Definition at line 70 of file nav_filterflat.c.
References fs_g_nav, nav_filterlist_mount(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
00071 { 00072 fs_g_nav.u8_flat_dir_level = 0; 00073 fs_g_nav.u16_flat_pos_offset = 0; 00074 return nav_filterlist_mount(); 00075 }
U16 nav_filterflat_nb | ( | void | ) |
This function computes the number of files and directories in filtered file list.
Definition at line 268 of file nav_filterflat.c.
References nav_filterflat_get(), nav_filterflat_goto(), nav_filterflat_next(), and nav_filterflat_reset().
00269 { 00270 U16 u16_save_position; 00271 U16 u16_number; 00272 00273 // Save current position 00274 u16_save_position = nav_filterflat_get(); 00275 00276 // Reset position 00277 if ( !nav_filterflat_reset()) 00278 return 0; 00279 00280 // Scan all directory 00281 u16_number = 0; 00282 while( nav_filterflat_next() ) 00283 { 00284 u16_number++; 00285 } 00286 // Restore previous position 00287 nav_filterflat_goto( u16_save_position ); 00288 00289 return u16_number; 00290 }
Bool nav_filterflat_next | ( | void | ) |
This function goes to the next position in the filtered file list.
TRUE otherwise
Definition at line 113 of file nav_filterflat.c.
References fs_g_nav, nav_dir_cd(), nav_file_isdir(), nav_filterlist_get(), nav_filterlist_gotoparent(), nav_filterlist_next(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
Referenced by nav_filterflat_findname(), nav_filterflat_goto(), nav_filterflat_gotoparent(), and nav_filterflat_nb().
00114 { 00115 U16 u16_save_current_pos; 00116 00117 u16_save_current_pos = nav_filterlist_get(); 00118 if( nav_file_isdir() ) 00119 { 00120 // The current file is a dir then enter in this 00121 if( !nav_dir_cd() ) 00122 return FALSE; 00123 if( nav_filterlist_next() ) 00124 { 00125 // File present in this dir then valid the new position 00126 fs_g_nav.u8_flat_dir_level++; 00127 fs_g_nav.u16_flat_pos_offset += u16_save_current_pos+1; 00128 return TRUE; 00129 }else{ 00130 // No file then return in parent dir 00131 if( !nav_filterlist_gotoparent() ) 00132 return FALSE; 00133 } 00134 } 00135 // Find next file in current dir or parent dir 00136 while( !nav_filterlist_next() ) 00137 { 00138 // End of current directory then goes to parent 00139 if( 0 == fs_g_nav.u8_flat_dir_level ) 00140 return FALSE; // End of list FLAT 00141 if( !nav_filterlist_gotoparent() ) 00142 return FALSE; 00143 fs_g_nav.u8_flat_dir_level--; 00144 } 00145 fs_g_nav.u16_flat_pos_offset = (fs_g_nav.u16_flat_pos_offset +u16_save_current_pos +1) -nav_filterlist_get(); 00146 return TRUE; 00147 }
Bool nav_filterflat_previous | ( | void | ) |
This function goes to the previous position in filtered file list.
TRUE otherwise
Definition at line 155 of file nav_filterflat.c.
References fs_g_nav, nav_dir_cd(), nav_file_isdir(), nav_filterlist_get(), nav_filterlist_gotoparent(), nav_filterlist_next(), nav_filterlist_previous(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
Referenced by nav_filterflat_goto().
00156 { 00157 U16 u16_save_current_pos; 00158 00159 u16_save_current_pos = nav_filterlist_get(); 00160 if( nav_filterlist_previous() ) 00161 { 00162 while( 1 ) 00163 { 00164 if( !nav_file_isdir() ) 00165 { 00166 fs_g_nav.u16_flat_pos_offset = ((fs_g_nav.u16_flat_pos_offset +u16_save_current_pos) -nav_filterlist_get()) -1; 00167 return TRUE; // New position valid 00168 } 00169 // The file is a dir then enter in this 00170 if( !nav_dir_cd() ) 00171 return FALSE; 00172 if( !nav_filterlist_next() ) 00173 { 00174 // Dir empty then goes to parent and dir is the new selection 00175 nav_filterlist_gotoparent(); 00176 fs_g_nav.u16_flat_pos_offset = ((fs_g_nav.u16_flat_pos_offset +u16_save_current_pos) -nav_filterlist_get()) -1; 00177 return TRUE; 00178 } 00179 fs_g_nav.u8_flat_dir_level++; 00180 // Go to end of the dir 00181 while( nav_filterlist_next() ); 00182 } 00183 } 00184 // Beginning of current directory then goes to parent 00185 if( 0 == fs_g_nav.u8_flat_dir_level ) 00186 return FALSE; // beginning of list FLAT 00187 if( !nav_filterlist_gotoparent() ) 00188 return FALSE; 00189 fs_g_nav.u8_flat_dir_level--; 00190 fs_g_nav.u16_flat_pos_offset -= (nav_filterlist_get()+1); 00191 return TRUE; 00192 }
Bool nav_filterflat_reset | ( | void | ) |
This function resets the pointer of selection, so "no file selected" in filtered file list.
TRUE otherwise
Definition at line 96 of file nav_filterflat.c.
References fs_g_nav, nav_dir_gotoparent(), nav_filterlist_reset(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
Referenced by nav_filterflat_goto(), and nav_filterflat_nb().
00097 { 00098 while( 0 != fs_g_nav.u8_flat_dir_level ) 00099 { 00100 fs_g_nav.u8_flat_dir_level--; 00101 nav_dir_gotoparent(); 00102 } 00103 fs_g_nav.u16_flat_pos_offset = 0; 00104 return nav_filterlist_reset(); 00105 }
Bool nav_filterflat_root | ( | void | ) |
This function initializes the file filtered list on the root directory.
TRUE otherwise
Definition at line 83 of file nav_filterflat.c.
References fs_g_nav, nav_filterlist_root(), Fs_management::u16_flat_pos_offset, and Fs_management::u8_flat_dir_level.
00084 { 00085 fs_g_nav.u8_flat_dir_level = 0; 00086 fs_g_nav.u16_flat_pos_offset = 0; 00087 return nav_filterlist_root(); 00088 }