Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv14404

Modified Files:
      Tag: Audacity_UmixIt
        Lyrics.cpp Lyrics.h 
Log Message:
project branding: logo & url

Index: Lyrics.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/Lyrics.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Lyrics.h    16 Nov 2006 01:06:32 -0000      1.1.2.1
+++ Lyrics.h    27 Nov 2006 06:22:52 -0000      1.1.2.2
@@ -5,6 +5,7 @@
   Lyrics.h
 
   Dominic Mazzoni
+  Vaughan Johnson
   
 **********************************************************************/
 
@@ -15,12 +16,11 @@
 
 #include <wx/dynarray.h>
 #include <wx/panel.h>
+#include <wx/html/htmlwin.h>
 
 #define LYRICS_DEFAULT_WIDTH 440
 #define LYRICS_DEFAULT_HEIGHT 330
 
-class wxHtmlWindow;
-
 struct Syllable {
    double t;
    wxString text;
@@ -34,6 +34,13 @@
 
 WX_DECLARE_OBJARRAY(Syllable, SyllableArray);
 
+class LinkingHtmlWindow : public wxHtmlWindow 
+{
+ public:
+   LinkingHtmlWindow(wxWindow *parent) : wxHtmlWindow(parent) {};
+   virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
+};
+
 class Lyrics : public wxPanel
 {
    DECLARE_DYNAMIC_CLASS(Lyrics)
@@ -82,7 +89,7 @@
 
    int            mTextHeight;
 
-   wxHtmlWindow   *mHtml;
+   LinkingHtmlWindow   *mHtml;
 
    bool           mMeasurementsDone;
 

Index: Lyrics.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Attic/Lyrics.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Lyrics.cpp  16 Nov 2006 01:06:32 -0000      1.1.2.1
+++ Lyrics.cpp  27 Nov 2006 06:22:49 -0000      1.1.2.2
@@ -13,14 +13,23 @@
 
 #include <wx/defs.h>
 #include <wx/dcmemory.h>
-#include <wx/html/htmlwin.h>
+#include <wx/mimetype.h>
 
 #include "Lyrics.h"
+#include "Internat.h"
 #include "Project.h" // for GetActiveProject in OnKeyEvent
 
 #include <wx/arrimpl.cpp>
 WX_DEFINE_OBJARRAY(SyllableArray);
 
+void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) 
+{
+   wxFileType* pFileType = 
wxTheMimeTypesManager->GetFileTypeFromExtension(wxT(".htm"));
+   if (pFileType == NULL) return;
+   wxString openCmd = pFileType->GetOpenCommand(link.GetHref());
+   ::wxExecute(openCmd);
+}
+
 BEGIN_EVENT_TABLE(Lyrics, wxPanel)
    EVT_CHAR(Lyrics::OnKeyEvent)
    EVT_PAINT(Lyrics::OnPaint)
@@ -35,8 +44,7 @@
    wxPanel(parent, id, pos, size),
    mWidth(size.x), mHeight(size.y)
 {
-   mHtml = new wxHtmlWindow(this, -1,
-                            wxDefaultPosition, wxDefaultSize);
+   mHtml = new LinkingHtmlWindow(this);
 
    Clear();
    Finish(0.0);
@@ -239,7 +247,7 @@
    // The y position is a simple cosine curve; the max height is a
    // function of the time.
    double height = t2 - t1 > 4.0? 1.0: sqrt((t2-t1)/4.0);
-   #ifdef _WIN32 
+   #ifdef __WXMSW__ 
       #define M_PI 3.1415926535897932385 
    #endif
    *outY = height * sin(M_PI * t);
@@ -261,6 +269,20 @@
    if (!bForce && (i < 0 || i >= mSyllables.GetCount()))
       htmlText = mText;
    else {
+      // branding
+      AudacityProject* pProject = GetActiveProject();
+      wxString strLogoFilename = "UmixIt.jpg"; //vvv UmixIt: Get name from 
project file.
+      wxString strLogoPathname = 
+         GetActiveProject()->GetDirManager()->GetProjectDataDir() + "\\" + 
strLogoFilename;
+      wxString strURL = "http://www.umixit.com";; //vvv UmixIt: Get url from 
project file.
+      wxString strBranding = "";
+      if (::wxFileExists(FILENAME(strLogoPathname))) 
+         strBranding = 
+            "<center><a href=\"" + FILENAME(strURL) + 
+               "\" target=\"_blank\"><img src=\"" + 
+                  FILENAME(strLogoPathname) + "\" alt=\"" + strLogoFilename + 
"\"><br>" + 
+               strURL + "</a><hr></center>\n";
+
       // Size the whole htmlText.
       // Map nFontRelativeSize into -2 to +4, in increments of 
DEFAULT_FONT_POINTSIZE/2
       int nFontRelativeSize = (int)((float)(2 * gKaraokeFontPointSize) / 
(float)DEFAULT_FONT_POINTSIZE);
@@ -284,21 +306,27 @@
       if (nFontRelativeSize != 0) {
          strFontRelativeSizeStart = 
             wxString::Format("<font size=\"%s%d\">", (nFontRelativeSize > 0) ? 
"+" : "", nFontRelativeSize);
-         strFontRelativeSizeEnd = "</font>";
+         strFontRelativeSizeEnd = "</font>\n";
       }
 
-      htmlText = 
-         strFontRelativeSizeStart + 
+      wxString strLyrics = 
          mText.Left(mSyllables[i].char0) +
          "<font color=\"#ee0066\">" + 
          mText.Mid(mSyllables[i].char0,
                    mSyllables[i].char1-mSyllables[i].char0) +
          "</font>" +
-         mText.Mid(mSyllables[i].char1) + 
-         strFontRelativeSizeEnd;
+         mText.Mid(mSyllables[i].char1);
+      strLyrics.Replace("_", "<br>"); // Convert '_' to newline.
+
+      htmlText = 
+         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 
Transitional//EN\">\n<html>\n<body>\n" + 
+         strBranding + 
+         strFontRelativeSizeStart + 
+         strLyrics + 
+         strFontRelativeSizeEnd + 
+         "</body>\n</html>";
    }
 
-   htmlText.Replace("_", "<br>"); // Convert '_' to newline.
    mHtml->SetPage(htmlText);
    mHtml->Refresh(false);
 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to