Mercurial > hg > octave-nkf
changeset 18565:4e0d72145c5a
maint: Merge gui-release to default.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 20 Feb 2014 09:27:57 -0800 |
parents | 80b8873c90ba (current diff) 1ec884e5ff00 (diff) |
children | c579bd4e12c9 |
files | doc/interpreter/func.txi libinterp/corefcn/lu.cc libinterp/parse-tree/lex.ll |
diffstat | 8 files changed, 177 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -1054,18 +1054,22 @@ As an example, @example -mlock ("my_function"); +@group +function my_function () + mlock (); + @dots{} +@end group @end example @noindent -prevents @code{my_function} from being removed from memory, even if -@code{clear} is called. It is possible to determine if a function is -locked into memory with the @code{mislocked}, and to unlock a function -with @code{munlock}, which the following illustrates. +prevents @code{my_function} from being removed from memory after it is +called, even if @code{clear} is called. It is possible to determine if +a function is locked into memory with the @code{mislocked}, and to unlock +a function with @code{munlock}, which the following illustrates. @example @group -mlock ("my_function"); +my_function (); mislocked ("my_function") @result{} ans = 1 munlock ("my_function"); @@ -1080,11 +1084,11 @@ @example @group function count_calls () + mlock (); persistent calls = 0; printf ("'count_calls' has been called %d times\n", ++calls); endfunction -mlock ("count_calls"); count_calls (); @print{} 'count_calls' has been called 1 times @@ -1095,22 +1099,6 @@ @end group @end example -@noindent -It is, however, often inconvenient to lock a function from the prompt, -so it is also possible to lock a function from within its body. This -is simply done by calling @code{mlock} from within the function. - -@example -@group -function count_calls () - mlock (); - persistent calls = 0; - printf ("'count_calls' has been called %d times\n", - ++calls); -endfunction -@end group -@end example - @code{mlock} might equally be used to prevent changes to a function from having effect in Octave, though a similar effect can be had with the @code{ignore_function_time_stamp} function.
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -1448,6 +1448,13 @@ _long_title = settings->value ("editor/longWindowTitle", false).toBool (); update_window_title (_edit_area->isModified ()); + _edit_area->setEdgeColumn ( + settings->value ("editor/long_line_column",80).toInt ()); + if (settings->value ("editor/long_line_marker",true).toBool ()) + _edit_area->setEdgeMode (QsciScintilla::EdgeLine); + else + _edit_area->setEdgeMode (QsciScintilla::EdgeNone); + } void
--- a/libgui/src/settings-dialog.cc +++ b/libgui/src/settings-dialog.cc @@ -142,6 +142,10 @@ _editor_current_line_color, SLOT (setEnabled (bool))); ui->editor_highlightCurrentLine->setChecked ( settings->value ("editor/highlightCurrentLine",true).toBool () ); + ui->editor_long_line_marker->setChecked ( + settings->value ("editor/long_line_marker",true).toBool ()); + ui->editor_long_line_column->setValue ( + settings->value ("editor/long_line_column",80).toInt ()); ui->editor_codeCompletion->setChecked ( settings->value ("editor/codeCompletion", true).toBool () ); @@ -181,6 +185,8 @@ settings->value ("editor/restoreSession", true).toBool ()); ui->editor_create_new_file->setChecked ( settings->value ("editor/create_new_file",false).toBool ()); + + // terminal ui->terminal_fontName->setCurrentFont (QFont ( settings->value ("terminal/fontName","Courier New").toString ()) ); ui->terminal_fontSize->setValue ( @@ -542,6 +548,10 @@ ui->editor_highlightCurrentLine->isChecked ()); settings->setValue ("editor/highlight_current_line_color", _editor_current_line_color->color ()); + settings->setValue ("editor/long_line_marker", + ui->editor_long_line_marker->isChecked ()); + settings->setValue ("editor/long_line_column", + ui->editor_long_line_column->value ()); settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ()); settings->setValue ("editor/codeCompletion_threshold",
--- a/libgui/src/settings-dialog.ui +++ b/libgui/src/settings-dialog.ui @@ -389,7 +389,7 @@ <x>0</x> <y>0</y> <width>662</width> - <height>419</height> + <height>470</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_16"> @@ -397,7 +397,7 @@ <layout class="QVBoxLayout" name="verticalLayout_9"> <item> <layout class="QGridLayout" name="editor_common_settings_grid"> - <property name="spacing"> + <property name="horizontalSpacing"> <number>6</number> </property> <item row="3" column="0"> @@ -440,19 +440,6 @@ </property> </widget> </item> - <item row="4" column="4"> - <spacer name="horizontalSpacer_18"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> <item row="4" column="0"> <widget class="QCheckBox" name="editor_highlightCurrentLine"> <property name="enabled"> @@ -525,32 +512,6 @@ </property> </spacer> </item> - <item row="2" column="4"> - <spacer name="horizontalSpacer_16"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="3" column="4"> - <spacer name="horizontalSpacer_17"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> <item row="1" column="2"> <layout class="QGridLayout" name="gridLayout_6"> <item row="0" column="0"> @@ -630,6 +591,56 @@ </property> </spacer> </item> + <item row="5" column="0"> + <widget class="QCheckBox" name="editor_long_line_marker"> + <property name="toolTip"> + <string>This works well for monospaced fonts. The line is drawn at a position based on the width of a space character in the default font. It may not work very well if styles use proportional fonts or if varied font sizes or bold, italic and normal texts are used.</string> + </property> + <property name="text"> + <string>Draw a long line marker</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="5" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="editor_long_line_column_text"> + <property name="text"> + <string>After Column</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="editor_long_line_column"> + <property name="minimum"> + <number>2</number> + </property> + <property name="maximum"> + <number>256</number> + </property> + <property name="value"> + <number>80</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> </layout> </item> <item> @@ -778,9 +789,6 @@ </item> <item> <layout class="QGridLayout" name="gridLayout_2"> - <property name="verticalSpacing"> - <number>0</number> - </property> <item row="1" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="spacing"> @@ -800,9 +808,6 @@ </item> <item row="2" column="1"> <layout class="QGridLayout" name="gridLayout_3"> - <property name="verticalSpacing"> - <number>0</number> - </property> <item row="0" column="1"> <spacer name="horizontalSpacer_15"> <property name="orientation"> @@ -895,17 +900,17 @@ </item> <item row="3" column="1"> <layout class="QGridLayout" name="gridLayout_10"> - <item row="0" column="1"> + <item row="0" column="2"> <widget class="QLabel" name="editor_label_ac_threshold"> <property name="enabled"> <bool>false</bool> </property> <property name="text"> - <string>after number of characters typed: </string> + <string>Number of characters before list is shwon: </string> </property> </widget> </item> - <item row="0" column="2"> + <item row="0" column="3"> <widget class="QSpinBox" name="editor_spinbox_ac_threshold"> <property name="enabled"> <bool>false</bool> @@ -930,20 +935,7 @@ </property> </widget> </item> - <item row="0" column="0"> - <widget class="QCheckBox" name="editor_codeCompletion"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>Show completion list automatically ...</string> - </property> - <property name="checked"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="3"> + <item row="0" column="4"> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -956,6 +948,35 @@ </property> </spacer> </item> + <item row="0" column="0"> + <widget class="QCheckBox" name="editor_codeCompletion"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Show completion list automatically</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <spacer name="horizontalSpacer_31"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </item> </layout> @@ -2195,5 +2216,37 @@ </hint> </hints> </connection> + <connection> + <sender>editor_long_line_marker</sender> + <signal>toggled(bool)</signal> + <receiver>editor_long_line_column</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>145</x> + <y>187</y> + </hint> + <hint type="destinationlabel"> + <x>355</x> + <y>187</y> + </hint> + </hints> + </connection> + <connection> + <sender>editor_long_line_marker</sender> + <signal>toggled(bool)</signal> + <receiver>editor_long_line_column_text</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>145</x> + <y>187</y> + </hint> + <hint type="destinationlabel"> + <x>302</x> + <y>187</y> + </hint> + </hints> + </connection> </connections> </ui>
--- a/libinterp/corefcn/lu.cc +++ b/libinterp/corefcn/lu.cc @@ -574,7 +574,7 @@ %!error lu () %!error <can not define pivoting threshold> lu ([1, 2; 3, 4], 2) -%!test +%!testif HAVE_UMFPACK %! Bi = [1 2 3 4 5 2 3 6 7 8 4 5 7 8 9]; %! Bj = [1 3 4 5 6 7 8 9 11 12 13 14 15 16 17]; %! Bv = [1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1];
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -1218,6 +1218,8 @@ } "@" { + curr_lexer->lexer_debug ("@"); + if (curr_lexer->previous_token_may_be_command () && curr_lexer->space_follows_previous_token ()) { @@ -1226,15 +1228,26 @@ } else { - curr_lexer->lexer_debug ("@"); - - curr_lexer->current_input_column++; - - curr_lexer->looking_at_function_handle++; - curr_lexer->looking_for_object_index = false; - curr_lexer->at_beginning_of_statement = false; - - return curr_lexer->count_token ('@'); + int tok = curr_lexer->previous_token_value (); + + if (curr_lexer->whitespace_is_significant () + && curr_lexer->space_follows_previous_token () + && ! (tok == '[' || tok == '{' + || curr_lexer->previous_token_is_binop ())) + { + yyless (0); + unput (','); + } + else + { + curr_lexer->current_input_column++; + + curr_lexer->looking_at_function_handle++; + curr_lexer->looking_for_object_index = false; + curr_lexer->at_beginning_of_statement = false; + + return curr_lexer->count_token ('@'); + } } }
--- a/scripts/gui/waitbar.m +++ b/scripts/gui/waitbar.m @@ -106,7 +106,8 @@ ## Save and restore current figure cf = get (0, "currentfigure"); - hf = figure ("position", [250, 500, 400, 100], + hf = figure ("units", "pixels", + "position", [250, 500, 400, 100], "numbertitle", "off", "menubar", "none", "toolbar", "none", "integerhandle", "off",
--- a/test/parser.tst +++ b/test/parser.tst @@ -287,3 +287,10 @@ %! a = [97 ... % comment %! 'b']; %! assert (a, 'ab'); + +## Check that a cell array containing function handles is parsed +## correctly with or without commas. +%!test +%! a = {1, @sin, 2, @cos}; +%! b = {1 @sin 2 @cos}; +%! assert (a, b)