Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f9339d1b
Kaydet (Commit)
f9339d1b
authored
Nis 14, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lokdocview: implement LOK_CALLBACK_STATE_CHANGED
Change-Id: I239849056dd88f785dce239c4d53d6c905177b64
üst
bc892b04
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitGtk.h
+1
-0
gtktiledviewer.cxx
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+34
-1
lokdocview.cxx
libreofficekit/source/gtk/lokdocview.cxx
+19
-1
No files found.
include/LibreOfficeKit/LibreOfficeKitGtk.h
Dosyayı görüntüle @
f9339d1b
...
...
@@ -38,6 +38,7 @@ struct _LOKDocViewClass
{
GtkScrolledWindowClass
parent_class
;
void
(
*
edit_changed
)
(
LOKDocView
*
pView
,
gboolean
was_edit
);
void
(
*
command_changed
)
(
LOKDocView
*
pView
,
char
*
new_state
);
};
guint
lok_docview_get_type
(
void
);
...
...
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
Dosyayı görüntüle @
f9339d1b
...
...
@@ -10,6 +10,7 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
...
...
@@ -31,6 +32,7 @@ static int help()
static
GtkWidget
*
pDocView
;
static
GtkToolItem
*
pEnableEditing
;
static
GtkToolItem
*
pBold
;
bool
g_bToolItemBroadcast
=
true
;
static
GtkWidget
*
pVBox
;
// GtkComboBox requires gtk 2.24 or later
#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
...
...
@@ -107,12 +109,42 @@ static void signalEdit(LOKDocView* pLOKDocView, gboolean bWasEdit, gpointer /*pD
gtk_toggle_tool_button_set_active
(
GTK_TOGGLE_TOOL_BUTTON
(
pEnableEditing
),
bEdit
);
}
/// LOKDocView changed command state -> inform the tool button.
static
void
signalCommand
(
LOKDocView
*
/*pLOKDocView*/
,
char
*
pPayload
,
gpointer
/*pData*/
)
{
std
::
string
aPayload
(
pPayload
);
size_t
nPosition
=
aPayload
.
find
(
"="
);
if
(
nPosition
!=
std
::
string
::
npos
)
{
std
::
string
aKey
=
aPayload
.
substr
(
0
,
nPosition
);
std
::
string
aValue
=
aPayload
.
substr
(
nPosition
+
1
);
g_info
(
"signalCommand: '%s' is '%s'"
,
aKey
.
c_str
(),
aValue
.
c_str
());
GtkToolItem
*
pItem
=
0
;
if
(
aKey
==
".uno:Bold"
)
pItem
=
pBold
;
if
(
pItem
)
{
bool
bEdit
=
aValue
==
"true"
;
if
(
gtk_toggle_tool_button_get_active
(
GTK_TOGGLE_TOOL_BUTTON
(
pItem
))
!=
bEdit
)
{
// Avoid invoking lok_docview_post_command().
g_bToolItemBroadcast
=
false
;
gtk_toggle_tool_button_set_active
(
GTK_TOGGLE_TOOL_BUTTON
(
pItem
),
bEdit
);
g_bToolItemBroadcast
=
true
;
}
}
}
}
/// User clicked on the 'Bold' button -> inform LOKDocView.
void
toggleBold
(
GtkWidget
*
/*pButton*/
,
gpointer
/*pItem*/
)
{
LOKDocView
*
pLOKDocView
=
LOK_DOCVIEW
(
pDocView
);
lok_docview_post_command
(
pLOKDocView
,
".uno:Bold"
);
if
(
g_bToolItemBroadcast
)
lok_docview_post_command
(
pLOKDocView
,
".uno:Bold"
);
}
// GtkComboBox requires gtk 2.24 or later
...
...
@@ -265,6 +297,7 @@ int main( int argc, char* argv[] )
// Docview
pDocView
=
lok_docview_new
(
pOffice
);
g_signal_connect
(
pDocView
,
"edit-changed"
,
G_CALLBACK
(
signalEdit
),
NULL
);
g_signal_connect
(
pDocView
,
"command-changed"
,
G_CALLBACK
(
signalCommand
),
NULL
);
// Input handling.
g_signal_connect
(
pWindow
,
"key-press-event"
,
G_CALLBACK
(
lok_docview_post_key
),
pDocView
);
...
...
libreofficekit/source/gtk/lokdocview.cxx
Dosyayı görüntüle @
f9339d1b
...
...
@@ -182,6 +182,8 @@ struct LOKDocView_Impl
static
void
callbackWorker
(
int
nType
,
const
char
*
pPayload
,
void
*
pData
);
/// Implementation of the callback worder handler, invoked by callbackWorker().
void
callbackWorkerImpl
(
int
nType
,
const
char
*
pPayload
);
/// Command state (various buttons like bold are toggled or not) is changed.
void
commandChanged
(
const
std
::
string
&
rPayload
);
};
LOKDocView_Impl
::
CallbackData
::
CallbackData
(
int
nType
,
const
std
::
string
&
rPayload
,
LOKDocView
*
pDocView
)
...
...
@@ -941,7 +943,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
}
case
LOK_CALLBACK_STATE_CHANGED
:
{
g_info
(
"%s"
,
pCallback
->
m_aPayload
.
c_str
()
);
commandChanged
(
pCallback
->
m_aPayload
);
}
break
;
default
:
...
...
@@ -971,11 +973,17 @@ void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
enum
{
EDIT_CHANGED
,
COMMAND_CHANGED
,
LAST_SIGNAL
};
static
guint
docview_signals
[
LAST_SIGNAL
]
=
{
0
};
void
LOKDocView_Impl
::
commandChanged
(
const
std
::
string
&
rString
)
{
g_signal_emit
(
m_pDocView
,
docview_signals
[
COMMAND_CHANGED
],
0
,
rString
.
c_str
());
}
static
void
lok_docview_class_init
(
gpointer
ptr
)
{
LOKDocViewClass
*
pClass
=
static_cast
<
LOKDocViewClass
*>
(
ptr
);
...
...
@@ -990,6 +998,16 @@ static void lok_docview_class_init( gpointer ptr )
g_cclosure_marshal_VOID__BOOLEAN
,
G_TYPE_NONE
,
1
,
G_TYPE_BOOLEAN
);
pClass
->
command_changed
=
NULL
;
docview_signals
[
COMMAND_CHANGED
]
=
g_signal_new
(
"command-changed"
,
G_TYPE_FROM_CLASS
(
gobject_class
),
G_SIGNAL_RUN_FIRST
,
G_STRUCT_OFFSET
(
LOKDocViewClass
,
command_changed
),
NULL
,
NULL
,
g_cclosure_marshal_VOID__STRING
,
G_TYPE_NONE
,
1
,
G_TYPE_STRING
);
}
static
void
lok_docview_init
(
GTypeInstance
*
pInstance
,
gpointer
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment