octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8013] GUI Workspace color coding based up


From: Dan Sebald
Subject: [Octave-patch-tracker] [patch #8013] GUI Workspace color coding based upon variable scope.
Date: Sat, 27 Apr 2013 19:27:29 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #4, patch #8013 (project octave):

I like it.  It is certainly the right idea and accomplished easy enough with
the small number of lines used.

I don't think it pays to quibble over too much right now.  This is one of
those things that will evolve as users try it and come up with ideas.  Along
with that will probably come ideas for how to group the data, display the
context when debugging and so on.

There is a Qt color selector here:

http://qt-project.org/doc/qt-4.8/qcolordialog.html

The basic colors in the far right rows look like the better candidates for a
default.  Although, I'm not sure why Qt has used six similar shades of green,
two similar shades of yellow, and three similar shades of blue.

My experience is that good candidate colors are those which are light and a
composite of more than one primary color.  If a color is light and
monochromatic, it tends to be harsh on the eyes.

One comment about coding.  This hunk of code:

+                if (c == 'g')
+                  retval = QVariant (tr ("global"));
+                else if (c == 'p')
+                  retval = QVariant (tr ("persistent"));
+                else if (c == 'a')
+                  retval = QVariant (tr ("automatic"));
+                else if (c == 'f')
+                  retval = QVariant (tr ("function parameter"));
+                else if (c == 'h')
+                  retval = QVariant (tr ("hidden"));
+                else if (c == 'i')
+                  retval = QVariant (tr ("inherited"));

is something that would work better as a switch statement.  Switch statements
are good for when there are more than two or three if conditions on the same
variable.  An if/elseif will test c (in this case) six times.  A switch
statement, on the other hand, will use some form of table lookup and jump to
the hunk of code that it is supposed to execute.  That is, a switch has a
little extra overhead up front, but after that is very efficient.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8013>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]