From 378f7b3f897e5959d6c8d89b4a7bc514b7617396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ball=C3=BCder?= Date: Sat, 3 Apr 1999 16:57:46 +0000 Subject: [PATCH] Compiles and runs again with new printing code (which is still broken in wxGTK). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2033 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- user/wxLayout/TODO | 31 +++++++++++++++++++++++++++---- user/wxLayout/wxLayout.cpp | 35 +++++++---------------------------- user/wxLayout/wxLayout.h | 2 +- user/wxLayout/wxllist.cpp | 14 ++++++++++---- user/wxLayout/wxlparser.cpp | 2 ++ user/wxLayout/wxlwindow.cpp | 29 +++++++++++++++++++++++++++-- 6 files changed, 74 insertions(+), 39 deletions(-) diff --git a/user/wxLayout/TODO b/user/wxLayout/TODO index 63008b8ed9..e7a6b8a1e3 100644 --- a/user/wxLayout/TODO +++ b/user/wxLayout/TODO @@ -5,14 +5,37 @@ BUGS - dmalloc shows duplicate deletion after merging two lines and deleting the second half -- printout page calculation still a bit wrong - word wrap for objects with lots of non-space needs to search in positive -direction if begin of first object is reached + direction if begin of first object is reached + + - delete in empty line doesn't always work + - fix initial scrollbar sizes + - fix horiz scrollbar size + - occasionally wraps lines wongly (twice) ?? TODO ===================================================================== - replacement of llist in window - undo -- Selections -- More optimisations +- Selections!!! + +- More optimisations: + +- let each line have a pointer to the last layoutcommand and let that + one only store the settings that changed, then we no longer need to + recalculate all the lines + + - update rectangle (needs support in wxllist and wxWindows) + +- fix(simplify) cursor size calculation: don't use icon cursor if there + is no cursor object + + - copy/cut/selections + - UNDO + +- cut&paste (paste is there but broken in wxGTK) + The current paste in wxGTK is broken, support is there. + Once selections are there, add copy (trivial). + +- DragNDrop (waiting for wxGTK/gtk1.2 & GNOME 1.0 / Debian Slink) diff --git a/user/wxLayout/wxLayout.cpp b/user/wxLayout/wxLayout.cpp index fe8fa471ee..ad3e4ebca0 100644 --- a/user/wxLayout/wxLayout.cpp +++ b/user/wxLayout/wxLayout.cpp @@ -11,14 +11,17 @@ #pragma implementation "wxLayout.h" #endif +#include "wx/wxprec.h" +#ifdef __BORLANDC__ +# pragma hdrstop +#endif + #include "wxLayout.h" #include "wx/textfile.h" #include "Micon.xpm" -// for testing only: -#include //----------------------------------------------------------------------------- // main program @@ -54,8 +57,6 @@ IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame ) END_EVENT_TABLE() - int orientation = wxPORTRAIT; - MyFrame::MyFrame(void) : wxFrame( (wxFrame *) NULL, -1, (char *) "wxLayout", wxPoint(20,20), wxSize(600,360) ) { @@ -296,7 +297,6 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); #endif wxPrintData printData; - printData.SetOrientation(orientation); // Pass two printout objects: for preview, and possible printing. wxPrintPreview *preview = new wxPrintPreview(new @@ -320,7 +320,6 @@ 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 wxLayoutPrintout( m_lwin->GetLayoutList()), new wxLayoutPrintout( m_lwin->GetLayoutList()), & printData); @@ -332,23 +331,13 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ +#ifdef OS_WIN wxGetApp().SetPrintMode(wxPRINT_WINDOWS); #else wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); #endif - wxPrintData data; - data.SetOrientation(orientation); - -#ifdef __WXMSW__ - wxPrintDialog printerDialog(this, & data); -#else - wxGenericPrintDialog printerDialog(this, & data); -#endif - printerDialog.GetPrintData().SetSetupDialog(TRUE); + wxPrintDialog printerDialog(this, & m_PrintData); printerDialog.ShowModal(); - - orientation = printerDialog.GetPrintData().GetOrientation(); } void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) @@ -359,7 +348,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); #endif wxPageSetupData data; - data.SetOrientation(orientation); #ifdef __WXMSW__ wxPageSetupDialog pageSetupDialog(this, & data); @@ -369,7 +357,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) pageSetupDialog.ShowModal(); data = pageSetupDialog.GetPageSetupData(); - orientation = data.GetOrientation(); } void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) @@ -377,17 +364,13 @@ void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxPrintData data; - data.SetOrientation(orientation); #ifdef __WXMSW__ wxPrintDialog printerDialog(this, & data); #else wxGenericPrintDialog printerDialog(this, & data); #endif - printerDialog.GetPrintData().SetSetupDialog(TRUE); printerDialog.ShowModal(); - - orientation = printerDialog.GetPrintData().GetOrientation(); } void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event)) @@ -395,16 +378,12 @@ void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event)) wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); wxPageSetupData data; - data.SetOrientation(orientation); - #ifdef __WXMSW__ wxPageSetupDialog pageSetupDialog(this, & data); #else wxGenericPageSetupDialog pageSetupDialog(this, & data); #endif pageSetupDialog.ShowModal(); - - orientation = pageSetupDialog.GetPageSetupData().GetOrientation(); } diff --git a/user/wxLayout/wxLayout.h b/user/wxLayout/wxLayout.h index ea811b8c67..d64cd74149 100644 --- a/user/wxLayout/wxLayout.h +++ b/user/wxLayout/wxLayout.h @@ -48,7 +48,7 @@ class MyFrame: public wxFrame private: wxLayoutWindow *m_lwin; - + wxPrintData m_PrintData; }; //----------------------------------------------------------------------------- diff --git a/user/wxLayout/wxllist.cpp b/user/wxLayout/wxllist.cpp index 3e783aa27d..3d9054444f 100644 --- a/user/wxLayout/wxllist.cpp +++ b/user/wxLayout/wxllist.cpp @@ -10,13 +10,18 @@ #pragma implementation "wxllist.h" #endif +#include "wx/wxprec.h" +#ifdef __BORLANDC__ +# pragma hdrstop +#endif + + //#include "Mpch.h" #ifdef M_PREFIX # include "gui/wxllist.h" #else # include "wxllist.h" #endif - #ifndef USE_PCH # include "iostream.h" # include @@ -198,7 +203,8 @@ wxLayoutObjectIcon::wxLayoutObjectIcon(wxBitmap *icon) void wxLayoutObjectIcon::Draw(wxDC &dc, wxPoint const &coords) { - dc.DrawBitmap(*m_Icon, coords.x, coords.y-m_Icon->GetHeight()); + dc.DrawBitmap(*m_Icon, coords.x, coords.y-m_Icon->GetHeight(), + (m_Icon->GetMask() == NULL) ? FALSE : TRUE); } void @@ -1476,11 +1482,11 @@ void wxLayoutPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, float scale = ScaleDC(&psdc); psdc.GetSize(&m_PageWidth, &m_PageHeight); - // This sets a left/top origin of 10% and 20%: + // This sets a left/top origin of 10% and 5%: m_Offset = wxPoint(m_PageWidth/10, m_PageHeight/20); // This is the length of the printable area. - m_PrintoutHeight = m_PageHeight - (int) (m_PageHeight * 0.1); + m_PrintoutHeight = m_PageHeight - (int) (m_PageHeight * 0.15); m_PrintoutHeight = (int)( m_PrintoutHeight / scale); // we want to use the real paper height diff --git a/user/wxLayout/wxlparser.cpp b/user/wxLayout/wxlparser.cpp index e078883b7c..d9cfe9b3fe 100644 --- a/user/wxLayout/wxlparser.cpp +++ b/user/wxLayout/wxlparser.cpp @@ -34,6 +34,8 @@ inline static bool IsEndOfLine(const char *p, int mode) void wxLayoutImportText(wxLayoutList *list, wxString const &str, int withflag) { + if(str.Length() == 0) + return; char * cptr = (char *)str.c_str(); // string gets changed only temporarily const char * begin = cptr; char backup; diff --git a/user/wxLayout/wxlwindow.cpp b/user/wxLayout/wxlwindow.cpp index 03d1a6bd09..1e34fe3ac8 100644 --- a/user/wxLayout/wxlwindow.cpp +++ b/user/wxLayout/wxlwindow.cpp @@ -10,8 +10,13 @@ # pragma implementation "wxlwindow.h" #endif -//#include "Mpch.h" +#include "wx/wxprec.h" +#ifdef __BORLANDC__ +# pragma hdrstop +#endif + +//#include "Mpch.h" #ifdef M_BASEDIR # ifndef USE_PCH # include "Mcommon.h" @@ -34,6 +39,7 @@ #endif #include +#include #include #include @@ -429,6 +435,7 @@ wxLayoutWindow::ResizeScrollbars(bool exact) void wxLayoutWindow::Paste(void) { + wxString text; // Read some text if (wxTheClipboard->Open()) { @@ -436,10 +443,28 @@ wxLayoutWindow::Paste(void) if (wxTheClipboard->IsSupported(wxDF_TEXT)) { wxTheClipboard->GetData(&data); - wxLayoutImportText( m_llist, data.GetText()); + text += data.GetText(); } wxTheClipboard->Close(); } +#ifdef __WXGTK__ + /* wxGTK's sophisticated multi-format copy/paste is not supported + by 99% of the X11 clients available. If there was no selection, + do the dumb thing, too: + */ +#if 0 + /* Unfortunately, this little hack doesn't work. So I'll go back to + pure X11. */ + if(text.Length() == 0) + { + wxTextCtrl tmp_tctrl(this,-1); + tmp_tctrl.Paste(); + text += tmp_tctrl.GetValue(); + } +#endif + +#endif + wxLayoutImportText( m_llist, text); }