summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-23 21:00:55 +0530
committerJan Holesovsky <kendy@collabora.com>2017-11-28 17:51:24 +0100
commit8bfceec2ce654246c873609d7158f67508f8b344 (patch)
treee295eececff66f1bfdd1a38dcab9b32e99bf4072 /libreofficekit
parent667d7003c2525f79b21cbf2a870f03168634e232 (diff)
lokdialog: gtv: Add width and height props to Dialog GObject
Change-Id: I488a94d9c6cefd37624f755c6308f0b75595df84
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx42
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx2
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx4
3 files changed, 43 insertions, 5 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 8225d980c2c1..50330d8e646d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -39,6 +39,8 @@ struct GtvLokDialogPrivate
guint32 m_nLastButtonReleaseTime;
guint32 m_nKeyModifier;
guint32 m_nLastButtonPressed;
+ guint32 m_nWidth;
+ guint32 m_nHeight;
// state for child floating windows
guint32 m_nChildLastButtonPressTime;
@@ -56,6 +58,8 @@ enum
PROP_0,
PROP_LOKDOCVIEW_CONTEXT,
PROP_DIALOG_ID,
+ PROP_DIALOG_WIDTH,
+ PROP_DIALOG_HEIGHT,
PROP_LAST
};
@@ -90,8 +94,9 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
GdkRectangle aRect;
gdk_cairo_get_clip_rectangle(pCairo, &aRect);
g_info("Painting dialog region: %d, %d, %d, %d", aRect.x, aRect.y, aRect.width, aRect.height);
- int nWidth = 1024;
- int nHeight = 768;
+ int nWidth = priv->m_nWidth;
+ int nHeight = priv->m_nHeight;
+ g_info("canvas width: %d and height %d", nWidth, nHeight);
if (aRect.width != 0 && aRect.height != 0)
{
nWidth = aRect.width;
@@ -105,6 +110,7 @@ gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
pDocument->pClass->paintDialog(pDocument, priv->dialogid, pBuffer, aRect.x, aRect.y, nWidth, nHeight);
int outWidth = 0, outHeight = 0;
pDocument->pClass->getDialogInfo(pDocument, priv->dialogid, &pDialogTitle, &outWidth, &outHeight);
+ g_debug("getDialogInfo: width: %d, height: %d", outWidth, outHeight);
if (pDialogTitle)
{
gtk_window_set_title(GTK_WINDOW(pDialog), pDialogTitle);
@@ -396,6 +402,12 @@ gtv_lok_dialog_set_property(GObject* object, guint propId, const GValue* value,
case PROP_DIALOG_ID:
priv->dialogid = g_value_dup_string(value);
break;
+ case PROP_DIALOG_WIDTH:
+ priv->m_nWidth = g_value_get_uint(value);
+ break;
+ case PROP_DIALOG_HEIGHT:
+ priv->m_nHeight = g_value_get_uint(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec);
}
@@ -415,6 +427,12 @@ gtv_lok_dialog_get_property(GObject* object, guint propId, GValue* value, GParam
case PROP_DIALOG_ID:
g_value_set_string(value, priv->dialogid);
break;
+ case PROP_DIALOG_WIDTH:
+ g_value_set_uint(value, priv->m_nWidth);
+ break;
+ case PROP_DIALOG_HEIGHT:
+ g_value_set_uint(value, priv->m_nHeight);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propId, pspec);
}
@@ -454,6 +472,22 @@ gtv_lok_dialog_class_init(GtvLokDialogClass* klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ properties[PROP_DIALOG_WIDTH] = g_param_spec_uint("width",
+ "Dialog width",
+ "Dialog width",
+ 0, 1024, 0,
+ static_cast<GParamFlags>(G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ properties[PROP_DIALOG_HEIGHT] = g_param_spec_uint("height",
+ "Dialog height",
+ "Dialog height",
+ 0, 1024, 0,
+ static_cast<GParamFlags>(G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_properties (G_OBJECT_CLASS(klass), PROP_LAST, properties);
}
@@ -668,12 +702,14 @@ void gtv_lok_dialog_child_close(GtvLokDialog* dialog)
GtkWidget*
-gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId)
+gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId, guint width, guint height)
{
GtkWindow* pWindow = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
return GTK_WIDGET(g_object_new(GTV_TYPE_LOK_DIALOG,
"lokdocview", pDocView,
"dialogid", dialogId,
+ "width", width,
+ "height", height,
"title", "LOK Dialog",
"modal", false,
"transient-for", pWindow,
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
index 619005635b60..8f2161ef5f27 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.hxx
@@ -35,7 +35,7 @@ struct GtvLokDialogClass
GType gtv_lok_dialog_get_type (void) G_GNUC_CONST;
-GtkWidget* gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId);
+GtkWidget* gtv_lok_dialog_new(LOKDocView* pDocView, const gchar* dialogId, guint width, guint height);
void gtv_lok_dialog_invalidate(GtvLokDialog* dialog, const GdkRectangle& aRectangle);
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index 9a92d126b011..712ab912deda 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -304,7 +304,9 @@ void openLokDialog( GtkWidget* pSelector, gpointer /*pItem*/ )
{
GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pSelector));
gchar* pDialogId = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(pSelector));
- GtkWidget* pDialog = gtv_lok_dialog_new(LOK_DOC_VIEW(window->lokdocview), pDialogId);
+ // Set the width, height of the dialog to something large enough to be able
+ // to render any dialog
+ GtkWidget* pDialog = gtv_lok_dialog_new(LOK_DOC_VIEW(window->lokdocview), pDialogId, 1024, 768);
gtv_application_window_register_child_window(window, GTK_WINDOW(pDialog));
g_signal_connect(pDialog, "destroy", G_CALLBACK(destroyLokDialog), window);
g_signal_connect(pDialog, "delete-event", G_CALLBACK(deleteLokDialog), window);