m_CursorStyleInfo = m_DefaultStyleInfo;
}
+void
+wxLayoutList::Read(wxString &istr)
+{
+ while(istr.Length())
+ {
+ wxLayoutObject *obj = wxLayoutObject::Read(istr);
+ if(obj)
+ Insert(obj);
+ }
+}
+
+
void
wxLayoutList::SetFont(int family, int size, int style, int weight,
int underline, wxColour *fg,
}
InvalidateUpdateRect();
-#ifdef DEBUG
- if ( m_Selection.m_valid )
- {
- WXLO_DEBUG(("Selection is %s : %ld,%ld/%ld,%ld",
- m_Selection.m_valid ? "valid" : "invalid",
- m_Selection.m_CursorA.x, m_Selection.m_CursorA.y,
- m_Selection.m_CursorB.x, m_Selection.m_CursorB.y));
- }
-#endif
+ WXLO_DEBUG(("Selection is %s : l%d,%ld/%ld,%ld",
+ m_Selection.m_valid ? "valid" : "invalid",
+ m_Selection.m_CursorA.x, m_Selection.m_CursorA.y,
+ m_Selection.m_CursorB.x, m_Selection.m_CursorB.y));
}
wxLayoutObject *
exp->content.object->Write(string);
delete exp;
}
-
wxlo->SetLayoutData(string);
}
return llist;
-#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 1
+#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
// ----------------------------------------------------------------------------
// event tables
if ( IsDirectionKey(keyCode) )
{
// just continue the old selection
- if ( m_Selecting )
+ if ( m_Selecting && event.ShiftDown() )
+ m_llist->ContinueSelection();
+ else
{
+ m_llist->DiscardSelection();
+ m_Selecting = false;
if( event.ShiftDown() )
- m_llist->ContinueSelection();
- else
{
- m_llist->DiscardSelection();
- m_Selecting = false;
+ m_Selecting = true;
+ m_llist->StartSelection();
}
}
- else if( event.ShiftDown() )
- {
- m_Selecting = true;
- m_llist->StartSelection();
- }
}
// If needed, make cursor visible:
m_llist->DeleteToEndOfLine();
SetDirty();
break;
+ case 'c':
+ Copy();
+ break;
case 'v':
- Paste();
+ // if SHIFT is down, use primary selection
+ Paste( event.ShiftDown() );
break;
case 'x':
Cut();
{
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
wxLayoutDataObject wxldo;
- if ( wxTheClipboard->GetData(wxldo) )
+ if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
{
- //FIXME: missing functionality m_llist->Insert(wxldo.GetList());
- wxLayoutImportText(m_llist, wxldo.GetLayoutData());
- SetDirty();
+ if(wxTheClipboard->GetData(wxldo))
+ {
+ wxString str = wxldo.GetLayoutData();
+ m_llist->Read(str);
+ RequestUpdate();
+ }
}
else
#endif
m_llist->EndSelection();
}
-#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
- // the data object which holds all different data objects, one for each
- // format we support
- wxDataObjectComposite *data = new wxDataObjectComposite;
-#endif
-
wxLayoutDataObject *wldo = new wxLayoutDataObject;
wxLayoutList *llist = m_llist->GetSelection(wldo, invalidate);
if(! llist)
- {
- delete wldo;
- delete data;
return FALSE;
- }
// Export selection as text:
wxString text;
wxLayoutExportObject *exp;
}
delete llist;
- bool rc;
// The exporter always appends a newline, so we chop it off if it
// is there:
{
if (wxTheClipboard->Open())
{
+ wxTextDataObject *data = new wxTextDataObject( text );
+ bool rc;
+
+ rc = wxTheClipboard->SetData( data );
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
- data->Add(wldo, TRUE /* preferred */);
- data->Add(new wxTextDataObject(text));
+ rc |= wxTheClipboard->SetData( wldo );
#endif
- rc = wxTheClipboard->SetData( data );
wxTheClipboard->Close();
+ return rc;
}
else
- rc = FALSE;
-
- delete wldo;
- delete data;
- return rc;
+ delete wldo;
+
+ return FALSE;
}
bool