gnustep-dev
[Top][All Lists]
Advanced

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

Some small proposals


From: Fred Kiefer
Subject: Some small proposals
Date: Mon, 18 Jun 2001 23:51:46 +0200

I would like to add a small extension to the NSCell protocol. In
addition to the performClick: method I would like to have a
performClickWithFrame:inView: as on NSPopupButtonCell. This would be
used to implement the performClick: method. Subclasses that would
overwrite performClick: now will overwrite this new method and at places
where we need to change the frame before the highlight is drawn (eg the
NSComboBoxCell) we just implement performClick and change the frame we
hand on. 
This change would not be needed if the NSComboBox would use a
NSPopupButtonCell instead of a NSButtonCell, but I think that this
change is an improvement that will be of general use. And it wont break
OpenStep compatibility, as for this the new method is just an
implementation detail.

The other thing is rather a question. In the specification of NSMenu and
NSComboBox it is defined that check if an item is included should return
-1 if it is not there. In other places of the framework the value
NSNotFound is used instead. Should we stick to the specification here or
try to be more consistent by using NSNotFound everywhere?

Than there is a small optimization I would like to discuss. When locking
focus on a view we call the following code (of course it looks a lot
different there)

 DPSgsave(ctxt);
 DPSsetgstate(ctxt, _gstate);

In the xgps backend the first line copies the gstate and pushes it on
the stack and the second line overwrites the copied gstate with another
on. So I would like to replace those two lines with a new operator, lets
say DPSreplacegstate(ctxt, _gstate). The standard implementation of this
on NSGraphicsContext would just call the two separate operators, but the
code in XGContext would optimize the code to push the gstate and replace
it with the new one. This would save us one copy for each lock focus,
and as far as I know XGGstates are the most commonly used objects in the
gui test code. Perhaps one third of them could be saved by this change.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]