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
This commit is contained in:
Karsten Ballüder 1999-04-03 16:57:46 +00:00
parent d14612c662
commit 378f7b3f89
6 changed files with 74 additions and 39 deletions

View File

@ -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
- 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)

View File

@ -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 <stdio.h>
//-----------------------------------------------------------------------------
// 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();
}

View File

@ -48,7 +48,7 @@ class MyFrame: public wxFrame
private:
wxLayoutWindow *m_lwin;
wxPrintData m_PrintData;
};
//-----------------------------------------------------------------------------

View File

@ -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 <wx/dc.h>
@ -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

View File

@ -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;

View File

@ -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 <wx/clipbrd.h>
#include <wx/textctrl.h>
#include <wx/dataobj.h>
#include <ctype.h>
@ -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);
}