\membersection{wxModule::OnExit}\label{wxmoduleonexit}
-\func{virtual bool}{OnExit}{\void}
+\func{virtual void}{OnExit}{\void}
Provide this function with appropriate cleanup for your module.
\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}
{ 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;
#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
{ 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
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;
return (long)((double)(y) * m_scaleY - 0.5);
}
- virtual void DrawOpenSpline( wxList *points ) = 0;
public:
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
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;
return (long)((double)(y) * m_scaleY - 0.5);
}
- virtual void DrawOpenSpline( wxList *points ) = 0;
public:
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
}
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;
return (long)((double)(y) * m_scaleY - 0.5);
}
- virtual void DrawOpenSpline( wxList *points ) = 0;
-
public:
bool m_ok;
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
class WXDLLEXPORT wxFileDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxFileDialog)
-protected:
+public:
wxString m_message;
long m_dialogStyle;
wxWindow * m_parent;
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,
{ 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
{ 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
#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
{
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__
}
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;
return (long)((double)(y) * m_scaleY - 0.5);
}
- virtual void DrawOpenSpline( wxList *points ) = 0;
-
public:
bool m_ok;
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
/////////////////////////////////////////////////////////////////////////////
-// Name: minimal.cpp
+// Name: controls.cpp
// Purpose: Controls wxWindows sample
// Author: Robert Roebling
// Modified by:
/////////////////////////////////////////////////////////////////////////////
#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".
#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
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
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;
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
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
#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"
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)");
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
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__
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__
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);
orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
}
+#endif
+
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{
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()
}
// 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;
// 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
*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";
*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 ));
*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 ));
*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";
*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";
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";
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";
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));
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));
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)
*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";
}
*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
{
if (!m_pstream)
return;
- *m_pstream << "%%Page: " << wxPageNumber++ << "\n";
+ *m_pstream << "%%Page: " << (wxPageNumber++) << "\n";
// *m_pstream << "matrix currentmatrix\n";
// Added by Chris Breeze
#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))
#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;
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));
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));
* 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)
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
#include "wx/window.h"
#include "wx/menu.h"
#include "wx/frame.h"
+#include "wx/msgdlg.h"
+#include "wx/textdlg.h"
#endif
#if wxUSE_IOSTREAMH
#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("");
+}
+
/////////////////////////////////////////////////////////////////////////////
-// Name: choicesg.cpp
+// Name: choicdgg.cpp
// Purpose: Choice dialogs
// Author: Julian Smart
// Modified by:
#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,
}
-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;
-}
-
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):
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("");
-}
#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"
// For PostScript printing
#if wxUSE_POSTSCRIPT
+/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
+ */
#endif
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
+/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
+ */
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
}
}
-void wxDC::DrawSpline( wxList *points )
-{
- DrawOpenSpline( points );
-}
-
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
}
}
-void wxPaintDC::DrawOpenSpline( wxList *points )
+void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
#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"
// For PostScript printing
#if wxUSE_POSTSCRIPT
+/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
+ */
#endif
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
+/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
+ */
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
}
}
-void wxDC::DrawSpline( wxList *points )
-{
- DrawOpenSpline( points );
-}
-
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
}
}
-void wxPaintDC::DrawOpenSpline( wxList *points )
+void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
#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>
// For PostScript printing
#if wxUSE_POSTSCRIPT
+/* Done using wxModule now
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
+*/
#endif
wxBitmap::InitStandardHandlers();
wxTheColourDatabase = NULL;
#if wxUSE_POSTSCRIPT
+/* Done using wxModule now
wxInitializePrintSetupData(FALSE);
delete wxThePrintPaperDatabase;
wxThePrintPaperDatabase = NULL;
+*/
#endif
wxBitmap::CleanUpHandlers();
};
};
-void wxDC::DrawSpline( wxList *points )
-{
- DrawOpenSpline( points );
-};
-
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
}
}
-void wxWindowDC::DrawOpenSpline( wxList *points )
+void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
// 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,
// 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);
wxDialog::~wxDialog()
{
m_modalShowing = FALSE;
- if (!USE_INVISIBLE_RESIZE && m_mainWidget)
+ if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
{
XtUnmapWidget((Widget) m_mainWidget);
}
if (show)
{
- if (!USE_INVISIBLE_RESIZE)
+ if (!wxUSE_INVISIBLE_RESIZE)
XtMapWidget(XtParent((Widget) m_mainWidget));
else
XtManageChild((Widget) m_mainWidget) ;
}
else
{
- if (!USE_INVISIBLE_RESIZE)
+ if (!wxUSE_INVISIBLE_RESIZE)
XtUnmapWidget(XtParent((Widget) m_mainWidget));
else
XtUnmanageChild((Widget) m_mainWidget) ;
#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,
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,
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));
// 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
#endif
#include "wx/msw/private.h"
-#include "wx/postscrp.h"
#include "wx/log.h"
#include "wx/module.h"
wxInitializeResourceSystem();
#endif
- // For PostScript printing
- #if wxUSE_POSTSCRIPT
- wxInitializePrintSetupData();
- wxThePrintPaperDatabase = new wxPrintPaperDatabase;
- wxThePrintPaperDatabase->CreateDatabase();
- #endif
-
wxBitmap::InitStandardHandlers();
#if defined(__WIN95__)
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++;
delete wxTheColourDatabase;
wxTheColourDatabase = NULL;
-#if wxUSE_POSTSCRIPT
- wxInitializePrintSetupData(FALSE);
- delete wxThePrintPaperDatabase;
- wxThePrintPaperDatabase = NULL;
-#endif
-
wxBitmap::CleanUpHandlers();
delete[] wxBuffer;
bool enterLoop)
{
#ifndef __WXDEBUG__ // take everything into a try-except block in release build
- __try {
+ try {
#endif
wxhInstance = (HINSTANCE) hInstance;
return retValue;
#ifndef __WXDEBUG__ // catch exceptions only in release build
}
- __except ( EXCEPTION_EXECUTE_HANDLER ) {
+ except ( EXCEPTION_EXECUTE_HANDLER ) {
/*
if ( wxTheApp )
wxTheApp->OnFatalException();
*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();
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)
{
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
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 \
$(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 \
$(COMMDIR)\module.obj \
$(COMMDIR)\odbc.obj \
$(COMMDIR)\object.obj \
- $(COMMDIR)\postscrp.obj \
$(COMMDIR)\prntbase.obj \
$(COMMDIR)\resource.obj \
$(COMMDIR)\tbarbase.obj \
$(OLEDIR)\uuid.obj
+# Add $(NONESSENTIALOBJS) if wanting generic dialogs, PostScript etc.
OBJECTS = $(COMMONOBJS) $(GENERICOBJS) $(MSWOBJS)
# Normal, static library
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);
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)
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;
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;
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;
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;
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;
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;
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;
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;
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;
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
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;
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;
event.m_eventObject = this;
event.m_keyCode = id;
- event.SetTimestamp(wxApp::sm_lastMessageTime); /* MATTHEW: timeStamp */
+ event.SetTimestamp(wxApp::sm_lastMessageTime);
POINT pt ;
GetCursorPos(&pt) ;
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)
!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
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
#include "wx/resource.h"
#endif
-#if wxUSE_POSTSCRIPT
-#include "wx/postscrp.h"
-#endif
-
#include <string.h>
extern char *wxBuffer;
wxInitializeResourceSystem();
#endif
- // For PostScript printing
-#if wxUSE_POSTSCRIPT
- wxInitializePrintSetupData();
- wxThePrintPaperDatabase = new wxPrintPaperDatabase;
- wxThePrintPaperDatabase->CreateDatabase();
-#endif
-
wxBitmap::InitStandardHandlers();
wxModule::RegisterModules();
delete wxTheColourDatabase;
wxTheColourDatabase = NULL;
-#if wxUSE_POSTSCRIPT
- wxInitializePrintSetupData(FALSE);
- delete wxThePrintPaperDatabase;
- wxThePrintPaperDatabase = NULL;
-#endif
-
wxBitmap::CleanUpHandlers();
delete[] wxBuffer;
};
};
-void wxDC::DrawSpline( wxList *points )
-{
- DrawOpenSpline( points );
-};
-
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
}
}
-void wxPaintDC::DrawOpenSpline( wxList *points )
+void wxPaintDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
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)
frame->SetAutoLayout(TRUE);
#ifdef __WXMSW__
- wxIcon *icon = new wxIcon("DIALOGEDICON");
- frame->SetIcon(icon);
+ frame->SetIcon(wxIcon("DIALOGEDICON"));
#endif
return frame;
}
node = node->Next();
}
}
- m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
+// m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
}
bool wxResourceManager::EditSelectedResource()
}
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);
panel->PushEventHandler(handler);
- res->SetStyle(style);
+// res->SetStyle(style);
handler->AddChildHandlers(); // Add event handlers for all controls
AssociateResource(res, panel);
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;
}
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));
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;
}
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;
}
names.Add("y");
names.Add("width");
names.Add("height");
+ names.Add("border");
if (!propertyWindow->IsKindOf(CLASSINFO(wxControl)))
{
names.Add("fontPoints");
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)
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);
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);
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);
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;