Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
gnumeric
Commits
5bcab256
Commit
5bcab256
authored
Apr 06, 1999
by
Michael Meeks
Browse files
Improved function wizard, RAND implemented
parent
c5680e8a
Changes
14
Hide whitespace changes
Inline
Side-by-side
ChangeLog-1999-07-09
View file @
5bcab256
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/func.c (tokenised_help_new): Improved algorithem.
(functions_init): Made descriptions more verbose.
* src/workbook.c (wizard_input): Cleaned to use local
entry instead of specific wb->ea_input.
* src/dialog-function-wizard.c (function_type_input):
Update types, add recursive function button.
(function_input): Created.
(arg_data_list_new): Added wb to ARG_DATA, needed for
function_input.
Added default code for multi-arg functions.
Deals with no-argument functions properly,
Fix silly args=NULL g_free(args) bug.
(dialog_function_wizard): Special 'no-arguments' quick
case.
* src/fn-math.c (gnumeric_rand): Added RAND function.
1999-04-05 Morten Wellinder <terra@diku.dk>
* src/cell.c (cell_set_rendered_text): Fix for circular
...
...
ChangeLog-2000-02-23
View file @
5bcab256
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/func.c (tokenised_help_new): Improved algorithem.
(functions_init): Made descriptions more verbose.
* src/workbook.c (wizard_input): Cleaned to use local
entry instead of specific wb->ea_input.
* src/dialog-function-wizard.c (function_type_input):
Update types, add recursive function button.
(function_input): Created.
(arg_data_list_new): Added wb to ARG_DATA, needed for
function_input.
Added default code for multi-arg functions.
Deals with no-argument functions properly,
Fix silly args=NULL g_free(args) bug.
(dialog_function_wizard): Special 'no-arguments' quick
case.
* src/fn-math.c (gnumeric_rand): Added RAND function.
1999-04-05 Morten Wellinder <terra@diku.dk>
* src/cell.c (cell_set_rendered_text): Fix for circular
...
...
OChangeLog-1999-07-09
View file @
5bcab256
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/func.c (tokenised_help_new): Improved algorithem.
(functions_init): Made descriptions more verbose.
* src/workbook.c (wizard_input): Cleaned to use local
entry instead of specific wb->ea_input.
* src/dialog-function-wizard.c (function_type_input):
Update types, add recursive function button.
(function_input): Created.
(arg_data_list_new): Added wb to ARG_DATA, needed for
function_input.
Added default code for multi-arg functions.
Deals with no-argument functions properly,
Fix silly args=NULL g_free(args) bug.
(dialog_function_wizard): Special 'no-arguments' quick
case.
* src/fn-math.c (gnumeric_rand): Added RAND function.
1999-04-05 Morten Wellinder <terra@diku.dk>
* src/cell.c (cell_set_rendered_text): Fix for circular
...
...
OChangeLog-2000-02-23
View file @
5bcab256
1999-04-06 Michael Meeks <michael@imaginator.com>
* src/func.c (tokenised_help_new): Improved algorithem.
(functions_init): Made descriptions more verbose.
* src/workbook.c (wizard_input): Cleaned to use local
entry instead of specific wb->ea_input.
* src/dialog-function-wizard.c (function_type_input):
Update types, add recursive function button.
(function_input): Created.
(arg_data_list_new): Added wb to ARG_DATA, needed for
function_input.
Added default code for multi-arg functions.
Deals with no-argument functions properly,
Fix silly args=NULL g_free(args) bug.
(dialog_function_wizard): Special 'no-arguments' quick
case.
* src/fn-math.c (gnumeric_rand): Added RAND function.
1999-04-05 Morten Wellinder <terra@diku.dk>
* src/cell.c (cell_set_rendered_text): Fix for circular
...
...
plugins/fn-math/functions.c
View file @
5bcab256
...
...
@@ -1073,6 +1073,24 @@ gnumeric_radians (struct FunctionDefinition *i, Value *argv [], char **error_str
return
value_float
((
value_get_as_double
(
argv
[
0
])
*
M_PI
)
/
180
);
}
static
char
*
help_rand
=
{
N_
(
"@FUNCTION=RAND
\n
"
"@SYNTAX=RAND()
\n
"
"@DESCRIPTION="
"Returns a random number greater than or equal to 0 and less than 1."
"
\n
"
"
\n
"
"@SEEALSO="
)
};
static
Value
*
gnumeric_rand
(
struct
FunctionDefinition
*
i
,
Value
*
argv
[],
char
**
error_string
)
{
return
value_float
(
rand
()
/
(
RAND_MAX
+
1
.
0
))
;
}
static
char
*
help_sin
=
{
N_
(
"@FUNCTION=SIN
\n
"
"@SYNTAX=SIN(x)
\n
"
...
...
@@ -1373,6 +1391,7 @@ FunctionDefinition math_functions [] = {
{
"or"
,
0
,
""
,
&
help_or
,
gnumeric_or
,
NULL
},
{
"power"
,
"ff"
,
"x,y"
,
&
help_power
,
NULL
,
gnumeric_power
},
{
"radians"
,
"f"
,
"number"
,
&
help_radians
,
NULL
,
gnumeric_radians
},
{
"rand"
,
""
,
""
,
&
help_rand
,
NULL
,
gnumeric_rand
},
{
"sin"
,
"f"
,
"number"
,
&
help_sin
,
NULL
,
gnumeric_sin
},
{
"sinh"
,
"f"
,
"number"
,
&
help_sinh
,
NULL
,
gnumeric_sinh
},
{
"sqrt"
,
"f"
,
"number"
,
&
help_sqrt
,
NULL
,
gnumeric_sqrt
},
...
...
src/dialog-function-select.c
View file @
5bcab256
...
...
@@ -16,11 +16,13 @@
#include
"func.h"
typedef
struct
{
GtkWidget
*
widget
;
GtkWidget
*
widget
,
*
dlg
;
GtkBox
*
dialog_box
;
Workbook
*
wb
;
GPtrArray
*
cats
;
GtkCList
*
function_list
;
GtkCList
*
cl_funcs
;
GtkCList
*
cl_cats
;
int
selected_func
;
/* An Entry */
int
selected_cat
;
/* An Array */
}
STATE
;
...
...
@@ -37,6 +39,7 @@ category_select_row (GtkCList *clist, gint row, gint col,
state
->
widget
)
;
state
->
selected_func
=
0
;
function_select_create
(
state
)
;
/* gtk_clist_select_row (state->cl_cats, row, 0) ; */
gtk_widget_show_all
(
GTK_WIDGET
(
state
->
dialog_box
))
;
}
...
...
@@ -44,11 +47,17 @@ static void
function_select_row
(
GtkCList
*
clist
,
gint
row
,
gint
col
,
GdkEvent
*
event
,
STATE
*
state
)
{
/* printf ("Function %d\n", row) ; */
/* printf ("Function %d\n", row) ; */
if
(
state
->
selected_func
==
row
)
{
/* printf ("Double click\n") ; */
gtk_signal_emit_by_name
(
GTK_OBJECT
(
state
->
dlg
),
"clicked"
,
0
)
;
}
state
->
selected_func
=
row
;
gtk_container_remove
(
GTK_CONTAINER
(
state
->
dialog_box
),
state
->
widget
)
;
function_select_create
(
state
)
;
/* gtk_clist_select_row (state->cl_funcs, row, 0) ; */
gtk_widget_show_all
(
GTK_WIDGET
(
state
->
dialog_box
))
;
}
...
...
@@ -101,9 +110,8 @@ function_select_create (STATE *state)
box
=
gtk_hbox_new
(
0
,
0
)
;
{
/* The Category List */
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
state
->
cl_cats
=
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
gtk_clist_column_titles_hide
(
cl
)
;
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
for
(
lp
=
0
;
lp
<
state
->
cats
->
len
;
lp
++
)
{
gchar
*
cols
[
1
]
;
...
...
@@ -113,6 +121,7 @@ function_select_create (STATE *state)
if
(
lp
==
state
->
selected_cat
)
gtk_clist_select_row
(
cl
,
lp
,
0
)
;
}
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
gtk_signal_connect
(
GTK_OBJECT
(
cl
),
"select_row"
,
GTK_SIGNAL_FUNC
(
category_select_row
),
state
);
...
...
@@ -129,9 +138,8 @@ function_select_create (STATE *state)
{
/* The Function List */
FunctionDefinition
*
fn
=
cat
->
functions
;
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
state
->
cl_funcs
=
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
gtk_clist_column_titles_hide
(
cl
)
;
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
max
=
0
;
for
(
lp
=
0
;
fn
[
lp
].
name
;
lp
++
)
{
...
...
@@ -144,6 +152,7 @@ function_select_create (STATE *state)
}
max
++
;
}
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
gtk_signal_connect
(
GTK_OBJECT
(
cl
),
"select_row"
,
GTK_SIGNAL_FUNC
(
function_select_row
),
state
);
...
...
@@ -216,6 +225,7 @@ dialog_function_select (Workbook *wb)
GTK_WINDOW
(
wb
->
toplevel
))
;
gtk_window_set_modal
(
GTK_WINDOW
(
dialog
),
TRUE
)
;
state
.
dlg
=
dialog
;
state
.
dialog_box
=
GTK_BOX
(
GNOME_DIALOG
(
dialog
)
->
vbox
)
;
function_select_create
(
&
state
)
;
...
...
src/dialog-function-wizard.c
View file @
5bcab256
...
...
@@ -15,6 +15,8 @@
#include
"expr.h"
#include
"func.h"
#define INPUTS_FOR_MULTI_ARG 6
typedef
struct
{
GtkBox
*
dialog_box
;
GtkWidget
*
widget
;
...
...
@@ -61,11 +63,12 @@ typedef struct {
gboolean
optional
;
gchar
type
;
GtkEntry
*
entry
;
Workbook
*
wb
;
}
ARG_DATA
;
/**
* Build descriptions of arguments
* If fd->args == 0,
do something different.
* If fd->args == 0,
make it up
**/
static
void
arg_data_list_new
(
STATE
*
state
)
...
...
@@ -79,15 +82,28 @@ arg_data_list_new (STATE *state)
!
state
->
tok
)
return
;
type
=
state
->
fd
->
args
;
g_return_if_fail
(
type
)
;
state
->
args
=
g_ptr_array_new
()
;
type
=
state
->
fd
->
args
;
if
(
!
type
)
{
int
lp
;
for
(
lp
=
0
;
lp
<
INPUTS_FOR_MULTI_ARG
;
lp
++
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strdup
(
"Value"
)
;
ad
->
wb
=
state
->
wb
;
ad
->
type
=
'?'
;
ad
->
optional
=
(
lp
!=
0
)
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
}
return
;
}
copy_args
=
tokenised_help_find
(
state
->
tok
,
"SYNTAX"
)
;
if
(
!
copy_args
)
{
state
->
args
=
NULL
;
g_ptr_array_free
(
state
->
args
,
FALSE
)
;
state
->
args
=
NULL
;
}
copy_args
=
g_strdup
(
copy_args
)
;
...
...
@@ -102,20 +118,22 @@ arg_data_list_new (STATE *state)
continue
;
}
if
(
*
ptr
==
','
||
*
ptr
==
')'
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strndup
(
start
,
(
int
)(
ptr
-
start
))
;
if
(
*
type
==
'|'
)
{
type
++
;
optional
=
1
;
}
ad
->
type
=
*
type
;
ad
->
optional
=
optional
;
if
(
ptr
>
start
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strndup
(
start
,
(
int
)(
ptr
-
start
))
;
ad
->
wb
=
state
->
wb
;
ad
->
type
=
*
type
;
ad
->
optional
=
optional
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
}
type
++
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
start
=
ptr
+
1
;
}
ptr
++
;
...
...
@@ -142,11 +160,32 @@ arg_data_list_destroy (STATE *state)
g_ptr_array_free
(
state
->
args
,
FALSE
)
;
}
static
void
function_input
(
GtkWidget
*
widget
,
ARG_DATA
*
ad
)
{
FunctionDefinition
*
fd
=
dialog_function_select
(
ad
->
wb
)
;
GtkEntry
*
entry
=
ad
->
entry
;
gchar
*
txt
;
int
pos
;
if
(
!
fd
)
return
;
txt
=
dialog_function_wizard
(
ad
->
wb
,
fd
)
;
if
(
!
txt
||
!
ad
->
wb
||
!
ad
->
wb
->
ea_input
)
return
;
pos
=
gtk_editable_get_position
(
GTK_EDITABLE
(
entry
))
;
gtk_editable_insert_text
(
GTK_EDITABLE
(
entry
),
txt
,
strlen
(
txt
),
&
pos
)
;
g_free
(
txt
)
;
}
static
GtkWidget
*
function_type_input
(
ARG_DATA
*
ad
)
{
GtkBox
*
box
;
GtkEntry
*
entry
;
GtkButton
*
button
;
GtkWidget
*
pix
;
gchar
*
txt
=
NULL
,
*
label
;
g_return_val_if_fail
(
ad
,
NULL
)
;
...
...
@@ -164,7 +203,7 @@ function_type_input (ARG_DATA *ad)
txt
=
_
(
"Boolean"
)
;
break
;
case
'r'
:
txt
=
_
(
"Range"
)
;
txt
=
_
(
"Range
/Array
"
)
;
break
;
case
'?'
:
txt
=
_
(
"Any"
)
;
...
...
@@ -184,6 +223,17 @@ function_type_input (ARG_DATA *ad)
label
=
g_strconcat
(
"("
,
txt
,
")"
,
NULL
)
;
else
label
=
g_strconcat
(
"="
,
txt
,
NULL
)
;
button
=
GTK_BUTTON
(
gtk_button_new
())
;
pix
=
gnome_stock_pixmap_widget_new
(
ad
->
wb
->
toplevel
,
GNOME_STOCK_PIXMAP_BOOK_GREEN
);
gtk_container_add
(
GTK_CONTAINER
(
button
),
pix
);
GTK_WIDGET_UNSET_FLAGS
(
button
,
GTK_CAN_FOCUS
);
gtk_signal_connect
(
GTK_OBJECT
(
button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
function_input
),
ad
);
gtk_box_pack_start
(
box
,
GTK_WIDGET
(
button
),
TRUE
,
TRUE
,
0
)
;
gtk_box_pack_start
(
box
,
gtk_label_new
(
label
),
TRUE
,
TRUE
,
0
)
;
g_free
(
label
)
;
...
...
@@ -261,6 +311,12 @@ dialog_function_wizard (Workbook *wb, FunctionDefinition *fd)
state
.
args
=
NULL
;
arg_data_list_new
(
&
state
)
;
/* It takes no arguments */
if
(
state
.
args
&&
state
.
args
->
len
==
0
)
{
tokenised_help_destroy
(
state
.
tok
)
;
return
get_text_value
(
&
state
)
;
}
dialog
=
gnome_dialog_new
(
_
(
"Formula Wizard"
),
GNOME_STOCK_BUTTON_OK
,
GNOME_STOCK_BUTTON_CANCEL
,
...
...
@@ -281,7 +337,3 @@ dialog_function_wizard (Workbook *wb, FunctionDefinition *fd)
tokenised_help_destroy
(
state
.
tok
)
;
return
ans
;
}
src/dialogs/dialog-formula-guru.c
View file @
5bcab256
...
...
@@ -15,6 +15,8 @@
#include
"expr.h"
#include
"func.h"
#define INPUTS_FOR_MULTI_ARG 6
typedef
struct
{
GtkBox
*
dialog_box
;
GtkWidget
*
widget
;
...
...
@@ -61,11 +63,12 @@ typedef struct {
gboolean
optional
;
gchar
type
;
GtkEntry
*
entry
;
Workbook
*
wb
;
}
ARG_DATA
;
/**
* Build descriptions of arguments
* If fd->args == 0,
do something different.
* If fd->args == 0,
make it up
**/
static
void
arg_data_list_new
(
STATE
*
state
)
...
...
@@ -79,15 +82,28 @@ arg_data_list_new (STATE *state)
!
state
->
tok
)
return
;
type
=
state
->
fd
->
args
;
g_return_if_fail
(
type
)
;
state
->
args
=
g_ptr_array_new
()
;
type
=
state
->
fd
->
args
;
if
(
!
type
)
{
int
lp
;
for
(
lp
=
0
;
lp
<
INPUTS_FOR_MULTI_ARG
;
lp
++
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strdup
(
"Value"
)
;
ad
->
wb
=
state
->
wb
;
ad
->
type
=
'?'
;
ad
->
optional
=
(
lp
!=
0
)
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
}
return
;
}
copy_args
=
tokenised_help_find
(
state
->
tok
,
"SYNTAX"
)
;
if
(
!
copy_args
)
{
state
->
args
=
NULL
;
g_ptr_array_free
(
state
->
args
,
FALSE
)
;
state
->
args
=
NULL
;
}
copy_args
=
g_strdup
(
copy_args
)
;
...
...
@@ -102,20 +118,22 @@ arg_data_list_new (STATE *state)
continue
;
}
if
(
*
ptr
==
','
||
*
ptr
==
')'
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strndup
(
start
,
(
int
)(
ptr
-
start
))
;
if
(
*
type
==
'|'
)
{
type
++
;
optional
=
1
;
}
ad
->
type
=
*
type
;
ad
->
optional
=
optional
;
if
(
ptr
>
start
)
{
ARG_DATA
*
ad
;
ad
=
g_new
(
ARG_DATA
,
1
)
;
ad
->
arg_name
=
g_strndup
(
start
,
(
int
)(
ptr
-
start
))
;
ad
->
wb
=
state
->
wb
;
ad
->
type
=
*
type
;
ad
->
optional
=
optional
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
}
type
++
;
ad
->
entry
=
NULL
;
g_ptr_array_add
(
state
->
args
,
ad
)
;
start
=
ptr
+
1
;
}
ptr
++
;
...
...
@@ -142,11 +160,32 @@ arg_data_list_destroy (STATE *state)
g_ptr_array_free
(
state
->
args
,
FALSE
)
;
}
static
void
function_input
(
GtkWidget
*
widget
,
ARG_DATA
*
ad
)
{
FunctionDefinition
*
fd
=
dialog_function_select
(
ad
->
wb
)
;
GtkEntry
*
entry
=
ad
->
entry
;
gchar
*
txt
;
int
pos
;
if
(
!
fd
)
return
;
txt
=
dialog_function_wizard
(
ad
->
wb
,
fd
)
;
if
(
!
txt
||
!
ad
->
wb
||
!
ad
->
wb
->
ea_input
)
return
;
pos
=
gtk_editable_get_position
(
GTK_EDITABLE
(
entry
))
;
gtk_editable_insert_text
(
GTK_EDITABLE
(
entry
),
txt
,
strlen
(
txt
),
&
pos
)
;
g_free
(
txt
)
;
}
static
GtkWidget
*
function_type_input
(
ARG_DATA
*
ad
)
{
GtkBox
*
box
;
GtkEntry
*
entry
;
GtkButton
*
button
;
GtkWidget
*
pix
;
gchar
*
txt
=
NULL
,
*
label
;
g_return_val_if_fail
(
ad
,
NULL
)
;
...
...
@@ -164,7 +203,7 @@ function_type_input (ARG_DATA *ad)
txt
=
_
(
"Boolean"
)
;
break
;
case
'r'
:
txt
=
_
(
"Range"
)
;
txt
=
_
(
"Range
/Array
"
)
;
break
;
case
'?'
:
txt
=
_
(
"Any"
)
;
...
...
@@ -184,6 +223,17 @@ function_type_input (ARG_DATA *ad)
label
=
g_strconcat
(
"("
,
txt
,
")"
,
NULL
)
;
else
label
=
g_strconcat
(
"="
,
txt
,
NULL
)
;
button
=
GTK_BUTTON
(
gtk_button_new
())
;
pix
=
gnome_stock_pixmap_widget_new
(
ad
->
wb
->
toplevel
,
GNOME_STOCK_PIXMAP_BOOK_GREEN
);
gtk_container_add
(
GTK_CONTAINER
(
button
),
pix
);
GTK_WIDGET_UNSET_FLAGS
(
button
,
GTK_CAN_FOCUS
);
gtk_signal_connect
(
GTK_OBJECT
(
button
),
"clicked"
,
GTK_SIGNAL_FUNC
(
function_input
),
ad
);
gtk_box_pack_start
(
box
,
GTK_WIDGET
(
button
),
TRUE
,
TRUE
,
0
)
;
gtk_box_pack_start
(
box
,
gtk_label_new
(
label
),
TRUE
,
TRUE
,
0
)
;
g_free
(
label
)
;
...
...
@@ -261,6 +311,12 @@ dialog_function_wizard (Workbook *wb, FunctionDefinition *fd)
state
.
args
=
NULL
;
arg_data_list_new
(
&
state
)
;
/* It takes no arguments */
if
(
state
.
args
&&
state
.
args
->
len
==
0
)
{
tokenised_help_destroy
(
state
.
tok
)
;
return
get_text_value
(
&
state
)
;
}
dialog
=
gnome_dialog_new
(
_
(
"Formula Wizard"
),
GNOME_STOCK_BUTTON_OK
,
GNOME_STOCK_BUTTON_CANCEL
,
...
...
@@ -281,7 +337,3 @@ dialog_function_wizard (Workbook *wb, FunctionDefinition *fd)
tokenised_help_destroy
(
state
.
tok
)
;
return
ans
;
}
src/dialogs/dialog-function-select.c
View file @
5bcab256
...
...
@@ -16,11 +16,13 @@
#include
"func.h"
typedef
struct
{
GtkWidget
*
widget
;
GtkWidget
*
widget
,
*
dlg
;
GtkBox
*
dialog_box
;
Workbook
*
wb
;
GPtrArray
*
cats
;
GtkCList
*
function_list
;
GtkCList
*
cl_funcs
;
GtkCList
*
cl_cats
;
int
selected_func
;
/* An Entry */
int
selected_cat
;
/* An Array */
}
STATE
;
...
...
@@ -37,6 +39,7 @@ category_select_row (GtkCList *clist, gint row, gint col,
state
->
widget
)
;
state
->
selected_func
=
0
;
function_select_create
(
state
)
;
/* gtk_clist_select_row (state->cl_cats, row, 0) ; */
gtk_widget_show_all
(
GTK_WIDGET
(
state
->
dialog_box
))
;
}
...
...
@@ -44,11 +47,17 @@ static void
function_select_row
(
GtkCList
*
clist
,
gint
row
,
gint
col
,
GdkEvent
*
event
,
STATE
*
state
)
{
/* printf ("Function %d\n", row) ; */
/* printf ("Function %d\n", row) ; */
if
(
state
->
selected_func
==
row
)
{
/* printf ("Double click\n") ; */
gtk_signal_emit_by_name
(
GTK_OBJECT
(
state
->
dlg
),
"clicked"
,
0
)
;
}
state
->
selected_func
=
row
;
gtk_container_remove
(
GTK_CONTAINER
(
state
->
dialog_box
),
state
->
widget
)
;
function_select_create
(
state
)
;
/* gtk_clist_select_row (state->cl_funcs, row, 0) ; */
gtk_widget_show_all
(
GTK_WIDGET
(
state
->
dialog_box
))
;
}
...
...
@@ -101,9 +110,8 @@ function_select_create (STATE *state)
box
=
gtk_hbox_new
(
0
,
0
)
;
{
/* The Category List */
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
state
->
cl_cats
=
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
gtk_clist_column_titles_hide
(
cl
)
;
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
for
(
lp
=
0
;
lp
<
state
->
cats
->
len
;
lp
++
)
{
gchar
*
cols
[
1
]
;
...
...
@@ -113,6 +121,7 @@ function_select_create (STATE *state)
if
(
lp
==
state
->
selected_cat
)
gtk_clist_select_row
(
cl
,
lp
,
0
)
;
}
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
gtk_signal_connect
(
GTK_OBJECT
(
cl
),
"select_row"
,
GTK_SIGNAL_FUNC
(
category_select_row
),
state
);
...
...
@@ -129,9 +138,8 @@ function_select_create (STATE *state)
{
/* The Function List */
FunctionDefinition
*
fn
=
cat
->
functions
;
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
state
->
cl_funcs
=
cl
=
GTK_CLIST
(
gtk_clist_new
(
1
))
;
gtk_clist_column_titles_hide
(
cl
)
;
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;
max
=
0
;
for
(
lp
=
0
;
fn
[
lp
].
name
;
lp
++
)
{
...
...
@@ -144,6 +152,7 @@ function_select_create (STATE *state)
}
max
++
;
}
gtk_clist_set_selection_mode
(
cl
,
GTK_SELECTION_SINGLE
)
;