[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - include/LibreOfficeKit libreofficekit/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 10 03:06:07 PDT 2015
include/LibreOfficeKit/LibreOfficeKitGtk.h | 1
libreofficekit/source/gtk/lokdocview.c | 51 ++++++++++++++++++++++++-----
2 files changed, 44 insertions(+), 8 deletions(-)
New commits:
commit 06b4748179bb84356a6dd697baf9b304805d30bc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 10 10:58:41 2015 +0100
lokdocview: log dragging the graphic selection
Not too important for now, but in case later we want to show some kind
of preview, then this will be the place to do it.
Change-Id: I531761178491f606834b4b359281122be4c8bca9
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 636c872..ebebbbf 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -104,10 +104,15 @@ gboolean lcl_signalMotion(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocVi
{
if (pDocView->m_bInDragGraphicHandles[i])
{
- g_info("lcl_signalButton: dragging the graphic handle #%d", i);
+ g_info("lcl_signalMotion: dragging the graphic handle #%d", i);
return FALSE;
}
}
+ if (pDocView->m_bInDragGraphicSelection)
+ {
+ g_info("lcl_signalMotion: dragging the graphic selection");
+ return FALSE;
+ }
return FALSE;
}
commit d6309cbe0d4ac6cccb08c853a9756333dd57a563
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 10 10:55:26 2015 +0100
lokdocview: return early in lcl_signalMotion()
Change-Id: Ibf9d62c52edeaad4aada7960820e1bb8fa6c2c63
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 0862c8a..636c872 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -70,6 +70,7 @@ void lcl_getDragPoint(GdkRectangle* pHandle, GdkEventButton* pEvent, GdkPoint* p
gboolean lcl_signalMotion(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* pDocView)
{
GdkPoint aPoint;
+ int i;
(void)pEventBox;
if (pDocView->m_bInDragMiddleHandle)
@@ -79,31 +80,32 @@ gboolean lcl_signalMotion(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocVi
pDocView->pDocument->pClass->setTextSelection(
pDocView->pDocument, LOK_SETTEXTSELECTION_RESET,
pixelToTwip(aPoint.x) / pDocView->fZoom, pixelToTwip(aPoint.y) / pDocView->fZoom);
+ return FALSE;
}
- else if (pDocView->m_bInDragStartHandle)
+ if (pDocView->m_bInDragStartHandle)
{
g_info("lcl_signalMotion: dragging the start handle");
lcl_getDragPoint(&pDocView->m_aHandleStartRect, pEvent, &aPoint);
pDocView->pDocument->pClass->setTextSelection(
pDocView->pDocument, LOK_SETTEXTSELECTION_START,
pixelToTwip(aPoint.x) / pDocView->fZoom, pixelToTwip(aPoint.y) / pDocView->fZoom);
+ return FALSE;
}
- else if (pDocView->m_bInDragEndHandle)
+ if (pDocView->m_bInDragEndHandle)
{
g_info("lcl_signalMotion: dragging the end handle");
lcl_getDragPoint(&pDocView->m_aHandleEndRect, pEvent, &aPoint);
pDocView->pDocument->pClass->setTextSelection(
pDocView->pDocument, LOK_SETTEXTSELECTION_END,
pixelToTwip(aPoint.x) / pDocView->fZoom, pixelToTwip(aPoint.y) / pDocView->fZoom);
+ return FALSE;
}
- else
+ for (i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
{
- int i;
-
- for (i = 0; i < GRAPHIC_HANDLE_COUNT; ++i)
+ if (pDocView->m_bInDragGraphicHandles[i])
{
- if (pDocView->m_bInDragGraphicHandles[i])
- g_info("lcl_signalButton: dragging the graphic handle #%d", i);
+ g_info("lcl_signalButton: dragging the graphic handle #%d", i);
+ return FALSE;
}
}
return FALSE;
commit 80bb1876fceb33bc02d50e2da162ce019ef802bc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 10 10:53:28 2015 +0100
lokdocview: implement move of images
It's the same as resizing, except that the action starts inside the
graphic selection, but not over any handles.
Change-Id: Ie2465fc4534d2d919ccb0f316874477f02a5d103
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index d83dbd2..a67c841 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -59,6 +59,7 @@ struct _LOKDocView
/// Position and size of the selection end.
GdkRectangle m_aTextSelectionEnd;
GdkRectangle m_aGraphicSelection;
+ gboolean m_bInDragGraphicSelection;
/// @name Start/middle/end handle.
///@{
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 0d62a5f..0862c8a 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -150,6 +150,17 @@ gboolean lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocVi
return FALSE;
}
}
+
+ if (pDocView->m_bInDragGraphicSelection)
+ {
+ g_info("lcl_signalButton: end of drag graphic selection");
+ pDocView->m_bInDragGraphicSelection = FALSE;
+ pDocView->pDocument->pClass->setGraphicSelection(
+ pDocView->pDocument, LOK_SETGRAPHICSELECTION_END,
+ pixelToTwip(pEvent->x) / pDocView->fZoom,
+ pixelToTwip(pEvent->y) / pDocView->fZoom);
+ return FALSE;
+ }
}
if (pDocView->m_bEdit)
@@ -162,6 +173,7 @@ gboolean lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocVi
if (pEvent->type == GDK_BUTTON_PRESS)
{
int i;
+ GdkRectangle aClickInTwips;
if (gdk_rectangle_intersect(&aClick, &pDocView->m_aHandleStartRect, NULL))
{
@@ -195,6 +207,21 @@ gboolean lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocVi
return FALSE;
}
}
+
+ aClickInTwips.x = pixelToTwip(pEvent->x) / pDocView->fZoom;
+ aClickInTwips.y = pixelToTwip(pEvent->y) / pDocView->fZoom;
+ aClickInTwips.width = 1;
+ aClickInTwips.height = 1;
+ if (gdk_rectangle_intersect(&aClickInTwips, &pDocView->m_aGraphicSelection, NULL))
+ {
+ g_info("lcl_signalButton: start of drag graphic selection");
+ pDocView->m_bInDragGraphicSelection = TRUE;
+ pDocView->pDocument->pClass->setGraphicSelection(
+ pDocView->pDocument, LOK_SETGRAPHICSELECTION_START,
+ pixelToTwip(pEvent->x) / pDocView->fZoom,
+ pixelToTwip(pEvent->y) / pDocView->fZoom);
+ return FALSE;
+ }
}
}
@@ -297,6 +324,7 @@ static void lok_docview_init( LOKDocView* pDocView )
memset(&pDocView->m_aTextSelectionStart, 0, sizeof(pDocView->m_aTextSelectionStart));
memset(&pDocView->m_aTextSelectionEnd, 0, sizeof(pDocView->m_aTextSelectionEnd));
memset(&pDocView->m_aGraphicSelection, 0, sizeof(pDocView->m_aGraphicSelection));
+ pDocView->m_bInDragGraphicSelection = FALSE;
// Start/middle/end handle.
pDocView->m_pHandleStart = NULL;
More information about the Libreoffice-commits
mailing list