Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26832/src/gui

Modified Files:
        wxllist.cpp 
Log Message:
removed 'optimization' of rev 1.166 which broke text colouring

Index: wxllist.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxllist.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -b -u -2 -r1.169 -r1.170
--- wxllist.cpp 8 Apr 2006 02:22:29 -0000       1.169
+++ wxllist.cpp 8 Apr 2006 17:00:11 -0000       1.170
@@ -540,6 +540,6 @@
 void wxLayoutStyleInfo::InitColours(wxColour *fg, wxColour *bg)
 {
-   m_fg_valid = fg != 0;
-   m_bg_valid = bg != 0;
+   m_fg_valid = fg != NULL;
+   m_bg_valid = bg != NULL;
    m_fg = m_fg_valid ? *fg : *wxBLACK;
    m_bg = m_bg_valid ? *bg : *wxWHITE;
@@ -608,8 +608,6 @@
       m_StyleInfo->weight,
       m_StyleInfo->underline,
-      m_StyleInfo->m_fg_valid ?
-      &m_StyleInfo->m_fg : NULL,
-      m_StyleInfo->m_bg_valid ?
-      &m_StyleInfo->m_bg : NULL);
+      m_StyleInfo->m_fg_valid ? &m_StyleInfo->m_fg : NULL,
+      m_StyleInfo->m_bg_valid ? &m_StyleInfo->m_bg : NULL);
    obj->SetUserData(m_UserData);
    return obj;
@@ -960,18 +958,7 @@
       if( i == m_ObjectList.tail()) // last object?
       {
-         // optimization: it's useless to have 2 command objects in a row as
-         // the latter overrides the former anyhow, so drop the previous one
-         if ( obj->GetType() == WXLO_TYPE_CMD )
-         {
-            if ( m_ObjectList.back()->GetType() == WXLO_TYPE_CMD )
-            {
-               delete m_ObjectList.pop_back();
-
-               // effective length is 0 as we added 1 and removed 1 object of
-               // the same type
-               *pLen = 0;
-            }
-         }
-
+         // TODO: possible optimization is to combine this object with the
+         //       previous one if they are both of type WXLO_TYPE_CMD as it
+         //       would save on calls to ApplyStyle() during Layout()
          m_ObjectList.push_back(obj);
       }
@@ -1885,6 +1872,8 @@
    if(weight != -1)    m_CurrentStyleInfo.weight = weight;
    if(underline != -1) m_CurrentStyleInfo.underline = underline != 0;
-   m_CurrentStyleInfo.m_fg = fg ? *fg : m_DefaultStyleInfo.m_fg;
-   m_CurrentStyleInfo.m_bg = bg ? *bg : m_DefaultStyleInfo.m_bg;
+   if ( fg )
+      m_CurrentStyleInfo.m_fg = *fg;
+   if ( bg )
+      m_CurrentStyleInfo.m_bg = *bg;
    if(enc != wxFONTENCODING_DEFAULT) m_CurrentStyleInfo.enc = enc;
    Insert(
@@ -1905,8 +1894,12 @@
 
 {
-   wxColour cfg = wxTheColourDatabase->Find( (fg) ? fg : wxT("BLACK") );
-   wxColour cbg = wxTheColourDatabase->Find( (bg) ? bg : wxT("WHITE") );
+   wxColour cfg, cbg;
+   if ( fg )
+      cfg = wxTheColourDatabase->Find(fg);
+   if ( bg )
+      cbg = wxTheColourDatabase->Find(bg);
 
-   SetFont(family, size, style, weight, underline, &cfg, &cbg, encoding);
+   SetFont(family, size, style, weight, underline,
+           fg ? &cfg : NULL, bg ? &cbg : NULL, encoding);
 }
 
@@ -3222,24 +3215,12 @@
    {
       m_CurrentStyleInfo.m_fg = si.m_fg;
-      m_CurrentStyleInfo.m_fg_valid = true;
       dc.SetTextForeground(m_CurrentStyleInfo.m_fg);
    }
-   else if ( m_CurrentStyleInfo.m_fg != m_DefaultStyleInfo.m_fg )
-   {
-      m_CurrentStyleInfo.m_fg = m_DefaultStyleInfo.m_fg;
-      dc.SetTextForeground(m_DefaultStyleInfo.m_fg);
-   }
 
    if ( si.m_bg_valid && m_CurrentStyleInfo.m_bg != si.m_bg )
    {
       m_CurrentStyleInfo.m_bg = si.m_bg;
-      m_CurrentStyleInfo.m_bg_valid = true;
       dc.SetTextBackground(m_CurrentStyleInfo.m_bg);
    }
-   else if ( m_CurrentStyleInfo.m_bg != m_DefaultStyleInfo.m_bg )
-   {
-      m_CurrentStyleInfo.m_bg = m_DefaultStyleInfo.m_bg;
-      dc.SetTextBackground(m_DefaultStyleInfo.m_bg);
-   }
 }
 
@@ -3294,11 +3275,15 @@
       {
          m_profile = prof;
+#ifdef M_BASEDIR
          m_profile->IncRef();
          SetZoom(READ_CONFIG(m_profile, MP_PRINT_PREVIEWZOOM));
+#endif // M_BASEDIR
       }
    ~wxMVPreview()
       {
+#ifdef M_BASEDIR
          m_profile->writeEntry(MP_PRINT_PREVIEWZOOM, (long) GetZoom());
          m_profile->DecRef();
+#endif // M_BASEDIR
       }
 
@@ -3317,5 +3302,9 @@
 bool wxLayoutPrintout::Print(wxWindow *window, wxLayoutList *llist)
 {
+#ifdef M_BASEDIR
+   wxPrintDialogData pdd;
+#else
    wxPrintDialogData pdd(*mApplication->GetPrintData());
+#endif // M_BASEDIR
    wxPrinter printer(& pdd);
    wxLayoutPrintout printout(llist);



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to