Commit 996d24a3 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/plug-in/plug-in-progress.[ch] added new PDB function

2005-02-12  Sven Neumann  <sven@gimp.org>

	* app/plug-in/plug-in-progress.[ch]
	* tools/pdbgen/pdb/progress.pdb: added new PDB function
	gimp_progress_set_text().

	* app/pdb/internal_procs.c
	* app/pdb/progress_cmds.c
	* libgimp/gimpprogress_pdb.[ch]: regenerated.

	* libgimp/gimp.def: updated.
parent 9cabb3e9
......@@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
/* 450 procedures registered total */
/* 451 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -89,7 +89,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Brush UI"), 0.049);
register_brush_select_procs (gimp);
(* status_callback) (NULL, _("Brushes"), 0.056);
(* status_callback) (NULL, _("Brushes"), 0.055);
register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.069);
......@@ -104,106 +104,106 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Convert"), 0.171);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.178);
(* status_callback) (NULL, _("Display procedures"), 0.177);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.187);
(* status_callback) (NULL, _("Drawable procedures"), 0.186);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.262);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.298);
(* status_callback) (NULL, _("Edit procedures"), 0.297);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.318);
(* status_callback) (NULL, _("File Operations"), 0.317);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.34);
(* status_callback) (NULL, _("Floating selections"), 0.339);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.353);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.36);
(* status_callback) (NULL, _("Fonts"), 0.359);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.364);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.378);
(* status_callback) (NULL, _("Gradient"), 0.377);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.444);
(* status_callback) (NULL, _("Gradient UI"), 0.443);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.451);
(* status_callback) (NULL, _("Gradients"), 0.45);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.462);
(* status_callback) (NULL, _("Guide procedures"), 0.461);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.476);
(* status_callback) (NULL, _("Help procedures"), 0.475);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.478);
(* status_callback) (NULL, _("Image"), 0.477);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.616);
(* status_callback) (NULL, _("Layer"), 0.614);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.676);
(* status_callback) (NULL, _("Message procedures"), 0.674);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.682);
(* status_callback) (NULL, _("Miscellaneous"), 0.681);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.687);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.685);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.72);
(* status_callback) (NULL, _("Palette"), 0.718);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.747);
(* status_callback) (NULL, _("Palette UI"), 0.745);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.753);
(* status_callback) (NULL, _("Palettes"), 0.752);
register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.762);
(* status_callback) (NULL, _("Parasite procedures"), 0.761);
register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.789);
(* status_callback) (NULL, _("Paths"), 0.787);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.822);
(* status_callback) (NULL, _("Pattern"), 0.82);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.827);
(* status_callback) (NULL, _("Pattern UI"), 0.825);
register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.833);
(* status_callback) (NULL, _("Patterns"), 0.831);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.842);
(* status_callback) (NULL, _("Plug-in"), 0.84);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.853);
(* status_callback) (NULL, _("Procedural database"), 0.851);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.873);
(* status_callback) (NULL, _("Progress"), 0.871);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.887);
register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.924);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.925);
register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.936);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.944);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.945);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.958);
......
......@@ -33,6 +33,7 @@
static ProcRecord progress_init_proc;
static ProcRecord progress_update_proc;
static ProcRecord progress_pulse_proc;
static ProcRecord progress_set_text_proc;
static ProcRecord progress_install_proc;
static ProcRecord progress_uninstall_proc;
static ProcRecord progress_cancel_proc;
......@@ -43,6 +44,7 @@ register_progress_procs (Gimp *gimp)
procedural_db_register (gimp, &progress_init_proc);
procedural_db_register (gimp, &progress_update_proc);
procedural_db_register (gimp, &progress_pulse_proc);
procedural_db_register (gimp, &progress_set_text_proc);
procedural_db_register (gimp, &progress_install_proc);
procedural_db_register (gimp, &progress_uninstall_proc);
procedural_db_register (gimp, &progress_cancel_proc);
......@@ -191,6 +193,59 @@ static ProcRecord progress_pulse_proc =
{ { progress_pulse_invoker } }
};
static Argument *
progress_set_text_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
gchar *message;
message = (gchar *) args[0].value.pdb_pointer;
if (message && !g_utf8_validate (message, -1, NULL))
success = FALSE;
if (success)
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_set_text (gimp->current_plug_in, message);
}
else
success = FALSE;
}
return procedural_db_return_args (&progress_set_text_proc, success);
}
static ProcArg progress_set_text_inargs[] =
{
{
GIMP_PDB_STRING,
"message",
"Message to use in the progress dialog"
}
};
static ProcRecord progress_set_text_proc =
{
"gimp_progress_set_text",
"Changes the text in the progress bar for the current plug-in.",
"This function allows to change the text in the progress bar for the current plug-in. Unlike gimp_progress_init() it does not change the displayed value.",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann",
"2005",
NULL,
GIMP_INTERNAL,
1,
progress_set_text_inargs,
0,
NULL,
{ { progress_set_text_invoker } }
};
static Argument *
progress_install_invoker (Gimp *gimp,
GimpContext *context,
......
......@@ -131,6 +131,20 @@ plug_in_progress_pulse (PlugIn *plug_in)
gimp_progress_pulse (proc_frame->progress);
}
void
plug_in_progress_set_text (PlugIn *plug_in,
const gchar *message)
{
PlugInProcFrame *proc_frame;
g_return_if_fail (plug_in != NULL);
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
gimp_progress_set_text (proc_frame->progress, message);
}
void
plug_in_progress_end (PlugIn *plug_in)
{
......
......@@ -28,6 +28,8 @@ void plug_in_progress_start (PlugIn *plug_in,
void plug_in_progress_update (PlugIn *plug_in,
gdouble percentage);
void plug_in_progress_pulse (PlugIn *plug_in);
void plug_in_progress_set_text (PlugIn *plug_in,
const gchar *message);
void plug_in_progress_end (PlugIn *plug_in);
gboolean plug_in_progress_install (PlugIn *plug_in,
......
......@@ -131,6 +131,20 @@ plug_in_progress_pulse (PlugIn *plug_in)
gimp_progress_pulse (proc_frame->progress);
}
void
plug_in_progress_set_text (PlugIn *plug_in,
const gchar *message)
{
PlugInProcFrame *proc_frame;
g_return_if_fail (plug_in != NULL);
proc_frame = plug_in_get_proc_frame (plug_in);
if (proc_frame->progress)
gimp_progress_set_text (proc_frame->progress, message);
}
void
plug_in_progress_end (PlugIn *plug_in)
{
......
......@@ -28,6 +28,8 @@ void plug_in_progress_start (PlugIn *plug_in,
void plug_in_progress_update (PlugIn *plug_in,
gdouble percentage);
void plug_in_progress_pulse (PlugIn *plug_in);
void plug_in_progress_set_text (PlugIn *plug_in,
const gchar *message);
void plug_in_progress_end (PlugIn *plug_in);
gboolean plug_in_progress_install (PlugIn *plug_in,
......
......@@ -718,6 +718,7 @@ GimpProgressValueCallback
gimp_progress_init
gimp_progress_update
gimp_progress_pulse
gimp_progress_set_text
gimp_progress_install
gimp_progress_uninstall
gimp_progress_cancel
......
......@@ -76,6 +76,15 @@ Functions for embedding the progress bar into a plug-in's GUI.
@Returns:
<!-- ##### FUNCTION gimp_progress_set_text ##### -->
<para>
</para>
@message:
@Returns:
<!-- ##### FUNCTION gimp_progress_install ##### -->
<para>
......
......@@ -481,6 +481,7 @@ EXPORTS
gimp_progress_init
gimp_progress_install
gimp_progress_pulse
gimp_progress_set_text
gimp_progress_uninstall
gimp_progress_update
gimp_quit
......
......@@ -120,6 +120,39 @@ gimp_progress_pulse (void)
return success;
}
/**
* gimp_progress_set_text:
* @message: Message to use in the progress dialog.
*
* Changes the text in the progress bar for the current plug-in.
*
* This function allows to change the text in the progress bar for the
* current plug-in. Unlike gimp_progress_init() it does not change the
* displayed value.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_progress_set_text (const gchar *message)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_progress_set_text",
&nreturn_vals,
GIMP_PDB_STRING, message,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* _gimp_progress_install:
* @progress_callback: The callback PDB proc to call.
......
......@@ -32,6 +32,7 @@ G_BEGIN_DECLS
gboolean gimp_progress_init (const gchar *message);
gboolean gimp_progress_update (gdouble percentage);
gboolean gimp_progress_pulse (void);
gboolean gimp_progress_set_text (const gchar *message);
gboolean _gimp_progress_install (const gchar *progress_callback);
gboolean _gimp_progress_uninstall (const gchar *progress_callback);
gboolean gimp_progress_cancel (const gchar *progress_callback);
......
......@@ -24,6 +24,13 @@ sub pdb_misc {
$since = '2.2';
}
sub neo_pdb_misc {
$author = 'Sven Neumann <sven@gimp.org>';
$copyright = 'Sven Neumann';
$date = '2005';
$since = '2.4';
}
sub progress_init {
$blurb = 'Initializes the progress bar for the current plug-in.';
......@@ -99,10 +106,7 @@ made. This usually causes the the progress bar to enter "activity
mode", where a block bounces back and forth.
HELP
$author = 'Sven Neumann <sven@gimp.org>';
$copyright = 'Sven Neumann';
$date = '2005';
$since = '2.4';
&neo_pdb_misc;
%invoke = (
code => <<'CODE'
......@@ -119,6 +123,36 @@ CODE
);
}
sub progress_set_text {
$blurb = 'Changes the text in the progress bar for the current plug-in.';
$help = <<'HELP';
This function allows to change the text in the progress bar for the
current plug-in. Unlike gimp_progress_init() it does not change the
displayed value.
HELP
&neo_pdb_misc;
@inargs = (
{ name => 'message', type => 'string', null_ok => 1,
desc => 'Message to use in the progress dialog' }
);
%invoke = (
code => <<'CODE'
{
if (gimp->current_plug_in && gimp->current_plug_in->open)
{
if (! gimp->no_interface)
plug_in_progress_set_text (gimp->current_plug_in, message);
}
else
success = FALSE;
}
CODE
);
}
sub progress_install {
$blurb = 'Installs a progress callback for the current plug-in.';
......@@ -207,7 +241,7 @@ CODE
@headers = qw("core/gimp.h" "plug-in/plug-in.h" "plug-in/plug-in-progress.h");
@procs = qw(progress_init progress_update progress_pulse
@procs = qw(progress_init progress_update progress_pulse progress_set_text
progress_install progress_uninstall progress_cancel);
%exports = (app => [@procs], lib => [@procs]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment