enum ids{ ID_ADD_SAMPLE = 1, ID_CLEAR, ID_PRINT,
ID_PRINT_SETUP, ID_PAGE_SETUP, ID_PREVIEW, ID_PRINT_PS,
ID_PRINT_SETUP_PS, ID_PAGE_SETUP_PS,ID_PREVIEW_PS,
- ID_WRAP, ID_NOWRAP, ID_PASTE, ID_COPY, ID_CUT, ID_FIND,
+ ID_WRAP, ID_NOWRAP, ID_PASTE, ID_COPY, ID_CUT,
+ ID_PASTE_PRIMARY,
+ ID_FIND,
ID_WXLAYOUT_DEBUG, ID_QUIT, ID_CLICK, ID_HTML, ID_TEXT,
ID_TEST, ID_LINEBREAKS_TEST, ID_LONG_TEST, ID_URL_TEST };
edit_menu->AppendSeparator();
edit_menu->Append(ID_COPY, "&Copy", "Copy text to clipboard.");
edit_menu->Append(ID_CUT, "Cu&t", "Cut text to clipboard.");
+#ifdef __WXGTK__
edit_menu->Append(ID_PASTE,"&Paste", "Paste text from clipboard.");
+#endif
+ edit_menu->Append(ID_PASTE_PRIMARY,"&Paste primary", "Paste text from primary selection.");
edit_menu->Append(ID_FIND, "&Find", "Find text.");
menu_bar->Append(edit_menu, "&Edit" );
m_lwin->Paste();
m_lwin->Refresh(FALSE);
break;
+#ifdef __WXGTK__
+ case ID_PASTE_PRIMARY:
+ m_lwin->Paste(TRUE);
+ m_lwin->Refresh(FALSE);
+ break;
+#endif
case ID_COPY:
m_lwin->Copy();
m_lwin->Refresh(FALSE);
wxLayoutList *llist,
wxPoint *cursorPos,
wxPoint *cursorSize,
+ wxLayoutStyleInfo *cursorStyle,
int cx,
bool suppressSIupdate)
{
str = WXLO_CURSORCHAR;
dc.GetTextExtent(str, &width, &height, &descent);
+ if(cursorStyle) // set style info
+ *cursorStyle = llist->GetStyleInfo();
if ( cursorSize )
{
// Just in case some joker inserted an empty string object:
cursorSize->x = width;
cursorSize->y = height;
}
-
+
cursorFound = true; // no more checks
}
else
{
// on some other object
CoordType top, bottom; // unused
- *cursorSize = obj->GetSize(&top,&bottom);
+ if(cursorSize)
+ *cursorSize = obj->GetSize(&top,&bottom);
cursorPos->y = m_Position.y;
cursorFound = true; // no more checks
}
m_DefaultStyleInfo.m_bg = *wxWHITE;
m_CurrentStyleInfo = m_DefaultStyleInfo;
+ m_CursorStyleInfo = m_DefaultStyleInfo;
}
void
if(line == m_CursorLine)
line->Layout(dc, this,
(wxPoint *)&m_CursorScreenPos,
- (wxPoint *)&m_CursorSize, m_CursorPos.x);
+ (wxPoint *)&m_CursorSize,
+ &m_CursorStyleInfo,
+ m_CursorPos.x);
if(cpos && line->GetLineNumber() == cpos->y)
line->Layout(dc, this,
cpos,
- csize, cpos->x);
+ csize, NULL, cpos->x);
else
line->Layout(dc, this);
// little condition to speed up redrawing:
@param llist th e wxLayoutList
@param cursorPos if not NULL, set cursor screen position in there
@param cursorSize if not cursorPos != NULL, set cursor size in there
+ @param cursorStyle if non NULL where to store styleinfo for cursor pos
@param cx if cursorPos != NULL, the cursor x position
@param suppressStyleUpdate FALSe normally, only to suppress updating of m_StyleInfo
*/
wxLayoutList *llist,
wxPoint *cursorPos = NULL,
wxPoint *cursorSize = NULL,
+ wxLayoutStyleInfo *cursorStyle = NULL,
int cx = 0,
bool suppressStyleUpdate = FALSE);
/** This function finds an object belonging to a given cursor
wxLayoutStyleInfo &GetDefaultStyleInfo(void) { return m_DefaultStyleInfo ; }
wxLayoutStyleInfo &GetStyleInfo(void) { return m_CurrentStyleInfo ; }
const wxLayoutStyleInfo &GetStyleInfo(void) const { return m_CurrentStyleInfo ; }
+ const wxLayoutStyleInfo &GetCursorStyleInfo(void) const { return m_CursorStyleInfo ; }
/// is the current font underlined?
- bool IsFontUnderlined() const { return GetStyleInfo().underline != 0; }
+ bool IsFontUnderlined() const { return GetCursorStyleInfo().underline != 0; }
/// is the current font bold?
- bool IsFontBold() const { return GetStyleInfo().weight == wxBOLD; }
+ bool IsFontBold() const { return GetCursorStyleInfo().weight == wxBOLD; }
/// is the current font italic?
- bool IsFontItalic() const { return GetStyleInfo().style == wxITALIC; }
+ bool IsFontItalic() const { return GetCursorStyleInfo().style == wxITALIC; }
/// set underline if it was off, turn it off if it was on
void ToggleFontUnderline()
wxLayoutStyleInfo m_DefaultStyleInfo;
/// the current setting:
wxLayoutStyleInfo m_CurrentStyleInfo;
+ /// the current setting:
+ wxLayoutStyleInfo m_CursorStyleInfo;
//@}
};
EVT_LEFT_UP(wxLayoutWindow::OnLeftMouseUp)
EVT_RIGHT_DOWN(wxLayoutWindow::OnRightMouseClick)
EVT_LEFT_DCLICK(wxLayoutWindow::OnMouseDblClick)
+ EVT_MIDDLE_DOWN(wxLayoutWindow::OnMiddleMouseDown)
EVT_MOTION (wxLayoutWindow::OnMouseMove)
EVT_UPDATE_UI(WXLOWIN_MENU_UNDERLINE, wxLayoutWindow::OnUpdateMenuUnderline)
}
break;
- case WXLOWIN_MENU_RCLICK:
- // remove the selection if mouse click is outside it (TODO)
+ case WXLOWIN_MENU_MDOWN:
+ Paste(TRUE);
break;
case WXLOWIN_MENU_DBLCLICK:
// ----------------------------------------------------------------------------
// clipboard operations
+//
// ----------------------------------------------------------------------------
void
-wxLayoutWindow::Paste(void)
+wxLayoutWindow::Paste(bool primary)
{
// Read some text
if (wxTheClipboard->Open())
{
+#if __WXGTK__
+ if(primary)
+ wxTheClipboard->UsePrimarySelection();
+#endif
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
wxLayoutDataObject wxldo;
if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
switch (event.GetId())
{
case WXLOWIN_MENU_LARGER:
- m_llist->SetFontLarger();
- break;
+ m_llist->SetFontLarger(); Refresh(FALSE); break;
case WXLOWIN_MENU_SMALLER:
- m_llist->SetFontSmaller();
- break;
-
+ m_llist->SetFontSmaller(); Refresh(FALSE); break;
case WXLOWIN_MENU_UNDERLINE:
- m_llist->ToggleFontUnderline();
- break;
+ m_llist->ToggleFontUnderline(); Refresh(FALSE); break;
case WXLOWIN_MENU_BOLD:
- m_llist->ToggleFontWeight();
- break;
+ m_llist->ToggleFontWeight(); Refresh(FALSE); break;
case WXLOWIN_MENU_ITALICS:
- m_llist->ToggleFontItalics();
- break;
-
+ m_llist->ToggleFontItalics(); Refresh(FALSE); break;
case WXLOWIN_MENU_ROMAN:
- m_llist->SetFontFamily(wxROMAN); break;
+ m_llist->SetFontFamily(wxROMAN); Refresh(FALSE); break;
case WXLOWIN_MENU_TYPEWRITER:
- m_llist->SetFontFamily(wxFIXED); break;
+ m_llist->SetFontFamily(wxFIXED); Refresh(FALSE); break;
case WXLOWIN_MENU_SANSSERIF:
- m_llist->SetFontFamily(wxSWISS); break;
+ m_llist->SetFontFamily(wxSWISS); Refresh(FALSE); break;
}
}
WXLOWIN_MENU_SANSSERIF,
WXLOWIN_MENU_RCLICK,
WXLOWIN_MENU_DBLCLICK,
+ WXLOWIN_MENU_MDOWN,
WXLOWIN_MENU_LDOWN,
WXLOWIN_MENU_LUP,
WXLOWIN_MENU_MOUSEMOVE,
m_CursorVisibility = visibility; return v;}
/// Pastes text from clipboard.
- void Paste(void);
+ void Paste(bool usePrimarySelection = FALSE);
/** Copies selection to clipboard.
@param invalidate used internally, see wxllist.h for details
*/
void OnLeftMouseDown(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_LDOWN, event); }
void OnLeftMouseUp(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_LUP, event); }
void OnRightMouseClick(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_RCLICK, event); }
+ void OnMiddleMouseDown(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_MDOWN, event); }
void OnMouseDblClick(wxMouseEvent& event) { OnMouse(WXLOWIN_MENU_DBLCLICK, event); }
void OnMouseMove(wxMouseEvent &event) { OnMouse(WXLOWIN_MENU_MOUSEMOVE, event) ; }
void OnSetFocus(wxFocusEvent &ev);