mirror of https://github.com/fltk/fltk
Fix the filename pattern in FLUID for images.
Better KDE installation directory detection at run-time. Fix Fl_Preferences::entryExists(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2646 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
a04d891607
commit
b6e2aceb4a
5
CHANGES
5
CHANGES
|
@ -1,5 +1,10 @@
|
||||||
CHANGES IN FLTK 1.1.0
|
CHANGES IN FLTK 1.1.0
|
||||||
|
|
||||||
|
- Fl_Preferences::entryExists() did not work properly.
|
||||||
|
- FLUID's image file chooser pattern was incorrect.
|
||||||
|
- Fl_File_Icon::load_system_icons() now detects KDE
|
||||||
|
icons in /opt/kde, /usr/local, and /usr automatically,
|
||||||
|
and supports the KDEDIR environment variable as well.
|
||||||
- Submenus now display to the left of the parent menu if
|
- Submenus now display to the left of the parent menu if
|
||||||
they won't fit to the right. Previously they would
|
they won't fit to the right. Previously they would
|
||||||
display right on top of the parent menu...
|
display right on top of the parent menu...
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.12 2002/08/16 20:10:21 easysw Exp $"
|
// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.13 2002/10/03 15:23:46 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Pixmap label support for the Fast Light Tool Kit (FLTK).
|
// Pixmap label support for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
|
@ -212,7 +212,7 @@ Fluid_Image::~Fluid_Image() {
|
||||||
const char *ui_find_image_name;
|
const char *ui_find_image_name;
|
||||||
Fluid_Image *ui_find_image(const char *oldname) {
|
Fluid_Image *ui_find_image(const char *oldname) {
|
||||||
goto_source_dir();
|
goto_source_dir();
|
||||||
const char *name = fl_file_chooser("Image?","Image Files (*.{bm|bmp|gif|jpg|pbm|pgm|png|ppm|xbm|xpm})",oldname);
|
const char *name = fl_file_chooser("Image?","Image Files (*.{bm,bmp,gif,jpg,pbm,pgm,png,ppm,xbm,xpm})",oldname);
|
||||||
ui_find_image_name = name;
|
ui_find_image_name = name;
|
||||||
Fluid_Image *ret = (name && *name) ? Fluid_Image::find(name) : 0;
|
Fluid_Image *ret = (name && *name) ? Fluid_Image::find(name) : 0;
|
||||||
leave_source_dir();
|
leave_source_dir();
|
||||||
|
@ -221,5 +221,5 @@ Fluid_Image *ui_find_image(const char *oldname) {
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.12 2002/08/16 20:10:21 easysw Exp $".
|
// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.13 2002/10/03 15:23:46 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// "$Id: Fl_File_Icon2.cxx,v 1.1.2.16 2002/08/09 01:09:48 easysw Exp $"
|
// "$Id: Fl_File_Icon2.cxx,v 1.1.2.17 2002/10/03 15:23:46 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Fl_File_Icon system icon routines.
|
// Fl_File_Icon system icon routines.
|
||||||
//
|
//
|
||||||
|
@ -80,6 +80,13 @@ static char *kde_to_fltk_pattern(const char *kdepattern);
|
||||||
static char *get_kde_val(char *str, const char *key);
|
static char *get_kde_val(char *str, const char *key);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Local globals...
|
||||||
|
//
|
||||||
|
|
||||||
|
static const char *kdedir = NULL;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// 'Fl_File_Icon::load()' - Load an icon file...
|
// 'Fl_File_Icon::load()' - Load an icon file...
|
||||||
//
|
//
|
||||||
|
@ -576,6 +583,7 @@ void
|
||||||
Fl_File_Icon::load_system_icons(void)
|
Fl_File_Icon::load_system_icons(void)
|
||||||
{
|
{
|
||||||
Fl_File_Icon *icon; // New icons
|
Fl_File_Icon *icon; // New icons
|
||||||
|
char filename[1024]; // Filename
|
||||||
static int init = 0; // Have the icons been initialized?
|
static int init = 0; // Have the icons been initialized?
|
||||||
static short plain[] = // Plain file icon
|
static short plain[] = // Plain file icon
|
||||||
{
|
{
|
||||||
|
@ -649,26 +657,46 @@ Fl_File_Icon::load_system_icons(void)
|
||||||
// This method requires the images library...
|
// This method requires the images library...
|
||||||
fl_register_images();
|
fl_register_images();
|
||||||
|
|
||||||
if (!access("/usr/share/mimelnk", F_OK))
|
if (!kdedir)
|
||||||
|
{
|
||||||
|
// Figure out where KDE is installed...
|
||||||
|
if ((kdedir = getenv("KDEDIR")) == NULL)
|
||||||
|
{
|
||||||
|
if (!access("/opt/kde", F_OK))
|
||||||
|
kdedir = "/opt/kde";
|
||||||
|
else if (!access("/usr/local/share/mimelnk", F_OK))
|
||||||
|
kdedir = "/usr/local";
|
||||||
|
else
|
||||||
|
kdedir = "/usr";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
|
||||||
|
|
||||||
|
if (!access(filename, F_OK))
|
||||||
{
|
{
|
||||||
// Load KDE icons...
|
// Load KDE icons...
|
||||||
icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
|
icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
|
||||||
if (!access("/usr/share/icons/hicolor/16x16/mimetypes/unknown.png", F_OK))
|
|
||||||
icon->load_image("/usr/share/icons/hicolor/16x16/mimetypes/unknown.png");
|
snprintf(filename, sizeof(filename),
|
||||||
else
|
"%s/share/icons/hicolor/16x16/mimetypes/unknown.png", kdedir);
|
||||||
icon->load_image("/usr/share/icons/unknown.xpm");
|
|
||||||
|
if (access(filename, F_OK))
|
||||||
|
snprintf(filename, sizeof(filename), "%s/share/icons/unknown.xpm",
|
||||||
|
kdedir);
|
||||||
|
|
||||||
|
icon->load_image(filename);
|
||||||
|
|
||||||
icon = new Fl_File_Icon("*", Fl_File_Icon::LINK);
|
icon = new Fl_File_Icon("*", Fl_File_Icon::LINK);
|
||||||
if (!access("/usr/share/icons/hicolor/16x16/mimetypes/unknown.png", F_OK))
|
|
||||||
icon->load_image("/usr/share/icons/hicolor/16x16/mimetypes/unknown.png");
|
|
||||||
else
|
|
||||||
icon->load_image("/usr/share/icons/unknown.xpm");
|
|
||||||
if (!access("/usr/share/icons/hicolor/16x16/filesystems/link.png", F_OK))
|
|
||||||
icon->load_image("/usr/share/icons/hicolor/16x16/filesystems/link.png");
|
|
||||||
else
|
|
||||||
icon->load_image("/usr/share/icons/unknown.xpm");
|
|
||||||
|
|
||||||
load_kde_icons("/usr/share/mimelnk");
|
snprintf(filename, sizeof(filename),
|
||||||
|
"%s/share/icons/hicolor/16x16/filesystems/link.png", kdedir);
|
||||||
|
|
||||||
|
if (!access(filename, F_OK))
|
||||||
|
icon->load_image(filename);
|
||||||
|
|
||||||
|
snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
|
||||||
|
load_kde_icons(filename);
|
||||||
}
|
}
|
||||||
else if (!access("/usr/share/icons/folder.xpm", F_OK))
|
else if (!access("/usr/share/icons/folder.xpm", F_OK))
|
||||||
{
|
{
|
||||||
|
@ -800,7 +828,7 @@ static void
|
||||||
load_kde_mimelnk(const char *filename)
|
load_kde_mimelnk(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char tmp[256];
|
char tmp[1024];
|
||||||
char iconfilename[1024];
|
char iconfilename[1024];
|
||||||
char pattern[1024];
|
char pattern[1024];
|
||||||
char mimetype[1024];
|
char mimetype[1024];
|
||||||
|
@ -829,7 +857,9 @@ load_kde_mimelnk(const char *filename)
|
||||||
|
|
||||||
if (iconfilename[0] && (pattern[0] || strncmp(mimetype, "inode/", 6) == 0))
|
if (iconfilename[0] && (pattern[0] || strncmp(mimetype, "inode/", 6) == 0))
|
||||||
{
|
{
|
||||||
if (!access("/usr/share/icons/hicolor", F_OK))
|
snprintf(tmp, sizeof(tmp), "%s/share/icons/hicolor", kdedir);
|
||||||
|
|
||||||
|
if (!access(tmp, F_OK))
|
||||||
{
|
{
|
||||||
// KDE 2.x icons
|
// KDE 2.x icons
|
||||||
int i; // Looping var
|
int i; // Looping var
|
||||||
|
@ -855,8 +885,7 @@ load_kde_mimelnk(const char *filename)
|
||||||
|
|
||||||
for (i = 0; i < (int)(sizeof(paths) / sizeof(paths[0])); i ++) {
|
for (i = 0; i < (int)(sizeof(paths) / sizeof(paths[0])); i ++) {
|
||||||
snprintf(full_iconfilename, sizeof(full_iconfilename),
|
snprintf(full_iconfilename, sizeof(full_iconfilename),
|
||||||
"/usr/share/icons/hicolor/%s/%s.png", paths[i],
|
"%s/%s/%s.png", tmp, paths[i], iconfilename);
|
||||||
iconfilename);
|
|
||||||
|
|
||||||
if (!access(full_iconfilename, F_OK)) break;
|
if (!access(full_iconfilename, F_OK)) break;
|
||||||
}
|
}
|
||||||
|
@ -865,7 +894,7 @@ load_kde_mimelnk(const char *filename)
|
||||||
} else {
|
} else {
|
||||||
// KDE 1.x icons
|
// KDE 1.x icons
|
||||||
snprintf(full_iconfilename, sizeof(full_iconfilename),
|
snprintf(full_iconfilename, sizeof(full_iconfilename),
|
||||||
"/usr/share/icons/%s", iconfilename);
|
"%s/%s", tmp, iconfilename);
|
||||||
|
|
||||||
if (access(full_iconfilename, F_OK)) return;
|
if (access(full_iconfilename, F_OK)) return;
|
||||||
}
|
}
|
||||||
|
@ -942,5 +971,5 @@ get_kde_val(char *str,
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.16 2002/08/09 01:09:48 easysw Exp $".
|
// End of "$Id: Fl_File_Icon2.cxx,v 1.1.2.17 2002/10/03 15:23:46 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// "$Id: Fl_Preferences.cxx,v 1.1.2.20 2002/09/05 20:44:36 matthiaswm Exp $"
|
// "$Id: Fl_Preferences.cxx,v 1.1.2.21 2002/10/03 15:23:46 easysw Exp $"
|
||||||
//
|
//
|
||||||
// Preferences methods for the Fast Light Tool Kit (FLTK).
|
// Preferences methods for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
|
@ -182,12 +182,12 @@ const char *Fl_Preferences::entry( int ix )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return 1, if a group with this name exists
|
* return 1, if an entry with this name exists
|
||||||
* example: if ( buttonColor.entryExists( "red" ) ) ...
|
* example: if ( buttonColor.entryExists( "red" ) ) ...
|
||||||
*/
|
*/
|
||||||
char Fl_Preferences::entryExists( const char *key )
|
char Fl_Preferences::entryExists( const char *key )
|
||||||
{
|
{
|
||||||
return node->getEntry( key ) ? 1 : 0 ;
|
return node->getEntry( key )>=0 ? 1 : 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1113,5 +1113,5 @@ char Fl_Preferences::Node::remove()
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.20 2002/09/05 20:44:36 matthiaswm Exp $".
|
// End of "$Id: Fl_Preferences.cxx,v 1.1.2.21 2002/10/03 15:23:46 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue