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

Modified Files:
        TrackPanel.cpp LabelTrack.cpp 
Log Message:
Fixes a small drawing issue for non-wavetracks
Adds label track font size choice
Removes the 'auto create label when typing' method

Index: LabelTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/LabelTrack.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- LabelTrack.cpp      7 Jun 2007 05:15:41 -0000       1.83
+++ LabelTrack.cpp      29 Jul 2007 16:42:24 -0000      1.84
@@ -144,13 +144,14 @@
 {
    mFontHeight = -1;
    wxString facename = gPrefs->Read(wxT("/GUI/LabelFontFacename"), wxT(""));
+   int size = gPrefs->Read(wxT("/GUI/LabelFontSize"), 12);
    if (facename != wxT("")) {
-      msFont = wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+      msFont = wxFont(size, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
                       wxFONTWEIGHT_NORMAL, FALSE, facename,
                       wxFONTENCODING_SYSTEM);
    }
    else {
-      msFont = wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+      msFont = wxFont(size, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
                       wxFONTWEIGHT_NORMAL);
    }
 }
@@ -777,7 +778,7 @@
    int charLeading;
 
    // Calculate the width of the substring and add it to Xpos
-   dc.GetTextExtent(wxT("Test String"), NULL, &mFontHeight, &charDescent, 
&charLeading);
+   dc.GetTextExtent(wxT("(Test String)|[yp]"), NULL, &mFontHeight, 
&charDescent, &charLeading);
 
    // The cursor will have height charHeight.  We don't include the descender 
as 
    // part of the height because for phonetic fonts this leads to cursors 
which are
@@ -795,7 +796,7 @@
       return false;
    if (!mLabels[mSelIndex]->highlighted)
       return false;
-   if( mCurrentCursorPos == mInitialCursorPos ) 
+   if (mCurrentCursorPos == mInitialCursorPos)
       return false;
    return true;
 }
@@ -804,7 +805,7 @@
 ///  @return true if text is selected in text box, false otherwise
 bool LabelTrack::CutSelectedText() 
 {
-   if( !IsTextSelected() )
+   if (!IsTextSelected())
       return false;
 
    wxString left=wxT("");
@@ -1276,9 +1277,11 @@
       }
    }
 
+#if 0
    if (IsGoodLabelFirstCharacter(keyCode, charCode) && !event.CmdDown()) {
       return true;
    }
+#endif
 
    return false;
 }
@@ -1529,7 +1532,7 @@
       else
          event.Skip();
    }
-   else if( !IsGoodLabelFirstCharacter(keyCode, charCode))
+   else //if( !IsGoodLabelFirstCharacter(keyCode, charCode))
    {
       // Don't automatically start a label unless its one of the accepted 
       // characters.
@@ -1537,6 +1540,7 @@
       // as our first character.
       event.Skip();
    }
+#if 0
    else
    {
       // Create new label
@@ -1559,7 +1563,7 @@
       mSelIndex = pos;
       updated = true;
    }
-
+#endif
    // Make sure the caret is visible
    mDrawCursor = true;
 

Index: TrackPanel.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/TrackPanel.cpp,v
retrieving revision 1.365
retrieving revision 1.366
diff -u -d -r1.365 -r1.366
--- TrackPanel.cpp      5 Jul 2007 11:55:37 -0000       1.365
+++ TrackPanel.cpp      29 Jul 2007 16:42:24 -0000      1.366
@@ -103,12 +103,6 @@
 \brief Timer class dedicated to infomring the TrackPanel that it 
 is time to refresh some aspect of the screen.
 
-*//**************************************************************//**
-
-\class MyFontEnumerator
-\brief MyFontEnumerator, derived from wxFontEnumerator, creates 
-a list of fonts.
-
 *//*****************************************************************//**
 
 \page TrackPanelRefactor Track Panel Refactor
@@ -182,6 +176,8 @@
 #include <wx/textdlg.h>
 #include <wx/numdlg.h>
 #include <wx/choicdlg.h>
+#include <wx/spinctrl.h>
+#include <wx/listbox.h>
 #include <wx/textctrl.h>
 #include <wx/intl.h>
 #include <wx/image.h>
@@ -5571,17 +5567,19 @@
                                         const wxRect r, const int vrul,
                                         const int labelw)
 {
+   int h1 = r.y + t->GetHeight() - kTopInset;
+
    // Borders around track and label area
    dc->SetPen(*wxBLACK_PEN);
    dc->DrawLine(r.x, r.y, r.x + r.width - 1, r.y);      // top
    dc->DrawLine(r.x, r.y, r.x, r.y + r.height - 1);     // left
    dc->DrawLine(r.x, r.y + r.height - 2, r.x + r.width - 1, r.y + r.height - 
2);        // bottom
    dc->DrawLine(r.x + r.width - 2, r.y, r.x + r.width - 2, r.y + r.height - 
1); // right
-//   dc->DrawLine(vrul, r.y, vrul, r.y + r.height - 1); // between vrulr and 
track.
+   // LL:  This is needed for label, time, and midi tracks
+   dc->DrawLine(vrul, r.y, vrul, h1 - 2);                       // between 
vrulr and track.
    dc->DrawLine(labelw, r.y, labelw, r.y + r.height - 1);       // between 
vruler and TrackInfo
 
    if (t->GetLinked()) {
-      int h1 = r.y + t->GetHeight() - kTopInset;
       dc->DrawLine(vrul, h1 - 2, r.x + r.width - 1, h1 - 2);
       dc->DrawLine(vrul, h1 + kTopInset, r.x + r.width - 1,
                    h1 + kTopInset);
@@ -5993,42 +5991,60 @@
    RefreshTrack(lt, true);
 }
 
-class MyFontEnumerator : public wxFontEnumerator
-{
-  public:
-   wxArrayString facenames;
-   
-  protected:
-   virtual bool OnFacename(const wxString& facename)
-   {
-      facenames.Add(facename);
-      return true;
-   }
-};
-
 void TrackPanel::OnSetFont(wxCommandEvent &event)
 {
-   MyFontEnumerator fontEnumerator;
+   wxFontEnumerator fontEnumerator;
    
    fontEnumerator.EnumerateFacenames(wxFONTENCODING_SYSTEM, false);
-   int nFacenames = fontEnumerator.facenames.GetCount();
-   wxString *facenames = new wxString[nFacenames];
-   int i;
-   for (i = 0; i < nFacenames; i++)
-      facenames[i] = fontEnumerator.facenames[i];
-   
-   i = wxGetSingleChoiceIndex(_("Choose a font for Label Tracks"),
-                              _("Label Track Font"),
-                              nFacenames, facenames, this);
+   wxArrayString *facenames = fontEnumerator.GetFacenames();
 
-   delete [] facenames;
-   
-   if ( i == -1 )
-      return;
+   wxString facename = gPrefs->Read(wxT("/GUI/LabelFontFacename"), wxT(""));
+   long fontsize = gPrefs->Read(wxT("/GUI/LabelFontSize"), 12);
 
-   wxString facename = fontEnumerator.facenames[i];
+   wxDialog dlg(this, wxID_ANY, wxString(_("Label Track Font")));
+   ShuttleGui S(&dlg, eIsCreating);
+   wxListBox *lb;
+   wxSpinCtrl *sc;
 
-   gPrefs->Write(wxT("/GUI/LabelFontFacename"), facename);
+   S.StartVerticalLay(true);
+   {
+      S.StartMultiColumn(2, wxEXPAND);
+      {
+         S.SetStretchyRow(0);
+         S.SetStretchyCol(1);
+
+         S.AddPrompt(_("Face name"));
+         lb = new wxListBox(&dlg, wxID_ANY,
+                            wxDefaultPosition,
+                            wxDefaultSize,
+                            *facenames,
+                            wxLB_SINGLE);
+         lb->SetSelection(facenames->Index(facename));
+         S.AddWindow(lb, wxALIGN_LEFT | wxEXPAND | wxALL);
+
+         S.AddPrompt(_("Face size"));
+         sc = new wxSpinCtrl(&dlg, wxID_ANY,
+                             wxString::Format(wxT("%d"), fontsize),
+                             wxDefaultPosition,
+                             wxDefaultSize,
+                             wxSP_ARROW_KEYS,
+                             8, 48, fontsize);
+         S.AddWindow(sc, wxALIGN_LEFT | wxALL);
+      }
+      S.EndMultiColumn();
+      S.AddStandardButtons();
+   }
+   S.EndVerticalLay();
+
+   dlg.Layout();
+   dlg.Fit();
+   dlg.CenterOnParent();
+   if (dlg.ShowModal() == wxID_CANCEL) {
+      return;
+   }
+   
+   gPrefs->Write(wxT("/GUI/LabelFontFacename"), lb->GetStringSelection());
+   gPrefs->Write(wxT("/GUI/LabelFontSize"), sc->GetValue());
 
    LabelTrack::ResetFont();
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to