#457 Clipboard actions dont trigger SCN_MODIFYATTEMPTRO

Feature_Request
closed-rejected
Scintilla (792)
2
2006-08-23
2006-07-07
Anonymous
No

Cut or Paste in a read-only document doesnt seem to
trigger the SCN_MODIFYATTEMPTRO notification message.

Could this be added?

Discussion

  • Dan Petitt

    Dan Petitt - 2006-07-08

    Logged In: YES
    user_id=721162

    Oops, this should be in the Scintilla category

     
  • Dan Petitt

    Dan Petitt - 2006-07-08

    Logged In: YES
    user_id=721162

    After some more investigation I was wrong.

    Cut does work and triggers the event. Paste also does, but
    the Paste command is disabled if it is readonly, so here
    are some changes that would allow it to be enabled on
    readonly docs if so required (FYI: I need this for an
    editor that is integrated with Source Control)...

    EDITOR.H

    Add...
    bool allowReadOnlyPaste;

    EDITOR.CPP

    Add to Editor() constructor...
    allowReadOnlyPaste = false;

    Modify CanPaste function...
    bool Editor::CanPaste() {
    if( allowReadOnlyPaste )
    {
    return !SelectionContainsProtected();
    }

    return \!pdoc->IsReadOnly\(\) && \!
    

    SelectionContainsProtected();
    }

    Add to WndProc

    case SCI\_SETREADONLYPASTE:
        allowReadOnlyPaste = \(wParam \!= 0\);
        break;
    

    SCINTILLA.H
    Add.
    #define SCI_SETREADONLYPASTE 4012

    Hope this helps, it would be nice if it were added to main
    code.

     
  • Dan Petitt

    Dan Petitt - 2006-07-09

    Logged In: YES
    user_id=721162

    After some more investigation I was wrong.

    Cut does work and triggers the event. Paste also does, but
    the Paste command is disabled if it is readonly, so here
    are some changes that would allow it to be enabled on
    readonly docs if so required (FYI: I need this for an
    editor that is integrated with Source Control)...

    EDITOR.H

    Add...
    bool allowReadOnlyPaste;

    EDITOR.CPP

    Add to Editor() constructor...
    allowReadOnlyPaste = false;

    Modify CanPaste function...
    bool Editor::CanPaste() {
    if( allowReadOnlyPaste )
    {
    return !SelectionContainsProtected();
    }

    return \!pdoc->IsReadOnly\(\) && \!
    

    SelectionContainsProtected();
    }

    Add to WndProc

    case SCI\_SETREADONLYPASTE:
        allowReadOnlyPaste = \(wParam \!= 0\);
        break;
    

    SCINTILLA.H
    Add.
    #define SCI_SETREADONLYPASTE 4012

    Hope this helps, it would be nice if it were added to main
    code.

     
  • Neil Hodgson

    Neil Hodgson - 2006-07-12
    • labels: --> Scintilla
    • milestone: --> Feature_Request
    • priority: 5 --> 2
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-rejected
     
  • Neil Hodgson

    Neil Hodgson - 2006-07-12

    Logged In: YES
    user_id=12579

    Add a Paste command to your application that switches off
    read-only while you do the paste. Adding this to Scintilla
    is too irregular: why only for paste? Unusual requirements
    like this should be implemented where possible by the container.

     
  • Dan Petitt

    Dan Petitt - 2006-07-12

    Logged In: YES
    user_id=721162

    Its not that unusual and its only related to the CanPaste
    command not allowing paste on a readonly doc.

    As the container cant determine if there is anything in
    clipboard that is pasteable (I suppose it could by just
    looking in the clipboard for plain text), how would it
    determine whether to enable the command.

    I suppose I could disable ReadOnly on the pCmdUI (MFC) and
    re-enable it afterwards, but thats a bit tacky and
    messy ... and if that is what is required then its being
    done in the wrong place (i.e. it shouldnt be done in the
    container).

    I think I will stick with my simple modifications to
    Scintilla as detailed below.

     
  • Neil Hodgson

    Neil Hodgson - 2006-07-13

    Logged In: YES
    user_id=12579

    Its not unreasonable to leave paste enabled when unsure as
    Scintilla does on GTK+ where checking the clipboard is more
    complex. The standard context menu will also have Cut and
    Delete disabled in read-only mode.

     
  • Neil Hodgson

    Neil Hodgson - 2006-08-23
    • status: open-rejected --> closed-rejected
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks