A discussion on cut & paste



Hi all,

Some months back I raised the idea of providing some library routines to
make it easier to implement cut & paste. Anyway I have decided that I
really have to get this code into the 2.0 release of GTK.

However so that I don't implement things in ways that go against
everything else and end up having to re-write the code, I would like to
run my ideas past you guys first.

Overview: Right now compared to Windows, Gnome's cut & paste
functionality is rather poor. Most applications haven't done it well or
consistently, probably because it is a hassle and there are usually ways
around it using keyboard shortcuts, so it is left to the bottom of the
list.

Most people (particularly those new to an application) will initially
look under the "Edit" menu for cut/paste functionality - rather than use
the keyboard shortcuts. However it is this menu that is rarely well
implemented. I reckon there are two parts that need to be considered in
order to fix this:-

1) To implement the basic functionality - the menu callback functions
needs to know which widget is focussed, in order to tell which widget to
send the required cut_clipboard/copy_clipboard/paste_clipboard signal
to. So is a new function required to provide this? If so how should it
be done? Is there somewhere deep in gdk/gtk which give us this info? Do
we have track the focussing/unfocussing of each widget?

2) One of the nice things about using the menu for cut/paste is
immediately getting feedback on the pulldown menu that there is
something to be cut or pasted. Thus:-

"Cut" is active if there is something selected and the focussed widget
is editable.
"Copy" is active is there is something selected.
"Paste" is active if there is something in the clipboard and the
focussed widget is editable.

To provide this info we need to be able to determine if the focussed
widget is editable without really knowing the widget concerned. Is there
an attribute on each widget to tell us this?

Also to determine if there is something in the clipboard, I could use
gdk_selection_owner_get(GtkAtom), however this will even return NULL if
the owner is a non-gtk process. So I suggest a new function
gdk_is_selection_owner_set(GtkAtom) that simple returns true/false.

So what do you guys reckon? Am I totally off base - you can probably
tell I am not an expert in GTK in particular. I really just want a
little direction before I dive right in!

Thanks

Damian 


-- 
Damian Ivereigh
CEPS Team Lead
http://wwwin-print.cisco.com
Desk: +61 2 8446 6344
Mob: +61 418 217 582





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