Test for wxST_NO_AUTORESIZE in controls sample.

Add lots of code to change the (German) comma in
    floating point number string in Postscript
    code to ".".


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-05-02 15:34:14 +00:00
parent 066b2a4c3e
commit c518860f60
2 changed files with 49 additions and 16 deletions

View File

@@ -753,7 +753,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
(void)new wxButton(panel, ID_BUTTON_LABEL, "&Toggle label", wxPoint(250, 20));
m_label = new wxStaticText(panel, -1, "Label with some long text",
wxPoint(250, 60), wxDefaultSize,
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
m_label->SetForegroundColour( *wxBLUE );
m_notebook->AddPage(panel, "wxBitmapXXX");
@@ -1177,7 +1177,7 @@ void MyPanel::OnUpdateLabel( wxCommandEvent &WXUNUSED(event) )
static bool s_long = TRUE;
s_long = !s_long;
m_label->SetLabel(s_long ? "very very very long text" : "shorter text");
m_label->SetLabel(s_long ? "Very very very very very long text." : "Shorter text.");
}
void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )

View File

@@ -1005,7 +1005,10 @@ void wxPostScriptDC::SetFont( const wxFont& font )
fprintf( m_pstream, buffer );
fprintf( m_pstream, " findfont\n" );
fprintf( m_pstream, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F);
sprintf( buffer, "%f scalefont setfont\n", YLOG2DEVREL(m_font.GetPointSize() * 1000) / 1000.0F);
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
// this is a hack - we must scale font size (in pts) according to m_scaleY but
// YLOG2DEVREL works with wxCoord type (int or longint). Se we first convert font size
// to 1/1000th of pt and then back.
@@ -1085,10 +1088,14 @@ void wxPostScriptDC::SetPen( const wxPen& pen )
double redPS = (double)(red) / 255.0;
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
fprintf( m_pstream,
char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
m_currentRed = red;
m_currentBlue = blue;
@@ -1129,9 +1136,13 @@ void wxPostScriptDC::SetBrush( const wxBrush& brush )
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
fprintf( m_pstream,
char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
m_currentRed = red;
m_currentBlue = blue;
@@ -1175,9 +1186,13 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
fprintf( m_pstream,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
m_currentRed = red;
m_currentBlue = blue;
@@ -1283,9 +1298,13 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
fprintf( m_pstream,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
m_currentRed = red;
m_currentBlue = blue;
@@ -1300,7 +1319,13 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
// FIXME only correct for 90 degrees
fprintf(m_pstream, "%d %d moveto\n",
XLOG2DEV((wxCoord)(x + size)), YLOG2DEV(by) );
fprintf(m_pstream, "%.8f rotate\n", angle);
char buffer[100];
sprintf(buffer, "%.8f rotate\n", angle);
int i;
for (i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf(m_pstream, buffer);
/* I don't know how to write char to a stream, so I use a mini string */
char tmpbuf[2];
@@ -1309,7 +1334,6 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
fprintf( m_pstream, "(" );
const wxWX2MBbuf textbuf = text.mb_str();
int len = strlen(textbuf);
int i;
for (i = 0; i < len; i++)
{
int c = (unsigned char) textbuf[i];
@@ -1333,7 +1357,11 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
}
fprintf( m_pstream, ") show\n" );
fprintf( m_pstream, "%.8f rotate\n", -angle );
sprintf( buffer, "%.8f rotate\n", -angle );
for (i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
if (m_font.GetUnderlined())
{
@@ -1755,7 +1783,12 @@ void wxPostScriptDC::StartPage()
// fprintf( m_pstream, "90 rotate llx neg ury nef translate\n" );
}
fprintf( m_pstream, "%.8f %.8f scale\n", scale_x, scale_y );
char buffer[100];
sprintf( buffer, "%.8f %.8f scale\n", scale_x, scale_y );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
fprintf( m_pstream, buffer );
fprintf( m_pstream, "%d %d translate\n", translate_x, translate_y );
}