mirror of https://github.com/GNOME/gimp.git
only save sessionrc if the corresponding preferences option is enabled
1999-03-14 Michael Natterer <mitschel@cs.tu-berlin.de> * app/app_procs.c: only save sessionrc if the corresponding preferences option is enabled * app/preferences_dialog.c: preferences renovation part I: the directories page uses the new widgets from libgimp * libgimp/Makefile.am * ligbimp/gimpi.def * libgimp/gimpfileselection.[ch] * libgimp/gimppatheditor.[ch]: new widgets which enable a more comfortable file and searchpath selection * Makefile.am * pixmaps/no.xpm * pixmaps/yes.xpm: pixmaps used by the new widgets
This commit is contained in:
parent
2ea8e21772
commit
98f9e4e4c8
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
1999-03-14 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
|
||||||
|
* app/app_procs.c: only save sessionrc if the corresponding
|
||||||
|
preferences option is enabled
|
||||||
|
|
||||||
|
* app/preferences_dialog.c: preferences renovation part I: the
|
||||||
|
directories page uses the new widgets from libgimp
|
||||||
|
|
||||||
|
* libgimp/Makefile.am
|
||||||
|
* ligbimp/gimpi.def
|
||||||
|
* libgimp/gimpfileselection.[ch]
|
||||||
|
* libgimp/gimppatheditor.[ch]: new widgets which enable a more
|
||||||
|
comfortable file and searchpath selection
|
||||||
|
|
||||||
|
* Makefile.am
|
||||||
|
* pixmaps/no.xpm
|
||||||
|
* pixmaps/yes.xpm: pixmaps used by the new widgets
|
||||||
|
|
||||||
Sat Mar 13 19:46:54 MET 1999 Sven Neumann <sven@gimp.org>
|
Sat Mar 13 19:46:54 MET 1999 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* Makefile.am
|
* Makefile.am
|
||||||
|
@ -26,7 +44,7 @@ Sat Mar 13 19:46:54 MET 1999 Sven Neumann <sven@gimp.org>
|
||||||
* app/paths_dialog.c
|
* app/paths_dialog.c
|
||||||
* app/palette.c
|
* app/palette.c
|
||||||
* libgimp/gimpchainbutton.c: adjusted some #include's
|
* libgimp/gimpchainbutton.c: adjusted some #include's
|
||||||
|
|
||||||
Fri Mar 12 21:30:57 GMT 1999 Andy Thomas <alt@gimp.org>
|
Fri Mar 12 21:30:57 GMT 1999 Andy Thomas <alt@gimp.org>
|
||||||
|
|
||||||
Changed:-
|
Changed:-
|
||||||
|
|
|
@ -16,6 +16,7 @@ EXTRA_DIST = \
|
||||||
pixmaps/lower.xpm \
|
pixmaps/lower.xpm \
|
||||||
pixmaps/mask.xbm \
|
pixmaps/mask.xbm \
|
||||||
pixmaps/new.xpm \
|
pixmaps/new.xpm \
|
||||||
|
pixmaps/no.xpm \
|
||||||
pixmaps/raise.xpm \
|
pixmaps/raise.xpm \
|
||||||
pixmaps/paths.xbm \
|
pixmaps/paths.xbm \
|
||||||
pixmaps/penadd.xpm \
|
pixmaps/penadd.xpm \
|
||||||
|
@ -24,6 +25,7 @@ EXTRA_DIST = \
|
||||||
pixmaps/pennorm.xpm \
|
pixmaps/pennorm.xpm \
|
||||||
pixmaps/penstroke.xpm \
|
pixmaps/penstroke.xpm \
|
||||||
pixmaps/toselection.xpm \
|
pixmaps/toselection.xpm \
|
||||||
|
pixmaps/yes.xpm \
|
||||||
pixmaps/zoom_in.xpm \
|
pixmaps/zoom_in.xpm \
|
||||||
pixmaps/zoom_out.xpm \
|
pixmaps/zoom_out.xpm \
|
||||||
README.i18n \
|
README.i18n \
|
||||||
|
|
|
@ -638,7 +638,8 @@ app_exit_finish (void)
|
||||||
gximage_free ();
|
gximage_free ();
|
||||||
render_free ();
|
render_free ();
|
||||||
tools_options_dialog_free ();
|
tools_options_dialog_free ();
|
||||||
save_sessionrc ();
|
if (save_session_info)
|
||||||
|
save_sessionrc ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gtk_exit (0); */
|
/* gtk_exit (0); */
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#include "libgimp/gimpchainbutton.h"
|
#include "libgimp/gimpchainbutton.h"
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
#include "libgimp/gimpsizeentry.h"
|
#include "libgimp/gimpsizeentry.h"
|
||||||
|
#include "libgimp/gimpfileselection.h"
|
||||||
|
#include "libgimp/gimppatheditor.h"
|
||||||
|
|
||||||
|
|
||||||
/* preferences local functions */
|
/* preferences local functions */
|
||||||
|
@ -532,7 +534,7 @@ file_prefs_save_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_prefs_delete_callback (GtkWidget *widget,
|
file_prefs_delete_callback (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GtkWidget *dlg)
|
GtkWidget *dlg)
|
||||||
{
|
{
|
||||||
file_prefs_cancel_callback (widget, dlg);
|
file_prefs_cancel_callback (widget, dlg);
|
||||||
|
@ -735,6 +737,26 @@ file_prefs_string_callback (GtkWidget *widget,
|
||||||
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_filename_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_path_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -779,7 +801,7 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_size_callback (GtkWidget *widget,
|
file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||||
|
@ -789,7 +811,7 @@ file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -835,7 +857,7 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -883,7 +905,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *abox;
|
GtkWidget *abox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *radio_box;
|
GtkWidget *radio_box;
|
||||||
GtkWidget *entry;
|
GtkWidget *fileselection;
|
||||||
|
GtkWidget *patheditor;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GtkWidget *comboitem;
|
GtkWidget *comboitem;
|
||||||
|
@ -891,6 +914,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *menuitem;
|
GtkWidget *menuitem;
|
||||||
GtkWidget *optionmenu;
|
GtkWidget *optionmenu;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
GtkWidget *notebook2;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GSList *group;
|
GSList *group;
|
||||||
|
@ -934,17 +958,25 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
{N_("MegaBytes"), (1024*1024)}
|
{N_("MegaBytes"), (1024*1024)}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
char **mpath;
|
char *fs_label;
|
||||||
|
char **mdir;
|
||||||
} dirs[] =
|
} dirs[] =
|
||||||
{
|
{
|
||||||
{N_("Temp dir:"), &edit_temp_path},
|
{N_("Temp dir:"), N_("Select Temp Dir"), &edit_temp_path},
|
||||||
{N_("Swap dir:"), &edit_swap_path},
|
{N_("Swap dir:"), N_("Select Swap Dir"), &edit_swap_path},
|
||||||
{N_("Brushes dir:"), &edit_brush_path},
|
};
|
||||||
{N_("Gradients dir:"), &edit_gradient_path},
|
static const struct {
|
||||||
{N_("Patterns dir:"), &edit_pattern_path},
|
char *label;
|
||||||
{N_("Palette dir:"), &edit_palette_path},
|
char *fs_label;
|
||||||
{N_("Plug-in dir:"), &edit_plug_in_path}
|
char **mpath;
|
||||||
|
} paths[] =
|
||||||
|
{
|
||||||
|
{N_("Brushes"), N_("Select Brushes Dir"), &edit_brush_path},
|
||||||
|
{N_("Gradients"), N_("Select Gradients Dir"), &edit_gradient_path},
|
||||||
|
{N_("Patterns"), N_("Select Patterns Dir"), &edit_pattern_path},
|
||||||
|
{N_("Palettes"), N_("Select Palette Dir"), &edit_palette_path},
|
||||||
|
{N_("Plug-ins"), N_("Select Plug-in Dir"), &edit_plug_in_path}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
|
@ -959,6 +991,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
||||||
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
||||||
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
||||||
|
int npaths = sizeof(paths) / sizeof (paths[0]);
|
||||||
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
||||||
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
||||||
int i;
|
int i;
|
||||||
|
@ -1669,15 +1702,15 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
gtk_widget_set_usize (out_frame, 320, 200);
|
gtk_widget_set_usize (out_frame, 320, 200);
|
||||||
gtk_widget_show (out_frame);
|
gtk_widget_show (out_frame);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 2);
|
vbox = gtk_vbox_new (FALSE, 5);
|
||||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
table = gtk_table_new (ndirs+1, 2, FALSE);
|
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
for (i = 0; i < ndirs; i++)
|
for (i = 0; i < ndirs; i++)
|
||||||
|
@ -1688,15 +1721,37 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
fileselection = gimp_file_selection_new (gettext(dirs[i].fs_label),
|
||||||
gtk_widget_set_usize (entry, 25, 0);
|
*(dirs[i].mdir),
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), *(dirs[i].mpath));
|
TRUE, TRUE);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (fileselection), "filename_changed",
|
||||||
(GtkSignalFunc) file_prefs_string_callback,
|
(GtkSignalFunc) file_prefs_filename_callback,
|
||||||
dirs[i].mpath);
|
dirs[i].mdir);
|
||||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, i, i+1,
|
gtk_table_attach (GTK_TABLE (table), fileselection, 1, 2, i, i+1,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (fileselection);
|
||||||
|
}
|
||||||
|
|
||||||
|
notebook2 = gtk_notebook_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), notebook2, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show (notebook2);
|
||||||
|
|
||||||
|
for (i = 0; i < npaths; i++)
|
||||||
|
{
|
||||||
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||||
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
|
patheditor = gimp_path_editor_new (gettext(paths[i].fs_label),
|
||||||
|
*(paths[i].mpath));
|
||||||
|
gtk_signal_connect (GTK_OBJECT (patheditor), "path_changed",
|
||||||
|
(GtkSignalFunc) file_prefs_path_callback,
|
||||||
|
paths[i].mpath);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbox), patheditor);
|
||||||
|
gtk_widget_show (patheditor);
|
||||||
|
|
||||||
|
label = gtk_label_new (gettext(paths[i].label));
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook2), vbox, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
label = gtk_label_new (_("Directories"));
|
label = gtk_label_new (_("Directories"));
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#include "libgimp/gimpchainbutton.h"
|
#include "libgimp/gimpchainbutton.h"
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
#include "libgimp/gimpsizeentry.h"
|
#include "libgimp/gimpsizeentry.h"
|
||||||
|
#include "libgimp/gimpfileselection.h"
|
||||||
|
#include "libgimp/gimppatheditor.h"
|
||||||
|
|
||||||
|
|
||||||
/* preferences local functions */
|
/* preferences local functions */
|
||||||
|
@ -532,7 +534,7 @@ file_prefs_save_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_prefs_delete_callback (GtkWidget *widget,
|
file_prefs_delete_callback (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GtkWidget *dlg)
|
GtkWidget *dlg)
|
||||||
{
|
{
|
||||||
file_prefs_cancel_callback (widget, dlg);
|
file_prefs_cancel_callback (widget, dlg);
|
||||||
|
@ -735,6 +737,26 @@ file_prefs_string_callback (GtkWidget *widget,
|
||||||
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_filename_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_path_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -779,7 +801,7 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_size_callback (GtkWidget *widget,
|
file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||||
|
@ -789,7 +811,7 @@ file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -835,7 +857,7 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -883,7 +905,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *abox;
|
GtkWidget *abox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *radio_box;
|
GtkWidget *radio_box;
|
||||||
GtkWidget *entry;
|
GtkWidget *fileselection;
|
||||||
|
GtkWidget *patheditor;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GtkWidget *comboitem;
|
GtkWidget *comboitem;
|
||||||
|
@ -891,6 +914,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *menuitem;
|
GtkWidget *menuitem;
|
||||||
GtkWidget *optionmenu;
|
GtkWidget *optionmenu;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
GtkWidget *notebook2;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GSList *group;
|
GSList *group;
|
||||||
|
@ -934,17 +958,25 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
{N_("MegaBytes"), (1024*1024)}
|
{N_("MegaBytes"), (1024*1024)}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
char **mpath;
|
char *fs_label;
|
||||||
|
char **mdir;
|
||||||
} dirs[] =
|
} dirs[] =
|
||||||
{
|
{
|
||||||
{N_("Temp dir:"), &edit_temp_path},
|
{N_("Temp dir:"), N_("Select Temp Dir"), &edit_temp_path},
|
||||||
{N_("Swap dir:"), &edit_swap_path},
|
{N_("Swap dir:"), N_("Select Swap Dir"), &edit_swap_path},
|
||||||
{N_("Brushes dir:"), &edit_brush_path},
|
};
|
||||||
{N_("Gradients dir:"), &edit_gradient_path},
|
static const struct {
|
||||||
{N_("Patterns dir:"), &edit_pattern_path},
|
char *label;
|
||||||
{N_("Palette dir:"), &edit_palette_path},
|
char *fs_label;
|
||||||
{N_("Plug-in dir:"), &edit_plug_in_path}
|
char **mpath;
|
||||||
|
} paths[] =
|
||||||
|
{
|
||||||
|
{N_("Brushes"), N_("Select Brushes Dir"), &edit_brush_path},
|
||||||
|
{N_("Gradients"), N_("Select Gradients Dir"), &edit_gradient_path},
|
||||||
|
{N_("Patterns"), N_("Select Patterns Dir"), &edit_pattern_path},
|
||||||
|
{N_("Palettes"), N_("Select Palette Dir"), &edit_palette_path},
|
||||||
|
{N_("Plug-ins"), N_("Select Plug-in Dir"), &edit_plug_in_path}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
|
@ -959,6 +991,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
||||||
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
||||||
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
||||||
|
int npaths = sizeof(paths) / sizeof (paths[0]);
|
||||||
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
||||||
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
||||||
int i;
|
int i;
|
||||||
|
@ -1669,15 +1702,15 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
gtk_widget_set_usize (out_frame, 320, 200);
|
gtk_widget_set_usize (out_frame, 320, 200);
|
||||||
gtk_widget_show (out_frame);
|
gtk_widget_show (out_frame);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 2);
|
vbox = gtk_vbox_new (FALSE, 5);
|
||||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
table = gtk_table_new (ndirs+1, 2, FALSE);
|
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
for (i = 0; i < ndirs; i++)
|
for (i = 0; i < ndirs; i++)
|
||||||
|
@ -1688,15 +1721,37 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
fileselection = gimp_file_selection_new (gettext(dirs[i].fs_label),
|
||||||
gtk_widget_set_usize (entry, 25, 0);
|
*(dirs[i].mdir),
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), *(dirs[i].mpath));
|
TRUE, TRUE);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (fileselection), "filename_changed",
|
||||||
(GtkSignalFunc) file_prefs_string_callback,
|
(GtkSignalFunc) file_prefs_filename_callback,
|
||||||
dirs[i].mpath);
|
dirs[i].mdir);
|
||||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, i, i+1,
|
gtk_table_attach (GTK_TABLE (table), fileselection, 1, 2, i, i+1,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (fileselection);
|
||||||
|
}
|
||||||
|
|
||||||
|
notebook2 = gtk_notebook_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), notebook2, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show (notebook2);
|
||||||
|
|
||||||
|
for (i = 0; i < npaths; i++)
|
||||||
|
{
|
||||||
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||||
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
|
patheditor = gimp_path_editor_new (gettext(paths[i].fs_label),
|
||||||
|
*(paths[i].mpath));
|
||||||
|
gtk_signal_connect (GTK_OBJECT (patheditor), "path_changed",
|
||||||
|
(GtkSignalFunc) file_prefs_path_callback,
|
||||||
|
paths[i].mpath);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbox), patheditor);
|
||||||
|
gtk_widget_show (patheditor);
|
||||||
|
|
||||||
|
label = gtk_label_new (gettext(paths[i].label));
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook2), vbox, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
label = gtk_label_new (_("Directories"));
|
label = gtk_label_new (_("Directories"));
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#include "libgimp/gimpchainbutton.h"
|
#include "libgimp/gimpchainbutton.h"
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
#include "libgimp/gimpsizeentry.h"
|
#include "libgimp/gimpsizeentry.h"
|
||||||
|
#include "libgimp/gimpfileselection.h"
|
||||||
|
#include "libgimp/gimppatheditor.h"
|
||||||
|
|
||||||
|
|
||||||
/* preferences local functions */
|
/* preferences local functions */
|
||||||
|
@ -532,7 +534,7 @@ file_prefs_save_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
file_prefs_delete_callback (GtkWidget *widget,
|
file_prefs_delete_callback (GtkWidget *widget,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
GtkWidget *dlg)
|
GtkWidget *dlg)
|
||||||
{
|
{
|
||||||
file_prefs_cancel_callback (widget, dlg);
|
file_prefs_cancel_callback (widget, dlg);
|
||||||
|
@ -735,6 +737,26 @@ file_prefs_string_callback (GtkWidget *widget,
|
||||||
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_filename_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_prefs_path_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gchar **val;
|
||||||
|
|
||||||
|
val = data;
|
||||||
|
file_prefs_strset (val, gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget)));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
file_prefs_clear_session_info_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -779,7 +801,7 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_size_callback (GtkWidget *widget,
|
file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||||
|
@ -789,7 +811,7 @@ file_prefs_default_size_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -835,7 +857,7 @@ file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
static float xres = 0.0;
|
static float xres = 0.0;
|
||||||
static float yres = 0.0;
|
static float yres = 0.0;
|
||||||
|
@ -883,7 +905,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *abox;
|
GtkWidget *abox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *radio_box;
|
GtkWidget *radio_box;
|
||||||
GtkWidget *entry;
|
GtkWidget *fileselection;
|
||||||
|
GtkWidget *patheditor;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GtkWidget *comboitem;
|
GtkWidget *comboitem;
|
||||||
|
@ -891,6 +914,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GtkWidget *menuitem;
|
GtkWidget *menuitem;
|
||||||
GtkWidget *optionmenu;
|
GtkWidget *optionmenu;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
GtkWidget *notebook2;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GSList *group;
|
GSList *group;
|
||||||
|
@ -934,17 +958,25 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
{N_("MegaBytes"), (1024*1024)}
|
{N_("MegaBytes"), (1024*1024)}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
char **mpath;
|
char *fs_label;
|
||||||
|
char **mdir;
|
||||||
} dirs[] =
|
} dirs[] =
|
||||||
{
|
{
|
||||||
{N_("Temp dir:"), &edit_temp_path},
|
{N_("Temp dir:"), N_("Select Temp Dir"), &edit_temp_path},
|
||||||
{N_("Swap dir:"), &edit_swap_path},
|
{N_("Swap dir:"), N_("Select Swap Dir"), &edit_swap_path},
|
||||||
{N_("Brushes dir:"), &edit_brush_path},
|
};
|
||||||
{N_("Gradients dir:"), &edit_gradient_path},
|
static const struct {
|
||||||
{N_("Patterns dir:"), &edit_pattern_path},
|
char *label;
|
||||||
{N_("Palette dir:"), &edit_palette_path},
|
char *fs_label;
|
||||||
{N_("Plug-in dir:"), &edit_plug_in_path}
|
char **mpath;
|
||||||
|
} paths[] =
|
||||||
|
{
|
||||||
|
{N_("Brushes"), N_("Select Brushes Dir"), &edit_brush_path},
|
||||||
|
{N_("Gradients"), N_("Select Gradients Dir"), &edit_gradient_path},
|
||||||
|
{N_("Patterns"), N_("Select Patterns Dir"), &edit_pattern_path},
|
||||||
|
{N_("Palettes"), N_("Select Palette Dir"), &edit_palette_path},
|
||||||
|
{N_("Plug-ins"), N_("Select Plug-in Dir"), &edit_plug_in_path}
|
||||||
};
|
};
|
||||||
static const struct {
|
static const struct {
|
||||||
char *label;
|
char *label;
|
||||||
|
@ -959,6 +991,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
int ntransparencies = sizeof (transparencies) / sizeof (transparencies[0]);
|
||||||
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
int nchecks = sizeof (checks) / sizeof (checks[0]);
|
||||||
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
int ndirs = sizeof(dirs) / sizeof (dirs[0]);
|
||||||
|
int npaths = sizeof(paths) / sizeof (paths[0]);
|
||||||
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
int npreview_sizes = sizeof(preview_sizes) / sizeof (preview_sizes[0]);
|
||||||
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
int nmem_size_units = sizeof(mem_size_units) / sizeof (mem_size_units[0]);
|
||||||
int i;
|
int i;
|
||||||
|
@ -1669,15 +1702,15 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
gtk_widget_set_usize (out_frame, 320, 200);
|
gtk_widget_set_usize (out_frame, 320, 200);
|
||||||
gtk_widget_show (out_frame);
|
gtk_widget_show (out_frame);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 2);
|
vbox = gtk_vbox_new (FALSE, 5);
|
||||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
table = gtk_table_new (ndirs+1, 2, FALSE);
|
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
for (i = 0; i < ndirs; i++)
|
for (i = 0; i < ndirs; i++)
|
||||||
|
@ -1688,15 +1721,37 @@ file_pref_cmd_callback (GtkWidget *widget,
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
fileselection = gimp_file_selection_new (gettext(dirs[i].fs_label),
|
||||||
gtk_widget_set_usize (entry, 25, 0);
|
*(dirs[i].mdir),
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), *(dirs[i].mpath));
|
TRUE, TRUE);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (fileselection), "filename_changed",
|
||||||
(GtkSignalFunc) file_prefs_string_callback,
|
(GtkSignalFunc) file_prefs_filename_callback,
|
||||||
dirs[i].mpath);
|
dirs[i].mdir);
|
||||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, i, i+1,
|
gtk_table_attach (GTK_TABLE (table), fileselection, 1, 2, i, i+1,
|
||||||
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
GTK_EXPAND | GTK_FILL, 0, 0, 0);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (fileselection);
|
||||||
|
}
|
||||||
|
|
||||||
|
notebook2 = gtk_notebook_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), notebook2, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show (notebook2);
|
||||||
|
|
||||||
|
for (i = 0; i < npaths; i++)
|
||||||
|
{
|
||||||
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||||
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
|
patheditor = gimp_path_editor_new (gettext(paths[i].fs_label),
|
||||||
|
*(paths[i].mpath));
|
||||||
|
gtk_signal_connect (GTK_OBJECT (patheditor), "path_changed",
|
||||||
|
(GtkSignalFunc) file_prefs_path_callback,
|
||||||
|
paths[i].mpath);
|
||||||
|
gtk_container_add (GTK_CONTAINER (vbox), patheditor);
|
||||||
|
gtk_widget_show (patheditor);
|
||||||
|
|
||||||
|
label = gtk_label_new (gettext(paths[i].label));
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook2), vbox, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
label = gtk_label_new (_("Directories"));
|
label = gtk_label_new (_("Directories"));
|
||||||
|
|
|
@ -30,8 +30,12 @@ libgimpi_a_SOURCES = \
|
||||||
gimpenv.h \
|
gimpenv.h \
|
||||||
gimpchainbutton.c \
|
gimpchainbutton.c \
|
||||||
gimpchainbutton.h \
|
gimpchainbutton.h \
|
||||||
|
gimpfileselection.c \
|
||||||
|
gimpfileselection.h \
|
||||||
gimpmatrix.c \
|
gimpmatrix.c \
|
||||||
gimpmatrix.h \
|
gimpmatrix.h \
|
||||||
|
gimppatheditor.c \
|
||||||
|
gimppatheditor.h \
|
||||||
gimpprotocol.c \
|
gimpprotocol.c \
|
||||||
gimpprotocol.h \
|
gimpprotocol.h \
|
||||||
gimpsizeentry.c \
|
gimpsizeentry.c \
|
||||||
|
@ -93,9 +97,11 @@ gimpinclude_HEADERS = \
|
||||||
gimpenums.h \
|
gimpenums.h \
|
||||||
gimpenv.h \
|
gimpenv.h \
|
||||||
gimpfeatures.h \
|
gimpfeatures.h \
|
||||||
|
gimpfileselection.h \
|
||||||
gimpmatrix.h \
|
gimpmatrix.h \
|
||||||
gimpmenu.h \
|
gimpmenu.h \
|
||||||
gimpmodule.h \
|
gimpmodule.h \
|
||||||
|
gimppatheditor.h \
|
||||||
gimpsizeentry.h \
|
gimpsizeentry.h \
|
||||||
gimpui.h \
|
gimpui.h \
|
||||||
gimpunit.h \
|
gimpunit.h \
|
||||||
|
|
|
@ -0,0 +1,405 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.c
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gimpfileselection.h"
|
||||||
|
|
||||||
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
#include "pixmaps/yes.xpm"
|
||||||
|
#include "pixmaps/no.xpm"
|
||||||
|
|
||||||
|
/* callbacks
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static int gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
/* private functions
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GFS_FILENAME_CHANGED_SIGNAL,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static gint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
static GtkHBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_destroy (GtkObject *object)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (object));
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (object);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_widget_destroy (gfs->file_selection);
|
||||||
|
|
||||||
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||||
|
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_init (GimpFileSelectionClass *class)
|
||||||
|
{
|
||||||
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GtkObjectClass*) class;
|
||||||
|
|
||||||
|
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||||
|
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL] =
|
||||||
|
gtk_signal_new ("filename_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GimpFileSelectionClass,
|
||||||
|
gimp_file_selection),
|
||||||
|
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||||
|
gtk_object_class_add_signals (object_class, gimp_file_selection_signals,
|
||||||
|
LAST_SIGNAL);
|
||||||
|
|
||||||
|
object_class->destroy = gimp_file_selection_class_destroy;
|
||||||
|
class->gimp_file_selection = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_init (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
gfs->title = NULL;
|
||||||
|
gfs->file_selection = NULL;
|
||||||
|
gfs->file_exists = FALSE;
|
||||||
|
gfs->check_valid = FALSE;
|
||||||
|
|
||||||
|
gfs->browse_button = gtk_button_new_with_label (" ... ");
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
|
||||||
|
gtk_widget_show (gfs->browse_button);
|
||||||
|
|
||||||
|
gfs->entry = gtk_entry_new ();
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 5);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
|
||||||
|
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
|
||||||
|
(GdkEventFunc) gimp_file_selection_entry_focus_out_callback, gfs);
|
||||||
|
gtk_widget_show (gfs->entry);
|
||||||
|
|
||||||
|
/* this callback does the rest (pixmap creation etc.)
|
||||||
|
*/
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_realize), gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gimp_file_selection_get_type ()
|
||||||
|
{
|
||||||
|
static guint gfs_type = 0;
|
||||||
|
|
||||||
|
if (!gfs_type)
|
||||||
|
{
|
||||||
|
GtkTypeInfo gfs_info =
|
||||||
|
{
|
||||||
|
"GimpFileSelection",
|
||||||
|
sizeof (GimpFileSelection),
|
||||||
|
sizeof (GimpFileSelectionClass),
|
||||||
|
(GtkClassInitFunc) gimp_file_selection_class_init,
|
||||||
|
(GtkObjectInitFunc) gimp_file_selection_init,
|
||||||
|
/* reserved_1 */ NULL,
|
||||||
|
/* reserved_2 */ NULL,
|
||||||
|
(GtkClassInitFunc) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
gfs_type = gtk_type_unique (gtk_hbox_get_type (), &gfs_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gfs_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
gfs = gtk_type_new (gimp_file_selection_get_type ());
|
||||||
|
|
||||||
|
gfs->title = g_strdup (title);
|
||||||
|
gfs->dir_only = dir_only;
|
||||||
|
gfs->check_valid = check_valid;
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
return GTK_WIDGET (gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *parent;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (gfs)->parent;
|
||||||
|
if (! GTK_WIDGET_REALIZED (parent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (parent);
|
||||||
|
|
||||||
|
gfs->yes_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->yes_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
yes_xpm);
|
||||||
|
gfs->no_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->no_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
no_xpm);
|
||||||
|
|
||||||
|
gfs->file_exists = gtk_pixmap_new (gfs->no_pixmap, gfs->no_mask);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gfs), gfs->file_exists, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
gtk_widget_show (gfs->file_exists);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gimp_file_selection_get_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (gfs != NULL, g_strdup (""));
|
||||||
|
g_return_val_if_fail (GIMP_IS_FILE_SELECTION (gfs), g_strdup (""));
|
||||||
|
|
||||||
|
return gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename)
|
||||||
|
{
|
||||||
|
g_return_if_fail (gfs != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename));
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, (gpointer) gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
gint len;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
|
||||||
|
/* filenames still need more sanity checking
|
||||||
|
* (erase double G_DIR_SEPARATORS, ...)
|
||||||
|
*/
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
|
||||||
|
filename = g_strstrip (filename);
|
||||||
|
|
||||||
|
while (((len = strlen (filename)) > 1) &&
|
||||||
|
(filename[len - 1] == G_DIR_SEPARATOR))
|
||||||
|
filename[len - 1] = '\0';
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
g_free (filename);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gfs),
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_entry_callback (widget, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* these are local callbacks of gimp_file_selection_browse_callback()
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename =
|
||||||
|
gtk_file_selection_get_filename (GTK_FILE_SELECTION (gfs->file_selection));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_cancel_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_widget_hide (GIMP_FILE_SELECTION (data)->file_selection);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_filesel_delete_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_filesel_cancel_callback (NULL, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
|
||||||
|
if (gfs->file_selection == NULL)
|
||||||
|
{
|
||||||
|
if (gfs->dir_only)
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (gfs->title);
|
||||||
|
|
||||||
|
/* hiding these widgets uses internal gtk+ knowledge, but it's
|
||||||
|
* easier than creating my own directory browser -- michael
|
||||||
|
*/
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->fileop_del_file);
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->file_list->parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (_("Select File"));
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->ok_button)->child), _("Select"));
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button)->child), _("Close"));
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->ok_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->selection_entry),
|
||||||
|
"activate",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs), "unmap",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs->file_selection),
|
||||||
|
"delete_event",
|
||||||
|
(GdkEventFunc)gimp_file_selection_filesel_delete_callback,
|
||||||
|
gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
if (! GTK_WIDGET_VISIBLE (gfs->file_selection))
|
||||||
|
gtk_widget_show (gfs->file_selection);
|
||||||
|
else
|
||||||
|
gdk_window_raise (gfs->file_selection->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
static struct stat statbuf;
|
||||||
|
gchar* filename;
|
||||||
|
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
if (gfs->file_exists == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
if ((stat (filename, &statbuf) == 0) &&
|
||||||
|
(gfs->dir_only ? S_ISDIR(statbuf.st_mode) : S_ISREG(statbuf.st_mode)))
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->yes_pixmap, gfs->yes_mask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->no_pixmap, gfs->no_mask);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.h
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_FILE_SELECTION_H__
|
||||||
|
#define __GIMP_FILE_SELECTION_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GIMP_TYPE_FILE_SELECTION (gimp_file_selection_get_type ())
|
||||||
|
#define GIMP_FILE_SELECTION(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelection))
|
||||||
|
#define GIMP_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
|
||||||
|
#define GIMP_IS_FILE_SELECTION(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_FILE_SELECTION))
|
||||||
|
#define GIMP_IS_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION))
|
||||||
|
|
||||||
|
typedef struct _GimpFileSelection GimpFileSelection;
|
||||||
|
typedef struct _GimpFileSelectionClass GimpFileSelectionClass;
|
||||||
|
|
||||||
|
struct _GimpFileSelection
|
||||||
|
{
|
||||||
|
GtkVBox hbox;
|
||||||
|
|
||||||
|
GtkWidget *file_exists;
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *browse_button;
|
||||||
|
|
||||||
|
GtkWidget *file_selection;
|
||||||
|
|
||||||
|
GdkPixmap *yes_pixmap;
|
||||||
|
GdkBitmap *yes_mask;
|
||||||
|
GdkPixmap *no_pixmap;
|
||||||
|
GdkBitmap *no_mask;
|
||||||
|
|
||||||
|
gchar *title;
|
||||||
|
gboolean dir_only;
|
||||||
|
gboolean check_valid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpFileSelectionClass
|
||||||
|
{
|
||||||
|
GtkHBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* gimp_file_selection) (GimpFileSelection *gfs);
|
||||||
|
};
|
||||||
|
|
||||||
|
guint gimp_file_selection_get_type (void);
|
||||||
|
|
||||||
|
/* creates a new GimpFileSelection widget
|
||||||
|
*
|
||||||
|
* dir_only == TRUE will allow only directories
|
||||||
|
* check_valid == TRUE will show a pixmap which indicates if
|
||||||
|
* the filename is valid
|
||||||
|
*/
|
||||||
|
GtkWidget* gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid);
|
||||||
|
|
||||||
|
/* it's up to the caller to g_free() the returned string
|
||||||
|
*/
|
||||||
|
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
void gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __GIMP_FILE_SELECTION_H__ */
|
|
@ -10,6 +10,10 @@ EXPORTS
|
||||||
gimp_chain_button_set_active
|
gimp_chain_button_set_active
|
||||||
gimp_data_directory
|
gimp_data_directory
|
||||||
gimp_directory
|
gimp_directory
|
||||||
|
gimp_file_selection_get_filename
|
||||||
|
gimp_file_selection_get_type
|
||||||
|
gimp_file_selection_new
|
||||||
|
gimp_file_selection_set_filename
|
||||||
gimp_gtkrc
|
gimp_gtkrc
|
||||||
gimp_personal_rc_file
|
gimp_personal_rc_file
|
||||||
gimp_matrix_duplicate
|
gimp_matrix_duplicate
|
||||||
|
@ -23,6 +27,9 @@ EXPORTS
|
||||||
gimp_matrix_yshear
|
gimp_matrix_yshear
|
||||||
gimp_matrix_determinant
|
gimp_matrix_determinant
|
||||||
gimp_matrix_invert
|
gimp_matrix_invert
|
||||||
|
gimp_path_editor_get_path
|
||||||
|
gimp_path_editor_get_type
|
||||||
|
gimp_path_editor_new
|
||||||
gimp_size_entry_attach_label
|
gimp_size_entry_attach_label
|
||||||
gimp_size_entry_get_refval
|
gimp_size_entry_get_refval
|
||||||
gimp_size_entry_get_type
|
gimp_size_entry_get_type
|
||||||
|
|
|
@ -0,0 +1,540 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimppatheditor.c
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gimppatheditor.h"
|
||||||
|
|
||||||
|
#include "libgimp/gimpfileselection.h"
|
||||||
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "pixmaps/new.xpm"
|
||||||
|
#include "pixmaps/delete.xpm"
|
||||||
|
#include "pixmaps/raise.xpm"
|
||||||
|
#include "pixmaps/lower.xpm"
|
||||||
|
|
||||||
|
/* callbacks
|
||||||
|
*/
|
||||||
|
static void gimp_path_editor_realize (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_select_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_deselect_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_path_editor_new_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_delete_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_move_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_filesel_callback (GtkWidget *widget, gpointer data);
|
||||||
|
|
||||||
|
static void gimp_path_editor_data_destroy_callback (gpointer *data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void gimp_path_editor_check_path (GimpPathEditor *gpe,
|
||||||
|
GtkWidget *list_item);
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GPE_PATH_CHANGED_SIGNAL,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static gint gimp_path_editor_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
static GtkVBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_class_init (GimpPathEditorClass *class)
|
||||||
|
{
|
||||||
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GtkObjectClass*) class;
|
||||||
|
|
||||||
|
parent_class = gtk_type_class (gtk_vbox_get_type ());
|
||||||
|
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL] =
|
||||||
|
gtk_signal_new ("path_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GimpPathEditorClass,
|
||||||
|
gimp_path_editor),
|
||||||
|
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||||
|
gtk_object_class_add_signals (object_class, gimp_path_editor_signals,
|
||||||
|
LAST_SIGNAL);
|
||||||
|
|
||||||
|
class->gimp_path_editor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_init (GimpPathEditor *gpe)
|
||||||
|
{
|
||||||
|
GtkWidget *button_box;
|
||||||
|
GtkWidget *scrolled_window;
|
||||||
|
GtkObject *hadjustment;
|
||||||
|
GtkObject *vadjustment;
|
||||||
|
|
||||||
|
gpe->file_selection = NULL;
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
gpe->number_of_items = 0;
|
||||||
|
|
||||||
|
gpe->upper_hbox = gtk_hbox_new (FALSE, 5);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe), gpe->upper_hbox, FALSE, TRUE, 0);
|
||||||
|
gtk_widget_show (gpe->upper_hbox);
|
||||||
|
|
||||||
|
button_box = gtk_hbox_new (TRUE, 0);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), button_box, FALSE, TRUE, 0);
|
||||||
|
gtk_widget_show (button_box);
|
||||||
|
|
||||||
|
gpe->new_button = gtk_button_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->new_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->new_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_new_callback), gpe);
|
||||||
|
|
||||||
|
gpe->delete_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->delete_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->delete_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_delete_callback), gpe);
|
||||||
|
|
||||||
|
gpe->up_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->up_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->up_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_move_callback), gpe);
|
||||||
|
|
||||||
|
gpe->down_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->down_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->down_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_move_callback), gpe);
|
||||||
|
|
||||||
|
hadjustment = gtk_adjustment_new (0.0, 0.0, 1.0, 0.1, 0.2, 1.0);
|
||||||
|
vadjustment = gtk_adjustment_new (0.0, 0.0, 1.0, 0.1, 0.2, 1.0);
|
||||||
|
scrolled_window =
|
||||||
|
gtk_scrolled_window_new (GTK_ADJUSTMENT (hadjustment),
|
||||||
|
GTK_ADJUSTMENT (vadjustment));
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe), scrolled_window, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show (scrolled_window);
|
||||||
|
|
||||||
|
gpe->dir_list = gtk_list_new ();
|
||||||
|
gtk_list_set_selection_mode (GTK_LIST (gpe->dir_list), GTK_SELECTION_SINGLE);
|
||||||
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||||
|
gpe->dir_list);
|
||||||
|
gtk_widget_show (gpe->dir_list);
|
||||||
|
|
||||||
|
/* this callback does the rest (pixmap creation etc.)
|
||||||
|
*/
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_realize), gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gimp_path_editor_get_type ()
|
||||||
|
{
|
||||||
|
static guint gpe_type = 0;
|
||||||
|
|
||||||
|
if (!gpe_type)
|
||||||
|
{
|
||||||
|
GtkTypeInfo gpe_info =
|
||||||
|
{
|
||||||
|
"GimpPathEditor",
|
||||||
|
sizeof (GimpPathEditor),
|
||||||
|
sizeof (GimpPathEditorClass),
|
||||||
|
(GtkClassInitFunc) gimp_path_editor_class_init,
|
||||||
|
(GtkObjectInitFunc) gimp_path_editor_init,
|
||||||
|
/* reserved_1 */ NULL,
|
||||||
|
/* reserved_2 */ NULL,
|
||||||
|
(GtkClassInitFunc) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
gpe_type = gtk_type_unique (gtk_vbox_get_type (), &gpe_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gpe_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gimp_path_editor_new (gchar *filesel_title,
|
||||||
|
gchar *path)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
GtkWidget *list_item;
|
||||||
|
GList *directory_list;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((filesel_title != NULL), NULL);
|
||||||
|
g_return_val_if_fail ((path != NULL), NULL);
|
||||||
|
|
||||||
|
gpe = gtk_type_new (gimp_path_editor_get_type ());
|
||||||
|
|
||||||
|
gpe->file_selection = gimp_file_selection_new (filesel_title, "", TRUE, TRUE);
|
||||||
|
gtk_widget_set_sensitive (gpe->file_selection, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), gpe->file_selection,
|
||||||
|
TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gpe->file_selection), "filename_changed",
|
||||||
|
(GtkSignalFunc) gimp_path_editor_filesel_callback, gpe);
|
||||||
|
gtk_widget_show (gpe->file_selection);
|
||||||
|
|
||||||
|
directory_list = NULL;
|
||||||
|
directory = path = g_strdup (path);
|
||||||
|
|
||||||
|
/* split up the path
|
||||||
|
*/
|
||||||
|
while (strlen (directory))
|
||||||
|
{
|
||||||
|
gchar *current_dir;
|
||||||
|
gchar *next_separator;
|
||||||
|
|
||||||
|
next_separator = strchr (directory, G_SEARCHPATH_SEPARATOR);
|
||||||
|
if (next_separator != NULL)
|
||||||
|
*next_separator = '\0';
|
||||||
|
|
||||||
|
current_dir = g_strdup (directory);
|
||||||
|
|
||||||
|
list_item = gtk_list_item_new_with_label (current_dir);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
|
||||||
|
current_dir,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
directory_list = g_list_append (directory_list, list_item);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "select",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_select_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "deselect",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_deselect_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_widget_show (list_item);
|
||||||
|
gpe->number_of_items++;
|
||||||
|
|
||||||
|
if (next_separator != NULL)
|
||||||
|
directory = next_separator + 1;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
|
||||||
|
if (directory_list)
|
||||||
|
gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list);
|
||||||
|
|
||||||
|
return GTK_WIDGET (gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_realize (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *parent;
|
||||||
|
GdkPixmap *pixmap;
|
||||||
|
GdkBitmap *mask;
|
||||||
|
GtkWidget *gtk_pixmap;
|
||||||
|
/* GList *list = NULL; */
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (gpe)->parent;
|
||||||
|
if (! GTK_WIDGET_REALIZED (parent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (parent);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
new_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->new_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->new_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
delete_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->delete_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->delete_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
raise_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->up_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->up_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
lower_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->down_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->down_button);
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (list = GTK_LIST (gpe->dir_list)->children; list; list = list->next)
|
||||||
|
{
|
||||||
|
gimp_path_editor_check_path (gpe, GTK_WIDGET (list->data));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gimp_path_editor_get_path (GimpPathEditor *gpe)
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
gchar *path = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gpe != NULL, g_strdup (""));
|
||||||
|
g_return_val_if_fail (GIMP_IS_PATH_EDITOR (gpe), g_strdup (""));
|
||||||
|
|
||||||
|
for (list = GTK_LIST (gpe->dir_list)->children; list; list = list->next)
|
||||||
|
{
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
path = g_strdup ((gchar*)gtk_object_get_data (GTK_OBJECT (list->data),
|
||||||
|
"gimp_path_editor"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gchar *newpath;
|
||||||
|
|
||||||
|
newpath =
|
||||||
|
g_strconcat (path,
|
||||||
|
G_SEARCHPATH_SEPARATOR_S,
|
||||||
|
(gchar*)gtk_object_get_data (GTK_OBJECT (list->data),
|
||||||
|
"gimp_path_editor"),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
path = newpath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_select_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
gint pos;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
directory = (gchar*)gtk_object_get_data (GTK_OBJECT (widget),
|
||||||
|
"gimp_path_editor");
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (gpe->file_selection),
|
||||||
|
directory);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gpe->selected_item = widget;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, TRUE);
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, (pos > 0));
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button,
|
||||||
|
(pos < (gpe->number_of_items - 1)));
|
||||||
|
gtk_widget_set_sensitive (gpe->file_selection, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the selected directory may never be deselected except by the 'new'
|
||||||
|
* button, so catch the "deselect" signal and reselect it
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gimp_path_editor_deselect_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
if (widget != gpe->selected_item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_select_child (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_new_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
if (gpe->selected_item)
|
||||||
|
{
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_unselect_child (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
}
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->entry, TRUE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->browse_button, TRUE);
|
||||||
|
|
||||||
|
gtk_editable_set_position (GTK_EDITABLE (GIMP_FILE_SELECTION (gpe->file_selection)->entry), -1);
|
||||||
|
/* gtk_editable_select_region (GTK_EDITABLE (gpe->entry), 0, -1); */
|
||||||
|
gtk_widget_grab_focus (GTK_WIDGET (GIMP_FILE_SELECTION (gpe->file_selection)->entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_delete_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *delete_list = NULL;
|
||||||
|
gint pos;
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
delete_list = g_list_append (delete_list, gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_list_remove_items (GTK_LIST (gpe->dir_list), delete_list);
|
||||||
|
gpe->number_of_items--;
|
||||||
|
|
||||||
|
if (gpe->number_of_items == 0)
|
||||||
|
{
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (gpe->file_selection), "");
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->entry, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->browse_button, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pos == gpe->number_of_items) && (pos > 0))
|
||||||
|
pos--;
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), pos);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_move_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *move_list = NULL;
|
||||||
|
gint pos;
|
||||||
|
gint distance;
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
distance = (widget == gpe->up_button) ? - 1 : 1;
|
||||||
|
move_list = g_list_append (move_list, gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_remove_items_no_unref (GTK_LIST (gpe->dir_list), move_list);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_insert_items (GTK_LIST (gpe->dir_list), move_list, pos + distance);
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), pos + distance);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_filesel_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *append_list = NULL;
|
||||||
|
GtkWidget *list_item = NULL;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
directory = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
{
|
||||||
|
list_item = gtk_list_item_new_with_label (directory);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
|
||||||
|
directory,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
append_list = g_list_append (append_list, list_item);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "select",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_select_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "deselect",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_deselect_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_widget_show (list_item);
|
||||||
|
gpe->number_of_items++;
|
||||||
|
gtk_list_append_items (GTK_LIST (gpe->dir_list), append_list);
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), gpe->number_of_items - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (gpe->selected_item)->child),
|
||||||
|
directory);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (gpe->selected_item),
|
||||||
|
"gimp_path_editor",
|
||||||
|
directory,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gimp_path_editor_check_path (gpe, gpe->selected_item); */
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_data_destroy_callback (gpointer *data)
|
||||||
|
{
|
||||||
|
g_free (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void gimp_path_editor_check_path (GimpPathEditor *gpe,
|
||||||
|
GtkWidget *list_item)
|
||||||
|
{
|
||||||
|
g_print ("check path\n");
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,82 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimppatheditor.h
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_PATH_EDITOR_H__
|
||||||
|
#define __GIMP_PATH_EDITOR_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GIMP_TYPE_PATH_EDITOR (gimp_path_editor_get_type ())
|
||||||
|
#define GIMP_PATH_EDITOR(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_PATH_EDITOR, GimpPathEditor))
|
||||||
|
#define GIMP_PATH_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_EDITOR, GimpPathEditorClass))
|
||||||
|
#define GIMP_IS_PATH_EDITOR(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_PATH_EDITOR))
|
||||||
|
#define GIMP_IS_PATH_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_EDITOR))
|
||||||
|
|
||||||
|
typedef struct _GimpPathEditor GimpPathEditor;
|
||||||
|
typedef struct _GimpPathEditorClass GimpPathEditorClass;
|
||||||
|
|
||||||
|
struct _GimpPathEditor
|
||||||
|
{
|
||||||
|
GtkVBox vbox;
|
||||||
|
|
||||||
|
GtkWidget *upper_hbox;
|
||||||
|
|
||||||
|
GtkWidget *new_button;
|
||||||
|
GtkWidget *delete_button;
|
||||||
|
GtkWidget *up_button;
|
||||||
|
GtkWidget *down_button;
|
||||||
|
|
||||||
|
GtkWidget *file_selection;
|
||||||
|
|
||||||
|
GtkWidget *dir_list;
|
||||||
|
|
||||||
|
GtkWidget *selected_item;
|
||||||
|
gint number_of_items;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpPathEditorClass
|
||||||
|
{
|
||||||
|
GtkVBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* gimp_path_editor) (GimpPathEditor *gpe);
|
||||||
|
};
|
||||||
|
|
||||||
|
guint gimp_path_editor_get_type (void);
|
||||||
|
|
||||||
|
/* creates a new GimpPathEditor widget
|
||||||
|
*/
|
||||||
|
GtkWidget* gimp_path_editor_new (gchar *filesel_title,
|
||||||
|
gchar *path);
|
||||||
|
|
||||||
|
/* it's up to the caller to g_free() the returned string
|
||||||
|
*/
|
||||||
|
gchar* gimp_path_editor_get_path (GimpPathEditor *gpe);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __GIMP_PATH_EDITOR_H__ */
|
|
@ -0,0 +1,405 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.c
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gimpfileselection.h"
|
||||||
|
|
||||||
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
#include "pixmaps/yes.xpm"
|
||||||
|
#include "pixmaps/no.xpm"
|
||||||
|
|
||||||
|
/* callbacks
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static int gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
/* private functions
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GFS_FILENAME_CHANGED_SIGNAL,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static gint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
static GtkHBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_destroy (GtkObject *object)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (object));
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (object);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_widget_destroy (gfs->file_selection);
|
||||||
|
|
||||||
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||||
|
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_init (GimpFileSelectionClass *class)
|
||||||
|
{
|
||||||
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GtkObjectClass*) class;
|
||||||
|
|
||||||
|
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||||
|
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL] =
|
||||||
|
gtk_signal_new ("filename_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GimpFileSelectionClass,
|
||||||
|
gimp_file_selection),
|
||||||
|
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||||
|
gtk_object_class_add_signals (object_class, gimp_file_selection_signals,
|
||||||
|
LAST_SIGNAL);
|
||||||
|
|
||||||
|
object_class->destroy = gimp_file_selection_class_destroy;
|
||||||
|
class->gimp_file_selection = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_init (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
gfs->title = NULL;
|
||||||
|
gfs->file_selection = NULL;
|
||||||
|
gfs->file_exists = FALSE;
|
||||||
|
gfs->check_valid = FALSE;
|
||||||
|
|
||||||
|
gfs->browse_button = gtk_button_new_with_label (" ... ");
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
|
||||||
|
gtk_widget_show (gfs->browse_button);
|
||||||
|
|
||||||
|
gfs->entry = gtk_entry_new ();
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 5);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
|
||||||
|
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
|
||||||
|
(GdkEventFunc) gimp_file_selection_entry_focus_out_callback, gfs);
|
||||||
|
gtk_widget_show (gfs->entry);
|
||||||
|
|
||||||
|
/* this callback does the rest (pixmap creation etc.)
|
||||||
|
*/
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_realize), gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gimp_file_selection_get_type ()
|
||||||
|
{
|
||||||
|
static guint gfs_type = 0;
|
||||||
|
|
||||||
|
if (!gfs_type)
|
||||||
|
{
|
||||||
|
GtkTypeInfo gfs_info =
|
||||||
|
{
|
||||||
|
"GimpFileSelection",
|
||||||
|
sizeof (GimpFileSelection),
|
||||||
|
sizeof (GimpFileSelectionClass),
|
||||||
|
(GtkClassInitFunc) gimp_file_selection_class_init,
|
||||||
|
(GtkObjectInitFunc) gimp_file_selection_init,
|
||||||
|
/* reserved_1 */ NULL,
|
||||||
|
/* reserved_2 */ NULL,
|
||||||
|
(GtkClassInitFunc) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
gfs_type = gtk_type_unique (gtk_hbox_get_type (), &gfs_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gfs_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
gfs = gtk_type_new (gimp_file_selection_get_type ());
|
||||||
|
|
||||||
|
gfs->title = g_strdup (title);
|
||||||
|
gfs->dir_only = dir_only;
|
||||||
|
gfs->check_valid = check_valid;
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
return GTK_WIDGET (gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *parent;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (gfs)->parent;
|
||||||
|
if (! GTK_WIDGET_REALIZED (parent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (parent);
|
||||||
|
|
||||||
|
gfs->yes_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->yes_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
yes_xpm);
|
||||||
|
gfs->no_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->no_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
no_xpm);
|
||||||
|
|
||||||
|
gfs->file_exists = gtk_pixmap_new (gfs->no_pixmap, gfs->no_mask);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gfs), gfs->file_exists, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
gtk_widget_show (gfs->file_exists);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gimp_file_selection_get_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (gfs != NULL, g_strdup (""));
|
||||||
|
g_return_val_if_fail (GIMP_IS_FILE_SELECTION (gfs), g_strdup (""));
|
||||||
|
|
||||||
|
return gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename)
|
||||||
|
{
|
||||||
|
g_return_if_fail (gfs != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename));
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, (gpointer) gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
gint len;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
|
||||||
|
/* filenames still need more sanity checking
|
||||||
|
* (erase double G_DIR_SEPARATORS, ...)
|
||||||
|
*/
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
|
||||||
|
filename = g_strstrip (filename);
|
||||||
|
|
||||||
|
while (((len = strlen (filename)) > 1) &&
|
||||||
|
(filename[len - 1] == G_DIR_SEPARATOR))
|
||||||
|
filename[len - 1] = '\0';
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
g_free (filename);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gfs),
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_entry_callback (widget, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* these are local callbacks of gimp_file_selection_browse_callback()
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename =
|
||||||
|
gtk_file_selection_get_filename (GTK_FILE_SELECTION (gfs->file_selection));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_cancel_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_widget_hide (GIMP_FILE_SELECTION (data)->file_selection);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_filesel_delete_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_filesel_cancel_callback (NULL, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
|
||||||
|
if (gfs->file_selection == NULL)
|
||||||
|
{
|
||||||
|
if (gfs->dir_only)
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (gfs->title);
|
||||||
|
|
||||||
|
/* hiding these widgets uses internal gtk+ knowledge, but it's
|
||||||
|
* easier than creating my own directory browser -- michael
|
||||||
|
*/
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->fileop_del_file);
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->file_list->parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (_("Select File"));
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->ok_button)->child), _("Select"));
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button)->child), _("Close"));
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->ok_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->selection_entry),
|
||||||
|
"activate",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs), "unmap",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs->file_selection),
|
||||||
|
"delete_event",
|
||||||
|
(GdkEventFunc)gimp_file_selection_filesel_delete_callback,
|
||||||
|
gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
if (! GTK_WIDGET_VISIBLE (gfs->file_selection))
|
||||||
|
gtk_widget_show (gfs->file_selection);
|
||||||
|
else
|
||||||
|
gdk_window_raise (gfs->file_selection->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
static struct stat statbuf;
|
||||||
|
gchar* filename;
|
||||||
|
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
if (gfs->file_exists == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
if ((stat (filename, &statbuf) == 0) &&
|
||||||
|
(gfs->dir_only ? S_ISDIR(statbuf.st_mode) : S_ISREG(statbuf.st_mode)))
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->yes_pixmap, gfs->yes_mask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->no_pixmap, gfs->no_mask);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.h
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_FILE_SELECTION_H__
|
||||||
|
#define __GIMP_FILE_SELECTION_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GIMP_TYPE_FILE_SELECTION (gimp_file_selection_get_type ())
|
||||||
|
#define GIMP_FILE_SELECTION(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelection))
|
||||||
|
#define GIMP_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
|
||||||
|
#define GIMP_IS_FILE_SELECTION(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_FILE_SELECTION))
|
||||||
|
#define GIMP_IS_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION))
|
||||||
|
|
||||||
|
typedef struct _GimpFileSelection GimpFileSelection;
|
||||||
|
typedef struct _GimpFileSelectionClass GimpFileSelectionClass;
|
||||||
|
|
||||||
|
struct _GimpFileSelection
|
||||||
|
{
|
||||||
|
GtkVBox hbox;
|
||||||
|
|
||||||
|
GtkWidget *file_exists;
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *browse_button;
|
||||||
|
|
||||||
|
GtkWidget *file_selection;
|
||||||
|
|
||||||
|
GdkPixmap *yes_pixmap;
|
||||||
|
GdkBitmap *yes_mask;
|
||||||
|
GdkPixmap *no_pixmap;
|
||||||
|
GdkBitmap *no_mask;
|
||||||
|
|
||||||
|
gchar *title;
|
||||||
|
gboolean dir_only;
|
||||||
|
gboolean check_valid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpFileSelectionClass
|
||||||
|
{
|
||||||
|
GtkHBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* gimp_file_selection) (GimpFileSelection *gfs);
|
||||||
|
};
|
||||||
|
|
||||||
|
guint gimp_file_selection_get_type (void);
|
||||||
|
|
||||||
|
/* creates a new GimpFileSelection widget
|
||||||
|
*
|
||||||
|
* dir_only == TRUE will allow only directories
|
||||||
|
* check_valid == TRUE will show a pixmap which indicates if
|
||||||
|
* the filename is valid
|
||||||
|
*/
|
||||||
|
GtkWidget* gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid);
|
||||||
|
|
||||||
|
/* it's up to the caller to g_free() the returned string
|
||||||
|
*/
|
||||||
|
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
void gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __GIMP_FILE_SELECTION_H__ */
|
|
@ -0,0 +1,405 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.c
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gimpfileselection.h"
|
||||||
|
|
||||||
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
#include "pixmaps/yes.xpm"
|
||||||
|
#include "pixmaps/no.xpm"
|
||||||
|
|
||||||
|
/* callbacks
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static int gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
/* private functions
|
||||||
|
*/
|
||||||
|
static void gimp_file_selection_check_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GFS_FILENAME_CHANGED_SIGNAL,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static gint gimp_file_selection_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
static GtkHBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_destroy (GtkObject *object)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (object));
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (object);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_widget_destroy (gfs->file_selection);
|
||||||
|
|
||||||
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||||
|
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_class_init (GimpFileSelectionClass *class)
|
||||||
|
{
|
||||||
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GtkObjectClass*) class;
|
||||||
|
|
||||||
|
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||||
|
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL] =
|
||||||
|
gtk_signal_new ("filename_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GimpFileSelectionClass,
|
||||||
|
gimp_file_selection),
|
||||||
|
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||||
|
gtk_object_class_add_signals (object_class, gimp_file_selection_signals,
|
||||||
|
LAST_SIGNAL);
|
||||||
|
|
||||||
|
object_class->destroy = gimp_file_selection_class_destroy;
|
||||||
|
class->gimp_file_selection = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_init (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
gfs->title = NULL;
|
||||||
|
gfs->file_selection = NULL;
|
||||||
|
gfs->file_exists = FALSE;
|
||||||
|
gfs->check_valid = FALSE;
|
||||||
|
|
||||||
|
gfs->browse_button = gtk_button_new_with_label (" ... ");
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->browse_button, FALSE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->browse_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_browse_callback), gfs);
|
||||||
|
gtk_widget_show (gfs->browse_button);
|
||||||
|
|
||||||
|
gfs->entry = gtk_entry_new ();
|
||||||
|
gtk_box_pack_end (GTK_BOX (gfs), gfs->entry, TRUE, TRUE, 5);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "activate",
|
||||||
|
(GtkSignalFunc) gimp_file_selection_entry_callback, gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs->entry), "focus_out_event",
|
||||||
|
(GdkEventFunc) gimp_file_selection_entry_focus_out_callback, gfs);
|
||||||
|
gtk_widget_show (gfs->entry);
|
||||||
|
|
||||||
|
/* this callback does the rest (pixmap creation etc.)
|
||||||
|
*/
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gfs), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_file_selection_realize), gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gimp_file_selection_get_type ()
|
||||||
|
{
|
||||||
|
static guint gfs_type = 0;
|
||||||
|
|
||||||
|
if (!gfs_type)
|
||||||
|
{
|
||||||
|
GtkTypeInfo gfs_info =
|
||||||
|
{
|
||||||
|
"GimpFileSelection",
|
||||||
|
sizeof (GimpFileSelection),
|
||||||
|
sizeof (GimpFileSelectionClass),
|
||||||
|
(GtkClassInitFunc) gimp_file_selection_class_init,
|
||||||
|
(GtkObjectInitFunc) gimp_file_selection_init,
|
||||||
|
/* reserved_1 */ NULL,
|
||||||
|
/* reserved_2 */ NULL,
|
||||||
|
(GtkClassInitFunc) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
gfs_type = gtk_type_unique (gtk_hbox_get_type (), &gfs_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gfs_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
|
||||||
|
gfs = gtk_type_new (gimp_file_selection_get_type ());
|
||||||
|
|
||||||
|
gfs->title = g_strdup (title);
|
||||||
|
gfs->dir_only = dir_only;
|
||||||
|
gfs->check_valid = check_valid;
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
return GTK_WIDGET (gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_realize (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *parent;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (gfs)->parent;
|
||||||
|
if (! GTK_WIDGET_REALIZED (parent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (parent);
|
||||||
|
|
||||||
|
gfs->yes_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->yes_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
yes_xpm);
|
||||||
|
gfs->no_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&gfs->no_mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
no_xpm);
|
||||||
|
|
||||||
|
gfs->file_exists = gtk_pixmap_new (gfs->no_pixmap, gfs->no_mask);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gfs), gfs->file_exists, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
gtk_widget_show (gfs->file_exists);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gimp_file_selection_get_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (gfs != NULL, g_strdup (""));
|
||||||
|
g_return_val_if_fail (GIMP_IS_FILE_SELECTION (gfs), g_strdup (""));
|
||||||
|
|
||||||
|
return gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename)
|
||||||
|
{
|
||||||
|
g_return_if_fail (gfs != NULL);
|
||||||
|
g_return_if_fail (GIMP_IS_FILE_SELECTION (gfs));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), g_strdup (filename));
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, (gpointer) gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_entry_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
gint len;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
|
||||||
|
/* filenames still need more sanity checking
|
||||||
|
* (erase double G_DIR_SEPARATORS, ...)
|
||||||
|
*/
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
|
||||||
|
filename = g_strstrip (filename);
|
||||||
|
|
||||||
|
while (((len = strlen (filename)) > 1) &&
|
||||||
|
(filename[len - 1] == G_DIR_SEPARATOR))
|
||||||
|
filename[len - 1] = '\0';
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gfs->entry), gfs);
|
||||||
|
|
||||||
|
if (gfs->file_selection)
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
g_free (filename);
|
||||||
|
|
||||||
|
gimp_file_selection_check_filename (gfs);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gfs),
|
||||||
|
gimp_file_selection_signals[GFS_FILENAME_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_entry_focus_out_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_entry_callback (widget, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* these are local callbacks of gimp_file_selection_browse_callback()
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename =
|
||||||
|
gtk_file_selection_get_filename (GTK_FILE_SELECTION (gfs->file_selection));
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (gfs->entry), filename);
|
||||||
|
|
||||||
|
/* update everything
|
||||||
|
*/
|
||||||
|
gimp_file_selection_entry_callback (gfs->entry, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_filesel_cancel_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_widget_hide (GIMP_FILE_SELECTION (data)->file_selection);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
gimp_file_selection_filesel_delete_callback (GtkWidget *widget,
|
||||||
|
GdkEvent *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gimp_file_selection_filesel_cancel_callback (NULL, data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_browse_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpFileSelection *gfs;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
|
gfs = GIMP_FILE_SELECTION (data);
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
|
||||||
|
if (gfs->file_selection == NULL)
|
||||||
|
{
|
||||||
|
if (gfs->dir_only)
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (gfs->title);
|
||||||
|
|
||||||
|
/* hiding these widgets uses internal gtk+ knowledge, but it's
|
||||||
|
* easier than creating my own directory browser -- michael
|
||||||
|
*/
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->fileop_del_file);
|
||||||
|
gtk_widget_hide
|
||||||
|
(GTK_FILE_SELECTION (gfs->file_selection)->file_list->parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gfs->file_selection = gtk_file_selection_new (_("Select File"));
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->ok_button)->child), _("Select"));
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button)->child), _("Close"));
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->ok_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->selection_entry),
|
||||||
|
"activate",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_ok_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (gfs->file_selection)->cancel_button),
|
||||||
|
"clicked",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs), "unmap",
|
||||||
|
(GtkSignalFunc)gimp_file_selection_filesel_cancel_callback,
|
||||||
|
gfs);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gfs->file_selection),
|
||||||
|
"delete_event",
|
||||||
|
(GdkEventFunc)gimp_file_selection_filesel_delete_callback,
|
||||||
|
gfs);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_file_selection_set_filename (GTK_FILE_SELECTION (gfs->file_selection),
|
||||||
|
filename);
|
||||||
|
if (! GTK_WIDGET_VISIBLE (gfs->file_selection))
|
||||||
|
gtk_widget_show (gfs->file_selection);
|
||||||
|
else
|
||||||
|
gdk_window_raise (gfs->file_selection->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
||||||
|
{
|
||||||
|
static struct stat statbuf;
|
||||||
|
gchar* filename;
|
||||||
|
|
||||||
|
if (! gfs->check_valid)
|
||||||
|
return;
|
||||||
|
if (gfs->file_exists == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||||
|
if ((stat (filename, &statbuf) == 0) &&
|
||||||
|
(gfs->dir_only ? S_ISDIR(statbuf.st_mode) : S_ISREG(statbuf.st_mode)))
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->yes_pixmap, gfs->yes_mask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_pixmap_set (GTK_PIXMAP (gfs->file_exists),
|
||||||
|
gfs->no_pixmap, gfs->no_mask);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimpfileselection.h
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_FILE_SELECTION_H__
|
||||||
|
#define __GIMP_FILE_SELECTION_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GIMP_TYPE_FILE_SELECTION (gimp_file_selection_get_type ())
|
||||||
|
#define GIMP_FILE_SELECTION(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelection))
|
||||||
|
#define GIMP_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_SELECTION, GimpFileSelectionClass))
|
||||||
|
#define GIMP_IS_FILE_SELECTION(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_FILE_SELECTION))
|
||||||
|
#define GIMP_IS_FILE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_SELECTION))
|
||||||
|
|
||||||
|
typedef struct _GimpFileSelection GimpFileSelection;
|
||||||
|
typedef struct _GimpFileSelectionClass GimpFileSelectionClass;
|
||||||
|
|
||||||
|
struct _GimpFileSelection
|
||||||
|
{
|
||||||
|
GtkVBox hbox;
|
||||||
|
|
||||||
|
GtkWidget *file_exists;
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *browse_button;
|
||||||
|
|
||||||
|
GtkWidget *file_selection;
|
||||||
|
|
||||||
|
GdkPixmap *yes_pixmap;
|
||||||
|
GdkBitmap *yes_mask;
|
||||||
|
GdkPixmap *no_pixmap;
|
||||||
|
GdkBitmap *no_mask;
|
||||||
|
|
||||||
|
gchar *title;
|
||||||
|
gboolean dir_only;
|
||||||
|
gboolean check_valid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpFileSelectionClass
|
||||||
|
{
|
||||||
|
GtkHBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* gimp_file_selection) (GimpFileSelection *gfs);
|
||||||
|
};
|
||||||
|
|
||||||
|
guint gimp_file_selection_get_type (void);
|
||||||
|
|
||||||
|
/* creates a new GimpFileSelection widget
|
||||||
|
*
|
||||||
|
* dir_only == TRUE will allow only directories
|
||||||
|
* check_valid == TRUE will show a pixmap which indicates if
|
||||||
|
* the filename is valid
|
||||||
|
*/
|
||||||
|
GtkWidget* gimp_file_selection_new (gchar *title,
|
||||||
|
gchar *filename,
|
||||||
|
gboolean dir_only,
|
||||||
|
gboolean check_valid);
|
||||||
|
|
||||||
|
/* it's up to the caller to g_free() the returned string
|
||||||
|
*/
|
||||||
|
gchar* gimp_file_selection_get_filename (GimpFileSelection *gfs);
|
||||||
|
|
||||||
|
void gimp_file_selection_set_filename (GimpFileSelection *gfs,
|
||||||
|
gchar *filename);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __GIMP_FILE_SELECTION_H__ */
|
|
@ -0,0 +1,540 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimppatheditor.c
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gimppatheditor.h"
|
||||||
|
|
||||||
|
#include "libgimp/gimpfileselection.h"
|
||||||
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "pixmaps/new.xpm"
|
||||||
|
#include "pixmaps/delete.xpm"
|
||||||
|
#include "pixmaps/raise.xpm"
|
||||||
|
#include "pixmaps/lower.xpm"
|
||||||
|
|
||||||
|
/* callbacks
|
||||||
|
*/
|
||||||
|
static void gimp_path_editor_realize (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_select_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_deselect_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void gimp_path_editor_new_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_delete_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_move_callback (GtkWidget *widget, gpointer data);
|
||||||
|
static void gimp_path_editor_filesel_callback (GtkWidget *widget, gpointer data);
|
||||||
|
|
||||||
|
static void gimp_path_editor_data_destroy_callback (gpointer *data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void gimp_path_editor_check_path (GimpPathEditor *gpe,
|
||||||
|
GtkWidget *list_item);
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
GPE_PATH_CHANGED_SIGNAL,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static gint gimp_path_editor_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
static GtkVBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_class_init (GimpPathEditorClass *class)
|
||||||
|
{
|
||||||
|
GtkObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = (GtkObjectClass*) class;
|
||||||
|
|
||||||
|
parent_class = gtk_type_class (gtk_vbox_get_type ());
|
||||||
|
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL] =
|
||||||
|
gtk_signal_new ("path_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET (GimpPathEditorClass,
|
||||||
|
gimp_path_editor),
|
||||||
|
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||||
|
gtk_object_class_add_signals (object_class, gimp_path_editor_signals,
|
||||||
|
LAST_SIGNAL);
|
||||||
|
|
||||||
|
class->gimp_path_editor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_init (GimpPathEditor *gpe)
|
||||||
|
{
|
||||||
|
GtkWidget *button_box;
|
||||||
|
GtkWidget *scrolled_window;
|
||||||
|
GtkObject *hadjustment;
|
||||||
|
GtkObject *vadjustment;
|
||||||
|
|
||||||
|
gpe->file_selection = NULL;
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
gpe->number_of_items = 0;
|
||||||
|
|
||||||
|
gpe->upper_hbox = gtk_hbox_new (FALSE, 5);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe), gpe->upper_hbox, FALSE, TRUE, 0);
|
||||||
|
gtk_widget_show (gpe->upper_hbox);
|
||||||
|
|
||||||
|
button_box = gtk_hbox_new (TRUE, 0);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), button_box, FALSE, TRUE, 0);
|
||||||
|
gtk_widget_show (button_box);
|
||||||
|
|
||||||
|
gpe->new_button = gtk_button_new ();
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->new_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->new_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_new_callback), gpe);
|
||||||
|
|
||||||
|
gpe->delete_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->delete_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->delete_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_delete_callback), gpe);
|
||||||
|
|
||||||
|
gpe->up_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->up_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->up_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_move_callback), gpe);
|
||||||
|
|
||||||
|
gpe->down_button = gtk_button_new ();
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), gpe->down_button, TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe->down_button), "clicked",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_move_callback), gpe);
|
||||||
|
|
||||||
|
hadjustment = gtk_adjustment_new (0.0, 0.0, 1.0, 0.1, 0.2, 1.0);
|
||||||
|
vadjustment = gtk_adjustment_new (0.0, 0.0, 1.0, 0.1, 0.2, 1.0);
|
||||||
|
scrolled_window =
|
||||||
|
gtk_scrolled_window_new (GTK_ADJUSTMENT (hadjustment),
|
||||||
|
GTK_ADJUSTMENT (vadjustment));
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe), scrolled_window, TRUE, TRUE, 0);
|
||||||
|
gtk_widget_show (scrolled_window);
|
||||||
|
|
||||||
|
gpe->dir_list = gtk_list_new ();
|
||||||
|
gtk_list_set_selection_mode (GTK_LIST (gpe->dir_list), GTK_SELECTION_SINGLE);
|
||||||
|
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||||
|
gpe->dir_list);
|
||||||
|
gtk_widget_show (gpe->dir_list);
|
||||||
|
|
||||||
|
/* this callback does the rest (pixmap creation etc.)
|
||||||
|
*/
|
||||||
|
gtk_signal_connect (GTK_OBJECT(gpe), "realize",
|
||||||
|
GTK_SIGNAL_FUNC(gimp_path_editor_realize), gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gimp_path_editor_get_type ()
|
||||||
|
{
|
||||||
|
static guint gpe_type = 0;
|
||||||
|
|
||||||
|
if (!gpe_type)
|
||||||
|
{
|
||||||
|
GtkTypeInfo gpe_info =
|
||||||
|
{
|
||||||
|
"GimpPathEditor",
|
||||||
|
sizeof (GimpPathEditor),
|
||||||
|
sizeof (GimpPathEditorClass),
|
||||||
|
(GtkClassInitFunc) gimp_path_editor_class_init,
|
||||||
|
(GtkObjectInitFunc) gimp_path_editor_init,
|
||||||
|
/* reserved_1 */ NULL,
|
||||||
|
/* reserved_2 */ NULL,
|
||||||
|
(GtkClassInitFunc) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
gpe_type = gtk_type_unique (gtk_vbox_get_type (), &gpe_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gpe_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gimp_path_editor_new (gchar *filesel_title,
|
||||||
|
gchar *path)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
GtkWidget *list_item;
|
||||||
|
GList *directory_list;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((filesel_title != NULL), NULL);
|
||||||
|
g_return_val_if_fail ((path != NULL), NULL);
|
||||||
|
|
||||||
|
gpe = gtk_type_new (gimp_path_editor_get_type ());
|
||||||
|
|
||||||
|
gpe->file_selection = gimp_file_selection_new (filesel_title, "", TRUE, TRUE);
|
||||||
|
gtk_widget_set_sensitive (gpe->file_selection, FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), gpe->file_selection,
|
||||||
|
TRUE, TRUE, 0);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (gpe->file_selection), "filename_changed",
|
||||||
|
(GtkSignalFunc) gimp_path_editor_filesel_callback, gpe);
|
||||||
|
gtk_widget_show (gpe->file_selection);
|
||||||
|
|
||||||
|
directory_list = NULL;
|
||||||
|
directory = path = g_strdup (path);
|
||||||
|
|
||||||
|
/* split up the path
|
||||||
|
*/
|
||||||
|
while (strlen (directory))
|
||||||
|
{
|
||||||
|
gchar *current_dir;
|
||||||
|
gchar *next_separator;
|
||||||
|
|
||||||
|
next_separator = strchr (directory, G_SEARCHPATH_SEPARATOR);
|
||||||
|
if (next_separator != NULL)
|
||||||
|
*next_separator = '\0';
|
||||||
|
|
||||||
|
current_dir = g_strdup (directory);
|
||||||
|
|
||||||
|
list_item = gtk_list_item_new_with_label (current_dir);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
|
||||||
|
current_dir,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
directory_list = g_list_append (directory_list, list_item);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "select",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_select_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "deselect",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_deselect_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_widget_show (list_item);
|
||||||
|
gpe->number_of_items++;
|
||||||
|
|
||||||
|
if (next_separator != NULL)
|
||||||
|
directory = next_separator + 1;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
|
||||||
|
if (directory_list)
|
||||||
|
gtk_list_append_items (GTK_LIST (gpe->dir_list), directory_list);
|
||||||
|
|
||||||
|
return GTK_WIDGET (gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_realize (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *parent;
|
||||||
|
GdkPixmap *pixmap;
|
||||||
|
GdkBitmap *mask;
|
||||||
|
GtkWidget *gtk_pixmap;
|
||||||
|
/* GList *list = NULL; */
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
parent = GTK_WIDGET (gpe)->parent;
|
||||||
|
if (! GTK_WIDGET_REALIZED (parent))
|
||||||
|
return;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (parent);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
new_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->new_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->new_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
delete_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->delete_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->delete_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
raise_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->up_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->up_button);
|
||||||
|
|
||||||
|
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||||
|
&mask,
|
||||||
|
&style->bg[GTK_STATE_NORMAL],
|
||||||
|
lower_xpm);
|
||||||
|
gtk_pixmap = gtk_pixmap_new (pixmap, mask);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gpe->down_button), gtk_pixmap);
|
||||||
|
gtk_widget_show (gtk_pixmap);
|
||||||
|
gtk_widget_show (gpe->down_button);
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (list = GTK_LIST (gpe->dir_list)->children; list; list = list->next)
|
||||||
|
{
|
||||||
|
gimp_path_editor_check_path (gpe, GTK_WIDGET (list->data));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gimp_path_editor_get_path (GimpPathEditor *gpe)
|
||||||
|
{
|
||||||
|
GList *list;
|
||||||
|
gchar *path = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gpe != NULL, g_strdup (""));
|
||||||
|
g_return_val_if_fail (GIMP_IS_PATH_EDITOR (gpe), g_strdup (""));
|
||||||
|
|
||||||
|
for (list = GTK_LIST (gpe->dir_list)->children; list; list = list->next)
|
||||||
|
{
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
path = g_strdup ((gchar*)gtk_object_get_data (GTK_OBJECT (list->data),
|
||||||
|
"gimp_path_editor"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gchar *newpath;
|
||||||
|
|
||||||
|
newpath =
|
||||||
|
g_strconcat (path,
|
||||||
|
G_SEARCHPATH_SEPARATOR_S,
|
||||||
|
(gchar*)gtk_object_get_data (GTK_OBJECT (list->data),
|
||||||
|
"gimp_path_editor"),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
path = newpath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_select_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
gint pos;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
directory = (gchar*)gtk_object_get_data (GTK_OBJECT (widget),
|
||||||
|
"gimp_path_editor");
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (gpe->file_selection),
|
||||||
|
directory);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gpe->selected_item = widget;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, TRUE);
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, (pos > 0));
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button,
|
||||||
|
(pos < (gpe->number_of_items - 1)));
|
||||||
|
gtk_widget_set_sensitive (gpe->file_selection, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the selected directory may never be deselected except by the 'new'
|
||||||
|
* button, so catch the "deselect" signal and reselect it
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
gimp_path_editor_deselect_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
if (widget != gpe->selected_item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_select_child (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_new_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe;
|
||||||
|
|
||||||
|
gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
|
||||||
|
if (gpe->selected_item)
|
||||||
|
{
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_unselect_child (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
}
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (gpe->up_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (gpe->down_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->entry, TRUE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->browse_button, TRUE);
|
||||||
|
|
||||||
|
gtk_editable_set_position (GTK_EDITABLE (GIMP_FILE_SELECTION (gpe->file_selection)->entry), -1);
|
||||||
|
/* gtk_editable_select_region (GTK_EDITABLE (gpe->entry), 0, -1); */
|
||||||
|
gtk_widget_grab_focus (GTK_WIDGET (GIMP_FILE_SELECTION (gpe->file_selection)->entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_delete_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *delete_list = NULL;
|
||||||
|
gint pos;
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
delete_list = g_list_append (delete_list, gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_list_remove_items (GTK_LIST (gpe->dir_list), delete_list);
|
||||||
|
gpe->number_of_items--;
|
||||||
|
|
||||||
|
if (gpe->number_of_items == 0)
|
||||||
|
{
|
||||||
|
gpe->selected_item = NULL;
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gimp_file_selection_set_filename (GIMP_FILE_SELECTION (gpe->file_selection), "");
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->file_selection), gpe);
|
||||||
|
gtk_widget_set_sensitive (gpe->delete_button, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->entry, FALSE);
|
||||||
|
gtk_widget_set_sensitive (GIMP_FILE_SELECTION (gpe->file_selection)->browse_button, FALSE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pos == gpe->number_of_items) && (pos > 0))
|
||||||
|
pos--;
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), pos);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_move_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *move_list = NULL;
|
||||||
|
gint pos;
|
||||||
|
gint distance;
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pos = gtk_list_child_position (GTK_LIST (gpe->dir_list), gpe->selected_item);
|
||||||
|
distance = (widget == gpe->up_button) ? - 1 : 1;
|
||||||
|
move_list = g_list_append (move_list, gpe->selected_item);
|
||||||
|
|
||||||
|
gtk_signal_handler_block_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_remove_items_no_unref (GTK_LIST (gpe->dir_list), move_list);
|
||||||
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gpe->selected_item), gpe);
|
||||||
|
gtk_list_insert_items (GTK_LIST (gpe->dir_list), move_list, pos + distance);
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), pos + distance);
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_filesel_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpPathEditor *gpe = GIMP_PATH_EDITOR (data);
|
||||||
|
GList *append_list = NULL;
|
||||||
|
GtkWidget *list_item = NULL;
|
||||||
|
gchar *directory;
|
||||||
|
|
||||||
|
directory = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
|
||||||
|
|
||||||
|
if (gpe->selected_item == NULL)
|
||||||
|
{
|
||||||
|
list_item = gtk_list_item_new_with_label (directory);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
|
||||||
|
directory,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
append_list = g_list_append (append_list, list_item);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "select",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_select_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (list_item), "deselect",
|
||||||
|
(GtkSignalFunc)gimp_path_editor_deselect_callback,
|
||||||
|
gpe);
|
||||||
|
gtk_widget_show (list_item);
|
||||||
|
gpe->number_of_items++;
|
||||||
|
gtk_list_append_items (GTK_LIST (gpe->dir_list), append_list);
|
||||||
|
gtk_list_select_item (GTK_LIST (gpe->dir_list), gpe->number_of_items - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (gpe->selected_item)->child),
|
||||||
|
directory);
|
||||||
|
gtk_object_set_data_full (GTK_OBJECT (gpe->selected_item),
|
||||||
|
"gimp_path_editor",
|
||||||
|
directory,
|
||||||
|
(GtkDestroyNotify)gimp_path_editor_data_destroy_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gimp_path_editor_check_path (gpe, gpe->selected_item); */
|
||||||
|
|
||||||
|
gtk_signal_emit (GTK_OBJECT (gpe),
|
||||||
|
gimp_path_editor_signals[GPE_PATH_CHANGED_SIGNAL]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_path_editor_data_destroy_callback (gpointer *data)
|
||||||
|
{
|
||||||
|
g_free (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void gimp_path_editor_check_path (GimpPathEditor *gpe,
|
||||||
|
GtkWidget *list_item)
|
||||||
|
{
|
||||||
|
g_print ("check path\n");
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,82 @@
|
||||||
|
/* LIBGIMP - The GIMP Library
|
||||||
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
|
*
|
||||||
|
* gimppatheditor.h
|
||||||
|
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_PATH_EDITOR_H__
|
||||||
|
#define __GIMP_PATH_EDITOR_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GIMP_TYPE_PATH_EDITOR (gimp_path_editor_get_type ())
|
||||||
|
#define GIMP_PATH_EDITOR(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_PATH_EDITOR, GimpPathEditor))
|
||||||
|
#define GIMP_PATH_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PATH_EDITOR, GimpPathEditorClass))
|
||||||
|
#define GIMP_IS_PATH_EDITOR(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_PATH_EDITOR))
|
||||||
|
#define GIMP_IS_PATH_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PATH_EDITOR))
|
||||||
|
|
||||||
|
typedef struct _GimpPathEditor GimpPathEditor;
|
||||||
|
typedef struct _GimpPathEditorClass GimpPathEditorClass;
|
||||||
|
|
||||||
|
struct _GimpPathEditor
|
||||||
|
{
|
||||||
|
GtkVBox vbox;
|
||||||
|
|
||||||
|
GtkWidget *upper_hbox;
|
||||||
|
|
||||||
|
GtkWidget *new_button;
|
||||||
|
GtkWidget *delete_button;
|
||||||
|
GtkWidget *up_button;
|
||||||
|
GtkWidget *down_button;
|
||||||
|
|
||||||
|
GtkWidget *file_selection;
|
||||||
|
|
||||||
|
GtkWidget *dir_list;
|
||||||
|
|
||||||
|
GtkWidget *selected_item;
|
||||||
|
gint number_of_items;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpPathEditorClass
|
||||||
|
{
|
||||||
|
GtkVBoxClass parent_class;
|
||||||
|
|
||||||
|
void (* gimp_path_editor) (GimpPathEditor *gpe);
|
||||||
|
};
|
||||||
|
|
||||||
|
guint gimp_path_editor_get_type (void);
|
||||||
|
|
||||||
|
/* creates a new GimpPathEditor widget
|
||||||
|
*/
|
||||||
|
GtkWidget* gimp_path_editor_new (gchar *filesel_title,
|
||||||
|
gchar *path);
|
||||||
|
|
||||||
|
/* it's up to the caller to g_free() the returned string
|
||||||
|
*/
|
||||||
|
gchar* gimp_path_editor_get_path (GimpPathEditor *gpe);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __GIMP_PATH_EDITOR_H__ */
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* XPM */
|
||||||
|
static char * no_xpm[] = {
|
||||||
|
"18 18 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #FF0000",
|
||||||
|
"+ c #7F7F7F",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" . . ",
|
||||||
|
" ... ... ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" ......+ ",
|
||||||
|
" ....+ ",
|
||||||
|
" .... ",
|
||||||
|
" ...... ",
|
||||||
|
" ...++... ",
|
||||||
|
" ...+ ... ",
|
||||||
|
" ...+ ... ",
|
||||||
|
" ...+ ... ",
|
||||||
|
" .+ .+ ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* XPM */
|
||||||
|
static char * yes_xpm[] = {
|
||||||
|
"18 18 3 1",
|
||||||
|
" c None",
|
||||||
|
". c #3D841B",
|
||||||
|
"+ c #7F7F7F",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" . ",
|
||||||
|
" ... ",
|
||||||
|
" ...+ ",
|
||||||
|
" ...+ ",
|
||||||
|
" . ...+ ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" ... ...+ ",
|
||||||
|
" .....+ ",
|
||||||
|
" ...+ ",
|
||||||
|
" .+ ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
Loading…
Reference in New Issue