PIPS
|
#include <xview/xview.h>
#include <xview/panel.h>
#include <sys/param.h>
#include <sys/stat.h>
#include "genC.h"
#include "misc.h"
#include "database.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "wpips.h"
Go to the source code of this file.
Macros | |
#define | MAXNAMELEN MAXNAMLEN |
Generate a menu from the current directory to serve as a directory chooser. More... | |
Enumerations | |
enum | { MENU_PATH_DATA_HANDLER = 54829 , WPIPS_MAX_DIRECTORY_MENU_SIZE = 80 } |
Functions | |
static bool | accept_all_file_names (char *file_name __attribute__((unused))) |
Note the pedantic way to avoid the warning about unused file_name. More... | |
static Menu | directory_gen_pullright (Menu_item menu_item, Menu_generate op) |
static void | generate_a_directory_menu_notify (Menu menu, Menu_item menu_item) |
Menu | generate_a_directory_menu (char *directory) |
#define MAXNAMELEN MAXNAMLEN |
Generate a menu from the current directory to serve as a directory chooser.
To have SunOS 5.5 happy about MAXNAMELEN (in SunOS 4, it is already defined in sys/dirent.h): To have SunOS4 still working:
Definition at line 43 of file directory_menu.c.
anonymous enum |
Enumerator | |
---|---|
MENU_PATH_DATA_HANDLER | |
WPIPS_MAX_DIRECTORY_MENU_SIZE | Maximum size of the directory menu of the main frame: |
Definition at line 56 of file directory_menu.c.
Note the pedantic way to avoid the warning about unused file_name.
:-)
Definition at line 64 of file directory_menu.c.
|
static |
First get the parent directory name that is the title:
Build the new directory name:
Well, there is already a menu... we've been already here. Free it first:
Free the associated directory name:
Then initialize it with a new directory menu:
A Menu-Generating procedure has to return the menu in any case:
Definition at line 71 of file directory_menu.c.
References debug(), free(), generate_a_directory_menu(), MAXNAMELEN, and MENU_PATH_DATA_HANDLER.
Referenced by generate_a_directory_menu().
Menu generate_a_directory_menu | ( | char * | directory | ) |
The string is not copied in MENU_TITLE_ITEM:
and furthermore MENU_TITLE_ITEM is write only, so add the info somewhere else:
Add its own notifying procedure:
Get all the files in the directory:
Generate a corresponding entry for each file:
Skip the "." directory:
The strdup'ed string will also be freed when the menu is discarded:
Since a menu item cannot be selected as an item, add an plain item with the same name. Not beautiful hack... :-(
Now recreate another item that will be the submenu:
The strdup'ed string will also be freed when the menu is discarded:
Put a right menu on each directory entry:
And disable non-subdirectory entry:
Definition at line 129 of file directory_menu.c.
References buf, db_get_current_workspace_name(), directory_exists_p(), directory_gen_pullright(), file_name, gen_array_full_free(), gen_array_item(), gen_array_make(), gen_array_nitems(), generate_a_directory_menu_notify(), MAXNAMELEN, MENU_PATH_DATA_HANDLER, pips_debug, pips_user_warning, safe_list_files_in_directory(), strdup(), user_warning, and WPIPS_MAX_DIRECTORY_MENU_SIZE.
|
static |
Definition at line 115 of file directory_menu.c.
References end_directory_notify(), MAXNAMELEN, and MENU_PATH_DATA_HANDLER.
Referenced by generate_a_directory_menu().