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
23395948
Kaydet (Commit)
23395948
authored
Eki 22, 2012
tarafından
Antonio Fernandez
Kaydeden (comit)
Bjoern Michaelsen
Kas 14, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Only activated submenus are generated when activating them. (Broken)
Change-Id: I9548a2c8dfec114de3133d55ca00362793b71a6c
üst
865b7650
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
6 deletions
+145
-6
gtksalmenu.hxx
vcl/inc/unx/gtk/gtksalmenu.hxx
+7
-4
gtksalmenu.cxx
vcl/unx/gtk/window/gtksalmenu.cxx
+138
-2
No files found.
vcl/inc/unx/gtk/gtksalmenu.hxx
Dosyayı görüntüle @
23395948
...
...
@@ -35,9 +35,14 @@
class
MenuItemList
;
class
GtkSalMenu
;
class
GtkSalMenuItem
;
// Generate the complete structure of a menu.
static
void
GenerateFullMenu
(
GtkSalMenu
*
pSalMenu
);
class
GtkSalMenu
:
public
SalMenu
{
private
:
...
...
@@ -103,11 +108,9 @@ public:
void
DispatchCommand
(
gint
itemId
,
const
gchar
*
aCommand
);
void
Activate
(
const
gchar
*
aMenuCommand
);
void
Deactivate
(
const
gchar
*
aMenuCommand
);
// void DisconnectFrame();
void
Display
(
sal_Bool
bVisible
);
void
UpdateNativeMenu
();
// void UpdateNativeSubMenu();
bool
PrepUpdate
();
bool
PrepUpdate
();
// void UpdateNativeMenu();
};
class
GtkSalMenuItem
:
public
SalMenuItem
...
...
vcl/unx/gtk/window/gtksalmenu.cxx
Dosyayı görüntüle @
23395948
...
...
@@ -358,6 +358,141 @@ void GtkSalMenu::UpdateNativeMenu()
}
g_object_unref
(
pSubMenuModel
);
}
g_free
(
aNativeCommand
);
++
nItemPos
;
++
validItems
;
}
// Delete extra items in last section.
RemoveSpareItemsFromNativeMenu
(
pLOMenu
,
&
pOldCommandList
,
nSection
,
validItems
);
// Delete extra sections.
RemoveSpareSectionsFromNativeMenu
(
pLOMenu
,
&
pOldCommandList
,
nSection
);
// Delete unused commands.
RemoveUnusedCommands
(
pActionGroup
,
pOldCommandList
,
pNewCommandList
);
}
static
void
GenerateFullMenu
(
GtkSalMenu
*
pSalMenu
)
{
SolarMutexGuard
aGuard
;
//GTK_YIELD_GRAB();
if
(
!
pSalMenu
||
!
pSalMenu
->
PrepUpdate
()
)
return
;
Menu
*
pVCLMenu
=
pSalMenu
->
GetMenu
();
GLOMenu
*
pLOMenu
=
G_LO_MENU
(
pSalMenu
->
GetMenuModel
()
);
GLOActionGroup
*
pActionGroup
=
G_LO_ACTION_GROUP
(
pSalMenu
->
GetActionGroup
()
);
GList
*
pOldCommandList
=
NULL
;
GList
*
pNewCommandList
=
NULL
;
sal_uInt16
nLOMenuSize
=
g_menu_model_get_n_items
(
G_MENU_MODEL
(
pLOMenu
)
);
if
(
nLOMenuSize
==
0
)
g_lo_menu_new_section
(
pLOMenu
,
0
,
NULL
);
sal_Int32
nSection
=
0
;
sal_Int32
nItemPos
=
0
;
sal_Int32
validItems
=
0
;
sal_Int32
nItem
;
for
(
nItem
=
0
;
nItem
<
(
sal_Int32
)
pSalMenu
->
GetItemCount
();
nItem
++
)
{
if
(
pSalMenu
->
IsItemVisible
(
nItem
)
==
sal_False
)
continue
;
GtkSalMenuItem
*
pSalMenuItem
=
pSalMenu
->
GetItemAtPos
(
nItem
);
sal_uInt16
nId
=
pSalMenuItem
->
mnId
;
if
(
pSalMenuItem
->
mnType
==
MENUITEM_SEPARATOR
)
{
// Delete extra items from current section.
RemoveSpareItemsFromNativeMenu
(
pLOMenu
,
&
pOldCommandList
,
nSection
,
validItems
);
nSection
++
;
nItemPos
=
0
;
validItems
=
0
;
if
(
nLOMenuSize
<=
nSection
)
{
g_lo_menu_new_section
(
pLOMenu
,
nSection
,
NULL
);
nLOMenuSize
++
;
}
continue
;
}
if
(
nItemPos
>=
g_lo_menu_get_n_items_from_section
(
pLOMenu
,
nSection
)
)
g_lo_menu_insert_in_section
(
pLOMenu
,
nSection
,
nItemPos
,
"EMPTY STRING"
);
// Get internal menu item values.
String
aText
=
pVCLMenu
->
GetItemText
(
nId
);
rtl
::
OUString
aCommand
(
pVCLMenu
->
GetItemCommand
(
nId
)
);
sal_Bool
itemEnabled
=
pVCLMenu
->
IsItemEnabled
(
nId
);
KeyCode
nAccelKey
=
pVCLMenu
->
GetAccelKey
(
nId
);
sal_Bool
itemChecked
=
pVCLMenu
->
IsItemChecked
(
nId
);
MenuItemBits
itemBits
=
pVCLMenu
->
GetItemBits
(
nId
);
// Convert internal values to native values.
gboolean
bChecked
=
(
itemChecked
==
sal_True
)
?
TRUE
:
FALSE
;
gboolean
bEnabled
=
(
itemEnabled
==
sal_True
)
?
TRUE
:
FALSE
;
// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
gchar
*
aNativeCommand
=
pSalMenu
->
GetCommandForSpecialItem
(
pSalMenuItem
);
// Store current item command in command list.
gchar
*
aCurrentCommand
=
g_lo_menu_get_command_from_item_in_section
(
pLOMenu
,
nSection
,
nItemPos
);
if
(
aCurrentCommand
!=
NULL
)
pOldCommandList
=
g_list_append
(
pOldCommandList
,
aCurrentCommand
);
// Force updating of native menu labels.
pSalMenu
->
NativeSetItemText
(
nSection
,
nItemPos
,
aText
);
pSalMenu
->
NativeSetAccelerator
(
nSection
,
nItemPos
,
nAccelKey
,
nAccelKey
.
GetName
(
GetFrame
()
->
GetWindow
()
)
);
// Some items are special, so they have different commands.
// if ( g_strcmp0( aNativeCommand, "" ) == 0 )
if
(
!
aNativeCommand
)
{
// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem );
aNativeCommand
=
g_strdup
(
rtl
::
OUStringToOString
(
aCommand
,
RTL_TEXTENCODING_UTF8
).
getStr
()
);
// if ( aSpecialItemCmd != NULL )
// {
// g_free( aNativeCommand );
// aNativeCommand = aSpecialItemCmd;
// }
}
if
(
g_strcmp0
(
aNativeCommand
,
""
)
!=
0
&&
pSalMenuItem
->
mpSubMenu
==
NULL
)
{
pSalMenu
->
NativeSetItemCommand
(
nSection
,
nItemPos
,
nId
,
aNativeCommand
,
itemBits
,
bChecked
,
FALSE
);
pSalMenu
->
NativeCheckItem
(
nSection
,
nItemPos
,
itemBits
,
bChecked
);
pSalMenu
->
NativeSetEnableItem
(
aNativeCommand
,
bEnabled
);
pNewCommandList
=
g_list_append
(
pNewCommandList
,
g_strdup
(
aNativeCommand
)
);
}
GtkSalMenu
*
pSubmenu
=
pSalMenuItem
->
mpSubMenu
;
if
(
pSubmenu
&&
pSubmenu
->
GetMenu
()
)
{
pSalMenu
->
NativeSetItemCommand
(
nSection
,
nItemPos
,
nId
,
aNativeCommand
,
itemBits
,
FALSE
,
TRUE
);
pNewCommandList
=
g_list_append
(
pNewCommandList
,
g_strdup
(
aNativeCommand
)
);
GLOMenu
*
pSubMenuModel
=
g_lo_menu_get_submenu_from_item_in_section
(
pLOMenu
,
nSection
,
nItemPos
);
if
(
pSubMenuModel
==
NULL
)
{
//pSubMenuModel = g_lo_menu_new();
//g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) );
g_lo_menu_new_submenu_in_item_in_section
(
pLOMenu
,
nSection
,
nItemPos
);
pSubMenuModel
=
g_lo_menu_get_submenu_from_item_in_section
(
pLOMenu
,
nSection
,
nItemPos
);
}
g_object_unref
(
pSubMenuModel
);
pSubmenu
->
SetMenuModel
(
G_MENU_MODEL
(
pSubMenuModel
)
);
pSubmenu
->
SetActionGroup
(
G_ACTION_GROUP
(
pActionGroup
)
);
...
...
@@ -365,7 +500,8 @@ void GtkSalMenu::UpdateNativeMenu()
pSubmenu
->
GetMenu
()
->
Activate
();
pSubmenu
->
GetMenu
()
->
Deactivate
();
pSubmenu
->
UpdateNativeMenu
();
GenerateFullMenu
(
pSubmenu
);
//pSubmenu->UpdateNativeMenu();
}
g_free
(
aNativeCommand
);
...
...
@@ -707,7 +843,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand )
if
(
pSalSubMenu
!=
NULL
)
{
MenuBar
*
pMenuBar
=
static_cast
<
MenuBar
*
>
(
mpVCLMenu
);
pMenuBar
->
HandleMenuActivateEvent
(
pSalSubMenu
->
mpVCLMenu
);
pSalSubMenu
->
UpdateNativeMenu
();
pSalSubMenu
->
UpdateNativeMenu
2
();
}
}
...
...
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