cleanup - reformatting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,31 +1,19 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mac/fontenum.cpp
|
// Name: src/mac/carbon/fontenum.cpp
|
||||||
// Purpose: wxFontEnumerator class for MacOS
|
// Purpose: wxFontEnumerator class for MacOS
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// declarations
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// headers
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_FONTMAP
|
#if wxUSE_FONTMAP
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma hdrstop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/font.h"
|
#include "wx/font.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -38,9 +26,6 @@
|
|||||||
|
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// private classes
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxFontEnumeratorHelper
|
class wxFontEnumeratorHelper
|
||||||
{
|
{
|
||||||
@@ -65,9 +50,10 @@ private:
|
|||||||
// if not empty, enum only the fonts with this facename
|
// if not empty, enum only the fonts with this facename
|
||||||
wxString m_facename;
|
wxString m_facename;
|
||||||
|
|
||||||
// if TRUE, enum only fixed fonts
|
// if true, enum only fixed fonts
|
||||||
bool m_fixedOnly;
|
bool m_fixedOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -80,68 +66,62 @@ wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum)
|
|||||||
{
|
{
|
||||||
m_fontEnum = fontEnum;
|
m_fontEnum = fontEnum;
|
||||||
m_charset = -1;
|
m_charset = -1;
|
||||||
m_fixedOnly = FALSE;
|
m_fixedOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
|
bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
|
||||||
{
|
{
|
||||||
wxNativeEncodingInfo info;
|
wxNativeEncodingInfo info;
|
||||||
if ( !wxGetNativeFontEncoding(encoding, &info) )
|
if ( !wxGetNativeFontEncoding( encoding, &info ) )
|
||||||
{
|
{
|
||||||
if ( !wxFontMapper::Get()->GetAltForEncoding(encoding, &info) )
|
if ( !wxFontMapper::Get()->GetAltForEncoding( encoding, &info ) )
|
||||||
{
|
|
||||||
// no such encodings at all
|
// no such encodings at all
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_charset = info.charset;
|
m_charset = info.charset;
|
||||||
m_facename = info.facename;
|
m_facename = info.facename;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFontEnumeratorHelper::DoEnumerate()
|
void wxFontEnumeratorHelper::DoEnumerate()
|
||||||
{
|
{
|
||||||
MenuHandle menu ;
|
MenuHandle menu;
|
||||||
Str255 p_name ;
|
Str255 p_name;
|
||||||
|
short lines;
|
||||||
|
|
||||||
short lines ;
|
menu = NewMenu( 32000, "\pFont" );
|
||||||
|
AppendResMenu( menu, 'FONT' );
|
||||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
lines = CountMenuItems( menu );
|
||||||
AppendResMenu( menu , 'FONT' ) ;
|
|
||||||
lines = CountMenuItems( menu ) ;
|
|
||||||
|
|
||||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
for ( int i = 1; i < lines + 1; i ++ )
|
||||||
{
|
{
|
||||||
GetMenuItemText( menu , i , p_name ) ;
|
GetMenuItemText( menu, i, p_name );
|
||||||
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
|
wxString c_name = wxMacMakeStringFromPascal( p_name );
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
|
if ( m_fixedOnly )
|
||||||
if ( m_fixedOnly )
|
|
||||||
{
|
{
|
||||||
// check that it's a fixed pitch font (there is *no* error here, the
|
// check that it's a fixed pitch font:
|
||||||
// flag name is misleading!)
|
// there is *no* error here: the flag name is misleading!
|
||||||
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
||||||
{
|
|
||||||
// not a fixed pitch font
|
// not a fixed pitch font
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_charset != -1 )
|
if ( m_charset != -1 )
|
||||||
{
|
{
|
||||||
// check that we have the right encoding
|
// check that we have the right encoding
|
||||||
if ( lf->lfCharSet != m_charset )
|
if ( lf->lfCharSet != m_charset )
|
||||||
{
|
return true;
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
*/
|
|
||||||
m_fontEnum->OnFacename( c_name ) ;
|
m_fontEnum->OnFacename( c_name );
|
||||||
}
|
}
|
||||||
DisposeMenu( menu ) ;
|
|
||||||
|
DisposeMenu( menu );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -160,14 +140,14 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
|||||||
}
|
}
|
||||||
// else: no such fonts, unknown encoding
|
// else: no such fonts, unknown encoding
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxFontEnumerator::EnumerateEncodings() not yet implemented"));
|
wxFAIL_MSG(wxT("wxFontEnumerator::EnumerateEncodings() not yet implemented"));
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user