On Fri, Jun 21, 2002 at 02:52:17PM +1000, Allan Rae wrote:

> FYI, you have eyes and a brain that is capable of pattern recognition.
> We gave you a cursor (even one you can control with a mouse) you can
> do the search and replace by hand.  Like we did in the good old days
> when I were a lad. Oh wait that's sarcasm again.  Or is it hyperbole?

It's just very silly.

> I wish I could say "I feel your pain." about something as minor as
> an ellipsis.  But I can't.

Because it is NOT minor. "Hey, one minor ellipsis, one extra pref
checkbox, who cares ?" - crap. Building a good user interface is in some
significant part all about these supposedly "minor" things. This is also
the stuff it's easiest to get wrong, because nobody EVER complains about
things like this, but they make a real difference. I can only request
you read that link I gave you, they explain this stuff far better than I
could.

> I also can't understand why useability is
> a valid arguement for you but not for me.

a) because you don't seem to understand the basic concepts
b) because you state it is unimportant (see above)
c) it is a valid argument for you, but you don't seem to making a strong
case for it

> I am not opposed to cleaning up the interface or the code -- so in
> that respect I am in agreement with you.  I just don't see why we need
> to be so uptight about a few minor oddities.

Then all I can suggest is that you think a bit harder about how these
"minor oddities" accrue, and how unpleasant they make things, in sum.

> So why can't we have a feature some others don't?

All other things being equal, no reason. But all other things are not
equal, so this is not relevant.

> Why can't we keep a feature that is useful at present?

It's inconsistent with every other application's File->New behaviour. It
causes crufty code (see patch below). It complicates the awful prefs
dialog. Anybody who actually uses it has at least three simple, better,
ways of doing the same. It means the lack of an ellipsis is a lie (never
surprise the user, and yes, it's still a surprise even if the user has
to turn it on explicitly). Nobody uses it, FSVO nobody.

> Just because an ellipsis won't be present if the non-default operation
> is selected?  This seems excessive to me.

No, for all the reasons above.

> Allan. (ARRae)  Who will be leaving RSN to watch England beat Brazil.

Hah, that's what lyx-devel said last time...

Here's a patch to remove it. It also adds a feature, namely buffer-new
mychoice.lyx.

# diffstat kill_ask.diff
...
 7 files changed, 17 insertions, 124 deletions

Removing cruft is good.


? a.diff
? newfile1.lyx
? newfile2.lyx
? .lyx_cb.C.swp
? lyx_posix_wrappers.tar.bz2
Index: bufferlist.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferlist.C,v
retrieving revision 1.78
diff -u -r1.78 bufferlist.C
--- bufferlist.C        10 Jun 2002 07:57:34 -0000      1.78
+++ bufferlist.C        21 Jun 2002 04:53:02 -0000
@@ -489,7 +489,7 @@
                        
b->paragraph->layout(textclasslist[b->params.textclass].defaultLayoutName());
        }
 
-       if (!lyxrc.new_ask_filename && !isNamed) {
+       if (!isNamed) {
                b->setUnnamed();
                b->setFileName(name);
        }
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.327
diff -u -r1.327 lyxfunc.C
--- lyxfunc.C   21 Jun 2002 02:22:12 -0000      1.327
+++ lyxfunc.C   21 Jun 2002 04:53:07 -0000
@@ -1085,11 +1085,11 @@
 
                // --- Menus -----------------------------------------------
        case LFUN_MENUNEW:
-               menuNew(false);
+               menuNew(argument, false);
                break;
 
        case LFUN_MENUNEWTMPLT:
-               menuNew(true);
+               menuNew(argument, true);
                break;
 
        case LFUN_CLOSEBUFFER:
@@ -1700,9 +1700,10 @@
 }
 
 
-void LyXFunc::menuNew(bool fromTemplate)
+void LyXFunc::menuNew(string const & name, bool fromTemplate)
 {
        string initpath = lyxrc.document_path;
+       string filename(name);
 
        if (owner->view()->available()) {
                string const trypath = owner->buffer()->filePath();
@@ -1712,86 +1713,17 @@
        }
 
        static int newfile_number;
-       string s;
 
-       if (lyxrc.new_ask_filename) {
-               FileDialog fileDlg(owner, _("Enter filename for new document"),
-                                  LFUN_SELECT_FILE_SYNC,
-                       make_pair(string(_("Documents|#o#O")),
-                                 string(lyxrc.document_path)),
-                       make_pair(string(_("Templates|#T#t")),
-                                 string(lyxrc.template_path)));
-
-               FileDialog::Result result =
-                       fileDlg.Select(initpath,
-                                      _("*.lyx|LyX Documents (*.lyx)"),
-                                      _("newfile"));
-
-               if (result.second.empty()) {
-                       owner->message(_("Canceled."));
-                       lyxerr[Debug::INFO] << "New Document Cancelled." << endl;
-                       return;
-               }
-
-               // get absolute path of file and make sure the filename ends
-               // with .lyx
-               s = MakeAbsPath(result.second);
-               if (!IsLyXFilename(s))
-                       s += ".lyx";
-
-               // Check if the document already is open
-               if (bufferlist.exists(s)) {
-                       switch (Alert::askConfirmation(_("Document is already open:"),
-                                               MakeDisplayPath(s, 50),
-                                               _("Do you want to close that document 
now?\n"
-                                                 "('No' will just switch to the open 
version)")))
-                       {
-                       case 1: // Yes: close the document
-                               if (!bufferlist.close(bufferlist.getBuffer(s)))
-                               // If close is canceled, we cancel here too.
-                                       return;
-                               break;
-                       case 2: // No: switch to the open document
-                               owner->view()->buffer(bufferlist.getBuffer(s));
-                               return;
-                       case 3: // Cancel: Do nothing
-                               owner->message(_("Canceled."));
-                               return;
-                       }
-               }
-               // Check whether the file already exists
-               FileInfo fi(s);
-               if (fi.readable() &&
-                   Alert::askQuestion(_("File already exists:"),
-                               MakeDisplayPath(s, 50),
-                               _("Do you want to open the document?"))) {
-                               // loads document
-                       string const disp_fn(MakeDisplayPath(s));
-
-                       ostringstream str;
-                       str << _("Opening  document") << ' '
-                           << disp_fn << "...";
-
-                       owner->message(str.str().c_str());
-                       owner->view()->buffer(bufferlist.loadLyXFile(s));
-                       ostringstream str2;
-                       str2 << _("Document") << ' '
-                            << disp_fn << ' ' << _("opened.");
-
-                       owner->message(str2.str().c_str());
-
-                       return;
-               }
-       } else {
-               s = AddName(lyxrc.document_path,
+       if (filename.empty()) {
+               filename = AddName(lyxrc.document_path,
                            "newfile" + tostr(++newfile_number) + ".lyx");
-               FileInfo fi(s);
-               while (bufferlist.exists(s) || fi.readable()) {
+               FileInfo fi(filename);
+               while (bufferlist.exists(filename) || fi.readable()) {
                        ++newfile_number;
-                       s = AddName(lyxrc.document_path,
+                       filename = AddName(lyxrc.document_path,
                                    "newfile" + tostr(newfile_number) +
                                    ".lyx");
-                       fi.newFile(s);
+                       fi.newFile(filename);
                }
        }
 
@@ -1819,9 +1751,7 @@
                templname = fname;
        }
 
-       // find a free buffer
-       lyxerr[Debug::INFO] << "Find a free buffer." << endl;
-       owner->view()->buffer(bufferlist.newFile(s, templname));
+       owner->view()->buffer(bufferlist.newFile(filename, templname, !name.empty()));
 }
 
 
Index: lyxfunc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.h,v
retrieving revision 1.44
diff -u -r1.44 lyxfunc.h
--- lyxfunc.h   18 Jun 2002 15:44:17 -0000      1.44
+++ lyxfunc.h   21 Jun 2002 04:53:07 -0000
@@ -118,7 +118,7 @@
        // I think the following should be moved to BufferView. (Asger)
 
        ///
-       void menuNew(bool fromTemplate);
+       void menuNew(string const & argument, bool fromTemplate);
 
        ///
        void open(string const &);
Index: lyxrc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v
retrieving revision 1.116
diff -u -r1.116 lyxrc.C
--- lyxrc.C     11 Jun 2002 23:47:54 -0000      1.116
+++ lyxrc.C     21 Jun 2002 04:53:11 -0000
@@ -88,7 +88,6 @@
        { "\\lastfiles", LyXRC::RC_LASTFILES },
        { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
        { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
-       { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME },
        { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
        { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS },
        { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
@@ -248,8 +247,6 @@
        language_command_begin = "\\selectlanguage{$$lang}";
        language_command_local = "\\foreignlanguage{$$lang}{";
        default_language = "english";
-       //
-       new_ask_filename = false;
 
        //
        date_insert_format = "%A, %e %B %Y";
@@ -887,10 +884,6 @@
                                show_banner = lexrc.getBool();
                        break;
 
-               case RC_NEW_ASK_FILENAME:
-                       if (lexrc.next())
-                               new_ask_filename = lexrc.getBool();
-                       break;
                case RC_CONVERTER: {
                        string from, to, command, flags;
                        if (lexrc.next())
@@ -1568,11 +1561,6 @@
        case RC_AUTO_NUMBER:
                if (auto_number != system_lyxrc.auto_number) {
                        os << "\\auto_number " << tostr(auto_number) << "\n";
-               }
-       case RC_NEW_ASK_FILENAME:
-               if (new_ask_filename != system_lyxrc.new_ask_filename) {
-                       os << "\\new_ask_filename " << tostr(new_ask_filename)
-                          << "\n";
                }
        case RC_DEFAULT_LANGUAGE:
                if (default_language != system_lyxrc.default_language) {
Index: lyxrc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.h,v
retrieving revision 1.58
diff -u -r1.58 lyxrc.h
--- lyxrc.h     21 Mar 2002 17:25:15 -0000      1.58
+++ lyxrc.h     21 Jun 2002 04:53:13 -0000
@@ -339,8 +339,6 @@
        /// Do we have to use a GUI?
        bool use_gui;
        ///
-       bool new_ask_filename;
-       ///
        string default_language;
        ///
        bool cursor_follows_scrollbar;
Index: frontends/xforms/FormPreferences.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormPreferences.C,v
retrieving revision 1.117
diff -u -r1.117 FormPreferences.C
--- frontends/xforms/FormPreferences.C  18 Jun 2002 15:44:26 -0000      1.117
+++ frontends/xforms/FormPreferences.C  21 Jun 2002 04:53:21 -0000
@@ -1831,7 +1831,6 @@
        lyxrc.exit_confirmation = fl_get_button(dialog_->check_exit_confirm);
        lyxrc.display_shortcuts =
                fl_get_button(dialog_->check_display_shrtcuts);
-       lyxrc.new_ask_filename = fl_get_button(dialog_->check_ask_new_file);
        lyxrc.cursor_follows_scrollbar =
                fl_get_button(dialog_->check_cursor_follows_scrollbar);
        lyxrc.dialogs_iconify_with_main =
@@ -1874,7 +1873,6 @@
        setPrehandler(dialog_->check_exit_confirm);
        setPrehandler(dialog_->check_display_shrtcuts);
        setPrehandler(dialog_->counter_autosave);
-       setPrehandler(dialog_->check_ask_new_file);
        setPrehandler(dialog_->check_cursor_follows_scrollbar);
        setPrehandler(dialog_->check_dialogs_iconify_with_main);
        setPrehandler(dialog_->counter_wm_jump);
@@ -1898,8 +1896,6 @@
                str = lyxrc.getDescription(LyXRC::RC_EXIT_CONFIRMATION);
        else if (ob == dialog_->check_display_shrtcuts)
                str = lyxrc.getDescription(LyXRC::RC_DISPLAY_SHORTCUTS);
-       else if (ob == dialog_->check_ask_new_file)
-               str = lyxrc.getDescription(LyXRC::RC_NEW_ASK_FILENAME);
        else if (ob == dialog_->check_cursor_follows_scrollbar)
                str = lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
        else if (ob == dialog_->check_dialogs_iconify_with_main)
@@ -1925,7 +1921,6 @@
                      lyxrc.auto_region_delete);
        fl_set_button(dialog_->check_exit_confirm, lyxrc.exit_confirmation);
        fl_set_button(dialog_->check_display_shrtcuts, lyxrc.display_shortcuts);
-       fl_set_button(dialog_->check_ask_new_file, lyxrc.new_ask_filename);
        fl_set_button(dialog_->check_cursor_follows_scrollbar,
                      lyxrc.cursor_follows_scrollbar);
        fl_set_button(dialog_->check_dialogs_iconify_with_main,
Index: frontends/xforms/forms/form_preferences.fd
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_preferences.fd,v
retrieving revision 1.48
diff -u -r1.48 form_preferences.fd
--- frontends/xforms/forms/form_preferences.fd  13 Jun 2002 13:43:51 -0000      1.48
+++ frontends/xforms/forms/form_preferences.fd  21 Jun 2002 04:53:24 -0000
@@ -973,7 +973,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1101,7 +1101,7 @@
 Name: form_preferences_lnf_misc
 Width: 450
 Height: 350
-Number of Objects: 19
+Number of Objects: 18
 
 --------------------
 class: FL_BOX
@@ -1225,25 +1225,6 @@
 style: FL_NORMAL_STYLE
 size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: File->New asks for name|#N
-shortcut: 
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: check_ask_new_file
-callback: C_FormBaseDeprecatedInputCB
-argument: 0
-       value: 1
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 15 165 30 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
 label: Cursor follows scrollbar|#f
 shortcut: 
 resize: FL_RESIZE_ALL
@@ -1256,7 +1237,7 @@
 --------------------
 class: FL_CHECKBUTTON
 type: PUSH_BUTTON
-box: 15 195 30 30
+box: 15 165 30 30
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_YELLOW
 alignment: FL_ALIGN_CENTER
@@ -1319,7 +1300,7 @@
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER

-- 
"If a thing is not diminished by being shared, it is not rightly owned if
 it is only owned & not shared."
        - St. Augustine

Reply via email to