[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] libvob/doc/pegboard/vob_event_action--mudyc peg...
From: |
Matti Katila |
Subject: |
[ff-cvs] libvob/doc/pegboard/vob_event_action--mudyc peg... |
Date: |
Fri, 26 Sep 2003 10:38:50 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Matti Katila <address@hidden> 03/09/26 10:38:50
Modified files:
doc/pegboard/vob_event_action--mudyc: peg.rst
Log message:
fixed the selection peg. removed plenty of the implementation -> shorter
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/doc/pegboard/vob_event_action--mudyc/peg.rst.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: libvob/doc/pegboard/vob_event_action--mudyc/peg.rst
diff -u libvob/doc/pegboard/vob_event_action--mudyc/peg.rst:1.3
libvob/doc/pegboard/vob_event_action--mudyc/peg.rst:1.4
--- libvob/doc/pegboard/vob_event_action--mudyc/peg.rst:1.3 Thu Sep 18
07:13:12 2003
+++ libvob/doc/pegboard/vob_event_action--mudyc/peg.rst Fri Sep 26 10:38:49 2003
@@ -5,14 +5,13 @@
:Authors: Matti J. Katila
:Date-Created: 2003-09-08
-:Last-Modified: $Date: 2003/09/18 11:13:12 $
-:Revision: $Revision: 1.3 $
-:Status: Incomplete
+:Last-Modified: $Date: 2003/09/26 14:38:49 $
+:Revision: $Revision: 1.4 $
+:Status: Current
:Stakeholders: mudyc, tjl
:Scope: Minor
:Type: Architecture
-.. Affect-PEGs:
Our framework still lacks of good way to create button and
menu like objects. These objects are different than
@@ -31,7 +30,7 @@
Changes
=======
-Create a new abstract Vob which reacts to following events:
+Create a new abstract Vob which can react to following events:
1) select down(pre selection, event pressed but no released),
2) select up(no events, mostly this is the normal mode before events) and
@@ -42,25 +41,29 @@
the select Vob is immutable and all three Vobs must be given
in constructor. The current `selection mode` is shown by one of the Vobs
at the bottom and then placeable object is placed over it, i.e. text.
-The control of `selection mode` is done with second coordinate system.
-It is the only way to do it with immutable object.
-::
+Switching between `selection modes` is done with second
+coordinate system since it's the only way to do it with immutable object.
- package org.nongnu.libvob.vobs;
- import org.nongnu.libvob.*;
- import org.nongnu.libvob.gl.*;
- import org.nongnu.libvob.util.*;
- import java.awt.*;
+I propose the following abstraction for select Vob: ::
- /** An abstract vob which is selectable, i.e. when mouse
- * is pressed above it the vob is visualized differently.
+ /** An abstract Vob which is selectable, i.e., when mouse
+ * is pressed within a one the vob is visualized differently.
+ * There are three different visualizations a.k.a select modes.
+ * Switching between these modes is done by setting parameters of
+ * the second coordinate system.
+ * Please notice that constructing of this second
+ * coordinate system should be done trough the static methods
+ * <code>getControl</code> and
+ * <code>setControl</code> provided by this class.
*/
public abstract class AbstractSelectVob extends AbstractVob {
- public static boolean dbg = false;
- static private void p(String s) {
System.out.println("AbstractSelectVob:: "+s); }
+ /** The placeable mask which is placed on top of the select mode Vob.
+ * For example, if the mask is text then the text is drawn
+ * over the select mode Vob (see. normal, pre or post attributes).
+ */
protected final org.nongnu.libvob.lava.placeable.Placeable mask;
/** The vob visualizing of three possible select modes.
@@ -69,64 +72,25 @@
protected final Vob normal, pre, post;
/** A renderable vob which is used in OpenGL side to
- * switch the modes inside one vob scene.
+ * represent the current select mode inside one vob scene.
*/
protected Vob select = null;
- /** @param mask A Placeable object which is
- */
- public AbstractSelectVob(org.nongnu.libvob.lava.placeable.Placeable
mask) {
- this(mask,
- selectVob(Color.white),
- selectVob(Color.yellow),
- selectVob(Color.red));
- }
-
- static private Vob selectVob(Color color) {
- return
- GLCache.getCallListCoorded(
- "PushAttrib ENABLE_BIT CURRENT_BIT TEXTURE_BIT\n"+
- "Disable TEXTURE_2D \n"+
- "Color "+ ColorUtil.colorGLString(color) +"\n"+
- "Begin QUADS \n"+
- "Vertex 0 0 \n"+
- "Vertex 0 1 \n"+
- "Vertex 1 1 \n"+
- "Vertex 1 0 \n"+
- "End\n"+
- "PopAttrib");
- }
-
-
- public AbstractSelectVob(
- org.nongnu.libvob.lava.placeable.Placeable mask,
- Vob normalVob, Vob preSelectVob, Vob postActivatedVob)
+ public AbstractSelectVob(
+ org.nongnu.libvob.lava.placeable.Placeable mask,
+ Vob normalVob, Vob preSelectVob, Vob postActivatedVob)
{
this.mask = mask;
this.normal = normalVob;
- this.pre = preSelectVob;
- this.post = postActivatedVob;
- select = GLRen.createSelectVob((GL.Renderable1JavaObject) normal,
- (GL.Renderable1JavaObject) pre,
- (GL.Renderable1JavaObject) post);
- }
-
-
- public void render(Graphics g, boolean fast,
- RenderInfo info1, RenderInfo info2) {
- throw new Error("Not implemented");
+ this.pre = preSelectVob;
+ this.post = postActivatedVob;
}
- public int putGL(VobScene vs, int box, int controlCS) {
- if (select == null)
- select = GLRen.createSelectVob((GL.Renderable1JavaObject)
normal,
- (GL.Renderable1JavaObject) pre,
- (GL.Renderable1JavaObject) post);
- vs.map.put(select, box, controlCS);
- return 0;
- }
-
+
private static final Object baseKey = "SelectVobControlLine";
+
+ /** Creates a base cs tree for select vobs' coordinate system.
+ */
private static int baseControlCS(VobScene vs, Object key) {
if (vs.matcher.getCS(0, key) < 2)
vs.translateCS(0, key,0,0);
@@ -140,19 +104,10 @@
return vs.matcher.getCS(control, key);
}
- static public class ControlState { private ControlState() {; } }
-
- /** Enumeration of control state.
- */
- static public final ControlState
- normalState = new ControlState(),
- preState = new ControlState(),
- postState = new ControlState();
-
/** Get the coordinate system of mode selection control.
* @param vs The current VobScene
- * @param controlKey The key for this control coordinate
+ * @param controlKey A key for this control coordinate
* system. The key must be unique.
*/
public static int getControl(VobScene vs,
@@ -189,44 +144,22 @@
vs.coords.setOrthoBoxParams(cs, 0,0,0, 1,1, width, width );
return cs;
}
+
+
+ /** Help class to support typesafe enumeration of control state.
+ */
+ static public class ControlState { private ControlState() {; } }
- }
+ /** Enumeration of control state.
+ */
+ static public final ControlState
+ normalState = new ControlState(),
+ preState = new ControlState(),
+ postState = new ControlState();
+ }
We also need OpenGL renderable which can multiplex between three vobs.
-The change is trivial and belongs to libvob/include/vob/vobs/Trivial.hxx ::
-
-
- /** A Vob to draw a selection with 3 'selection modes'.
- * 2nd coordinate system is used to select the current mode.
- * The mode is represented by a vob. These 3 possibile 'selection mode'
- * vobs are set in parameters.
- * <p>
- * Modes(2nd cs square size width):
- * <=1 normal,
- * <= 2 pre selection and
- * other is post selection.
- */
- struct SelectVob {
- enum { NTrans = 2 };
-
- Vob1 * normal,
- * preSelect,
- * postSelect;
-
- template<class F> void params(F &f) {
- f(normal, preSelect, postSelect);
- }
-
- template<class T> void render(const T &t0, const T &t1) const {
- Pt box = t1.getSqSize();
- if (box.x <= 1) normal->render1(t0);
- else if (box.x <= 2) preSelect->render1(t0);
- else postSelect->render1(t0);
- }
-
- };
- VOB_DEFINED(SelectVob);
-
+The change is trivial and belongs to libvob/include/vob/vobs/Trivial.hxx