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:
parent
d14612c662
commit
378f7b3f89
@ -5,14 +5,37 @@ BUGS
|
|||||||
- dmalloc shows duplicate deletion after merging two lines and
|
- dmalloc shows duplicate deletion after merging two lines and
|
||||||
deleting the second half
|
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
|
- 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
|
TODO
|
||||||
=====================================================================
|
=====================================================================
|
||||||
- replacement of llist in window
|
- replacement of llist in window
|
||||||
- undo
|
- 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)
|
||||||
|
@ -11,14 +11,17 @@
|
|||||||
#pragma implementation "wxLayout.h"
|
#pragma implementation "wxLayout.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
# pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wxLayout.h"
|
#include "wxLayout.h"
|
||||||
#include "wx/textfile.h"
|
#include "wx/textfile.h"
|
||||||
|
|
||||||
|
|
||||||
#include "Micon.xpm"
|
#include "Micon.xpm"
|
||||||
|
|
||||||
// for testing only:
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// main program
|
// main program
|
||||||
@ -54,8 +57,6 @@ IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
int orientation = wxPORTRAIT;
|
|
||||||
|
|
||||||
MyFrame::MyFrame(void) :
|
MyFrame::MyFrame(void) :
|
||||||
wxFrame( (wxFrame *) NULL, -1, (char *) "wxLayout", wxPoint(20,20), wxSize(600,360) )
|
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);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
#endif
|
#endif
|
||||||
wxPrintData printData;
|
wxPrintData printData;
|
||||||
printData.SetOrientation(orientation);
|
|
||||||
|
|
||||||
// Pass two printout objects: for preview, and possible printing.
|
// Pass two printout objects: for preview, and possible printing.
|
||||||
wxPrintPreview *preview = new wxPrintPreview(new
|
wxPrintPreview *preview = new wxPrintPreview(new
|
||||||
@ -320,7 +320,6 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
|
|
||||||
wxPrintData printData;
|
wxPrintData printData;
|
||||||
printData.SetOrientation(orientation);
|
|
||||||
|
|
||||||
// Pass two printout objects: for preview, and possible printing.
|
// Pass two printout objects: for preview, and possible printing.
|
||||||
wxPrintPreview *preview = new wxPrintPreview(new wxLayoutPrintout( m_lwin->GetLayoutList()), new wxLayoutPrintout( m_lwin->GetLayoutList()), & printData);
|
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))
|
void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef OS_WIN
|
||||||
wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
|
wxGetApp().SetPrintMode(wxPRINT_WINDOWS);
|
||||||
#else
|
#else
|
||||||
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
#endif
|
#endif
|
||||||
wxPrintData data;
|
wxPrintDialog printerDialog(this, & m_PrintData);
|
||||||
data.SetOrientation(orientation);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
wxPrintDialog printerDialog(this, & data);
|
|
||||||
#else
|
|
||||||
wxGenericPrintDialog printerDialog(this, & data);
|
|
||||||
#endif
|
|
||||||
printerDialog.GetPrintData().SetSetupDialog(TRUE);
|
|
||||||
printerDialog.ShowModal();
|
printerDialog.ShowModal();
|
||||||
|
|
||||||
orientation = printerDialog.GetPrintData().GetOrientation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -359,7 +348,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
#endif
|
#endif
|
||||||
wxPageSetupData data;
|
wxPageSetupData data;
|
||||||
data.SetOrientation(orientation);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxPageSetupDialog pageSetupDialog(this, & data);
|
wxPageSetupDialog pageSetupDialog(this, & data);
|
||||||
@ -369,7 +357,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
|||||||
pageSetupDialog.ShowModal();
|
pageSetupDialog.ShowModal();
|
||||||
|
|
||||||
data = pageSetupDialog.GetPageSetupData();
|
data = pageSetupDialog.GetPageSetupData();
|
||||||
orientation = data.GetOrientation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -377,17 +364,13 @@ void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
|
|
||||||
wxPrintData data;
|
wxPrintData data;
|
||||||
data.SetOrientation(orientation);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxPrintDialog printerDialog(this, & data);
|
wxPrintDialog printerDialog(this, & data);
|
||||||
#else
|
#else
|
||||||
wxGenericPrintDialog printerDialog(this, & data);
|
wxGenericPrintDialog printerDialog(this, & data);
|
||||||
#endif
|
#endif
|
||||||
printerDialog.GetPrintData().SetSetupDialog(TRUE);
|
|
||||||
printerDialog.ShowModal();
|
printerDialog.ShowModal();
|
||||||
|
|
||||||
orientation = printerDialog.GetPrintData().GetOrientation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
||||||
@ -395,16 +378,12 @@ void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT);
|
||||||
|
|
||||||
wxPageSetupData data;
|
wxPageSetupData data;
|
||||||
data.SetOrientation(orientation);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxPageSetupDialog pageSetupDialog(this, & data);
|
wxPageSetupDialog pageSetupDialog(this, & data);
|
||||||
#else
|
#else
|
||||||
wxGenericPageSetupDialog pageSetupDialog(this, & data);
|
wxGenericPageSetupDialog pageSetupDialog(this, & data);
|
||||||
#endif
|
#endif
|
||||||
pageSetupDialog.ShowModal();
|
pageSetupDialog.ShowModal();
|
||||||
|
|
||||||
orientation = pageSetupDialog.GetPageSetupData().GetOrientation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class MyFrame: public wxFrame
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
wxLayoutWindow *m_lwin;
|
wxLayoutWindow *m_lwin;
|
||||||
|
wxPrintData m_PrintData;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -10,13 +10,18 @@
|
|||||||
#pragma implementation "wxllist.h"
|
#pragma implementation "wxllist.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
# pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//#include "Mpch.h"
|
//#include "Mpch.h"
|
||||||
#ifdef M_PREFIX
|
#ifdef M_PREFIX
|
||||||
# include "gui/wxllist.h"
|
# include "gui/wxllist.h"
|
||||||
#else
|
#else
|
||||||
# include "wxllist.h"
|
# include "wxllist.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_PCH
|
#ifndef USE_PCH
|
||||||
# include "iostream.h"
|
# include "iostream.h"
|
||||||
# include <wx/dc.h>
|
# include <wx/dc.h>
|
||||||
@ -198,7 +203,8 @@ wxLayoutObjectIcon::wxLayoutObjectIcon(wxBitmap *icon)
|
|||||||
void
|
void
|
||||||
wxLayoutObjectIcon::Draw(wxDC &dc, wxPoint const &coords)
|
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
|
void
|
||||||
@ -1476,11 +1482,11 @@ void wxLayoutPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom,
|
|||||||
float scale = ScaleDC(&psdc);
|
float scale = ScaleDC(&psdc);
|
||||||
|
|
||||||
psdc.GetSize(&m_PageWidth, &m_PageHeight);
|
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);
|
m_Offset = wxPoint(m_PageWidth/10, m_PageHeight/20);
|
||||||
|
|
||||||
// This is the length of the printable area.
|
// 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
|
m_PrintoutHeight = (int)( m_PrintoutHeight / scale); // we want to use the real paper height
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ inline static bool IsEndOfLine(const char *p, int mode)
|
|||||||
|
|
||||||
void wxLayoutImportText(wxLayoutList *list, wxString const &str, int withflag)
|
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
|
char * cptr = (char *)str.c_str(); // string gets changed only temporarily
|
||||||
const char * begin = cptr;
|
const char * begin = cptr;
|
||||||
char backup;
|
char backup;
|
||||||
|
@ -10,8 +10,13 @@
|
|||||||
# pragma implementation "wxlwindow.h"
|
# pragma implementation "wxlwindow.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include "Mpch.h"
|
#include "wx/wxprec.h"
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
# pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//#include "Mpch.h"
|
||||||
#ifdef M_BASEDIR
|
#ifdef M_BASEDIR
|
||||||
# ifndef USE_PCH
|
# ifndef USE_PCH
|
||||||
# include "Mcommon.h"
|
# include "Mcommon.h"
|
||||||
@ -34,6 +39,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
|
#include <wx/textctrl.h>
|
||||||
#include <wx/dataobj.h>
|
#include <wx/dataobj.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -429,6 +435,7 @@ wxLayoutWindow::ResizeScrollbars(bool exact)
|
|||||||
void
|
void
|
||||||
wxLayoutWindow::Paste(void)
|
wxLayoutWindow::Paste(void)
|
||||||
{
|
{
|
||||||
|
wxString text;
|
||||||
// Read some text
|
// Read some text
|
||||||
if (wxTheClipboard->Open())
|
if (wxTheClipboard->Open())
|
||||||
{
|
{
|
||||||
@ -436,10 +443,28 @@ wxLayoutWindow::Paste(void)
|
|||||||
if (wxTheClipboard->IsSupported(wxDF_TEXT))
|
if (wxTheClipboard->IsSupported(wxDF_TEXT))
|
||||||
{
|
{
|
||||||
wxTheClipboard->GetData(&data);
|
wxTheClipboard->GetData(&data);
|
||||||
wxLayoutImportText( m_llist, data.GetText());
|
text += data.GetText();
|
||||||
}
|
}
|
||||||
wxTheClipboard->Close();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user