mouse selection handling fixed

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 commit is contained in:
Karsten Ballüder
1999-11-06 16:59:44 +00:00
parent 41ee29dfda
commit b581c7e649
4 changed files with 34 additions and 27 deletions

View File

@@ -1230,7 +1230,7 @@ wxLayoutLine::Layout(wxDC &dc,
{ {
// this might be the case if the cursor is at the end of the // this might be the case if the cursor is at the end of the
// line or on a command object: // line or on a command object:
if(cursorSize->y < WXLO_MINIMUM_CURSOR_WIDTH) if(cursorSize->x < WXLO_MINIMUM_CURSOR_WIDTH)
{ {
CoordType width, height, descent; CoordType width, height, descent;
dc.GetTextExtent(WXLO_CURSORCHAR, &width, &height, &descent); dc.GetTextExtent(WXLO_CURSORCHAR, &width, &height, &descent);
@@ -2479,6 +2479,8 @@ wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate)
#ifdef WXLAYOUT_USE_CARET #ifdef WXLAYOUT_USE_CARET
m_caret->Move(coords); m_caret->Move(coords);
#else // !WXLAYOUT_USE_CARET #else // !WXLAYOUT_USE_CARET
wxASSERT(m_CursorSize.x >= WXLO_MINIMUM_CURSOR_WIDTH);
dc.SetBrush(*wxWHITE_BRUSH); dc.SetBrush(*wxWHITE_BRUSH);
//FIXME: wxGTK XOR is borken at the moment!!!dc.SetLogicalFunction(wxXOR); //FIXME: wxGTK XOR is borken at the moment!!!dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID)); dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
@@ -2544,16 +2546,16 @@ wxLayoutList::ContinueSelection(const wxPoint& cposOrig, const wxPoint& spos)
wxASSERT(m_Selection.m_valid == false); wxASSERT(m_Selection.m_valid == false);
WXLO_DEBUG(("Continuing selection at %ld/%ld", cpos.x, cpos.y)); WXLO_DEBUG(("Continuing selection at %ld/%ld", cpos.x, cpos.y));
m_Selection.m_ScreenB = spos; m_Selection.m_ScreenB = spos;
m_Selection.m_CursorB = cpos;} m_Selection.m_CursorB = cpos;
}
void void
wxLayoutList::EndSelection(const wxPoint& cposOrig, const wxPoint& spos) wxLayoutList::EndSelection(const wxPoint& cposOrig, const wxPoint& spos)
{ {
wxPoint cpos(cposOrig); wxPoint cpos(cposOrig);
if(cpos.x == -1) if(cpos.x == -1) cpos = m_CursorPos;
cpos = m_CursorPos; ContinueSelection(cpos, spos);
ContinueSelection(cpos);
WXLO_DEBUG(("Ending selection at %ld/%ld", cpos.x, cpos.y)); WXLO_DEBUG(("Ending selection at %ld/%ld", cpos.x, cpos.y));
// we always want m_CursorA <= m_CursorB! // we always want m_CursorA <= m_CursorB!
if( m_Selection.m_CursorA > m_Selection.m_CursorB ) if( m_Selection.m_CursorA > m_Selection.m_CursorB )

View File

@@ -28,7 +28,7 @@
# define WXMENU_LAYOUT_LCLICK 1111 # define WXMENU_LAYOUT_LCLICK 1111
# define WXMENU_LAYOUT_RCLICK 1112 # define WXMENU_LAYOUT_RCLICK 1112
# define WXMENU_LAYOUT_DBLCLICK 1113 # define WXMENU_LAYOUT_DBLCLICK 1113
#else // for Mahogany only: #else // for Mahogany only
# include "MObject.h" # include "MObject.h"
#endif #endif

View File

@@ -86,6 +86,10 @@
static const int X_SCROLL_PAGE = 10; static const int X_SCROLL_PAGE = 10;
static const int Y_SCROLL_PAGE = 20; static const int Y_SCROLL_PAGE = 20;
#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// event tables // event tables
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -394,7 +398,9 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
case WXLOWIN_MENU_LUP: case WXLOWIN_MENU_LUP:
if ( m_Selecting ) if ( m_Selecting )
{ {
m_llist->EndSelection(); // end selection at the cursor position corresponding to the
// current mouse position, but don<6F>t move cursor there.
m_llist->EndSelection(cursorPos,m_ClickPosition);
m_Selecting = false; m_Selecting = false;
RequestUpdate(); // TODO: we don't have to redraw everything! RequestUpdate(); // TODO: we don't have to redraw everything!
@@ -457,7 +463,6 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
if(keyCode == WXK_F1) if(keyCode == WXK_F1)
{ {
m_llist->Debug(); m_llist->Debug();
event.skip();
return; return;
} }
#endif #endif
@@ -571,6 +576,8 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
FindAgain(); FindAgain();
break; break;
default: default:
// we don't handle it, maybe an accelerator?
event.Skip();
; ;
} }
else if( IsEditable() ) else if( IsEditable() )
@@ -636,7 +643,8 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
break; break;
#endif #endif
default: default:
; // we don't handle it, maybe an accelerator?
event.Skip();
} }
} }
// ALT only: // ALT only:
@@ -650,7 +658,8 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
SetDirty(); SetDirty();
break; break;
default: default:
; // we don't handle it, maybe an accelerator?
event.Skip();
} }
} }
// no control keys: // no control keys:
@@ -715,10 +724,16 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
m_llist->Insert((char)keyCode); m_llist->Insert((char)keyCode);
SetDirty(); SetDirty();
} }
else
// we don't handle it, maybe an accelerator?
event.Skip();
break; break;
} }
} }
}// if(IsEditable()) }// if(IsEditable())
else
// we don't handle it, maybe an accelerator?
event.Skip();
}// first switch() }// first switch()
if ( m_Selecting ) if ( m_Selecting )
@@ -729,7 +744,6 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
ScrollToCursor(); ScrollToCursor();
// refresh the screen // refresh the screen
RequestUpdate(m_llist->GetUpdateRect()); RequestUpdate(m_llist->GetUpdateRect());
event.Skip();
} }
void void
@@ -1068,6 +1082,7 @@ wxLayoutWindow::ResizeScrollbars(bool exact)
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
//
// clipboard operations // clipboard operations
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1086,7 +1101,7 @@ wxLayoutWindow::Paste(bool primary)
wxLayoutDataObject wxldo; wxLayoutDataObject wxldo;
if (wxTheClipboard->IsSupported( wxldo.GetFormat() )) 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());
@@ -1094,16 +1109,14 @@ wxLayoutWindow::Paste(bool primary)
else else
#endif #endif
{ {
#if 0 //RE_ENABLE FIXME!!
wxTextDataObject data; wxTextDataObject data;
if (wxTheClipboard->IsSupported( data.GetFormat() )) if (wxTheClipboard->IsSupported( data.GetFormat() )
&& wxTheClipboard->GetData(data) )
{ {
wxTheClipboard->GetData(&data);
wxString text = data.GetText(); wxString text = data.GetText();
wxLayoutImportText( m_llist, text); wxLayoutImportText( m_llist, text);
SetDirty(); SetDirty();
} }
#endif
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
@@ -1120,7 +1133,6 @@ wxLayoutWindow::Copy(bool invalidate)
m_llist->EndSelection(); m_llist->EndSelection();
} }
#if 0 //FIXME CLIPBOARD
wxLayoutDataObject wldo; wxLayoutDataObject wldo;
wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate); wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate);
if(! llist) if(! llist)
@@ -1147,7 +1159,6 @@ wxLayoutWindow::Copy(bool invalidate)
text = text.Mid(0,len-1); text = text.Mid(0,len-1);
} }
if (wxTheClipboard->Open()) if (wxTheClipboard->Open())
{ {
wxTextDataObject *data = new wxTextDataObject( text ); wxTextDataObject *data = new wxTextDataObject( text );
@@ -1158,7 +1169,6 @@ wxLayoutWindow::Copy(bool invalidate)
wxTheClipboard->Close(); wxTheClipboard->Close();
return rc; return rc;
} }
#endif //FIXME CLIPBOARD
return FALSE; return FALSE;
} }
@@ -1180,12 +1190,12 @@ wxLayoutWindow::Cut(void)
// searching // searching
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef M_BASEDIR
bool bool
wxLayoutWindow::Find(const wxString &needle, wxLayoutWindow::Find(const wxString &needle,
wxPoint * fromWhere, wxPoint * fromWhere,
const wxString &configPath) const wxString &configPath)
{ {
#ifdef M_BASEDIR
wxPoint found; wxPoint found;
if(needle.Length() == 0) if(needle.Length() == 0)
@@ -1217,6 +1227,7 @@ wxLayoutWindow::Find(const wxString &needle,
RequestUpdate(); RequestUpdate();
return true; return true;
} }
#endif
return false; return false;
} }
@@ -1227,7 +1238,6 @@ wxLayoutWindow::FindAgain(void)
bool rc = Find(m_FindString); bool rc = Find(m_FindString);
return rc; return rc;
} }
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// popup menu stuff // popup menu stuff

View File

@@ -23,8 +23,6 @@
#endif #endif
#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
enum enum
{ {
WXLOWIN_MENU_LARGER = WXLOWIN_MENU_FIRST, WXLOWIN_MENU_LARGER = WXLOWIN_MENU_FIRST,
@@ -106,15 +104,12 @@ public:
bool Cut(void); bool Cut(void);
//@} //@}
#ifdef M_BASEDIR
/// find string in buffer /// find string in buffer
bool Find(const wxString &needle, bool Find(const wxString &needle,
wxPoint * fromWhere = NULL, wxPoint * fromWhere = NULL,
const wxString &configPath = "MsgViewFindString"); const wxString &configPath = "MsgViewFindString");
/// find the same string again /// find the same string again
bool FindAgain(void); bool FindAgain(void);
#endif
void EnablePopup(bool enable = true) { m_DoPopupMenu = enable; } void EnablePopup(bool enable = true) { m_DoPopupMenu = enable; }