Ejemplo n.º 1
0
 public override void Cacher(IntPtr handle)
 {
     Escalier.Cacher(handle);
     Barre.Cacher(handle);
     barre1.Cacher(handle);
     barre2.Cacher(handle);
     barre3.Cacher(handle);
     barre4.Cacher(handle);
     Mur.Cacher(handle);
     vide.Cacher(handle);
     vider.Cacher(handle);
 }
Ejemplo n.º 2
0
 public override void Afficher(Graphics gr)
 {
     Escalier.Afficher(gr);
     barre1.Afficher(gr);
     barre2.Afficher(gr);
     barre3.Afficher(gr);
     barre4.Afficher(gr);
     Barre.Afficher(gr);
     Mur.Afficher(gr);
     vide.Afficher(gr);
     vider.Afficher(gr);
 }
Ejemplo n.º 3
0
            public void AjouterElement(Element element)
            {
                var DicMat = new Dictionary <String, List <Barre> >();

                if (_dic.ContainsKey(element.Materiau))
                {
                    DicMat = _dic[element.Materiau];
                }
                else
                {
                    _dic.Add(element.Materiau, DicMat);
                }

                var ListBarre = new List <Barre>();

                if (DicMat.ContainsKey(element.Profil))
                {
                    ListBarre = DicMat[element.Profil];
                }
                else
                {
                    DicMat.Add(element.Profil, ListBarre);
                }

                Double lgMax = _ListeLgProfil.LgMax(element.Materiau, element.Profil);

                if (ListBarre.Count == 0)
                {
                    NbBarre++;
                    ListBarre.Add(new Barre(lgMax));
                }

                // On essaye d'ajouter la barre
                // si c'est ok, on sort de la routine
                foreach (var barre in ListBarre)
                {
                    if (barre.Ajouter(element))
                    {
                        return;
                    }
                }

                // sinon on ajoute une nouvelle barre
                {
                    var barre = new Barre(lgMax);
                    barre.Ajouter(element);
                    NbBarre++;
                    ListBarre.Add(barre);
                }
            }
Ejemplo n.º 4
0
        private void ReadNewChord(Chord chord)
        {
            /*Read new-style (GP4) chord diagram.
             *
             * New-style chord diagram is read as follows:
             *
             * - Sharp: :ref:`bool`. If true, display all semitones as sharps,
             * otherwise display as flats.
             *
             * - Blank space, 3 :ref:`Bytes <byte>`.
             *
             * - Root: :ref:`int`. Values are:
             *
             * -1 for customized chords
             *  0: C
             *  1: C#
             * ...
             *
             * - Type: :ref:`int`. Determines the chord type as followed. See
             * :class:`guitarpro.models.ChordType` for mapping.
             *
             * - Chord extension: :ref:`int`. See
             * :class:`guitarpro.models.ChordExtension` for mapping.
             *
             * - Bass note: :ref:`int`. Lowest note of chord as in *C/Am*.
             *
             * - Tonality: :ref:`int`. See
             * :class:`guitarpro.models.ChordAlteration` for mapping.
             *
             * - Add: :ref:`bool`. Determines if an "add" (added note) is
             * present in the chord.
             *
             * - Name: :ref:`byte-size-string`. Max length is 22.
             *
             * - Fifth alteration: :ref:`int`. Maps to
             * :class:`guitarpro.models.ChordAlteration`.
             *
             * - Ninth alteration: :ref:`int`. Maps to
             * :class:`guitarpro.models.ChordAlteration`.
             *
             * - Eleventh alteration: :ref:`int`. Maps to
             * :class:`guitarpro.models.ChordAlteration`.
             *
             * - List of frets: 6 :ref:`Ints <int>`. Fret values are saved as
             * in default format.
             *
             * - Count of barres: :ref:`int`. Maximum count is 2.
             *
             * - Barre frets: 2 :ref:`Ints <int>`.
             *
             * - Barre start strings: 2 :ref:`Ints <int>`.
             *
             * - Barre end string: 2 :ref:`Ints <int>`.
             *
             * - Omissions: 7 :ref:`Bools <bool>`. If the value is true then
             * note is played in chord.
             *
             * - Blank space, 1 :ref:`byte`.*/

            chord.Sharp = GpBase.ReadBool()[0];
            var intonation = chord.Sharp ? "sharp" : "flat";

            GpBase.Skip(3);
            chord.Root      = new PitchClass(GpBase.ReadByte()[0], -1, "", intonation);
            chord.Type      = (ChordTypes)GpBase.ReadByte()[0];
            chord.Extension = (ChordExtensions)GpBase.ReadByte()[0];
            chord.Bass      = new PitchClass(GpBase.ReadInt()[0], -1, "", intonation);
            chord.Tonality  = (ChordAlterations)GpBase.ReadInt()[0];
            chord.Add       = GpBase.ReadBool()[0];
            chord.Name      = GpBase.ReadByteSizeString(22);
            chord.Fifth     = (ChordAlterations)GpBase.ReadByte()[0];
            chord.Ninth     = (ChordAlterations)GpBase.ReadByte()[0];
            chord.Eleventh  = (ChordAlterations)GpBase.ReadByte()[0];
            chord.FirstFret = GpBase.ReadInt()[0];
            for (int i = 0; i < 7; i++)
            {
                var fret = GpBase.ReadInt()[0];
                if (i < chord.Strings.Length)
                {
                    chord.Strings[i] = fret;
                }
            }
            chord.Barres.Clear();
            var barresCount = GpBase.ReadByte()[0];
            var barreFrets  = GpBase.ReadByte(5);
            var barreStarts = GpBase.ReadByte(5);
            var barreEnds   = GpBase.ReadByte(5);

            for (int x = 0; x < Math.Min(5, (int)barresCount); x++)
            {
                var barre = new Barre(barreFrets[x], barreStarts[x], barreEnds[x]);
                chord.Barres.Add(barre);
            }
            chord.Omissions = GpBase.ReadBool(7);
            GpBase.Skip(1);
            List <Fingerings> f = new List <Fingerings>();

            for (int x = 0; x < 7; x++)
            {
                f.Add((Fingerings)GpBase.ReadSignedByte()[0]);
            }
            chord.Fingerings = f;
            chord.Show       = GpBase.ReadBool()[0];
        }
Ejemplo n.º 5
0
        protected override void Command()
        {
            try
            {
                CreerDossierExport(MdlBase);

                var dic = MdlBase.ListerComposants(false);

                int MdlPct = 0;
                foreach (var mdl in dic.Keys)
                {
                    WindowLog.SautDeLigne();
                    WindowLog.EcrireF("[{1}/{2}] {0}", mdl.eNomSansExt(), ++MdlPct, dic.Count);

                    mdl.eActiver(swRebuildOnActivation_e.swRebuildActiveDoc);
                    var cfgActive = mdl.eNomConfigActive();

                    var ListeNomConfigs = dic[mdl];
                    int CfgPct          = 0;
                    foreach (var NomConfigPliee in ListeNomConfigs.Keys)
                    {
                        WindowLog.SautDeLigne();
                        WindowLog.EcrireF("  [{1}/{2}] Config : \"{0}\"", NomConfigPliee, ++CfgPct, ListeNomConfigs.Count);
                        mdl.ShowConfiguration2(NomConfigPliee);
                        mdl.EditRebuild3();
                        mdl.eEffacerSelection();

                        var     NbConfig = dic[mdl][NomConfigPliee];
                        PartDoc Piece    = mdl.ePartDoc();

                        var ListeDossier = Piece.eListeDesDossiersDePiecesSoudees(
                            dossier =>
                        {
                            if (dossier.eEstExclu() || dossier.IsNull() || (dossier.GetBodyCount() == 0))
                            {
                                return(false);
                            }

                            String Profil   = dossier.eProp(CONSTANTES.PROFIL_NOM);
                            String Longueur = dossier.eProp(CONSTANTES.PROFIL_LONGUEUR);

                            if (String.IsNullOrWhiteSpace(Profil) || String.IsNullOrWhiteSpace(Longueur))
                            {
                                return(false);
                            }

                            foreach (var Barre in dossier.eListeDesCorps())
                            {
                                Barre.Select2(true, null);
                            }

                            return(true);
                        }
                            );

                        if (ListeDossier.Count == 0)
                        {
                            continue;
                        }

                        var NomFichier = String.Format("{0}-{1} (x{2}) - {3}", mdl.eNomSansExt(), NomConfigPliee, NbConfig, Indice);

                        var mdlExport = ExportSelection(Piece, NomFichier, eTypeFichierExport.Piece);

                        if (mdlExport.IsNull())
                        {
                            WindowLog.EcrireF("Erreur : {0}", NomFichier);
                            continue;
                        }

                        WindowLog.EcrireF("     {0}", NomFichier);

                        mdlExport.ViewZoomtofit2();
                        mdlExport.ShowNamedView2("*Isométrique", 7);
                        int lErrors = 0, lWarnings = 0;
                        mdlExport.Save3((int)swSaveAsOptions_e.swSaveAsOptions_Silent, ref lErrors, ref lWarnings);

                        mdlExport.eFermer();

                        mdl.eFermerSiDifferent(MdlBase);
                    }
                }
            }
            catch (Exception e)
            {
                this.LogErreur(new Object[] { e });
            }
        }