[tomboy-list] Enhancement suggestion to Tomboy's UndoManager (to support custom EditActions)
Matt Guo
matt at mattguo.com
Wed Oct 27 20:16:55 PDT 2010
On Thu, Oct 28, 2010 at 12:36 AM, Russ Fretenburg
<russ.fretenburg at gmail.com> wrote:
> Hi Matt,
> Thanks for this addin. It looks really useful. Here are some comments from
> my initial testing.
>
> I use local folder sync to synchronize a Windows XP machine, and two Ubuntu
> machines. I use this every day for work and it's great. So of course I wish
> this image addin worked with sync. When I first tried it yesterday it caused
> Tomboy on my Windows machine to lock up but today after getting the latest
> dll that you mentioned it does not lock up. I just don't get the image
> copied over to the second machine. Do you plan to work on the sync
> capability for images?
Thanks, Russ. Sync is still not feasible fow now. Tomboy hasn't
started to provide infrastrcuture to sync addins, though we already
had some related discussions on this topic before.
As Sandy pointed, 2 of them are:
http://lists.beatniksoftware.com/pipermail/tomboy-list-beatniksoftware.com/2009-December/001414.html
https://bugzilla.gnome.org/show_bug.cgi?id=632015#c3
Also I have some new ideas on this topic since
a) inspired by tomboy-image
b) I'm now working for a push-mail company. As I understand, "Tomboy
with attachments" becomes sorts like a email server. You know, emails
are rich texts with all kinds (aka MIME types) of embedded
attachments; and we need to sync them to various clients, not only
correctly, but also efficiently.
I'll write the whole idea down some time later, maybe this Friday.
> It's great to be able to easily resize the image in a note but I think it
> would be better if when you grab the corner it maintains the original aspect
> ratio.
Yes, it can be very useful. How can I forgot this feature.
> On Ubuntu 10.10 when I try to insert a local image some folders show no
> images in the file dialog even though they have many images. It just looks
> like an empty folder in the file dialog. Other folders work fine. I am not
> sure what the difference is.
I also installed Ubuntu 10.10, can you provide more info of the "empty
folder", such as the "ls -l dir_name" info?
> On Windows XP when I try to insert an image the image does not appear in the
> note.
Can you send me a copy of the .note file for analysis (DO NOT do it if
the note contains any confidential info). The .note files are
typically stored in "C:\Documents and
Settings\YOUR_USER_NAME\Application Data\Tomboy\" on XP. You may
select the right note by checking the file size (if the note contains
image, then the size would be much larger than other pure text notes),
or last modified data, or open the .note file (it's XML format) and
check the <title> element.
> I would love to be able to insert or attach other types of objects in Tomboy
> notes too.
>
> On Ubuntu 10.10 I am running Tomboy 1.4.0 that came with Ubuntu.
> On Windows XP I am running Tomboy 1.3.3.
> Best regards,
> Russ
>
>
> On Wed, Oct 27, 2010 at 2:11 AM, Matt Guo <matt at mattguo.com> wrote:
>>
>> I implemented several undoable actions in the tomboy-image addin:
>> http://www.mattguo.com/tomboy-image/
>> (My mistake: I placed a wrong/old dll on the project page, now it's
>> replaced with the latest version dll)
>>
>> The most difficult part (i.e. DeleteImageAction in the tombo-image
>> code base) is to implement undo/redo for text-range-deletion,
>> especially when the range contains both images and texts, and I found
>> the following enhancements are needed to implement such EditActions.
>>
>> Enhancements:
>>
>> 1) UndoManager already provided FreezeUndo and ThawUndo, while I still
>> need "IsUndoFrozen" exposed.
>> Usually we'll create some visitors to watch the changes happened on
>> underlying resources (such as listen TextBuffer.DeleteRange), so that
>> we can instantiate the custom EditActions according to the watched
>> changes, but only if the UndoManager is not forzen. While currently
>> the addin visitors can't know whether the UndoManager is forzen or
>> not.
>>
>> 2) Every EditAction can define CanMerge and Merge methods. And the
>> pseudo logic of "UndoManager::AddUndoAction (EditAction e)" is:
>>
>> if (try_merge) {
>> var top = undo_stack.Peek();
>> if (top.CanMerge (e)) {
>> top.Merge(e);
>> return;
>> }
>> }
>> undo_stack.Push (e)
>>
>> Then the suggest enhancement is to not only allow "top" to merge "e",
>> but also allow "e" to merge "top":
>>
>> if (try_merge) {
>> var top = undo_stack.Peek();
>> if (top.CanMerge (e)) {
>> top.Merge(e);
>> return;
>> } else {
>> while (top != null && e.CanMerge (top)) {
>> e.Merge (top);
>> undo_stack.pop ();
>> top = undo_stack.Peek();
>> }
>> }
>> }
>> undo_stack.Push (e)
>>
>> The reason for this enhancement: usually a Tomboy action TA (such as a
>> EraseAction) has knowledge of an addin action AA (such as a
>> DeleteImageAction), thus for sure TA can't merge AA. While AA knows
>> TA, and sometimes might also want to merge the TA.
>>
>> PS. why DeleteImageAction must merge EraseAction:
>> suppose this text range is just deleted: "..#...", where "." means a
>> char, and "#" means an image, then if the DeleteImageAction can't
>> merge EraseAction, during undo, the image will firstly be un-deleted,
>> and then the text will be un-deleted, and finally the undo result will
>> become "#......" or "......#"
>>
>> PPS. as workaround, tomboy-image currently used some reflection hacks
>> to access UndoManager's private members.
>> --
>> B.R.
>> GUO Rui (Matt)
>> _______________________________________________
>> Tomboy-list mailing list
>> Tomboy-list at lists.beatniksoftware.com
>>
>> http://lists.beatniksoftware.com/listinfo.cgi/tomboy-list-beatniksoftware.com
>
>
>
> --
> Russ Fretenburg
> russ.fretenburg at gmail.com
>
>
--
--
B.R.
GUO Rui (Matt)
More information about the Tomboy-list
mailing list