QtOctave Menus

QtOctave menus.
Menus structure.
Simple way of build menus.
Complete way of build menus.
Menu's icon.

# QtOctave menus.

QtOctave menus can be found in /usr/local/share/qtoctave/menus/ or can be located in user's home.

Menus in /usr/local/share/qtoctave/menus/ are read for all users.

Menus in user's home are read only for user.

Menus in user's home are located in ~/.qtoctave/menus/.

Some menus are fixed and cannot be edited.

# Menus structure.

Every folder you put in menus folder represents menus. Inside of this folder you can put other menus.

For example, if you you want put a new menu in help menu, you must create a new folder in menus folder called help. Inside of help folder you will put your new menus.

There are two ways of build menus: Simple and complete.

## Simple way of build menus.

Only add to your menu folder a .menu file.There is and example of .menu file:

#This is an example of menu for qtoctave
menu_name=Menu title
input_label= Parameter 1
input= parameter1
input_label= Parameter 2
input= parameter2
input_label= Parameter 3
input=
output_label= Output Parameter 1
output= output1
output_label= Output Parameter 2
output= output2
begin{help}
<html>
<body>
<b>This is an example.</b><br>
Help of example.
</body>
</html>
end{help}
begin{command}
title("%i1%");
sombrero(%i2%);
[%o1%,%o2%] = hola (%i1%,%i2%,%i3%);
end{command}

Lines starting with # are commens.

menu_name property is name of menu window.

input_label is label of input parameter.

input property is name of this parameter in code. You can add all parameters you need.

input_file property is name of file in code.

begin{input_list}...end{input_list} lets select one property from list inside begin{input_list} and end{input_list}. Each line represents one option.

output_label, output, begin{output_list}...end{output_list} and output_file properties are similar with output parameters.

begin{command}...end{command} is code that will be passed to octave.
%i1% is 1st input parameter, %i2% is second input parameter,...
%o1% is 1st output parameter, %o2% is second output parameter,...

begin{help}...end{help} is this menu help. Help must be in html. This parameter is not needed.

Example: Easy integrate.menu has the next code:

#This is an example of menu for qtoctave
menu_name= Integrate Function Easy
input_label= Function name f(x)
input=
input_label= 1st limit of integration
input=
input_label= 2st limit of integration
input=
output_label= Value
output=v
output_label=ier
output=ier
output_label= nfun
output=nfun
output_label=err
output=err
begin{help}
<html>
<p><b>Integrate a nonlinear function of one variable using Quadpack.</b></p><br>
Use quad function for more options.<br><br>
<br> The first argument is the name of the function, the function handle or the inline function to call to compute the value of the integrand. It must have the form:<br>
y = f (x)<br>
where y and x are scalars.<br>
This parameter is a string. Ex.:<br>
[v, ier, nfun, err] = quad ("f", 0, 3)<br><br>
<br> The second and third arguments are limits of integration. Either or both may be infinite.<br><br>
<br> You can use the function quad_options to set optional parameters for quad.<br>
</html>
end{help}
begin{command}
[%o1%, %o2%, %o3%, %o4%] = quad ("%i1%",%i2%,%i3%)
end{command}

This code creates this menu:

## Complete way of build menus.

Is very similar. You can put an executable file in menus folder and QtOctave will put in menu. When user selects this menu, QtOctave executes this file and sends output to Octave.

Example:

You can put this code in file called Sombrero function:
#!/bin/cat
title('Sombrero');
sombrero(20);
Then put this file in menus folder and make it executable using:
chmod +x "Sombrero function"
This menu will appear in QtOctave and makes plot of sombrero function.

# Menu's icon.

Putting icons to menus is very simple. If you have an ej.menu file (or other), you must put ex.menu.png icon in the same place that ex.menu. That is all.