• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ev_EditBits.h

Go to the documentation of this file.
00001 /* AbiSource Program Utilities
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 
00021 
00022 
00023 #ifndef EV_EDITBITS_H
00024 #define EV_EDITBITS_H
00025 
00026 #include "ut_types.h"
00027 
00028 /*****************************************************************
00029 ******************************************************************
00030 ** we compress virtual key code and mouse ops along with modifier
00031 ** keys into a single long word in order to facilitate binding lookups.
00032 ******************************************************************
00033 *****************************************************************/
00034 
00035 
00036 typedef UT_uint32 EV_EditMouseContext;                              /* may not be ORed */
00037 // NB: when adding new values, you have to also increase EV_COUNT_EMC
00038 // defined at the bottom of this file -- if you dont you will spend
00039 // hours trying to work out why your functions do not get called, as
00040 // I did :) (Tomas)
00041 //
00042 // Foddex:  the values for the various contexts were bad. The EV_EMC_ToNumber
00043 //          define is used to make an index out of the context bits. It is
00044 //          used assuming that it will never yield a value larger than or
00045 //          equal to EV_COUNT_EMC. However, the original values were defined
00046 //          in such a way that it often was bigger dan EV_COUNT_EMC. E.g.
00047 //          0xe0000000 >> 27 = 28, which is bigger than EV_COUNT_EMC. I therefor
00048 //          rearranged the values. I just hope noone ever was so stupid to use
00049 //          hardcoded values...
00050 #define EV_EMC__MASK__          ((EV_EditMouseContext) 0xf8000000)
00051 #define EV_EMC_UNKNOWN          ((EV_EditMouseContext) 0x08000000)
00052 #define EV_EMC_TEXT             ((EV_EditMouseContext) 0x10000000)
00053 #define EV_EMC_LEFTOFTEXT       ((EV_EditMouseContext) 0x18000000)
00054 #define EV_EMC_MISSPELLEDTEXT   ((EV_EditMouseContext) 0x20000000)
00055 #define EV_EMC_IMAGE            ((EV_EditMouseContext) 0x28000000)
00056 #define EV_EMC_IMAGESIZE        ((EV_EditMouseContext) 0x30000000)
00057 #define EV_EMC_FIELD            ((EV_EditMouseContext) 0x38000000)
00058 #define EV_EMC_HYPERLINK        ((EV_EditMouseContext) 0x40000000)
00059 #define EV_EMC_RIGHTOFTEXT      ((EV_EditMouseContext) 0x48000000)
00060 #define EV_EMC_REVISION         ((EV_EditMouseContext) 0x50000000)
00061 #define EV_EMC_VLINE            ((EV_EditMouseContext) 0x58000000)
00062 #define EV_EMC_HLINE            ((EV_EditMouseContext) 0x60000000)
00063 #define EV_EMC_FRAME            ((EV_EditMouseContext) 0x68000000)
00064 #define EV_EMC_VISUALTEXTDRAG   ((EV_EditMouseContext) 0x70000000)
00065 #define EV_EMC_TOPCELL          ((EV_EditMouseContext) 0x78000000)
00066 #define EV_EMC_TOC              ((EV_EditMouseContext) 0x80000000)
00067 #define EV_EMC_POSOBJECT        ((EV_EditMouseContext) 0x88000000)
00068 #define EV_EMC_MATH             ((EV_EditMouseContext) 0x90000000)
00069 #define EV_EMC_EMBED            ((EV_EditMouseContext) 0x98000000)
00070 
00071 // NB: the following two values are not included in EV_COUNT_EMC
00072 // because they are not used in the bindings, and are, therefore,
00073 // never processed by bet the mouse routines, consequently they
00074 // do not have to follow the rules for EV_EMC ( and they dont so that
00075 // they would not waste available values, which we will soon run
00076 // out off); they are here so that contextHyperlink can create
00077 // different menus in dependence on the nature of the text of
00078 // the hyperlink
00079 
00080 #define EV_EMC_HYPERLINKTEXT      ((EV_EditMouseContext) 0x000000002)
00081 #define EV_EMC_HYPERLINKMISSPELLED ((EV_EditMouseContext) 0x000000001)
00082 // RIVERA
00083 #define EV_EMC_ANNOTATIONTEXT      ((EV_EditMouseContext) 0x000000003)
00084 #define EV_EMC_ANNOTATIONMISSPELLED ((EV_EditMouseContext) 0x000000004)
00085 #define EV_EMC_RDFANCHORTEXT      ((EV_EditMouseContext) 0x000000005)
00086 // dynamic values will be generated starting from EV_EMC_AVAIL, should
00087 // be changed if needed.
00088 #define EV_EMC_AVAIL              ((EV_EditMouseContext) 0x000000007)
00089 
00090 #define EV_EMC_ToNumber(emc)            ((((emc)&EV_EMC__MASK__)>>27)-1)
00091 #define EV_EMC_FromNumber(n)            (((n+1)<<27)&EV_EMC__MASK__)
00092 
00093 typedef UT_uint32 EV_EditModifierState;                             /* may be ORed */
00094 #define EV_EMS__MASK__          ((EV_EditModifierState) 0x07000000)
00095 #define EV_EMS_SHIFT            ((EV_EditModifierState) 0x01000000)
00096 #define EV_EMS_CONTROL          ((EV_EditModifierState) 0x02000000)
00097 #define EV_EMS_ALT              ((EV_EditModifierState) 0x04000000)
00098 #define EV_EMS_ToNumber(ems)            (((ems)&EV_EMS__MASK__)>>24)
00099 #define EV_EMS_ToNumberNoShift(ems)     (((ems)&EV_EMS__MASK__)>>25)    /* exclude shift */
00100 #define EV_EMS_FromNumber(n)            ((((n)<<24)&EV_EMS__MASK__))
00101 #define EV_EMS_FromNumberNoShift(n)     ((((n)<<25)&EV_EMS__MASK__))
00102 
00103 
00104 typedef UT_uint32 EV_EditKeyPress;                                  /* may be ORed */
00105 #define EV_EKP__MASK__          ((EV_EditKeyPress)      0x00880000)
00106 #define EV_EKP_PRESS            ((EV_EditKeyPress)      0x00800000)
00107 #define EV_EKP_NAMEDKEY         ((EV_EditKeyPress)      0x00080000)
00108 #define EV_NamedKey(xxxx)   (EV_EKP_NAMEDKEY | (xxxx))
00109 
00110 
00111 typedef UT_uint32 EV_EditMouseButton;                               /* may not be ORed */
00112 #define EV_EMB__MASK__          ((EV_EditMouseButton)   0x00700000)
00113 #define EV_EMB_BUTTON0          ((EV_EditMouseButton)   0x00100000) /* no buttons down */
00114 #define EV_EMB_BUTTON1          ((EV_EditMouseButton)   0x00200000)
00115 #define EV_EMB_BUTTON2          ((EV_EditMouseButton)   0x00300000)
00116 #define EV_EMB_BUTTON3          ((EV_EditMouseButton)   0x00400000)
00117 #define EV_EMB_BUTTON4          ((EV_EditMouseButton)   0x00500000)
00118 #define EV_EMB_BUTTON5          ((EV_EditMouseButton)   0x00600000)
00119 #define EV_EMB_ToNumber(emb)    (((emb)&EV_EMB__MASK__)>>20)
00120 
00121 
00122 typedef UT_uint32 EV_EditMouseOp;                                   /* may not be ORed */
00123 #define EV_EMO__MASK__          ((EV_EditMouseOp)       0x00070000)
00124 #define EV_EMO_SINGLECLICK      ((EV_EditMouseOp)       0x00010000)
00125 #define EV_EMO_DOUBLECLICK      ((EV_EditMouseOp)       0x00020000)
00126 #define EV_EMO_DRAG             ((EV_EditMouseOp)       0x00030000) /* drag */
00127 #define EV_EMO_DOUBLEDRAG       ((EV_EditMouseOp)       0x00040000) /* drag following doubleclick */
00128 #define EV_EMO_RELEASE          ((EV_EditMouseOp)       0x00050000) /* release following singleclick */
00129 #define EV_EMO_DOUBLERELEASE    ((EV_EditMouseOp)       0x00060000) /* release following doubleclick */
00130 #define EV_EMO_ToNumber(emb)    (((emb)&EV_EMO__MASK__)>>16)
00131 #define EV_EMO_FromNumber(n)    ((((n)<<16)&EV_EMO__MASK__))
00132 
00133 
00134 typedef UT_uint32 EV_EditVirtualKey;                                /* may not be ORed */
00135 #define EV_EVK__MASK__          ((EV_EditVirtualKey)    0x0000ffff)
00136 #define EV_EVK_ToNumber(evk)    (((evk)&EV_EVK__MASK__))
00137 #define EV_NVK_ToNumber(nvk)    (((nvk)&EV_EVK__MASK__))
00138 
00139 
00140 typedef UT_uint32 EV_EditBits;  /* union of all the above bits */
00141 
00142 // the EV_COUNT_ give the number of unique combinations
00143 // currently defined in the bits above.
00144 
00145 #define EV_COUNT_EMS            8       // combinations under 'OR' (including 0)
00146 #define EV_COUNT_EMS_NoShift    (EV_COUNT_EMS/2)
00147 
00148 #define EV_COUNT_EMB            6       // simple count (not 'OR')
00149 #define EV_COUNT_EMO            6       // simple count (not 'OR')
00150 #define EV_COUNT_EMC            19      // simple count (not 'OR')
00151 
00152 #define EV_IsMouse(eb)          (((eb) & EV_EMO__MASK__))
00153 #define EV_IsKeyboard(eb)       (((eb) & EV_EKP__MASK__))
00154 
00155 #endif /* EV_EDITBITS_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1