Mercurial > hg > octave-nkf
annotate scripts/gui/uipushtool.m @ 20818:9d2023d1a63c
binoinv.m: Implement binary search algorithm for 28X performance increase (bug #34363).
* binoinv.m: Call new functions scalar_binoinv or vector_binoinv to calculate
binoinv. If there are still uncalculated values then call bin_search_binoinv
to perform binary search for remaining values. Add more BIST tests.
* binoinv.m (scalar_binoinv): New subfunction to calculate binoinv for scalar x.
Stops when x > 1000.
* binoinv.m (vector_binoinv): New subfunction to calculate binoinv for scalar x.
Stops when x > 1000.
author | Lachlan Andrew <lachlanbis@gmail.com> |
---|---|
date | Sun, 11 Oct 2015 19:49:40 -0700 |
parents | 7890893a0e69 |
children | 93d96da9ff3e |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2012-2015 Michael Goffioul |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
2 ## |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
4 ## |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
8 ## your option) any later version. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
9 ## |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
13 ## General Public License for more details. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
14 ## |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
18 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
20808
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
20 ## @deftypefn {Function File} {@var{hui} =} uipushtool (@var{property}, @var{value}, @dots{}) |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
21 ## @deftypefnx {Function File} {@var{hui} =} uipushtool (@var{parent}, @var{property}, @var{value}, @dots{}) |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
22 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
23 ## Create a uipushtool object and return a handle to it. |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
24 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
25 ## uipushtools are buttons that appear on a figure toolbar. The button is created with a border that |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
26 ## is shown when the user hovers over the button. An image can be set using the cdata property. |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
27 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
28 ## If @var{parent} is omitted then a uipushtool for the current figure is |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
29 ## created. If no figure is available, a new figure is created first. If a figure is |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
30 ## available, but does not contain a uitoolbar, a uitoolbar will be created. |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
31 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
32 ## If @var{parent} is given then a uipushtools is created on the @var{parent} uitoolbar. |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
33 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
34 ## Any provided property value pairs will override the default values of the created |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
35 ## uipushtool object. |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
36 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
37 ## Examples: |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
38 ## |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
39 ## @example |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
40 ## @group |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
41 ## % create figure without a default toolbar |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
42 ## f = figure ("toolbar", "none"); |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
43 ## % create empty toolbar |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
44 ## t = uitoolbar (f); |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
45 ## % create a 19x19x3 black square |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
46 ## img=zeros(19,19,3); |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
47 ## % add pushtool button to toolbar |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
48 ## b = uipushtool (t, "cdata", img); |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
49 ## @end group |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
50 ## @end example |
7890893a0e69
Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents:
20038
diff
changeset
|
51 ## @seealso{figure, uitoolbar, uitoggletool} |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
52 ## @end deftypefn |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
53 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
54 ## Author: goffioul |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
55 |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
56 function hui = uipushtool (varargin) |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
57 |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
58 [h, args] = __uiobject_split_args__ ("uipushtool", varargin, |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
59 {"uitoolbar"}, 0); |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
60 if (isempty (h)) |
13726
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
61 h = findobj (gcf, "-depth", 1, "type", "uitoolbar"); |
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
62 if (isempty (h)) |
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
63 h = uitoolbar (); |
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
64 else |
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
65 h = h(1); |
5a2734f26dbc
Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
13703
diff
changeset
|
66 endif |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
67 endif |
20038
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
68 hui = __go_uipushtool__ (h, args{:}); |
13703
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
69 |
22ce748da25f
Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff
changeset
|
70 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
14359
diff
changeset
|
71 |