Menu

#654 Improve formatting technique for dirview ctxt menu

Not Scheduled
open
nobody
None
5
2013-02-28
2004-05-08
No

DirView.cpp

In CDirView::ListContextMenu, move the strings for, eg,
"Copy Left to Right, %1 of %2 items", from the string
table up into the actual popup menu, and use a new
function very much like FormatContextMenu (except, the
new one only takes two numbers, and also takes a BOOL
readonlyOverride argument).

That is, change the way the Copy & Open menu update
handlers work in imitation of the way the zip ones
currently work.

The zip ones precompute all the counts over all the
selected items, so the Copy & Open ones can just use
those counts. Right now the Copy & Open ones all have
their own update handlers which each recompute all the
relevant counts.

This would be the implementation of this note by me
over a year ago, in the code, viz.:

// TODO: It would be more efficient to set
// all the popup items now with one traverse over

selected items
// instead of using updates, in which we make a
traverse for every item
// Perry, 2002-12-04

//2003/12/17 Jochen:
//- Archive related menu items follow the above

suggestion.
//- For disabling to work properly, the tracking
frame's m_bAutoMenuEnable
// member has to temporarily be turned off.

Discussion

  • Anonymous

    Anonymous - 2004-05-08

    Logged In: YES
    user_id=60964

    I was halfway into writing the code for this, to submit the
    patch with code, when I realized I'd have to make resource
    changes, and I'm not touching the resources because of the
    People's Democratic Great Resource String Revolution
    scheduled for today :)

     
  • Kimmo Varis

    Kimmo Varis - 2004-05-08

    Logged In: YES
    user_id=631874

    We have two formats for copy/delete items, with one and two
    counts. How'd you handle this from only menu resource? Or
    are you going back to one string format?

    I don't remember tracker item where we had long discussion
    about those strings...

     
  • Anonymous

    Anonymous - 2004-05-08

    Logged In: YES
    user_id=60964

    Good question; I had just discovered that writing the code,
    when i realized that it was a bad time to write the patch
    (actually I think the resource improvements were over, but I
    didn't know that).

    My plan is to go to just one string, and put it directly in
    the popup menu, a la the zip menu strings, which are in
    Merge.rc (of course) in IDR_POPUP_DIRVIEW MENU, like so:

    MENUITEM SEPARATOR
    POPUP "&Zip"
    BEGIN
    MENUITEM "Zip &Left Side %1 File(s) from %2
    Selected Item(s)",

    ID_DIR_ZIP_LEFT
    MENUITEM "Zip &Right Side %1 File(s) from %2
    Selected Item(s)",

    ID_DIR_ZIP_RIGHT
    MENUITEM "Zip &Both Sides %1 File(s) from %2
    Selected Item(s)",

    ID_DIR_ZIP_BOTH
    MENUITEM "Zip Both &Sides Diffs Only %1 File(s)
    from %2 of %3 Selected Item(s)",

    ID_DIR_ZIP_BOTH_DIFFS_ONLY

    END

    They're embedded directly in the menu, instead of being over
    in the string resource. Therefore, they all always give both
    numbers. I can't remember the discussions. What do you think
    of just always giving two numbers and embedding them like this?

    I don't have to move them into the menu like this; I can do
    this patch change (removing those silly update handlers that
    duplicate the selected item counting) and still retain the
    existing string resources (both 1 and 2 number versions for
    each).

    I also would like to gray out the entire Copy Left menu when
    the left item is readonly -- not all the submenu items,
    which are already greyed out, but the parent item "Copy
    Left" as well. In fact, optimally, I'd like to disable it
    (gray) and also change its text to "Copy Left (left is
    readonly)".

    Maybe I should simply do the removal of the update handlers,
    and leave all the GUI exactly the same for now, and we can
    have this discussion of GUI changes somewhere else.

     
  • Anonymous

    Anonymous - 2004-05-08

    Logged In: YES
    user_id=60964

    Wow, I remember all that now. sourceforge needs a little
    text paragraph somewhere reminding what characters not to
    type -- quotes for instance -- because they come out looking
    hideous.

    Ok, I'm going to submit a patch to do only the internal
    optimization -- no GUI change at all.

     
  • Kimmo Varis

    Kimmo Varis - 2004-05-25

    Logged In: YES
    user_id=631874

    BTW, we count ".." item in when showing Copy/Delete
    submenus. Maybe you can add ignore for it while you are
    touching code around? I already added one if to context menu
    creation, which disables zip* items when only ".." is selected.

     
  • elsapo

    elsapo - 2005-01-23

    Logged In: YES
    user_id=1195173

    YAPBDIHTI: Yet Another Patch Bogged Down In Hopelessly
    Tedious Issues :)

    Need upgrades to developer brainpower... (because I just get
    tired looking at these YAPBDIHTI and timeout before I figure
    it all out again)

     
  • Christian List

    Christian List - 2013-02-28
    • milestone: --> Not Scheduled
     

Log in to post a comment.