Removed DrawOpenSpline since it doesn't seem to be needed, with required changes

in all ports. Added Motif wxFileDialog. Added wxPostScriptModule and removed
PostScript init in app.cpp. Also removed wxMessageBox function from
generic implementation. Windows release .exes are now smaller (< 300K for minimal.exe).
Some OGL updates. __try -> try in MSW main.cpp. BC++ 5 fixes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1998-10-02 12:50:01 +00:00
parent 9c039d08bf
commit dfad059924
56 changed files with 825 additions and 368 deletions

View File

@ -58,7 +58,7 @@ need for an application to call it.
\membersection{wxModule::OnExit}\label{wxmoduleonexit}
\func{virtual bool}{OnExit}{\void}
\func{virtual void}{OnExit}{\void}
Provide this function with appropriate cleanup for your module.

View File

@ -278,6 +278,16 @@ Note that this is a static function, so it can be called without needing a wxWin
\helpref{wxWindow::SetFocus}{wxwindowsetfocus}
\membersection{wxWindow::FindWindow}\label{wxwindowfindwindow}
\func{wxWindow*}{FindWindow}{\param{long}{ id}}
Find a child of this window, by identifier.
\func{wxWindow*}{FindWindow}{\param{const wxString\&}{ name}}
Find a child of this window, by name.
\membersection{wxWindow::Fit}\label{wxwindowfit}
\func{virtual void}{Fit}{\void}

View File

@ -164,6 +164,11 @@ public:
{ long l; Read(strKey, &l, defVal); return l; }
// Convenience functions that are built on other forms
// int
virtual bool Read(const wxString& key, int *pi) const;
virtual bool Read(const wxString& key, int *pi, int defVal) const;
// double
virtual bool Read(const wxString& key, double* val) const;
virtual bool Read(const wxString& key, double* val, double defVal) const;

View File

@ -847,6 +847,8 @@ enum {
#define wxID_NO 5104
#define wxID_STATIC 5105
#define wxID_HIGHEST 5999
#ifdef __WXMSW__
// Stand-ins for Windows types, to avoid
// #including all of windows.h

View File

@ -166,6 +166,10 @@ public:
{ return wxConfigBase::Read(key, pl, defVal); }
long Read(const wxString& key, long defVal) const
{ return wxConfigBase::Read(key, defVal); }
bool Read(const wxString& key, int *pi, int defVal) const
{ return wxConfigBase::Read(key, pi, defVal); }
bool Read(const wxString& key, int *pi) const
{ return wxConfigBase::Read(key, pi); }
bool Read(const wxString& key, double* val) const
{ return wxConfigBase::Read(key, val); }
bool Read(const wxString& key, double* val, double defVal) const

View File

@ -90,7 +90,7 @@ class wxDC: public wxObject
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
@ -250,7 +250,6 @@ class wxDC: public wxObject
return (long)((double)(y) * m_scaleY - 0.5);
}
virtual void DrawOpenSpline( wxList *points ) = 0;
public:

View File

@ -90,7 +90,7 @@ class wxPaintDC: public wxDC
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawOpenSpline( wxList *points );
virtual void DrawSpline( wxList *points );
public: // shouldn't be public

View File

@ -90,7 +90,7 @@ class wxDC: public wxObject
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
@ -250,7 +250,6 @@ class wxDC: public wxObject
return (long)((double)(y) * m_scaleY - 0.5);
}
virtual void DrawOpenSpline( wxList *points ) = 0;
public:

View File

@ -90,7 +90,7 @@ class wxPaintDC: public wxDC
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawOpenSpline( wxList *points );
virtual void DrawSpline( wxList *points );
public: // shouldn't be public

View File

@ -137,7 +137,7 @@ class WXDLLEXPORT wxDC: public wxObject
}
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
@ -334,8 +334,6 @@ class WXDLLEXPORT wxDC: public wxObject
return (long)((double)(y) * m_scaleY - 0.5);
}
virtual void DrawOpenSpline( wxList *points ) = 0;
public:
bool m_ok;

View File

@ -91,7 +91,7 @@ class WXDLLEXPORT wxWindowDC: public wxDC
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawOpenSpline( wxList *points );
virtual void DrawSpline( wxList *points );
// Motif-specific
void SetDCClipping (); // Helper function for setting clipping

View File

@ -28,7 +28,7 @@ WXDLLEXPORT_DATA(extern const char*) wxFileSelectorDefaultWildcardStr;
class WXDLLEXPORT wxFileDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
protected:
public:
wxString m_message;
long m_dialogStyle;
wxWindow * m_parent;
@ -37,6 +37,12 @@ protected:
wxString m_fileName;
wxString m_wildCard;
int m_filterIndex;
// For Motif
wxPoint m_pos;
static wxString m_fileSelectorAnswer;
static bool m_fileSelectorReturned;
public:
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildCard = wxFileSelectorDefaultWildcardStr,

View File

@ -77,6 +77,10 @@ public:
{ return wxConfigBase::Read(key, pl, defVal); }
long Read(const wxString& key, long defVal) const
{ return wxConfigBase::Read(key, defVal); }
bool Read(const wxString& key, int *pi, int defVal) const
{ return wxConfigBase::Read(key, pi, defVal); }
bool Read(const wxString& key, int *pi) const
{ return wxConfigBase::Read(key, pi); }
bool Read(const wxString& key, double* val) const
{ return wxConfigBase::Read(key, val); }
bool Read(const wxString& key, double* val, double defVal) const

View File

@ -69,6 +69,10 @@ public:
{ return wxConfigBase::Read(key, defVal); }
bool Read(const wxString& key, long *pl, long defVal) const
{ return wxConfigBase::Read(key, pl, defVal); }
bool Read(const wxString& key, int *pi, int defVal) const
{ return wxConfigBase::Read(key, pi, defVal); }
bool Read(const wxString& key, int *pi) const
{ return wxConfigBase::Read(key, pi); }
long Read(const wxString& key, long defVal) const
{ return wxConfigBase::Read(key, defVal); }
bool Read(const wxString& key, double* val) const

View File

@ -18,9 +18,22 @@
#include "wx/dc.h"
#include "wx/dialog.h"
#include "wx/module.h"
#if wxUSE_POSTSCRIPT
// A module to allow initialization/cleanup of PostScript-related
// things without calling these functions from app.cpp.
class WXDLLEXPORT wxPostScriptModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxPostScriptModule)
public:
wxPostScriptModule() {}
bool OnInit();
void OnExit();
};
class WXDLLIMPORT ofstream;
class WXDLLEXPORT wxPostScriptDC: public wxDC
{
@ -62,18 +75,7 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20);
void DrawEllipse(long x, long y, long width, long height);
// RR: I define these in wxDC, after all they all do the same everywhere
#ifdef __WXMSW__
// Splines
// 3-point spline
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
// Any number of control points - a list of pointers to wxPoints
void DrawSpline(wxList *points);
void DrawSpline(int n, wxPoint points[]);
#endif
void DrawOpenSpline(wxList *points);
void DrawIcon(const wxIcon& icon, long x, long y);
#ifdef __WXGTK__

View File

@ -137,7 +137,7 @@ class WXDLLEXPORT wxDC: public wxObject
}
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
@ -316,8 +316,6 @@ class WXDLLEXPORT wxDC: public wxObject
return (long)((double)(y) * m_scaleY - 0.5);
}
virtual void DrawOpenSpline( wxList *points ) = 0;
public:
bool m_ok;

View File

@ -94,7 +94,7 @@ class WXDLLEXPORT wxPaintDC: public wxDC
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawOpenSpline( wxList *points );
virtual void DrawSpline( wxList *points );
};
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: minimal.cpp
// Name: controls.cpp
// Purpose: Controls wxWindows sample
// Author: Robert Roebling
// Modified by:
@ -9,8 +9,8 @@
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "minimal.cpp"
#pragma interface "minimal.cpp"
#pragma implementation "controls.cpp"
#pragma interface "controls.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".

View File

@ -31,7 +31,9 @@
#include <wx/fontdlg.h>
#include <wx/choicdlg.h>
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#define wxTEST_GENERIC_DIALOGS_IN_MSW 0
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
#include <wx/generic/colrdlgg.h>
#include <wx/generic/fontdlgg.h>
#endif
@ -60,14 +62,14 @@ bool MyApp::OnInit(void)
file_menu->Append(DIALOGS_CHOOSE_COLOUR, "&Choose colour");
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
file_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, "Choose colour (&generic)");
#endif
file_menu->AppendSeparator();
file_menu->Append(DIALOGS_CHOOSE_FONT, "Choose &font");
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
file_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, "Choose f&ont (generic)");
#endif
@ -147,7 +149,7 @@ void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
dialog->Close();
}
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
{
wxColourData data;
@ -292,7 +294,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen)
EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric)
EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric)
#endif

View File

@ -37,7 +37,7 @@ class MyFrame: public wxFrame
void FileSave(wxCommandEvent& event);
void DirChoose(wxCommandEvent& event);
#if !defined(__WXMSW__) || wxUSE_GENERIC_DIALOGS_IN_MSW
#if !defined(__WXMSW__) || wxTEST_GENERIC_DIALOGS_IN_MSW
void ChooseColourGeneric(wxCommandEvent& event);
void ChooseFontGeneric(wxCommandEvent& event);
#endif

View File

@ -29,12 +29,19 @@
#error You must set wxUSE_PRINTING_ARCHITECTURE to 1 in wx_setup.h to compile this demo.
#endif
// Set this to 1 if you want to test PostScript printing under MSW.
// However, you'll also need to edit src/msw/makefile.nt.
#define wxTEST_POSTSCRIPT_IN_MSW 0
#include <ctype.h>
#include "wx/metafile.h"
#include "wx/print.h"
#include "wx/printdlg.h"
#if wxTEST_POSTSCRIPT_IN_MSW
#include "wx/generic/printps.h"
#include "wx/generic/prntdlgg.h"
#endif
#include "printing.h"
@ -84,7 +91,7 @@ bool MyApp::OnInit(void)
file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
#ifdef __WXMSW__
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
file_menu->AppendSeparator();
file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
file_menu->Append(WXPRINT_PRINT_SETUP_PS, "Print Setup PostScript...", "Setup printer properties (PostScript)");
@ -128,11 +135,13 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(WXPRINT_PREVIEW, MyFrame::OnPrintPreview)
EVT_MENU(WXPRINT_PRINT_SETUP, MyFrame::OnPrintSetup)
EVT_MENU(WXPRINT_PAGE_SETUP, MyFrame::OnPageSetup)
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
EVT_MENU(WXPRINT_PRINT_PS, MyFrame::OnPrintPS)
EVT_MENU(WXPRINT_PREVIEW_PS, MyFrame::OnPrintPreviewPS)
EVT_MENU(WXPRINT_PRINT_SETUP_PS, MyFrame::OnPrintSetupPS)
EVT_MENU(WXPRINT_PAGE_SETUP_PS, MyFrame::OnPageSetupPS)
EVT_MENU(WXPRINT_ABOUT, MyFrame::OnPrintAbout)
#endif
END_EVENT_TABLE()
// Define my frame constructor
@ -160,15 +169,6 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
}
void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
wxPostScriptPrinter printer;
MyPrintout printout("My printout");
printer.Print(this, &printout, TRUE);
}
void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
{
#ifdef __WXMSW__
@ -194,21 +194,6 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
frame->Show(TRUE);
}
void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
wxPrintData printData;
printData.SetOrientation(orientation);
// Pass two printout objects: for preview, and possible printing.
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(TRUE);
}
void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
{
#ifdef __WXMSW__
@ -251,6 +236,31 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
orientation = data.GetOrientation();
}
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
wxPostScriptPrinter printer;
MyPrintout printout("My printout");
printer.Print(this, &printout, TRUE);
}
void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
wxPrintData printData;
printData.SetOrientation(orientation);
// Pass two printout objects: for preview, and possible printing.
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printData);
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(TRUE);
}
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
{
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
@ -277,6 +287,8 @@ void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
}
#endif
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{

View File

@ -43,10 +43,13 @@ class MyFrame: public wxFrame
void OnPrintPreview(wxCommandEvent& event);
void OnPrintSetup(wxCommandEvent& event);
void OnPageSetup(wxCommandEvent& event);
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
void OnPrintPS(wxCommandEvent& event);
void OnPrintPreviewPS(wxCommandEvent& event);
void OnPrintSetupPS(wxCommandEvent& event);
void OnPageSetupPS(wxCommandEvent& event);
#endif
void OnExit(wxCommandEvent& event);
void OnPrintAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()

View File

@ -179,6 +179,24 @@ bool wxConfigBase::Read(const wxString& key, bool* val, bool defVal) const
}
// Convenience functions
bool wxConfigBase::Read(const wxString& key, int *pi) const
{
long l;
bool ret = Read(key, &l);
if (ret)
*pi = (int) l;
return ret;
}
bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const
{
long l;
bool ret = Read(key, &l, (long) defVal);
*pi = (int) l;
return ret;
}
bool wxConfigBase::Write(const wxString& key, double val)
{
wxString str;

View File

@ -859,7 +859,7 @@ wxFileConfig::LineList *wxFileConfig::ConfigGroup::GetGroupLine()
// this group wasn't present in local config file, add it now
if ( pParent != NULL ) {
wxString strFullName;
strFullName << "[" << GetFullName().c_str() + 1 << "]"; // +1: no '/'
strFullName << "[" << (GetFullName().c_str() + 1) << "]"; // +1: no '/'
m_pLine = m_pConfig->LineListInsert(strFullName,
pParent->GetLastGroupLine());
pParent->SetLastGroup(this); // we're surely after all the others

View File

@ -294,7 +294,7 @@ void wxPostScriptDC::SetClippingRegion (long cx, long cy, long cw, long ch)
*m_pstream << "gsave\n";
*m_pstream << "newpath\n";
*m_pstream << cx << " " << YSCALE (cy) << " moveto\n";
*m_pstream << cx + cw << " " << YSCALE (cy) << " lineto\n";
*m_pstream << (cx + cw) << " " << YSCALE (cy) << " lineto\n";
*m_pstream << cx + cw << " " << YSCALE (cy + ch) << " lineto\n";
*m_pstream << cx << " " << YSCALE (cy + ch) << " lineto\n";
*m_pstream << "closepath clip newpath\n";
@ -415,8 +415,8 @@ void wxPostScriptDC::DrawEllipticArc(long x,long y,long w,long h,double sa,doubl
*m_pstream <<
"newpath\n" <<
x+w/2 << " " << YSCALE (y+h/2) << " " <<
w/2 << " " << h/2 << " " <<
(x+w/2) << " " << YSCALE (y+h/2) << " " <<
w/2 << " " << (h/2) << " " <<
int(sa) <<" "<< int(ea)<<" true ellipticarc\n";
CalcBoundingBox (x , (long)YSCALE (y ));
@ -428,8 +428,8 @@ void wxPostScriptDC::DrawEllipticArc(long x,long y,long w,long h,double sa,doubl
*m_pstream <<
"newpath\n" <<
x+w/2 << " " << YSCALE (y+h/2) << " " <<
w/2 << " " << h/2 << " " <<
(x+w/2) << " " << YSCALE (y+h/2) << " " <<
(w/2) << " " << (h/2) << " " <<
int(sa) <<" "<< int(ea)<<" false ellipticarc\n";
CalcBoundingBox (x , (long)YSCALE (y ));
@ -545,8 +545,8 @@ void wxPostScriptDC::DrawRectangle (long x, long y, long width, long height)
*m_pstream << "newpath\n";
*m_pstream << x << " " << YSCALE (y) << " moveto\n";
*m_pstream << x + width << " " << YSCALE (y) << " lineto\n";
*m_pstream << x + width << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << (x + width) << " " << YSCALE (y) << " lineto\n";
*m_pstream << (x + width) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << "closepath\n";
*m_pstream << "fill\n";
@ -560,8 +560,8 @@ void wxPostScriptDC::DrawRectangle (long x, long y, long width, long height)
*m_pstream << "newpath\n";
*m_pstream << x << " " << YSCALE (y) << " moveto\n";
*m_pstream << x + width << " " << YSCALE (y) << " lineto\n";
*m_pstream << x + width << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << (x + width) << " " << YSCALE (y) << " lineto\n";
*m_pstream << (x + width) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << "closepath\n";
*m_pstream << "stroke\n";
@ -593,19 +593,19 @@ void wxPostScriptDC::DrawRoundedRectangle (long x, long y, long width, long heig
SetBrush (m_brush);
// Draw rectangle anticlockwise
*m_pstream << "newpath\n";
*m_pstream << x + radius << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << (x + radius) << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << x << " " << YSCALE (y + radius) << " moveto\n";
*m_pstream << x + radius << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
*m_pstream << x + width - radius << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << (x + radius) << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x + width - radius << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
*m_pstream << x + width << " " << YSCALE (y + radius) << " lineto\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
*m_pstream << (x + width) << " " << YSCALE (y + radius) << " lineto\n";
*m_pstream << x + width - radius << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
*m_pstream << x + radius << " " << YSCALE (y) << " lineto\n";
*m_pstream << (x + radius) << " " << YSCALE (y) << " lineto\n";
*m_pstream << "closepath\n";
@ -619,19 +619,19 @@ void wxPostScriptDC::DrawRoundedRectangle (long x, long y, long width, long heig
SetPen (m_pen);
// Draw rectangle anticlockwise
*m_pstream << "newpath\n";
*m_pstream << x + radius << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << (x + radius) << " " << YSCALE (y + radius) << " " << radius << " 90 180 arc\n";
*m_pstream << x << " " << YSCALE (y + height - radius) << " lineto\n";
*m_pstream << x + radius << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
*m_pstream << x + width - radius << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << (x + radius) << " " << YSCALE (y + height - radius) << " " << radius << " 180 270 arc\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + height) << " lineto\n";
*m_pstream << x + width - radius << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
*m_pstream << x + width << " " << YSCALE (y + radius) << " lineto\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + height - radius) << " " << radius << " 270 0 arc\n";
*m_pstream << (x + width) << " " << YSCALE (y + radius) << " lineto\n";
*m_pstream << x + width - radius << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
*m_pstream << (x + width - radius) << " " << YSCALE (y + radius) << " " << radius << " 0 90 arc\n";
*m_pstream << x + radius << " " << YSCALE (y) << " lineto\n";
*m_pstream << (x + radius) << " " << YSCALE (y) << " lineto\n";
*m_pstream << "closepath\n";
@ -651,8 +651,8 @@ void wxPostScriptDC::DrawEllipse (long x, long y, long width, long height)
SetBrush (m_brush);
*m_pstream << "newpath\n";
*m_pstream << x + width / 2 << " " << YSCALE (y + height / 2) << " ";
*m_pstream << width / 2 << " " << height / 2 << " 0 360 ellipse\n";
*m_pstream << (x + width / 2) << " " << YSCALE (y + height / 2) << " ";
*m_pstream << (width / 2) << " " << (height / 2) << " 0 360 ellipse\n";
*m_pstream << "fill\n";
CalcBoundingBox (x - width, (long)YSCALE (y - height));
@ -663,8 +663,8 @@ void wxPostScriptDC::DrawEllipse (long x, long y, long width, long height)
SetPen (m_pen);
*m_pstream << "newpath\n";
*m_pstream << x + width / 2 << " " << YSCALE (y + height / 2) << " ";
*m_pstream << width / 2 << " " << height / 2 << " 0 360 ellipse\n";
*m_pstream << (x + width / 2) << " " << YSCALE (y + height / 2) << " ";
*m_pstream << (width / 2) << " " << (height / 2) << " 0 360 ellipse\n";
*m_pstream << "stroke\n";
CalcBoundingBox (x - width, (long)YSCALE (y - height));
@ -767,7 +767,7 @@ void wxPostScriptDC::SetFont (const wxFont& the_font)
strcpy (buf, name);
strcat (buf, style);
*m_pstream << buf << " findfont\n";
*m_pstream << m_font.GetPointSize() * m_scaleFactor << " scalefont setfont\n";
*m_pstream << (m_font.GetPointSize() * m_scaleFactor) << " scalefont setfont\n";
}
void wxPostScriptDC::SetPen (const wxPen& pen)
@ -976,7 +976,7 @@ void wxPostScriptDC::DrawText (const wxString& text, long x, long y, bool WXUNUS
*m_pstream << "gsave " << x << " " << YSCALE (y + size - UnderlinePosition)
<< " moveto\n"
<< UnderlineThickness << " setlinewidth "
<< x + w << " " << YSCALE (y + size - UnderlinePosition)
<< (x + w) << " " << YSCALE (y + size - UnderlinePosition)
<< " lineto stroke grestore\n";
}
@ -1216,7 +1216,7 @@ void wxPostScriptDC::EndDoc (void)
*m_pstream << "%%BoundingBox: "
<< floor((double)llx) << " " << floor((double)lly) << " "
<< ceil((double)urx) << " " << ceil((double)ury) << "\n";
*m_pstream << "%%Pages: " << wxPageNumber - 1 << "\n";
*m_pstream << "%%Pages: " << (wxPageNumber - 1) << "\n";
*m_pstream << "%%EndComments\n\n";
// To check the correctness of the bounding box, postscript commands
@ -1322,7 +1322,7 @@ void wxPostScriptDC::StartPage (void)
{
if (!m_pstream)
return;
*m_pstream << "%%Page: " << wxPageNumber++ << "\n";
*m_pstream << "%%Page: " << (wxPageNumber++) << "\n";
// *m_pstream << "matrix currentmatrix\n";
// Added by Chris Breeze
@ -1403,8 +1403,6 @@ void wxPostScriptDC::EndPage (void)
#endif
}
/* MATTHEW: Implement Blit: */
/* MATTHEW: [4] Re-wrote to use colormap */
bool wxPostScriptDC::
Blit (long xdest, long ydest, long fwidth, long fheight,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(rop), bool WXUNUSED(useMask))
@ -1820,7 +1818,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
#endif
}
void wxPostScriptDC::DrawOpenSpline( wxList *points )
void wxPostScriptDC::DrawSpline( wxList *points )
{
double a, b, c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q;
@ -1836,7 +1834,7 @@ void wxPostScriptDC::DrawOpenSpline( wxList *points )
x3 = a = (double)(x1 + c) / 2;
y3 = b = (double)(y1 + d) / 2;
*(GetStream()) << "newpath " << x1 << " " << GetYOrigin() - y1 << " moveto " << x3 << " " << GetYOrigin() - y3;
*(GetStream()) << "newpath " << x1 << " " << (GetYOrigin() - y1) << " moveto " << x3 << " " << (GetYOrigin() - y3);
*(GetStream()) << " lineto\n";
CalcBoundingBox( (long)x1, (long)(GetYOrigin() - y1));
CalcBoundingBox( (long)x3, (long)(GetYOrigin() - y3));
@ -1850,8 +1848,8 @@ void wxPostScriptDC::DrawOpenSpline( wxList *points )
c = q->x; d = q->y;
x3 = (double)(x2 + c) / 2;
y3 = (double)(y2 + d) / 2;
*(GetStream()) << x1 << " " << GetYOrigin() - y1 << " " << x2 << " " << GetYOrigin() - y2 << " ";
*(GetStream()) << x3 << " " << GetYOrigin() - y3 << " DrawSplineSection\n";
*(GetStream()) << x1 << " " << (GetYOrigin() - y1) << " " << x2 << " " << (GetYOrigin() - y2) << " ";
*(GetStream()) << x3 << " " << (GetYOrigin() - y3) << " DrawSplineSection\n";
CalcBoundingBox( (long)x1, (long)(GetYOrigin() - y1));
CalcBoundingBox( (long)x3, (long)(GetYOrigin() - y3));
@ -1860,7 +1858,7 @@ void wxPostScriptDC::DrawOpenSpline( wxList *points )
* At this point, (x2,y2) and (c,d) are the position of the
* next-to-last and last point respectively, in the point list
*/
*(GetStream()) << c << " " << GetYOrigin() - d << " lineto stroke\n";
*(GetStream()) << c << " " << (GetYOrigin() - d) << " lineto stroke\n";
}
long wxPostScriptDC::GetCharWidth (void)
@ -2586,4 +2584,25 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const char *name)
return (wxPrintPaperType *) NULL;
}
/*
* Initialization/cleanup module
*/
bool wxPostScriptModule::OnInit()
{
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
return TRUE;
}
void wxPostScriptModule::OnExit()
{
wxInitializePrintSetupData(FALSE);
delete wxThePrintPaperDatabase;
wxThePrintPaperDatabase = NULL;
}
#endif

View File

@ -26,6 +26,8 @@
#include "wx/window.h"
#include "wx/menu.h"
#include "wx/frame.h"
#include "wx/msgdlg.h"
#include "wx/textdlg.h"
#endif
#if wxUSE_IOSTREAMH
@ -740,3 +742,44 @@ whereami(name)
#endif
/*
* N.B. these convenience functions must be separate from msgdlgg.cpp, textdlgg.cpp
* since otherwise the generic code may be pulled in unnecessarily.
*/
int wxMessageBox(const wxString& message, const wxString& caption, long style,
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
{
wxMessageDialog dialog(parent, message, caption, style);
int ans = dialog.ShowModal();
switch ( ans )
{
case wxID_OK:
return wxOK;
break;
case wxID_YES:
return wxYES;
break;
case wxID_NO:
return wxNO;
break;
default:
case wxID_CANCEL:
return wxCANCEL;
break;
}
return ans;
}
wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
const wxString& defaultValue, wxWindow *parent,
int x, int y, bool WXUNUSED(centre) )
{
wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y));
if (dialog.ShowModal() == wxID_OK)
return dialog.GetValue();
else
return wxString("");
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choicesg.cpp
// Name: choicdgg.cpp
// Purpose: Choice dialogs
// Author: Julian Smart
// Modified by:
@ -33,7 +33,38 @@
#include "wx/generic/choicdgg.h"
extern void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer);
// Split message, using constraints to position controls
static void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer)
{
char *copyMessage = copystring(message);
size_t i = 0;
size_t len = strlen(copyMessage);
char *currentMessage = copyMessage;
// wxWindow *lastWindow = parent;
while (i < len) {
while ((i < len) && (copyMessage[i] != '\n')) i++;
if (i < len) copyMessage[i] = 0;
wxStaticText *mess = new wxStaticText(parent, -1, currentMessage);
/*
wxLayoutConstraints *c = new wxLayoutConstraints;
c->left.SameAs (parent, wxLeft, 10);
c->top.SameAs (lastWindow, wxBottom, 5);
c->right.AsIs ();
c->height.AsIs ();
mess->SetConstraints(c);
*/
sizer->AddSizerChild(mess);
messageList->Append(mess);
currentMessage = copyMessage + i + 1;
}
delete[] copyMessage;
}
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent,

View File

@ -179,28 +179,3 @@ void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
}
int wxMessageBox(const wxString& message, const wxString& caption, long style,
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
{
wxMessageDialog dialog(parent, message, caption, style);
int ans = dialog.ShowModal();
switch ( ans )
{
case wxID_OK:
return wxOK;
break;
case wxID_YES:
return wxYES;
break;
case wxID_NO:
return wxNO;
break;
default:
case wxID_CANCEL:
return wxCANCEL;
break;
}
return ans;
}

View File

@ -44,7 +44,38 @@ END_EVENT_TABLE()
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
#endif
extern void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer);
// Split message, using constraints to position controls
static void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer)
{
char *copyMessage = copystring(message);
size_t i = 0;
size_t len = strlen(copyMessage);
char *currentMessage = copyMessage;
// wxWindow *lastWindow = parent;
while (i < len) {
while ((i < len) && (copyMessage[i] != '\n')) i++;
if (i < len) copyMessage[i] = 0;
wxStaticText *mess = new wxStaticText(parent, -1, currentMessage);
/*
wxLayoutConstraints *c = new wxLayoutConstraints;
c->left.SameAs (parent, wxLeft, 10);
c->top.SameAs (lastWindow, wxBottom, 5);
c->right.AsIs ();
c->height.AsIs ();
mess->SetConstraints(c);
*/
sizer->AddSizerChild(mess);
messageList->Append(mess);
currentMessage = copyMessage + i + 1;
}
delete[] copyMessage;
}
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption,
const wxString& value, long style, const wxPoint& pos):
@ -128,13 +159,3 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
EndModal(wxID_OK);
}
wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
const wxString& defaultValue, wxWindow *parent,
int x, int y, bool WXUNUSED(centre) )
{
wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y));
if (dialog.ShowModal() == wxID_OK)
return dialog.GetValue();
else
return wxString("");
}

View File

@ -15,7 +15,6 @@
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/memory.h"
@ -263,9 +262,11 @@ void wxApp::CommonInit(void)
// For PostScript printing
#if wxUSE_POSTSCRIPT
/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
*/
#endif
@ -279,8 +280,10 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
*/
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();

View File

@ -151,11 +151,6 @@ void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
}
}
void wxDC::DrawSpline( wxList *points )
{
DrawOpenSpline( points );
}
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;

View File

@ -1013,7 +1013,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxPaintDC::DrawOpenSpline( wxList *points )
void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;

View File

@ -15,7 +15,6 @@
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/memory.h"
@ -263,9 +262,11 @@ void wxApp::CommonInit(void)
// For PostScript printing
#if wxUSE_POSTSCRIPT
/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
*/
#endif
@ -279,8 +280,10 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
*/
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();

View File

@ -151,11 +151,6 @@ void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
}
}
void wxDC::DrawSpline( wxList *points )
{
DrawOpenSpline( points );
}
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;

View File

@ -1013,7 +1013,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxPaintDC::DrawOpenSpline( wxList *points )
void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;

View File

@ -33,10 +33,6 @@
#include "wx/resource.h"
#endif
#if wxUSE_POSTSCRIPT
#include "wx/postscrp.h"
#endif
#include <Xm/Xm.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -91,9 +87,11 @@ bool wxApp::Initialize()
// For PostScript printing
#if wxUSE_POSTSCRIPT
/* Done using wxModule now
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
*/
#endif
wxBitmap::InitStandardHandlers();
@ -137,9 +135,11 @@ void wxApp::CleanUp()
wxTheColourDatabase = NULL;
#if wxUSE_POSTSCRIPT
/* Done using wxModule now
wxInitializePrintSetupData(FALSE);
delete wxThePrintPaperDatabase;
wxThePrintPaperDatabase = NULL;
*/
#endif
wxBitmap::CleanUpHandlers();

View File

@ -147,11 +147,6 @@ void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
};
};
void wxDC::DrawSpline( wxList *points )
{
DrawOpenSpline( points );
};
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;

View File

@ -2174,7 +2174,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxWindowDC::DrawOpenSpline( wxList *points )
void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;

View File

@ -164,7 +164,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
// Can't remember what this was about... but I think it's necessary.
if (USE_INVISIBLE_RESIZE)
if (wxUSE_INVISIBLE_RESIZE)
{
if (pos.x > -1)
XtVaSetValues(dialogShell, XmNx, pos.x,
@ -216,10 +216,10 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
// Positioning of the dialog doesn't work properly unless the dialog
// is managed, so we manage without mapping to the screen.
// To show, we map the shell (actually it's parent).
if (!USE_INVISIBLE_RESIZE)
if (!wxUSE_INVISIBLE_RESIZE)
XtVaSetValues(shell, XmNmappedWhenManaged, FALSE, NULL);
if (!USE_INVISIBLE_RESIZE)
if (!wxUSE_INVISIBLE_RESIZE)
{
XtManageChild(dialogShell);
SetSize(pos.x, pos.y, size.x, size.y);
@ -252,7 +252,7 @@ void wxDialog::SetModal(bool flag)
wxDialog::~wxDialog()
{
m_modalShowing = FALSE;
if (!USE_INVISIBLE_RESIZE && m_mainWidget)
if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
{
XtUnmapWidget((Widget) m_mainWidget);
}
@ -426,7 +426,7 @@ bool wxDialog::Show(bool show)
if (show)
{
if (!USE_INVISIBLE_RESIZE)
if (!wxUSE_INVISIBLE_RESIZE)
XtMapWidget(XtParent((Widget) m_mainWidget));
else
XtManageChild((Widget) m_mainWidget) ;
@ -436,7 +436,7 @@ bool wxDialog::Show(bool show)
}
else
{
if (!USE_INVISIBLE_RESIZE)
if (!wxUSE_INVISIBLE_RESIZE)
XtUnmapWidget(XtParent((Widget) m_mainWidget));
else
XtUnmanageChild((Widget) m_mainWidget) ;

View File

@ -18,13 +18,31 @@
#include "wx/dialog.h"
#include "wx/filedlg.h"
#include "wx/intl.h"
#include "wx/app.h"
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/Label.h>
#include <Xm/BulletinB.h>
#include <Xm/Frame.h>
#include <Xm/Text.h>
#include <Xm/DialogS.h>
#include <Xm/FileSB.h>
#include <Xm/RowColumn.h>
#include <Xm/LabelG.h>
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif
#define DEFAULT_FILE_SELECTOR_SIZE 0
// Let Motif defines the size of File
// Selector Box (if 1), or fix it to
// wxFSB_WIDTH x wxFSB_HEIGHT (if 0)
#define wxFSB_WIDTH 600
#define wxFSB_HEIGHT 500
char *wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
@ -86,104 +104,105 @@ char *wxFileSelectorEx(const char *title,
return NULL;
}
// TODO: Motif file selector code
#if 0
char *wxFileSelectorAnswer = NULL;
Bool wxFileSelectorReturned = FALSE;
wxString wxFileDialog::m_fileSelectorAnswer = "";
bool wxFileDialog::m_fileSelectorReturned = FALSE;
void wxFileSelCancel(Widget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs)
{
wxFileSelectorAnswer = NULL;
wxFileSelectorReturned = TRUE;
wxFileDialog::m_fileSelectorAnswer = "";
wxFileDialog::m_fileSelectorReturned = TRUE;
}
void wxFileSelOk(Widget fs, XtPointer client_data, XmFileSelectionBoxCallbackStruct *cbs)
{
char *filename = NULL;
if (!XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &filename)) {
wxFileSelectorAnswer = NULL;
wxFileSelectorReturned = TRUE;
wxFileDialog::m_fileSelectorAnswer = "";
wxFileDialog::m_fileSelectorReturned = TRUE;
} else {
if (filename) {
if (wxFileSelectorAnswer) delete[] wxFileSelectorAnswer;
wxFileSelectorAnswer = copystring(filename);
wxFileDialog::m_fileSelectorAnswer = filename;
XtFree(filename);
}
wxFileSelectorReturned = TRUE;
wxFileDialog::m_fileSelectorReturned = TRUE;
}
}
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
long style, const wxPoint& pos)
{
m_message = message;
m_dialogStyle = style;
m_parent = parent;
m_path = "";
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_filterIndex = 1;
m_pos = pos;
}
char *wxMotifFileSelector(char *message,
char *default_path, char *default_filename,
char *default_extension, char *wildcard, int flags,
wxWindow *parent, int x, int y)
int wxFileDialog::ShowModal()
{
wxBeginBusyCursor();
static char fileBuf[512];
Widget parentWidget = 0;
if (parent)
Widget parentWidget = (Widget) 0;
if (m_parent)
{
if (parent->IsKindOf(CLASSINFO(wxFrame)))
parentWidget = ((wxFrame *)parent)->frameShell;
else if (parent->IsKindOf(CLASSINFO(wxDialogBox)))
parentWidget = ((wxDialogBox *)parent)->dialogShell;
else
parentWidget = (Widget)parent->handle;
parentWidget = (Widget) m_parent->GetTopWidget();
}
else if (wxTheApp->wx_frame)
parentWidget = wxTheApp->wx_frame->frameShell;
else
parentWidget = (Widget) wxTheApp->GetTopLevelWidget();
Widget fileSel = XmCreateFileSelectionDialog(parentWidget, "file_selector", NULL, 0);
XtUnmanageChild(XmFileSelectionBoxGetChild(fileSel, XmDIALOG_HELP_BUTTON));
Widget shell = XtParent(fileSel);
if (message)
XtVaSetValues(shell, XmNtitle, message, NULL);
if (!m_message.IsNull())
XtVaSetValues(shell, XmNtitle, (char*) (const char*) m_message, NULL);
char *entirePath = NULL;
wxString entirePath("");
if (default_path && default_filename)
if ((m_dir != "") && (m_fileName != ""))
{
sprintf(wxBuffer, "%s/%s", default_path, default_filename);
entirePath = copystring(wxBuffer);
entirePath = m_dir + wxString("/") + m_fileName;
}
else if (default_path && !default_filename)
else if ((m_dir != "") && (m_fileName == ""))
{
sprintf(wxBuffer, "%s/", default_path);
entirePath = copystring(wxBuffer);
entirePath = m_dir + wxString("/");
}
else if ((!default_path) && default_filename)
else if ((m_dir == "") && (m_fileName != ""))
{
sprintf(wxBuffer, "%s", default_filename);
entirePath = copystring(wxBuffer);
entirePath = m_fileName;
}
if (entirePath)
if (entirePath != "")
{
Widget selectionWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_TEXT);
XmTextSetString(selectionWidget, entirePath);
delete[] entirePath;
XmTextSetString(selectionWidget, (char*) (const char*) entirePath);
}
if (wildcard)
if (m_wildCard != "")
{
if (default_path)
sprintf(wxBuffer, "%s/%s", default_path, wildcard);
wxString filter("");
if (m_dir != "")
filter = m_dir + wxString("/") + m_wildCard;
else
sprintf(wxBuffer, "%s", wildcard);
filter = m_wildCard;
Widget filterWidget = XmFileSelectionBoxGetChild(fileSel, XmDIALOG_FILTER_TEXT);
XmTextSetString(filterWidget, wxBuffer);
XmTextSetString(filterWidget, (char*) (const char*) filter);
XmFileSelectionDoSearch(fileSel, NULL);
}
// Suggested by Terry Gitnick, 16/9/97, because of change in Motif
// file selector on Solaris 1.5.1.
if ( default_path )
if ( m_dir != "" )
{
XmString thePath = XmStringCreateLtoR (default_path,
XmString thePath = XmStringCreateLtoR ((char*) (const char*) m_dir,
XmSTRING_DEFAULT_CHARSET);
XtVaSetValues (fileSel,
@ -214,24 +233,20 @@ char *wxMotifFileSelector(char *message,
XtManageChild(fileSel);
if (wxFileSelectorAnswer)
delete[] wxFileSelectorAnswer;
wxFileSelectorAnswer = NULL;
wxFileSelectorReturned = FALSE;
m_fileSelectorAnswer = "";
m_fileSelectorReturned = FALSE;
wxEndBusyCursor();
XtAddGrab(XtParent(fileSel), TRUE, FALSE);
XEvent event;
while (!wxFileSelectorReturned)
while (!m_fileSelectorReturned)
{
XtAppNextEvent(wxTheApp->appContext, &event);
XtDispatchEvent(&event);
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
}
XtRemoveGrab(XtParent(fileSel));
XmUpdateDisplay(wxTheApp->topLevel); // Experimental
XmUpdateDisplay((Widget) wxTheApp->GetTopLevelWidget()); // Experimental
// XtDestroyWidget(fileSel);
XtUnmapWidget(XtParent(fileSel));
@ -239,41 +254,22 @@ char *wxMotifFileSelector(char *message,
// Now process all events, because otherwise
// this might remain on the screen
XSync(XtDisplay(wxTheApp->topLevel), FALSE);
while (XtAppPending(wxTheApp->appContext))
XSync(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()), FALSE);
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext()))
{
XFlush(XtDisplay(wxTheApp->topLevel));
XtAppNextEvent(wxTheApp->appContext, &event);
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
XtDispatchEvent(&event);
}
if (wxFileSelectorAnswer)
{
strcpy(fileBuf, wxFileSelectorAnswer);
return fileBuf;
}
else return NULL;
}
#endif
m_path = m_fileSelectorAnswer;
m_fileName = wxFileNameFromPath(m_fileSelectorAnswer);
m_dir = wxPathOnly(m_path);
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
long style, const wxPoint& pos)
{
m_message = message;
m_dialogStyle = style;
m_parent = parent;
m_path = "";
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_filterIndex = 1;
}
int wxFileDialog::ShowModal()
{
// TODO
if (m_fileName == "")
return wxID_CANCEL;
else
return wxID_OK;
}
// Generic file load/save dialog

View File

@ -36,7 +36,6 @@
#endif
#include "wx/msw/private.h"
#include "wx/postscrp.h"
#include "wx/log.h"
#include "wx/module.h"
@ -149,13 +148,6 @@ bool wxApp::Initialize()
wxInitializeResourceSystem();
#endif
// For PostScript printing
#if wxUSE_POSTSCRIPT
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
#endif
wxBitmap::InitStandardHandlers();
#if defined(__WIN95__)
@ -387,12 +379,13 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine)
char* str = buf;
while (*str)
{
if ( count == WXSIZEOF(command) )
/*
if ( count == WXSIZEOF(command) )
{
wxFAIL_MSG("too many command line args.");
break;
}
*/
while ( *str && isspace(*str) ) // skip whitespace
str++;
@ -456,12 +449,6 @@ void wxApp::CleanUp()
delete wxTheColourDatabase;
wxTheColourDatabase = NULL;
#if wxUSE_POSTSCRIPT
wxInitializePrintSetupData(FALSE);
delete wxThePrintPaperDatabase;
wxThePrintPaperDatabase = NULL;
#endif
wxBitmap::CleanUpHandlers();
delete[] wxBuffer;
@ -525,7 +512,7 @@ int wxEntry(WXHINSTANCE hInstance,
bool enterLoop)
{
#ifndef __WXDEBUG__ // take everything into a try-except block in release build
__try {
try {
#endif
wxhInstance = (HINSTANCE) hInstance;
@ -606,7 +593,7 @@ int wxEntry(WXHINSTANCE hInstance,
return retValue;
#ifndef __WXDEBUG__ // catch exceptions only in release build
}
__except ( EXCEPTION_EXECUTE_HANDLER ) {
except ( EXCEPTION_EXECUTE_HANDLER ) {
/*
if ( wxTheApp )
wxTheApp->OnFatalException();

View File

@ -1326,10 +1326,6 @@ void wxDC::GetSizeMM(long *width, long *height) const
*height = h;
}
#if wxUSE_SPLINES
#include "xfspline.inc"
#endif // wxUSE_SPLINES
void wxDC::DrawPolygon(wxList *list, long xoffset, long yoffset,int fillStyle)
{
int n = list->Number();
@ -1370,34 +1366,6 @@ void wxDC::SetTextBackground(const wxColour& colour)
m_textBackgroundColour = colour;
}
#if wxUSE_SPLINES
// Make a 3-point spline
void wxDC::DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
{
wxList *point_list = new wxList;
wxPoint *point1 = new wxPoint;
point1->x = x1; point1->y = y1;
point_list->Append((wxObject*)point1);
wxPoint *point2 = new wxPoint;
point2->x = x2; point2->y = y2;
point_list->Append((wxObject*)point2);
wxPoint *point3 = new wxPoint;
point3->x = x3; point3->y = y3;
point_list->Append((wxObject*)point3);
DrawSpline(point_list);
for(wxNode *node = point_list->First(); node; node = node->Next()) {
wxPoint *p = (wxPoint *)node->Data();
delete p;
}
delete point_list;
}
#endif
// For use by wxWindows only, unless custom units are required.
void wxDC::SetLogicalScale(double x, double y)
{
@ -1446,4 +1414,274 @@ int wxDC::GetDepth(void) const
return (int) ::GetDeviceCaps((HDC) m_hDC,BITSPIXEL);
}
#if wxUSE_SPLINES
// Make a 3-point spline
void wxDC::DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
{
wxList *point_list = new wxList;
wxPoint *point1 = new wxPoint;
point1->x = x1; point1->y = y1;
point_list->Append((wxObject*)point1);
wxPoint *point2 = new wxPoint;
point2->x = x2; point2->y = y2;
point_list->Append((wxObject*)point2);
wxPoint *point3 = new wxPoint;
point3->x = x3; point3->y = y3;
point_list->Append((wxObject*)point3);
DrawSpline(point_list);
for(wxNode *node = point_list->First(); node; node = node->Next()) {
wxPoint *p = (wxPoint *)node->Data();
delete p;
}
delete point_list;
}
////#define wx_round(a) (int)((a)+.5)
//#define wx_round(a) (a)
class wxSpline: public wxObject
{
public:
int type;
wxList *points;
wxSpline(wxList *list);
void DeletePoints(void);
// Doesn't delete points
~wxSpline(void);
};
void wxDC::DrawSpline(int n, wxPoint points[])
{
wxList list;
int i;
for (i =0; i < n; i++)
list.Append((wxObject*)&points[i]);
DrawSpline((wxList *)&list);
}
void wx_draw_open_spline(wxDC *dc, wxSpline *spline);
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
double a3, double b3, double a4, double b4);
void wx_clear_stack(void);
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
double *y3, double *x4, double *y4);
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
double x4, double y4);
static bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDC *dc);
wxSpline *wx_make_spline(int x1, int y1, int x2, int y2, int x3, int y3);
void wxDC::DrawSpline(wxList *list)
{
wxSpline spline(list);
wx_draw_open_spline(this, &spline);
}
wxList wx_spline_point_list;
void wx_draw_open_spline(wxDC *dc, wxSpline *spline)
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
wxNode *node = spline->points->First();
p = (wxPoint *)node->Data();
x1 = p->x;
y1 = p->y;
node = node->Next();
p = (wxPoint *)node->Data();
x2 = p->x;
y2 = p->y;
cx1 = (double)((x1 + x2) / 2);
cy1 = (double)((y1 + y2) / 2);
cx2 = (double)((cx1 + x2) / 2);
cy2 = (double)((cy1 + y2) / 2);
wx_spline_add_point(x1, y1);
while ((node = node->Next()) != NULL)
{
p = (wxPoint *)node->Data();
x1 = x2;
y1 = y2;
x2 = p->x;
y2 = p->y;
cx4 = (double)(x1 + x2) / 2;
cy4 = (double)(y1 + y2) / 2;
cx3 = (double)(x1 + cx4) / 2;
cy3 = (double)(y1 + cy4) / 2;
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
cx1 = cx4;
cy1 = cy4;
cx2 = (double)(cx1 + x2) / 2;
cy2 = (double)(cy1 + y2) / 2;
}
wx_spline_add_point((double)wx_round(cx1), (double)wx_round(cy1));
wx_spline_add_point(x2, y2);
wx_spline_draw_point_array(dc);
}
/********************* CURVES FOR SPLINES *****************************
The following spline drawing routine is from
"An Algorithm for High-Speed Curve Generation"
by George Merrill Chaikin,
Computer Graphics and Image Processing, 3, Academic Press,
1974, 346-349.
and
"On Chaikin's Algorithm" by R. F. Riesenfeld,
Computer Graphics and Image Processing, 4, Academic Press,
1975, 304-310.
***********************************************************************/
#define half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5
/* iterative version */
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
double b4)
{
register double xmid, ymid;
double x1, y1, x2, y2, x3, y3, x4, y4;
wx_clear_stack();
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
xmid = (double)half(x2, x3);
ymid = (double)half(y2, y3);
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
wx_spline_add_point((double)wx_round(x1), (double)wx_round(y1));
wx_spline_add_point((double)wx_round(xmid), (double)wx_round(ymid));
} else {
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
}
}
}
/* utilities used by spline drawing routines */
typedef struct wx_spline_stack_struct {
double x1, y1, x2, y2, x3, y3, x4, y4;
}
Stack;
#define SPLINE_STACK_DEPTH 20
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
static Stack *wx_stack_top;
static int wx_stack_count;
void wx_clear_stack(void)
{
wx_stack_top = wx_spline_stack;
wx_stack_count = 0;
}
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
{
wx_stack_top->x1 = x1;
wx_stack_top->y1 = y1;
wx_stack_top->x2 = x2;
wx_stack_top->y2 = y2;
wx_stack_top->x3 = x3;
wx_stack_top->y3 = y3;
wx_stack_top->x4 = x4;
wx_stack_top->y4 = y4;
wx_stack_top++;
wx_stack_count++;
}
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
double *x3, double *y3, double *x4, double *y4)
{
if (wx_stack_count == 0)
return (0);
wx_stack_top--;
wx_stack_count--;
*x1 = wx_stack_top->x1;
*y1 = wx_stack_top->y1;
*x2 = wx_stack_top->x2;
*y2 = wx_stack_top->y2;
*x3 = wx_stack_top->x3;
*y3 = wx_stack_top->y3;
*x4 = wx_stack_top->x4;
*y4 = wx_stack_top->y4;
return (1);
}
static bool wx_spline_add_point(double x, double y)
{
wxPoint *point = new wxPoint ;
point->x = (int) x;
point->y = (int) y;
wx_spline_point_list.Append((wxObject*)point);
return TRUE;
}
static void wx_spline_draw_point_array(wxDC *dc)
{
dc->DrawLines(&wx_spline_point_list, (double)0.0, (double)0.0);
wxNode *node = wx_spline_point_list.First();
while (node)
{
wxPoint *point = (wxPoint *)node->Data();
delete point;
delete node;
node = wx_spline_point_list.First();
}
}
wxSpline::wxSpline(wxList *list)
{
points = list;
}
wxSpline::~wxSpline(void)
{
}
void wxSpline::DeletePoints(void)
{
for(wxNode *node = points->First(); node; node = points->First())
{
wxPoint *point = (wxPoint *)node->Data();
delete point;
delete node;
}
delete points;
}
#endif // wxUSE_SPLINES

View File

@ -61,15 +61,9 @@ DOCDIR = $(WXDIR)\docs
GENERICOBJS= \
$(GENDIR)\choicdgg.obj \
$(GENDIR)\colrdlgg.obj \
$(GENDIR)\fontdlgg.obj \
$(GENDIR)\gridg.obj \
$(GENDIR)\helpxlp.obj \
$(GENDIR)\laywin.obj \
$(GENDIR)\msgdlgg.obj \
$(GENDIR)\panelg.obj \
$(GENDIR)\printps.obj \
$(GENDIR)\prntdlgg.obj \
$(GENDIR)\sashwin.obj \
$(GENDIR)\scrolwin.obj \
$(GENDIR)\splitter.obj \
@ -77,6 +71,17 @@ GENERICOBJS= \
$(GENDIR)\tabg.obj \
$(GENDIR)\textdlgg.obj
# These are generic things that don't need to be compiled on MSW,
# but sometimes it's useful to do so for testing purposes.
NONESSENTIALOBJS= \
$(GENDIR)\printps.obj \
$(GENDIR)\prntdlgg.obj \
$(GENDIR)\msgdlgg.obj \
$(GENDIR)\helpxlp.obj \
$(GENDIR)\colrdlgg.obj \
$(GENDIR)\fontdlgg.obj \
$(COMMDIR)\postscrp.obj
COMMONOBJS = \
$(COMMDIR)\cmndata.obj \
$(COMMDIR)\config.obj \
@ -101,7 +106,6 @@ COMMONOBJS = \
$(COMMDIR)\module.obj \
$(COMMDIR)\odbc.obj \
$(COMMDIR)\object.obj \
$(COMMDIR)\postscrp.obj \
$(COMMDIR)\prntbase.obj \
$(COMMDIR)\resource.obj \
$(COMMDIR)\tbarbase.obj \
@ -229,6 +233,7 @@ MSWOBJS = \
$(OLEDIR)\uuid.obj
# Add $(NONESSENTIALOBJS) if wanting generic dialogs, PostScript etc.
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
# Normal, static library

View File

@ -383,7 +383,7 @@ void wxToolBar95::SetRows(int nRows)
wxSize wxToolBar95::GetMaxSize(void) const
{
if (m_maxWidth == -1 | m_maxHeight == -1)
if ((m_maxWidth == -1) || (m_maxHeight == -1))
{
RECT rect;
::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
@ -451,7 +451,7 @@ void wxToolBar95::ClearTools(void)
wxToolBarTool *wxToolBar95::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap,
bool toggle, long xPos, long yPos, wxObject *clientData, const wxString& helpString1, const wxString& helpString2)
{
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, (wxBitmap *)NULL, toggle, xPos, yPos, helpString1, helpString2);
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2);
tool->m_clientData = clientData;
if (xPos > -1)

View File

@ -2140,7 +2140,7 @@ void wxWindow::MSWOnLButtonDown(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVENT_TYPE_LEFT_DOWN;
@ -2159,7 +2159,7 @@ void wxWindow::MSWOnLButtonUp(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_UP;
@ -2175,10 +2175,10 @@ void wxWindow::MSWOnLButtonDClick(int x, int y, WXUINT flags)
event.m_x = x; event.m_y = y;
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
event.m_controlDown = ((flags & MK_CONTROL) != 0);
event.m_leftDown = ((flags & MK_LBUTTON != 0));
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_DCLICK;
@ -2197,7 +2197,7 @@ void wxWindow::MSWOnMButtonDown(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_MIDDLE_DOWN;
@ -2217,7 +2217,7 @@ void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_MIDDLE_UP;
@ -2236,7 +2236,7 @@ void wxWindow::MSWOnMButtonDClick(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_MIDDLE_DCLICK;
@ -2255,7 +2255,7 @@ void wxWindow::MSWOnRButtonDown(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_RIGHT_DOWN;
@ -2275,7 +2275,7 @@ void wxWindow::MSWOnRButtonUp(int x, int y, WXUINT flags)
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.m_eventObject = this;
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_RIGHT_UP;
@ -2293,7 +2293,7 @@ void wxWindow::MSWOnRButtonDClick(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_RIGHT_DCLICK;
@ -2326,7 +2326,7 @@ void wxWindow::MSWOnMouseMove(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
// Window gets a click down message followed by a mouse move
@ -2358,7 +2358,7 @@ void wxWindow::MSWOnMouseEnter(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastEvent = wxEVT_ENTER_WINDOW;
@ -2378,7 +2378,7 @@ void wxWindow::MSWOnMouseLeave(int x, int y, WXUINT flags)
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.m_eventObject = this;
m_lastEvent = wxEVT_LEAVE_WINDOW;
@ -2439,7 +2439,7 @@ void wxWindow::MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII)
event.m_eventObject = this;
event.m_keyCode = id;
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
POINT pt ;
GetCursorPos(&pt) ;
@ -2984,7 +2984,7 @@ int APIENTRY _EXPORT
event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE);
event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE);
/* end Albert's fix for control and shift key 26.5 */
event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
event.SetTimestamp(wxApp::sm_lastMessageTime);
wxWindow *win = wxGetActiveWindow();
if (win)

View File

@ -121,7 +121,7 @@ OPTIONS=
!if "$(FINAL)" == "0"
OPT = /Od /Gy
# ***N.B.*** to save space/time, comment out /FR to avoid browse info (.sbr files) being generated
DEBUG_FLAGS= /Zi /D__WXDEBUG__ /DWXDEBUG=1 # /FR
DEBUG_FLAGS= /Zi /D__WXDEBUG__ /DWXDEBUG=1 /DDEBUG=1 # /FR
LINK_DEBUG_FLAGS=-debug:full -debugtype:cv # /PDB:NONE
CRTFLAG=/MD
!else
@ -145,9 +145,9 @@ PRECOMP=/YuWX/WXPREC.H /Fp$(WXDIR)\src\msw\$(PCH) /Fd$(WXDIR)\lib\wx.pdb
MAKEPRECOMP=/YcWX/WXPREC.H
!endif
CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WXMSW__ /DDEBUG=1 $(INC) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) /D__WINDOWS__ /GX /DSTRICT
CPPFLAGS=$(WINFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(EXTRAFLAGS) /D__WXMSW__ $(INC) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) /D__WINDOWS__ /GX /DSTRICT
# If you don't include wxprec.h, use CPPFLAGS2
CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WXMSW__ /DDEBUG=1 $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) /D__WINDOWS__ /GX /DSTRICT
CPPFLAGS2=$(WINFLAGS) $(DEBUG_FLAGS) /D__WXMSW__ $(INC) $(EXTRAFLAGS) $(OPT) $(EXTRADLLFLAGS) $(CRTFLAG) /D__WINDOWS__ /GX /DSTRICT
LINKFLAGS=$(LINK_DEBUG_FLAGS) $(WINLINKFLAGS) -entry:WinMainCRTStartup
DUMMY=dummy

View File

@ -33,10 +33,6 @@
#include "wx/resource.h"
#endif
#if wxUSE_POSTSCRIPT
#include "wx/postscrp.h"
#endif
#include <string.h>
extern char *wxBuffer;
@ -79,13 +75,6 @@ bool wxApp::Initialize()
wxInitializeResourceSystem();
#endif
// For PostScript printing
#if wxUSE_POSTSCRIPT
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
#endif
wxBitmap::InitStandardHandlers();
wxModule::RegisterModules();
@ -121,12 +110,6 @@ void wxApp::CleanUp()
delete wxTheColourDatabase;
wxTheColourDatabase = NULL;
#if wxUSE_POSTSCRIPT
wxInitializePrintSetupData(FALSE);
delete wxThePrintPaperDatabase;
wxThePrintPaperDatabase = NULL;
#endif
wxBitmap::CleanUpHandlers();
delete[] wxBuffer;

View File

@ -146,11 +146,6 @@ void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
};
};
void wxDC::DrawSpline( wxList *points )
{
DrawOpenSpline( points );
};
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;

View File

@ -569,7 +569,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxPaintDC::DrawOpenSpline( wxList *points )
void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;

View File

@ -124,7 +124,7 @@ void wxToolBar::ClearTools()
wxToolBarTool *wxToolBar::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap,
bool toggle, long xPos, long yPos, wxObject *clientData, const wxString& helpString1, const wxString& helpString2)
{
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, (wxBitmap *)NULL, toggle, xPos, yPos, helpString1, helpString2);
wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2);
tool->m_clientData = clientData;
if (xPos > -1)

View File

@ -687,8 +687,7 @@ wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title)
frame->SetAutoLayout(TRUE);
#ifdef __WXMSW__
wxIcon *icon = new wxIcon("DIALOGEDICON");
frame->SetIcon(icon);
frame->SetIcon(wxIcon("DIALOGEDICON"));
#endif
return frame;
}
@ -893,7 +892,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
node = node->Next();
}
}
m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
// m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
}
bool wxResourceManager::EditSelectedResource()
@ -921,8 +920,8 @@ bool wxResourceManager::Edit(wxItemResource *res)
}
else
{
long style = res->GetStyle();
res->SetStyle(style|wxRAISED_BORDER);
// long style = res->GetStyle();
// res->SetStyle(style|wxRAISED_BORDER);
panel = new wxPanel;
wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(),
this);
@ -931,7 +930,7 @@ bool wxResourceManager::Edit(wxItemResource *res)
panel->PushEventHandler(handler);
res->SetStyle(style);
// res->SetStyle(style);
handler->AddChildHandlers(); // Add event handlers for all controls
AssociateResource(res, panel);

View File

@ -230,6 +230,10 @@ int wxResourceSymbolTable::FindHighestId()
node = m_hashTable.Next();
}
// Make sure we don't clash with future standard wxWindows ids
if (highest <= wxID_HIGHEST)
highest = wxID_HIGHEST + 1;
return highest;
}
@ -245,12 +249,49 @@ struct wxStandardSymbolStruct
static wxStandardSymbolStruct sg_StandardSymbols[] =
{
{ "wxID_OK", wxID_OK },
{ "wxID_CANCEL", wxID_CANCEL },
{ "wxID_APPLY", wxID_APPLY },
// { "wxID_STATIC", wxID_STATIC },
{ "wxID_YES", wxID_YES },
{ "wxID_NO", wxID_NO }
{ "wxID_OK", wxID_OK },
{ "wxID_CANCEL", wxID_CANCEL },
{ "wxID_APPLY", wxID_APPLY },
{ "wxID_HELP", wxID_HELP },
{ "wxID_STATIC", wxID_STATIC },
{ "wxID_YES", wxID_YES },
{ "wxID_NO", wxID_NO },
{ "wxID_OPEN", wxID_OPEN },
{ "wxID_CLOSE", wxID_CLOSE },
{ "wxID_NEW", wxID_NEW },
{ "wxID_SAVE", wxID_SAVE },
{ "wxID_SAVEAS", wxID_SAVEAS },
{ "wxID_REVERT", wxID_REVERT },
{ "wxID_EXIT", wxID_EXIT },
{ "wxID_UNDO", wxID_UNDO },
{ "wxID_REDO", wxID_REDO },
{ "wxID_PRINT", wxID_PRINT },
{ "wxID_PRINT_SETUP", wxID_PRINT_SETUP },
{ "wxID_PREVIEW", wxID_PREVIEW },
{ "wxID_ABOUT", wxID_ABOUT },
{ "wxID_HELP_CONTENTS", wxID_HELP_CONTENTS },
{ "wxID_HELP_COMMANDS", wxID_HELP_COMMANDS },
{ "wxID_HELP_PROCEDURES", wxID_HELP_PROCEDURES },
{ "wxID_HELP_CONTEXT", wxID_HELP_CONTEXT },
{ "wxID_CUT", wxID_CUT },
{ "wxID_COPY", wxID_COPY },
{ "wxID_PASTE", wxID_PASTE },
{ "wxID_CLEAR", wxID_CLEAR },
{ "wxID_FIND", wxID_FIND },
{ "wxID_DUPLICATE", wxID_DUPLICATE },
{ "wxID_FILE1", wxID_FILE1 },
{ "wxID_FILE2", wxID_FILE2 },
{ "wxID_FILE3", wxID_FILE3 },
{ "wxID_FILE4", wxID_FILE4 },
{ "wxID_FILE5", wxID_FILE5 },
{ "wxID_FILE6", wxID_FILE6 },
{ "wxID_FILE7", wxID_FILE7 },
{ "wxID_FILE8", wxID_FILE8 },
{ "wxID_FILE9", wxID_FILE9 }
};
static int sg_StandardSymbolSize = (sizeof(sg_StandardSymbols)/sizeof(wxStandardSymbolStruct));

View File

@ -325,6 +325,26 @@ wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name)
else
return NULL;
}
else if (name == "border")
{
wxString border("");
if (propertyWindow->GetWindowStyleFlag() & wxSIMPLE_BORDER)
border = "wxSIMPLE_BORDER";
else if (propertyWindow->GetWindowStyleFlag() & wxRAISED_BORDER)
border = "wxRAISED_BORDER";
else if (propertyWindow->GetWindowStyleFlag() & wxSUNKEN_BORDER)
border = "wxSUNKEN_BORDER";
else if (propertyWindow->GetWindowStyleFlag() & wxDOUBLE_BORDER)
border = "wxDOUBLE_BORDER";
else if (propertyWindow->GetWindowStyleFlag() & wxSTATIC_BORDER)
border = "wxSTATIC_BORDER";
else
border = "wxNO_BORDER";
return new wxProperty("border", border, "string",
new wxStringListValidator(new wxStringList("wxSIMPLE_BORDER", "wxRAISED_BORDER",
"wxSUNKEN_BORDER", "wxDOUBLE_BORDER", "wxSTATIC_BORDER", "wxNO_BORDER", NULL)));
}
else
return NULL;
}
@ -491,6 +511,37 @@ bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property)
else
return FALSE;
}
else if (name == "border")
{
long borderStyle = wxNO_BORDER;
wxString val = property->GetValue().StringValue();
if (val == "wxSIMPLE_BORDER")
borderStyle = wxSIMPLE_BORDER;
else if (val == "wxRAISED_BORDER")
borderStyle = wxRAISED_BORDER;
else if (val == "wxSUNKEN_BORDER")
borderStyle = wxSUNKEN_BORDER;
else if (val == "wxDOUBLE_BORDER")
borderStyle = wxDOUBLE_BORDER;
else if (val == "wxSTATIC_BORDER")
borderStyle = wxSTATIC_BORDER;
else
borderStyle = wxNO_BORDER;
SetWindowStyle(propertyWindow, wxSIMPLE_BORDER, FALSE);
SetWindowStyle(propertyWindow, wxRAISED_BORDER, FALSE);
SetWindowStyle(propertyWindow, wxSUNKEN_BORDER, FALSE);
SetWindowStyle(propertyWindow, wxDOUBLE_BORDER, FALSE);
SetWindowStyle(propertyWindow, wxSTATIC_BORDER, FALSE);
SetWindowStyle(propertyWindow, wxNO_BORDER, FALSE);
SetWindowStyle(propertyWindow, borderStyle, TRUE);
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(propertyWindow);
resource->SetStyle(propertyWindow->GetWindowStyleFlag());
return TRUE;
}
else
return FALSE;
}
@ -503,6 +554,7 @@ void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names)
names.Add("y");
names.Add("width");
names.Add("height");
names.Add("border");
if (!propertyWindow->IsKindOf(CLASSINFO(wxControl)))
{
names.Add("fontPoints");

View File

@ -177,6 +177,12 @@ void wxShapeEvtHandler::OnLeftClick(double x, double y, int keys, int attachment
m_previousHandler->OnLeftClick(x, y, keys, attachment);
}
void wxShapeEvtHandler::OnLeftDoubleClick(double x, double y, int keys, int attachment)
{
if (m_previousHandler)
m_previousHandler->OnLeftDoubleClick(x, y, keys, attachment);
}
void wxShapeEvtHandler::OnRightClick(double x, double y, int keys, int attachment)
{
if (m_previousHandler)
@ -3152,7 +3158,7 @@ void wxShape::OnDrawBranches(wxDC& dc, int attachment, bool erase)
GetBranchingAttachmentPoint(attachment, i, pt, stemPt);
dc.DrawLine((long) stemPt.x, (long) stemPt.y, (long) pt.x, (long) pt.y);
if (GetBranchStyle() & BRANCHING_ATTACHMENT_BLOB)
if ((GetBranchStyle() & BRANCHING_ATTACHMENT_BLOB) && (count > 1))
{
long blobSize=6;
// dc.DrawEllipse((long) (stemPt.x + 0.5 - (blobSize/2.0)), (long) (stemPt.y + 0.5 - (blobSize/2.0)), blobSize, blobSize);

View File

@ -142,6 +142,7 @@ class wxShapeEvtHandler: public wxObject
virtual void OnEraseContents(wxDC& dc);
virtual void OnHighlight(wxDC& dc);
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnSize(double x, double y);
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
@ -221,6 +222,7 @@ class wxShape: public wxShapeEvtHandler
virtual void OnEraseContents(wxDC& dc);
virtual void OnHighlight(wxDC& dc);
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0) {}
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnSize(double x, double y);
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);

View File

@ -275,6 +275,13 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_draggedShape = NULL;
m_dragState = NoDragging;
}
else if (event.LeftDClick())
{
nearest_object->GetEventHandler()->OnLeftDoubleClick((double)x, (double)y, keys, attachment);
m_draggedShape = NULL;
m_dragState = NoDragging;
}
else if (event.RightDown())
{
m_draggedShape = nearest_object;