wxGTK private clipboard data format and private selection are broken!
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4402
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
// this might be the case if the cursor is at the end of the
// line or on a command object:
{
// this might be the case if the cursor is at the end of the
// line or on a command object:
- if(cursorSize->y < WXLO_MINIMUM_CURSOR_WIDTH)
+ if(cursorSize->x < WXLO_MINIMUM_CURSOR_WIDTH)
{
CoordType width, height, descent;
dc.GetTextExtent(WXLO_CURSORCHAR, &width, &height, &descent);
{
CoordType width, height, descent;
dc.GetTextExtent(WXLO_CURSORCHAR, &width, &height, &descent);
#ifdef WXLAYOUT_USE_CARET
m_caret->Move(coords);
#else // !WXLAYOUT_USE_CARET
#ifdef WXLAYOUT_USE_CARET
m_caret->Move(coords);
#else // !WXLAYOUT_USE_CARET
+
+ wxASSERT(m_CursorSize.x >= WXLO_MINIMUM_CURSOR_WIDTH);
dc.SetBrush(*wxWHITE_BRUSH);
//FIXME: wxGTK XOR is borken at the moment!!!dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
dc.SetBrush(*wxWHITE_BRUSH);
//FIXME: wxGTK XOR is borken at the moment!!!dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
wxASSERT(m_Selection.m_valid == false);
WXLO_DEBUG(("Continuing selection at %ld/%ld", cpos.x, cpos.y));
wxASSERT(m_Selection.m_valid == false);
WXLO_DEBUG(("Continuing selection at %ld/%ld", cpos.x, cpos.y));
- m_Selection.m_ScreenB = spos;
- m_Selection.m_CursorB = cpos;}
+ m_Selection.m_ScreenB = spos;
+ m_Selection.m_CursorB = cpos;
+}
void
wxLayoutList::EndSelection(const wxPoint& cposOrig, const wxPoint& spos)
{
wxPoint cpos(cposOrig);
void
wxLayoutList::EndSelection(const wxPoint& cposOrig, const wxPoint& spos)
{
wxPoint cpos(cposOrig);
- if(cpos.x == -1)
- cpos = m_CursorPos;
- ContinueSelection(cpos);
+ if(cpos.x == -1) cpos = m_CursorPos;
+ ContinueSelection(cpos, spos);
WXLO_DEBUG(("Ending selection at %ld/%ld", cpos.x, cpos.y));
// we always want m_CursorA <= m_CursorB!
if( m_Selection.m_CursorA > m_Selection.m_CursorB )
WXLO_DEBUG(("Ending selection at %ld/%ld", cpos.x, cpos.y));
// we always want m_CursorA <= m_CursorB!
if( m_Selection.m_CursorA > m_Selection.m_CursorB )
# define WXMENU_LAYOUT_LCLICK 1111
# define WXMENU_LAYOUT_RCLICK 1112
# define WXMENU_LAYOUT_DBLCLICK 1113
# define WXMENU_LAYOUT_LCLICK 1111
# define WXMENU_LAYOUT_RCLICK 1112
# define WXMENU_LAYOUT_DBLCLICK 1113
-#else // for Mahogany only:
+#else // for Mahogany only
# include "MObject.h"
#endif
# include "MObject.h"
#endif
static const int X_SCROLL_PAGE = 10;
static const int Y_SCROLL_PAGE = 20;
static const int X_SCROLL_PAGE = 10;
static const int Y_SCROLL_PAGE = 20;
+
+
+#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
+
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
case WXLOWIN_MENU_LUP:
if ( m_Selecting )
{
case WXLOWIN_MENU_LUP:
if ( m_Selecting )
{
- m_llist->EndSelection();
+ // end selection at the cursor position corresponding to the
+ // current mouse position, but don´t move cursor there.
+ m_llist->EndSelection(cursorPos,m_ClickPosition);
m_Selecting = false;
RequestUpdate(); // TODO: we don't have to redraw everything!
m_Selecting = false;
RequestUpdate(); // TODO: we don't have to redraw everything!
if(keyCode == WXK_F1)
{
m_llist->Debug();
if(keyCode == WXK_F1)
{
m_llist->Debug();
FindAgain();
break;
default:
FindAgain();
break;
default:
+ // we don't handle it, maybe an accelerator?
+ event.Skip();
;
}
else if( IsEditable() )
;
}
else if( IsEditable() )
+ // we don't handle it, maybe an accelerator?
+ event.Skip();
SetDirty();
break;
default:
SetDirty();
break;
default:
+ // we don't handle it, maybe an accelerator?
+ event.Skip();
m_llist->Insert((char)keyCode);
SetDirty();
}
m_llist->Insert((char)keyCode);
SetDirty();
}
+ else
+ // we don't handle it, maybe an accelerator?
+ event.Skip();
break;
}
}
}// if(IsEditable())
break;
}
}
}// if(IsEditable())
+ else
+ // we don't handle it, maybe an accelerator?
+ event.Skip();
}// first switch()
if ( m_Selecting )
}// first switch()
if ( m_Selecting )
ScrollToCursor();
// refresh the screen
RequestUpdate(m_llist->GetUpdateRect());
ScrollToCursor();
// refresh the screen
RequestUpdate(m_llist->GetUpdateRect());
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
// clipboard operations
//
// ----------------------------------------------------------------------------
// clipboard operations
//
// ----------------------------------------------------------------------------
wxLayoutDataObject wxldo;
if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
{
wxLayoutDataObject wxldo;
if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
{
- wxTheClipboard->GetData(&wxldo);
+ wxTheClipboard->GetData(wxldo);
{
}
//FIXME: missing functionality m_llist->Insert(wxldo.GetList());
{
}
//FIXME: missing functionality m_llist->Insert(wxldo.GetList());
-#if 0 //RE_ENABLE FIXME!!
- if (wxTheClipboard->IsSupported( data.GetFormat() ))
+ if (wxTheClipboard->IsSupported( data.GetFormat() )
+ && wxTheClipboard->GetData(data) )
- wxTheClipboard->GetData(&data);
wxString text = data.GetText();
wxLayoutImportText( m_llist, text);
SetDirty();
}
wxString text = data.GetText();
wxLayoutImportText( m_llist, text);
SetDirty();
}
}
wxTheClipboard->Close();
}
}
wxTheClipboard->Close();
}
m_llist->EndSelection();
}
m_llist->EndSelection();
}
wxLayoutDataObject wldo;
wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate);
if(! llist)
wxLayoutDataObject wldo;
wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate);
if(! llist)
text = text.Mid(0,len-1);
}
text = text.Mid(0,len-1);
}
if (wxTheClipboard->Open())
{
wxTextDataObject *data = new wxTextDataObject( text );
if (wxTheClipboard->Open())
{
wxTextDataObject *data = new wxTextDataObject( text );
wxTheClipboard->Close();
return rc;
}
wxTheClipboard->Close();
return rc;
}
-#endif //FIXME CLIPBOARD
// searching
// ----------------------------------------------------------------------------
// searching
// ----------------------------------------------------------------------------
bool
wxLayoutWindow::Find(const wxString &needle,
wxPoint * fromWhere,
const wxString &configPath)
{
bool
wxLayoutWindow::Find(const wxString &needle,
wxPoint * fromWhere,
const wxString &configPath)
{
wxPoint found;
if(needle.Length() == 0)
wxPoint found;
if(needle.Length() == 0)
RequestUpdate();
return true;
}
RequestUpdate();
return true;
}
bool rc = Find(m_FindString);
return rc;
}
bool rc = Find(m_FindString);
return rc;
}
// ----------------------------------------------------------------------------
// popup menu stuff
// ----------------------------------------------------------------------------
// popup menu stuff
-#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
-
enum
{
WXLOWIN_MENU_LARGER = WXLOWIN_MENU_FIRST,
enum
{
WXLOWIN_MENU_LARGER = WXLOWIN_MENU_FIRST,
/// find string in buffer
bool Find(const wxString &needle,
wxPoint * fromWhere = NULL,
const wxString &configPath = "MsgViewFindString");
/// find the same string again
bool FindAgain(void);
/// find string in buffer
bool Find(const wxString &needle,
wxPoint * fromWhere = NULL,
const wxString &configPath = "MsgViewFindString");
/// find the same string again
bool FindAgain(void);
void EnablePopup(bool enable = true) { m_DoPopupMenu = enable; }
void EnablePopup(bool enable = true) { m_DoPopupMenu = enable; }