Add dialogs_show_input_numeric() to the plugins API.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3497 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
0582c61824
commit
836fa1dca0
@ -9,6 +9,9 @@
|
||||
* src/document.c, src/keyfile.c, src/search.c, src/tools.c,
|
||||
src/utils.c, src/vte.c, tagmanager/tm_source_file.c:
|
||||
Replace remaining occurrences of '__func__' with 'G_STRFUNC'.
|
||||
* plugins/geanyfunctions.h, src/dialogs.c, src/plugindata.h,
|
||||
src/plugins.c:
|
||||
Add dialogs_show_input_numeric() to the plugins API.
|
||||
|
||||
|
||||
2009-01-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
@ -190,6 +190,8 @@
|
||||
geany_functions->p_dialogs->show_msgbox
|
||||
#define dialogs_show_save_as \
|
||||
geany_functions->p_dialogs->show_save_as
|
||||
#define dialogs_show_input_numeric \
|
||||
geany_functions->p_dialogs->show_input_numeric
|
||||
#define msgwin_status_add \
|
||||
geany_functions->p_msgwin->status_add
|
||||
#define msgwin_compiler_add \
|
||||
|
||||
@ -924,12 +924,30 @@ dialogs_show_input(const gchar *title, const gchar *label_text, const gchar *def
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show an input box to enter a numerical value using a GtkSpinButton.
|
||||
*
|
||||
* @param title The dialog title.
|
||||
* @param label_text The shown dialog label.
|
||||
* @param value The default value for the spin button and the return location of the entered value.
|
||||
* Must be non-NULL.
|
||||
* @param min Minimum allowable value (see documentation for @a gtk_spin_button_new_with_range()).
|
||||
* @param max Maximum allowable value (see documentation for @a gtk_spin_button_new_with_range()).
|
||||
* @param step Increment added or subtracted by spinning the widget
|
||||
* (see documentation for @a gtk_spin_button_new_with_range()).
|
||||
*
|
||||
* @return @a TRUE if a value was entered and the dialog closed with 'OK'. @a FALSE otherwise.
|
||||
**/
|
||||
gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text,
|
||||
gdouble *value, gdouble min, gdouble max, gdouble step)
|
||||
{
|
||||
GtkWidget *dialog, *label, *spin, *vbox;
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_val_if_fail(title != NULL, FALSE);
|
||||
g_return_val_if_fail(label_text != NULL, FALSE);
|
||||
g_return_val_if_fail(value != NULL, FALSE);
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
enum {
|
||||
/** The Application Programming Interface (API) version, incremented
|
||||
* whenever any plugin data types are modified or appended to. */
|
||||
GEANY_API_VERSION = 127,
|
||||
GEANY_API_VERSION = 128,
|
||||
|
||||
/** The Application Binary Interface (ABI) version, incremented whenever
|
||||
* existing fields in the plugin data types have to be changed or reordered. */
|
||||
@ -393,6 +393,9 @@ typedef struct DialogFuncs
|
||||
gboolean (*show_question) (const gchar *text, ...);
|
||||
void (*show_msgbox) (gint type, const gchar *text, ...);
|
||||
gboolean (*show_save_as) (void);
|
||||
gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text,
|
||||
gdouble *value, gdouble min, gdouble max, gdouble step);
|
||||
|
||||
}
|
||||
DialogFuncs;
|
||||
|
||||
|
||||
@ -231,7 +231,8 @@ static UIUtilsFuncs uiutils_funcs = {
|
||||
static DialogFuncs dialog_funcs = {
|
||||
&dialogs_show_question,
|
||||
&dialogs_show_msgbox,
|
||||
&dialogs_show_save_as
|
||||
&dialogs_show_save_as,
|
||||
&dialogs_show_input_numeric
|
||||
};
|
||||
|
||||
/* Macro to prevent confusing macro being generated in geanyfunctions.h */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user