public BiometricSession(PWINBIO_IDENTIFY_CALLBACK callback)
        {
            _identifyCallback = callback;
            _sessionHandle = new ArrayPtr<WINBIO_SESSION_HANDLE>();

            HRESULT hr = NativeFunctions.WinBioOpenSession(NativeConstants.WINBIO_TYPE_FINGERPRINT,
                                                           NativeConstants.WINBIO_POOL_SYSTEM,
                                                           NativeConstants.WINBIO_FLAG_DEFAULT, 
                                                           null, 0, null,
                                                           _sessionHandle);

            if (hr != 0)
                throw new Win32Exception(hr, "WinBioOpenSession failed");

            hr = NativeFunctions.WinBioIdentifyWithCallback(_sessionHandle[0], _identifyCallback, null);

            if (hr != 0)
                throw new Win32Exception(hr, "WinBioIdentifyWithCallback failed");

            _isOpen = true;
        }
示例#2
0
 public void AllocTileWorkerData(MemoryAllocator allocator, int tileCols, int tileRows)
 {
     TileWorkerData = allocator.Allocate <TileWorkerData>(tileCols * tileRows);
 }
示例#3
0
        /// <summary>
        /// Emulate what a real renderer will do, assuming character widths are as determined by CharWidth,
        /// and only space is a valid line break.
        /// Including width of white space:
        /// Basically, if the white space is known to end the line, we don't count its width.
        /// - If we stopped mid-line because of a hard break, ichLim{backtracking} != source length, etc.,
        /// we will try to put more on line, so must include space width.
        /// - If we stop at the very end of the whole paragraph, don't include it? But then how can IP be after
        /// final space?
        /// - If we know next stuff must go on another line leave out its width.
        /// </summary>
        public void FindBreakPoint(IVwGraphics vg, IVwTextSource source, IVwJustifier justifier,
                                   int ichMin, int ichLim, int ichLimBacktrack, bool fNeedFinalBreak, bool fStartLine, int dxMaxWidth,
                                   LgLineBreak lbPref, LgLineBreak lbMax, LgTrailingWsHandling twsh, bool fParaRightToLeft,
                                   out ILgSegment segRet, out int dichLimSeg, out int dxWidth, out LgEndSegmentType est, ILgSegment segPrev)
        {
            // Default return values in case we cannot make a segment.
            segRet     = null;
            dichLimSeg = 0;
            dxWidth    = 0;
            est        = LgEndSegmentType.kestNothingFit;

            int    width     = 0;
            int    lastSpace = -1;
            string input;
            int    cchRead = ichLim - ichMin;

            if (fNeedFinalBreak)
            {
                cchRead++;
            }
            using (ArrayPtr ptr = new ArrayPtr((cchRead) * 2 + 2))
            {
                source.Fetch(ichMin, ichMin + cchRead, ptr.IntPtr);
                input = MarshalEx.NativeToString(ptr, cchRead, true);
            }
            int widthAtLastSpace = 0;

            int ichLimWs = GetLimInSameWs(ichMin, source, ichLimBacktrack);

            FakeSegment result = null;
            // limit in input of characters we may include in segment.
            int limit         = Math.Min(ichLimBacktrack, ichLimWs) - ichMin;
            int limWholeInput = ichLim - ichMin;
            int ichInput      = 0;

            if (twsh == LgTrailingWsHandling.ktwshOnlyWs)
            {
                result = MakeWhiteSpaceOnlySegment(input, width, ichInput, limit);
            }
            else             // mixed allowed or no-white-space
            {
                // Advance past what will fit, keeping track of the last good break position (white space).
                for (; ichInput < limit; ichInput++)
                {
                    if (input[ichInput] == ' ')
                    {
                        lastSpace        = ichInput;
                        widthAtLastSpace = width;
                    }
                    var charWidth = CharWidth(input[ichInput]);
                    if (width + charWidth > dxMaxWidth)
                    {
                        break;
                    }
                    width += charWidth;
                }
                Debug.Assert(width <= dxMaxWidth);                 // loop never allows it to exceed max
                if (ichInput < input.Length && input[ichInput] == ' ')
                {
                    // good break exactly at limit
                    lastSpace        = ichInput;
                    widthAtLastSpace = width;
                }

                if (ichInput == limit && ichLimBacktrack >= ichLimWs)                 // all the text in our WS fit; also handles special case of zero-char range
                {
                    // everything we were allowed to include fit; if it wasn't absolutely everything caller needs to decide
                    // about break.
                    if (twsh == LgTrailingWsHandling.ktwshAll)
                    {
                        result = new FakeSegment(input.Substring(0, limit), width, Ws,
                                                 ichInput == limWholeInput ? LgEndSegmentType.kestNoMore : LgEndSegmentType.kestWsBreak);
                    }
                    else
                    {
                        // must be no-trailing-white-space (all WS is handled above). strip off any trailing spaces.
                        while (ichInput > 0 && input[ichInput - 1] == ' ')
                        {
                            ichInput--;
                            width -= CharWidth(' ');
                        }
                        if (ichInput == limit)                         // no trailing ws removed (also handles empty run)
                        {
                            result = new FakeSegment(input.Substring(0, limit), width, Ws,
                                                     ichInput == limWholeInput ? LgEndSegmentType.kestNoMore : LgEndSegmentType.kestWsBreak); // all fit
                        }
                        else if (ichInput > 0)                                                                                                // got some text, stripped some white space
                        {
                            result = new FakeSegment(input.Substring(0, ichInput), width, Ws, LgEndSegmentType.kestMoreWhtsp);
                        }
                        else
                        {
                            // we're not done with the whole input, but no non-white at start
                            return;
                        }
                    }
                }
                else                 // some stuff we wanted to put on line didn't fit;
                if (lastSpace >= 0)  // there's a good break we can use
                {
                    int end = lastSpace;
                    if (twsh == LgTrailingWsHandling.ktwshAll)
                    {
                        // include trailing spaces without increasing width; they 'disappear' into line break.
                        while (end < limit && input[end] == ' ')
                        {
                            end++;
                        }
                    }
                    result = new FakeSegment(input.Substring(0, end), widthAtLastSpace, Ws,
                                             LgEndSegmentType.kestMoreLines);
                }
                else if (lbMax == LgLineBreak.klbWordBreak)
                {
                    // we needed a word break and didn't get one.
                    return;
                }
                else
                {
                    // remaining possibility is that we need to make some sort of segment with at least one character.
                    // (if we don't have any i = limit = 0 and we take another branch).
                    if (ichInput == 0)
                    {
                        width += CharWidth(input[ichInput]);
                        ichInput++;                                 // must have at least one character
                    }
                    result = new FakeSegment(input.Substring(ichInput), width, Ws, LgEndSegmentType.kestMoreLines);
                }
            }
            if (result == null)
            {
                return;
            }
            segRet        = result;
            dichLimSeg    = result.Length;
            dxWidth       = result.Width;
            est           = result.EndSegType;
            result.Height = SegmentHeight;
            result.Ascent = SegmentAscent;
            // DirectionDepth is usually 0 for LTR text in an LTR paragraph.
            // For RTL text, however, it is always 1.
            // And for UPSTREAM LTR text (in an RTL paragraph) it has to be 2.
            if (RightToLeft)
            {
                result.DirectionDepth = 1;
            }
            else if (fParaRightToLeft)
            {
                result.DirectionDepth = 2;
            }
        }
 protected abstract void OverlapStereo(ArrayPtr <TSampleType> output, ArrayPtr <TSampleType> input);
 protected abstract double CalculateCrossCorr(ArrayPtr <TSampleType> mixingPos, ArrayPtr <TSampleType> compare);
 /// <summary>
 /// Gets a list of the fields for the specified class.
 /// Gets all fields whose types match the specified argument, which should be a combination
 /// of the fcpt values defined in CmTypes.h, e.g., to get all owning properties
 /// pass kfcptOwningCollection | kfcptOwningAtom | kfcptOwningSequence.
 /// Returns E_FAIL if the array is too small. cflidMax 0 may be passed to obtain the required
 /// size.
 /// Fields of superclasses are also returned, if the relevant flag is true.
 /// [Note: The special CmObject fields are not returned, for now,
 /// but the plan to include them before too long.]
 ///</summary>
 /// <param name='luClid'> </param>
 /// <param name='fIncludeSuperclasses'> </param>
 /// <param name='grfcpt'> </param>
 /// <param name='cflidMax'> </param>
 /// <param name='rgflid'> </param>
 /// <returns></returns>
 public int GetFields(int luClid, bool fIncludeSuperclasses, int grfcpt, int cflidMax, ArrayPtr rgflid)
 {
     throw new NotSupportedException();
 }
 /// <summary>
 /// Gets the list of field identification numbers (in no particular order). If the array
 /// provided is too small, only an arbitrary set of cflid values is returned. If the array
 /// provided is too large, the excess entries are set to zero.
 ///</summary>
 /// <param name='cflid'>The size of the output array. </param>
 /// <param name='rgflid'>An integer array for returning the field identification numbers. </param>
 public void GetFieldIds(int cflid, ArrayPtr rgflid)
 {
     throw new NotSupportedException();
 }
示例#8
0
 private void DecAllocMi(MemoryAllocator allocator, int miSize)
 {
     Mip        = allocator.Allocate <ModeInfo>(miSize);
     MiGridBase = allocator.Allocate <Ptr <ModeInfo> >(miSize);
 }
示例#9
0
 protected abstract int EvaluateFilterMulti(ArrayPtr <TSampleType> dest, ArrayPtr <TSampleType> src, int numSamples, int numChannels);
示例#10
0
 protected abstract int EvaluateFilterStereo(ArrayPtr <TSampleType> dest, ArrayPtr <TSampleType> src, int numSamples);
示例#11
0
        // Implementation of both get_NormalizedForm and NfdAndFixOffsets
        private ITsString get_NormalizedFormAndFixOffsets(FwNormalizationMode nm, ArrayPtr oldOffsetsToFix, int numOffsetsToFix)
        {
            // Can we skip unnecessary work?
            if (IsAlreadyNormalized(nm))
            {
                return(this);
            }
            if (string.IsNullOrEmpty(Text))
            {
                NoteAlreadyNormalized(nm);
                return(this);
            }

            if (nm == FwNormalizationMode.knmLim)
            {
                throw new ArgumentException("Normalization mode may not be knmLim", "nm");
            }

            // NFSC needs to be decomposed first, then recomposed as NFC.
            if (nm == FwNormalizationMode.knmNFSC && !get_IsNormalizedForm(FwNormalizationMode.knmNFD))
            {
                var nfd = (TsString)get_NormalizedForm(FwNormalizationMode.knmNFD);
                // Line below is *not* a typo; this call will not recurse infinitely.
                return(nfd.get_NormalizedFormAndFixOffsets(FwNormalizationMode.knmNFSC, oldOffsetsToFix, numOffsetsToFix));
            }

            bool willFixOffsets = numOffsetsToFix > 0 && oldOffsetsToFix != null && oldOffsetsToFix.IntPtr != IntPtr.Zero;
            // Keys = offsets into original string, values = offsets into normalized string
            var stringOffsetMapping = willFixOffsets ? new Dictionary <int, int>() : null;            // Don't allocate an object if we'll never use it

            var icuNormalizer = CustomIcu.GetIcuNormalizer(nm);

            TsStrBldr resultBuilder = new TsStrBldr();
            int       segmentMin    = 0;

            foreach (int segmentLim in EnumerateSegmentLimits(icuNormalizer))
            {
                string       segment           = GetChars(segmentMin, segmentLim);
                string       normalizedSegment = icuNormalizer.Normalize(segment);
                int          curRun            = get_RunAt(segmentMin);
                int          curRunLim         = get_LimOfRun(curRun);
                ITsTextProps curTextProps      = get_Properties(curRun);
                if (curRunLim >= segmentLim)
                {
                    // The segment is contained entirely in the current run, so our job is simple
                    int outputLenSoFar = resultBuilder.Length;
                    resultBuilder.Replace(outputLenSoFar, outputLenSoFar, normalizedSegment, curTextProps);
                    // Calculate the orig -> norm index mappings if (and only if) they're needed, since this calculation is expensive
                    if (willFixOffsets)
                    {
                        foreach (RearrangedIndexMapping mapping in MatchUpIndexesAfterNormalization(segment, normalizedSegment, icuNormalizer))
                        {
                            // Note that our local mapping is from the start of this segment, but we want to keep track of indexes from the start
                            // of the *string*. (Both the original string and the output, normalized string). So we adjust the indexes here.
                            if (mapping.isFirstCharOfDecomposition)
                            {
                                stringOffsetMapping[segmentMin + mapping.origIdx] = outputLenSoFar + mapping.normIdx;
                            }
                        }
                    }
                }
                else
                {
                    // The segment straddles two runs, so our job is harder. We have to either deal with decomposition
                    // rearranging things (and make sure the right characters maintain the right text properties), or
                    // else we have to deal with composition possibly trying to "compress" some diacritics that straddle
                    // a run border (which can happen, for example, if they have different text properties).

                    if (nm == FwNormalizationMode.knmNFD || nm == FwNormalizationMode.knmNFKD)
                    {
                        // Decomposition: we have to deal with rearranging. Some characters from after the first run's
                        // endpoint may have ended up "inside" the first run after rearranging, so their text properties
                        // will be incorrect at first. We'll fix them up after calculating the orig -> norm index mappings.

                        int outputLenSoFar = resultBuilder.Length;                         // This will be the start index from which
                        resultBuilder.Replace(outputLenSoFar, outputLenSoFar, normalizedSegment, curTextProps);

                        // Now correct the text properties, one index at a time.
                        IEnumerable <RearrangedIndexMapping> indexMappings = MatchUpIndexesAfterNormalization(segment, normalizedSegment, icuNormalizer);
                        foreach (RearrangedIndexMapping mapping in indexMappings)
                        {
                            ITsTextProps origProperties = get_PropertiesAt(segmentMin + mapping.origIdx);
                            int          outputIdx      = outputLenSoFar + mapping.normIdx;
                            int          size           = Char.IsSurrogate(normalizedSegment, mapping.normIdx) ? 2 : 1;
                            resultBuilder.SetProperties(outputIdx, outputIdx + size, origProperties);
                            // And if we also need to fix up offsets at the end, we keep track of the ones we'll need
                            if (willFixOffsets && mapping.isFirstCharOfDecomposition)
                            {
                                stringOffsetMapping[segmentMin + mapping.origIdx] = outputLenSoFar + mapping.normIdx;
                            }
                        }
                    }

                    else if (nm == FwNormalizationMode.knmNFSC)
                    {
                        // Composition that preserves styles. By this point, our input is NFD so we at least know there will be no rearranging.

                        // If there is more than one character remaining in the current run, then we might be able to compose those, at least.
                        if (curRunLim - segmentMin > 1)
                        {
                            // Unicode canonical ordering is such that any subsequence of a composed character can itself be composed, so this is safe.
                            string remainderOfFirstRun = GetChars(segmentMin, curRunLim);
                            string normalizedRemainder = icuNormalizer.Normalize(remainderOfFirstRun);
                            resultBuilder.Replace(resultBuilder.Length, resultBuilder.Length, normalizedRemainder, curTextProps);
                            // Now the start of the un-composable part is just the limit of the first run (which is the start of the second run).
                            segmentMin = curRunLim;
                        }
                        // Now there could be any NUMBER of runs between currentInputIdx and segmentLim. Maybe there are TEN composing
                        // characters, each with different text properties (and thus different runs). However, since the base character
                        // was in the first run, none of the characters from the second or subsequent runs are composable any longer. So we
                        // can copy them to the output as-is as one big TsString, which will carry text, runs and all.
                        ITsString uncomposablePartOfSegment = GetSubstring(segmentMin, segmentLim);
                        resultBuilder.ReplaceTsString(resultBuilder.Length, resultBuilder.Length, uncomposablePartOfSegment);
                    }

                    else
                    {
                        // For NFC and NFKC, we do not try to preserve styles or offset mappings, so this branch is quite simple
                        int outputLenSoFar = resultBuilder.Length;
                        resultBuilder.Replace(outputLenSoFar, outputLenSoFar, normalizedSegment, curTextProps);
                    }
                }
                segmentMin = segmentLim;                 // Next segment will start where the current segment ended
            }
            if (willFixOffsets)
            {
                stringOffsetMapping[segmentMin] = resultBuilder.Length;
                int ptrSize = Marshal.SizeOf(typeof(IntPtr));
                for (int i = 0; i < numOffsetsToFix; i++)
                {
                    IntPtr offsetPtr = Marshal.ReadIntPtr(oldOffsetsToFix.IntPtr, i * ptrSize);
                    int    oldOffset = Marshal.ReadInt32(offsetPtr);
                    int    newOffset;
                    if (stringOffsetMapping.TryGetValue(oldOffset, out newOffset))
                    {
                        Marshal.WriteInt32(offsetPtr, newOffset);
                    }
                    else
                    {
                        // The only likely way for one of the offsets we've been asked to fix up to NOT
                        // be found in the offset mapping dictionary is if it happened to be an offset
                        // to the second half of a surrogate pair. In which case we want to fix it up to
                        // point to wherever the first half of that pair ended up, so searching downwards
                        // through the offset mapping dictionary will find the best match.
                        bool found = false;
                        while (!found && oldOffset > 0)
                        {
                            oldOffset--;
                            found = stringOffsetMapping.TryGetValue(oldOffset, out newOffset);
                        }
                        // Any offset that could not be matched at all will be pointed at the beginning
                        // of the TsString, since that's safe with strings of all sizes (including empty).
                        Marshal.WriteInt32(offsetPtr, found ? newOffset : 0);
                    }
                }
            }
            var result = (TsString)resultBuilder.GetString();

            result.NoteAlreadyNormalized(nm);             // So we won't have to do all this work a second time
            return(result);
        }
示例#12
0
        private void LexImportWizardLanguage_Load(object sender, System.EventArgs e)
        {
            // (Bev) modify a few labels
            if (m_LinguaLinksImport)
            {
                this.Text        = LexTextControls.ksSpecifyFwWs;
                lblComment.Text  = LexTextControls.ksSpecifyFwWsDescription;
                lblLangDesc.Text = LexTextControls.ksLanguageDefinition;
            }
            else
            {
                if (m_AddUsage)
                {
                    this.Text = LexTextControls.ksAddLangMapping;
                }
                else
                {
                    this.Text = LexTextControls.ksModifyLangMapping;
                }
            }

            tbLangDesc.Text = m_LangDesc;

            //getting name for a writing system given the ICU code.
            ILgWritingSystemFactory wsf = m_cache.LanguageWritingSystemFactoryAccessor;
            int            wsUser       = wsf.UserWs;
            int            wsVern       = m_cache.DefaultVernWs;
            IWritingSystem ws           = wsf.get_EngineOrNull(wsVern);

            m_wsiDefault = new WsInfo(wsVern, ws.get_UiName(wsVern), ws.IcuLocale, ws.LegacyMapping);

            // getting list of writing systems to populate a combo.
            int cws = wsf.NumberOfWs;

            using (ArrayPtr ptr = MarshalEx.ArrayToNative(cws, typeof(int)))
            {
                wsf.GetWritingSystems(ptr, cws);
                int[] vws = (int[])MarshalEx.NativeToArray(ptr, cws, typeof(int));
                for (int iws = 0; iws < cws; iws++)
                {
                    if (vws[iws] == 0)
                    {
                        continue;
                    }
                    ws = wsf.get_EngineOrNull(vws[iws]);
                    if (ws == null)
                    {
                        continue;
                    }
                    string name     = ws.get_UiName(wsUser);
                    string icuLocal = ws.IcuLocale;
                    string mapName  = ws.LegacyMapping;
                    WsInfo wsi      = new WsInfo(vws[iws], name, icuLocal, mapName);
                    m_wsInfo.Add(wsi.KEY, wsi);
                }
            }

            // initialize the 'ws' combo box with the data from the DB
            foreach (DictionaryEntry entry in m_wsInfo)
            {
                WsInfo wsi = entry.Value as WsInfo;
                cbWS.Items.Add(wsi);
            }
            cbWS.Sorted = false;
            WsInfo wsiIgnore = new WsInfo();

            cbWS.Items.Add(wsiIgnore);

            // select the proper index if there is a valid writhing system
            int index = 0;

            if (m_wsName != null && m_wsName != "")
            {
                index = cbWS.FindStringExact(m_wsName);
                if (index < 0)
                {
                    index = 0;
                }
            }
            cbWS.SelectedIndex = index;

            LoadEncodingConverters();

            index = 0;
            if (m_encConverter != null && m_encConverter != "")
            {
                index = cbEC.FindStringExact(m_encConverter);
                if (index < 0)
                {
                    index = 0;
                }
            }
            cbEC.SelectedIndex = index;
        }
示例#13
0
 public void GetFontDataRgch(int nTableId, out int _cbTableSz, ArrayPtr _rgch, int cchMax)
 {
     throw new System.NotImplementedException();
 }
示例#14
0
 protected abstract int TransposeMulti(ArrayPtr <TSampleType> dst, ArrayPtr <TSampleType> src, ref int srcSamples);
示例#15
0
 /// <summary>
 /// Fill in the given array with the encodings this database finds interesting, up
 /// to the given max, and return the number obtainedeg, vernacular plus analysis
 /// encodings. (Currently this is used by the Styles dialog to flesh out the fonts tab.)
 /// ENHANCE JohnT: Replace with a method or methods asking for specifc kinds of encodings?
 /// Return a list of the encodings that are of interest within the database.
 /// If cwsMax is zero, return the actual number (but no encodings).
 /// If there is not enough room, return E_INVALIDARG.
 ///</summary>
 /// <param name='cwsMax'> </param>
 /// <param name='_ws'> </param>
 /// <returns></returns>
 public int get_WritingSystemsOfInterest(int cwsMax, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ArrayPtrMarshaler), SizeParamIndex = 0)] ArrayPtr /*int[]*/ _ws)
 {
     return(m_baseSda.get_WritingSystemsOfInterest(cwsMax, _ws));
 }
示例#16
0
 protected override int TransposeMulti(ArrayPtr <float> dst, ArrayPtr <float> src, ref int srcSamples)
 {
     throw new NotImplementedException();
 }
        internal static int ComVecPropFromManagedVecProp(int[] hvos, int hvo, int tag, ArrayPtr rghvo, int chvoMax)
        {
            if (hvos.Length > chvoMax)
            {
                throw new ArgumentException("The count is greater than the parameter 'chvo'.");
            }

            MarshalEx.ArrayToNative(rghvo, chvoMax, hvos);
            return(hvos.Length);
        }
示例#18
0
 private unsafe void DecSetupMi()
 {
     Mi            = Mip.Slice(MiStride + 1);
     MiGridVisible = MiGridBase.Slice(MiStride + 1);
     MemoryUtil.Fill(MiGridBase.ToPointer(), Ptr <ModeInfo> .Null, MiStride * (MiRows + 1));
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Setups the font features.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void SetupFontFeatures()
        {
            CheckDisposed();

#if __MonoCS__
            // TODO-Linux: Neither Graphite or UniscribeEngine Avaliable
            m_featureEngine = null;
            return;
#else
            if (m_fontName == null || m_fontName == "")
            {
                Enabled          = false;
                m_isGraphiteFont = false;
                return;
            }
            IRenderEngine renderer;
            if (FontHasGraphiteTables(m_fontName, false, false))
            {
                renderer         = FwGrEngineClass.Create();
                m_isGraphiteFont = true;
            }
            else
            {
                renderer         = UniscribeEngineClass.Create();
                m_isGraphiteFont = false;
            }
            renderer.WritingSystemFactory = m_wsf;
            using (HoldDummyGraphics hdg = new HoldDummyGraphics(m_fontName, false, false, this))
            {
                renderer.InitRenderer(hdg.m_vwGraphics, m_fontFeatures);
                m_featureEngine = renderer as IRenderingFeatures;
                if (m_featureEngine == null)
                {
                    Enabled = false;
                    return;
                }
                int cfid;
                m_featureEngine.GetFeatureIDs(0, null, out cfid);
                if (cfid == 0)
                {
                    Enabled = false;
                    return;
                }
                if (cfid == 1)
                {
                    // What if it's the dummy built-in graphite feature that we ignore?
                    // Get the list of features (only 1).
                    using (ArrayPtr idsM = MarshalEx.ArrayToNative <int>(cfid))
                    {
                        m_featureEngine.GetFeatureIDs(cfid, idsM, out cfid);
                        int [] ids = MarshalEx.NativeToArray <int>(idsM, cfid);
                        if (ids[0] == kGrLangFeature)
                        {
                            Enabled = false;
                            return;
                        }
                    }
                }
                Enabled = true;
            }
#endif
        }
 /// <summary>
 /// Gets the list of class identification numbers (in no particular order). If the array
 /// provided is too small, only an arbitrary subset of cclid values is returned. If the
 /// array provided is too large, the excess entries are set to zero.
 ///</summary>
 /// <param name='cclid'>The size of the output array. </param>
 /// <param name='rgclid'>An integer array for returning the class identification numbers. </param>
 public void GetClassIds(int cclid, ArrayPtr rgclid)
 {
     throw new NotSupportedException();
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Raises the click event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        /// ------------------------------------------------------------------------------------
        protected override void OnClick(EventArgs e)
        {
            var menu = components.ContextMenu("ContextMenu");
            int cfid;

            m_featureEngine.GetFeatureIDs(0, null, out cfid);

            // Get the list of features.
            using (ArrayPtr idsM = MarshalEx.ArrayToNative <int>(cfid))
            {
                m_featureEngine.GetFeatureIDs(cfid, idsM, out cfid);
                m_ids = MarshalEx.NativeToArray <int>(idsM, cfid);
            }
            m_values = ParseFeatureString(m_ids, m_fontFeatures);
            Debug.Assert(m_ids.Length == m_values.Length);

            for (int ifeat = 0; ifeat < m_ids.Length; ++ifeat)
            {
                int id = m_ids[ifeat];
                if (id == kGrLangFeature)
                {
                    continue;                     // Don't show Graphite built-in 'lang' feature.
                }
                string label;
                m_featureEngine.GetFeatureLabel(id, kUiCodePage, out label);
                if (label.Length == 0)
                {
                    //Create backup default string, ie, "Feature #1".
                    label = string.Format(FwCoreDlgControls.kstidFeature, id);
                }
                int    cValueIds;
                int    nDefault;
                int [] valueIds = new int[0];
                using (ArrayPtr valueIdsM = MarshalEx.ArrayToNative <int>(kMaxValPerFeat))
                {
                    m_featureEngine.GetFeatureValues(id, kMaxValPerFeat, valueIdsM,
                                                     out cValueIds, out nDefault);
                    valueIds = MarshalEx.NativeToArray <int>(valueIdsM, cValueIds);
                }
                // If we know a value for this feature, use it. Otherwise init to default.
                int featureValue = nDefault;
                if (m_values[ifeat] != Int32.MaxValue)
                {
                    featureValue = m_values[ifeat];
                }

                // Decide whether to just use a check mark, or have a submenu. Default is sub.
                bool fBinary = false;
                if (cValueIds == 2 &&
                    (valueIds[0] == 0 || valueIds[1] == 0) &&
                    valueIds[0] + valueIds[1] == 1)
                {
                    // Minimum requirement is that there are two states and the values have
                    // ids of 0 and 1. We further require that the actual values belong to a
                    // natural boolean set.
                    string valueLabelT;                     // Label corresponding to 'true' etc, the checked value
                    m_featureEngine.GetFeatureValueLabel(id, 1, kUiCodePage, out valueLabelT);
                    string valueLabelF;                     // Label corresponding to 'false' etc, the unchecked val.
                    m_featureEngine.GetFeatureValueLabel(id, 0, kUiCodePage, out valueLabelF);

                    // Enhance: these should be based on a resource, or something that depends
                    // on the code page, if the code page is ever not constant.
                    switch (valueLabelT.ToLowerInvariant())
                    {
                    case "true":
                    case "yes":
                    case "on":
                    case "":
                    {
                        switch (valueLabelF.ToLowerInvariant())
                        {
                        case "false":
                        case "no":
                        case "off":
                        case "":
                            fBinary = true;
                            break;
                        }
                    }
                    break;
                    }
                }
                if (fBinary)
                {
                    FontFeatureMenuItem item = new FontFeatureMenuItem(label, ifeat, this);
                    item.Checked = featureValue == 1;
                    menu.MenuItems.Add(item);
                }
                else if (cValueIds > 0)
                {
                    FontFeatureMenuItem menuSub = new FontFeatureMenuItem(label, ifeat, this);
                    for (int ival = 0; ival < valueIds.Length; ++ival)
                    {
                        string valueLabel;
                        m_featureEngine.GetFeatureValueLabel(id, valueIds[ival],
                                                             kUiCodePage, out valueLabel);
                        if (valueLabel.Length == 0)
                        {
                            // Create backup default string.
                            valueLabel = string.Format(FwCoreDlgControls.kstidFeatureValue,
                                                       valueIds[ival]);
                        }
                        FontFeatureMenuItem itemSub =
                            new FontFeatureMenuItem(valueLabel, valueIds[ival], this);
                        itemSub.Checked = valueIds[ival] == featureValue;
                        menuSub.MenuItems.Add(itemSub);
                    }
                    menu.MenuItems.Add(menuSub);
                }
                //				if (fBinary)
                //				{
                //					...
                //					Assert(vnMenuMap.Size() == cItems);
                //					vnMenuMap.Push((ifeat << 16) | 0x0000FFFF);
                //					cItems++;
                //				}
                //				else if (cn > 0)
                //				{
                //					Assert(cn < 0x0000FFFF);
                //					HMENU hmenuSub = ::CreatePopupMenu();
                //					::AppendMenu(hmenu, MF_POPUP, (UINT_PTR)hmenuSub, strFeat.Chars());
                //					for (int in = 0; in < cn; in++)
                //					{
                //
                //						Assert(vnMenuMap.Size() == cItems);
                //						vnMenuMap.Push((ifeat << 16) | in);
                //						cItems++;
                //					}
                //				}
                //				else
                //				}
            }
            menu.Show(this, new Point(0, Height));
        }
 /// <summary>
 /// Gets all subclasses of the given class, including itself (which is always the first
 /// result in the list, so it can easily be skipped if desired). The list is therefore
 /// a complete list of the classes which are valid to store in a property whose
 /// signature is the class identified by luClid.
 ///</summary>
 /// <param name='luClid'> </param>
 /// <param name='cluMax'> </param>
 /// <param name='cluOut'> </param>
 /// <param name='rgluSubclasses'> </param>
 public void GetAllSubclasses(int luClid, int cluMax, out int cluOut, ArrayPtr rgluSubclasses)
 {
     throw new NotSupportedException();
 }
示例#23
0
 public void GetHardAndSoftCharProps(int cttpMax, ArrayPtr _rgpttpSel, ArrayPtr _rgpvpsSoft, out int _cttp)
 {
     throw new NotImplementedException();
 }
 protected abstract void OverlapMono(ArrayPtr <TSampleType> pOutput, ArrayPtr <TSampleType> pInput);
示例#25
0
 public void GetParaProps(int cttpMax, ArrayPtr _rgpvps, out int _cttp)
 {
     throw new NotImplementedException();
 }
 private void ClearMidBuffer()
 {
     ArrayPtr <TSampleType> .Fill(_midBuffer, default(TSampleType), 2 *_overlapLength);
 }
示例#27
0
 public void GetHardAndSoftParaProps(int cttpMax, ITsTextProps[] _rgpttpPara, ArrayPtr _rgpttpHard, ArrayPtr _rgpvpsSoft, out int _cttp)
 {
     throw new NotImplementedException();
 }
示例#28
0
        public void GetCharPlacement(int ichBase, IVwGraphics vg, int ichMin, int ichLim, Rect rcSrc, Rect rcDst,
                                     bool fSkipSpace, int cxdMax, out int cxd,
                                     [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ArrayPtrMarshaler),
                                                SizeParamIndex = 1)] ArrayPtr /*int[]*/ rgxdLefts,
                                     [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ArrayPtrMarshaler),
                                                SizeParamIndex = 1)] ArrayPtr /*int[]*/ rgxdRights,
                                     [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ArrayPtrMarshaler),
                                                SizeParamIndex = 1)] ArrayPtr /*int[]*/ rgydUnderTops)
        {
            if (cxdMax == 0)
            {
                // don't count this call; it's a preliminary query to get the length.
                if (NextCharPlacementResults.Count == 0)
                {
                    cxd = 1;
                }
                else
                {
                    cxd = NextCharPlacementResults[0].Lefts.Length;
                }
                return;
            }
            PrevCharPlacementArgs.Add(new CharPlacementArgs()
            {
                IchBase   = ichBase,
                Vg        = vg,
                IchMin    = ichMin,
                IchLim    = ichLim,
                RcSrc     = rcSrc,
                RcDst     = rcDst,
                SkipSpace = fSkipSpace,
                CxdMax    = cxdMax
            });
            var lefts  = new int[1];
            var rights = new int[1];
            var tops   = new int[1];

            if (NextCharPlacementResults.Count == 0)
            {
                // This is a plausible algorithm which is not currently used and hasn't been tried.
                cxd = 1;
                if (cxdMax < 1)
                {
                    return;
                }

                int cchMin = ichMin - ichBase;
                if (cchMin <= 0 || cchMin >= Length)
                {
                    cxd = 0;
                    return;
                }
                int cch = ichLim - ichMin;
                if (ichLim > ichBase + Length)
                {
                    cch = Length - (ichMin - ichBase);
                }

                int left  = FakeRenderEngine.SimulatedWidth(Text.Substring(cchMin));
                int right = left + FakeRenderEngine.SimulatedWidth(Text.Substring(cchMin, cch));
                lefts[0]  = MapXTo(left, rcSrc, rcDst);
                rights[0] = MapXTo(right, rcSrc, rcDst);
                tops[0]   = MapYTo(Ascent + 1, rcSrc, rcDst);
            }
            else
            {
                var nextResult = NextCharPlacementResults[0];
                NextCharPlacementResults.RemoveAt(0);
                cxd = nextResult.Lefts.Length;
                if (cxdMax == 0)
                {
                    return;
                }
                lefts  = nextResult.Lefts;
                rights = nextResult.Rights;
                tops   = nextResult.Tops;
            }

            MarshalEx.ArrayToNative(rgxdLefts, cxdMax, lefts);
            MarshalEx.ArrayToNative(rgxdRights, cxdMax, rights);
            MarshalEx.ArrayToNative(rgydUnderTops, cxdMax, tops);
        }
示例#29
0
 public void AllTextSelInfo(out int _ihvoRoot, int cvlsi, ArrayPtr _rgvsli, out int _tagTextProp, out int _cpropPrevious, out int _ichAnchor, out int _ichEnd, out int _ws, out bool _fAssocPrev, out int _ihvoEnd, out ITsTextProps _pttp)
 {
     throw new NotImplementedException();
 }
示例#30
0
 public void AllSelEndInfo(bool fEndPoint, out int _ihvoRoot, int cvlsi, ArrayPtr _rgvsli, out int _tagTextProp, out int _cpropPrevious, out int _ich, out int _ws, out bool _fAssocPrev, out ITsTextProps _pttp)
 {
     throw new NotImplementedException();
 }
示例#31
0
 /// <summary> Get the full contents of the specified sequence in one go.</summary>
 /// <param name='hvo'> </param>
 /// <param name='tag'> </param>
 /// <param name='chvoMax'> </param>
 /// <param name='_chvo'> </param>
 /// <param name='_rghvo'> </param>
 public virtual void VecProp(int hvo, int tag, int chvoMax, out int _chvo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ArrayPtrMarshaler), SizeParamIndex = 2)] ArrayPtr /*long[]*/ _rghvo)
 {
     m_baseSda.VecProp(hvo, tag, chvoMax, out _chvo, _rghvo);
 }