Beispiel #1
0
        public CoverList(string filename)
        {
            //loading xml file and selecting right nodes
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(filename);
            XmlNodeList album = xDoc.GetElementsByTagName("album");

            Count = album.Count;
            item = new Cover[Count];

            //insert all albums from xml file to linkedlist
            for(int i=0;i<Count;i++)
            {
                item[i] = new Cover(album[i]);

                //In the future some sorting methods should be added
                //somwhere around, most probably here during loading
                //just to have xml file organized later on.

            }
        }
 /// <summary>
 /// Given selected cover index returns first available TrackId form BanseeDB
 /// </summary>
 public static int GetTrackId(Cover c)
 {
     object result = Banshee.Base.Globals.Library.Db.QuerySingle("SELECT TrackId FROM Tracks WHERE Artist LIKE \""+c.artist+"\" AND AlbumTitle LIKE \""+c.albumtitle+"\" LIMIT 1");
     return result == null ? -1 : (int)result;
 }
        /// <summary>
        /// Draw cover in GLScene
        /// </summary>
        /// <param name="cover"></param>
        /// <param name="name">Cover int name (used with GL_SELECT)</param>
        void DrawCover(Cover cover,int name)
        {
            // Check if cover should actually be drawn
            if(Math.Abs(cover.x)<3.0f)
            {

                gl.glPushMatrix();

                gl.glTranslatef(cover.x,cover.y,cover.z);
                gl.glRotatef(cover.angle,0.0f,1.0f,0.0f);

                float br = 1;
                if(Math.Abs(cover.x)>2.0f)
                {
                    br = 1.0f - 1.0f*(Math.Abs(cover.x)-2.0f);
                }
                gl.glColor3f(br, br, br);							// Manipulate Brightness At The Edges

                gl.glPushName(name);
                gl.glBindTexture(gl.GL_TEXTURE_2D, cover.texture);
                gl.glBegin(gl.GL_QUADS);

                    gl.glNormal3f( 0.0f, 0.0f, 1.0f);
                    gl.glTexCoord2f(-1, 1); gl.glVertex3f( -1.0f, -1.0f, 0.0f);
                    gl.glTexCoord2f(0, 1); gl.glVertex3f( 1.0f, -1.0f, 0.0f);
                    gl.glTexCoord2f(0, 0); gl.glVertex3f( 1.0f, 1.0f, 0.0f);
                    gl.glTexCoord2f(-1, 0); gl.glVertex3f( -1.0f, 1.0f, 0.0f);

                gl.glEnd();
                gl.glPopName();

                gl.glPopMatrix();

            }
        }