зеркало из https://github.com/mozilla/gecko-dev.git
Use the prefapi directly for the toolbar prefs.
This commit is contained in:
Родитель
6d3c8bb663
Коммит
2f656e6836
|
@ -543,14 +543,17 @@ void XFE_PrefsPageGeneralAppearance::init()
|
|||
|
||||
// Show toolbar as
|
||||
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
XtVaSetValues(fep->pic_and_text_toggle,
|
||||
XmNset, (prefs->toolbar_style == BROWSER_TOOLBAR_ICONS_AND_TEXT),
|
||||
XmNset, (toolbar_style == BROWSER_TOOLBAR_ICONS_AND_TEXT),
|
||||
0);
|
||||
XtVaSetValues(fep->pic_only_toggle,
|
||||
XmNset, (prefs->toolbar_style == BROWSER_TOOLBAR_ICONS_ONLY),
|
||||
XmNset, (toolbar_style == BROWSER_TOOLBAR_ICONS_ONLY),
|
||||
0);
|
||||
XtVaSetValues(fep->text_only_toggle,
|
||||
XmNset, (prefs->toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY),
|
||||
XmNset, (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY),
|
||||
0);
|
||||
|
||||
sensitive = !PREF_PrefIsLocked("browser.chrome.toolbar_style");
|
||||
|
@ -624,33 +627,22 @@ void XFE_PrefsPageGeneralAppearance::save()
|
|||
|
||||
// Show Toolbar as
|
||||
|
||||
Boolean picsNtext;
|
||||
Boolean picsOnly;
|
||||
int old_toolbar_style = fe_globalPrefs.toolbar_style;
|
||||
Boolean iconsNtext;
|
||||
Boolean iconsOnly;
|
||||
|
||||
XtVaGetValues(fep->pic_and_text_toggle, XmNset, &picsNtext, 0);
|
||||
XtVaGetValues(fep->pic_only_toggle, XmNset, &picsOnly, 0);
|
||||
XtVaGetValues(fep->pic_and_text_toggle, XmNset, &iconsNtext, 0);
|
||||
XtVaGetValues(fep->pic_only_toggle, XmNset, &iconsOnly, 0);
|
||||
|
||||
if (picsNtext)
|
||||
{
|
||||
fe_globalPrefs.toolbar_style = BROWSER_TOOLBAR_ICONS_AND_TEXT;
|
||||
fe_globalPrefs.toolbar_icons_p = True;
|
||||
fe_globalPrefs.toolbar_text_p = True;
|
||||
}
|
||||
else if (picsOnly)
|
||||
{
|
||||
fe_globalPrefs.toolbar_style = BROWSER_TOOLBAR_ICONS_ONLY;
|
||||
fe_globalPrefs.toolbar_icons_p = True;
|
||||
fe_globalPrefs.toolbar_text_p = False;
|
||||
}
|
||||
else
|
||||
{
|
||||
fe_globalPrefs.toolbar_style = BROWSER_TOOLBAR_TEXT_ONLY;
|
||||
fe_globalPrefs.toolbar_icons_p = False;
|
||||
fe_globalPrefs.toolbar_text_p = True;
|
||||
}
|
||||
int32 new_toolbar_style = (iconsNtext ? BROWSER_TOOLBAR_ICONS_AND_TEXT :
|
||||
(iconsOnly ? BROWSER_TOOLBAR_ICONS_ONLY :
|
||||
BROWSER_TOOLBAR_TEXT_ONLY));
|
||||
|
||||
if (old_toolbar_style != fe_globalPrefs.toolbar_style) {
|
||||
int32 old_toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &old_toolbar_style);
|
||||
|
||||
if (old_toolbar_style != new_toolbar_style)
|
||||
{
|
||||
PREF_SetIntPref("browser.chrome.toolbar_style", new_toolbar_style);
|
||||
m_toolbar_needs_updating = TRUE;
|
||||
}
|
||||
|
||||
|
@ -2194,8 +2186,11 @@ void XFE_PrefsPageGeneralColors::init()
|
|||
|
||||
// Underline links
|
||||
|
||||
XP_Bool underline_links;
|
||||
PREF_GetBoolPref("browser.underline_anchors",&underline_links);
|
||||
|
||||
XtVaSetValues(fep->underline_links_toggle,
|
||||
XmNset, prefs->underline_links_p,
|
||||
XmNset, underline_links,
|
||||
XmNsensitive, !PREF_PrefIsLocked("browser.underline_anchors"),
|
||||
0);
|
||||
|
||||
|
@ -2287,11 +2282,15 @@ void XFE_PrefsPageGeneralColors::save()
|
|||
|
||||
// Underline links
|
||||
|
||||
XP_Bool old_underline_links = fe_globalPrefs.underline_links_p;
|
||||
XtVaGetValues(fep->underline_links_toggle, XmNset, &b, 0);
|
||||
fe_globalPrefs.underline_links_p = b;
|
||||
XP_Bool old_underline_links;
|
||||
PREF_GetBoolPref("browser.underline_anchors",&old_underline_links);
|
||||
|
||||
if (old_underline_links != fe_globalPrefs.underline_links_p) {
|
||||
XP_Bool new_underline_links;
|
||||
XtVaGetValues(fep->underline_links_toggle, XmNset,
|
||||
&new_underline_links, 0);
|
||||
|
||||
if (old_underline_links != new_underline_links) {
|
||||
PREF_SetBoolPref("browser.underline_anchors", new_underline_links);
|
||||
m_underlinelinks_changed = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "felocale.h"
|
||||
#include "intl_csi.h"
|
||||
#include "prefapi.h"
|
||||
|
||||
#include <Xfe/XfeAll.h>
|
||||
#include <Xfe/BmButton.h>
|
||||
|
@ -1208,31 +1209,44 @@ XFE_RDFMenuToolbarBase::configureXfeButton(Widget /*item*/,HT_Resource /*entry*/
|
|||
/* virtual */ void
|
||||
XFE_RDFMenuToolbarBase::configureXfeBmButton(Widget item,HT_Resource entry)
|
||||
{
|
||||
if (fe_globalPrefs.toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
D(printf("XFE_RDFMenuToolbarBase::configureXfeCascade: toolbar_style = %d\n",
|
||||
toolbar_style););
|
||||
|
||||
|
||||
if (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
|
||||
XmNlabelPixmapMask, XmUNSPECIFIED_PIXMAP,
|
||||
NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
getPixmapsForEntry(entry,&pixmap,&mask,NULL,NULL);
|
||||
|
||||
getPixmapsForEntry(entry,&pixmap,&mask,NULL,NULL);
|
||||
|
||||
XtVaSetValues(item,
|
||||
XmNlabelPixmap, pixmap,
|
||||
XmNlabelPixmapMask, mask,
|
||||
NULL);
|
||||
XtVaSetValues(item,
|
||||
XmNlabelPixmap, pixmap,
|
||||
XmNlabelPixmapMask, mask,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* virtual */ void
|
||||
XFE_RDFMenuToolbarBase::configureXfeBmCascade(Widget item,HT_Resource entry)
|
||||
{
|
||||
if (fe_globalPrefs.toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
D(printf("XFE_RDFMenuToolbarBase::configureXfeBmCascade: toolbar_style = %d\n",
|
||||
toolbar_style););
|
||||
if (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNlabelPixmap, XmUNSPECIFIED_PIXMAP,
|
||||
|
@ -1240,31 +1254,31 @@ XFE_RDFMenuToolbarBase::configureXfeBmCascade(Widget item,HT_Resource entry)
|
|||
XmNarmPixmap, XmUNSPECIFIED_PIXMAP,
|
||||
XmNarmPixmapMask, XmUNSPECIFIED_PIXMAP,
|
||||
NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
Pixmap armedPixmap;
|
||||
Pixmap armedMask;
|
||||
|
||||
getPixmapsForEntry(entry,&pixmap,&mask,&armedPixmap,&armedMask);
|
||||
|
||||
Arg av[4];
|
||||
Cardinal ac = 0;
|
||||
|
||||
XtSetArg(av[ac],XmNlabelPixmap, pixmap); ac++;
|
||||
XtSetArg(av[ac],XmNlabelPixmapMask, mask); ac++;
|
||||
|
||||
// Only show the aremd pixmap/mask if this entry has children
|
||||
if (XfeIsAlive(XfeCascadeGetSubMenu(item)))
|
||||
{
|
||||
XtSetArg(av[ac],XmNarmPixmap, armedPixmap); ac++;
|
||||
XtSetArg(av[ac],XmNarmPixmapMask, armedMask); ac++;
|
||||
else
|
||||
{
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
Pixmap armedPixmap;
|
||||
Pixmap armedMask;
|
||||
|
||||
getPixmapsForEntry(entry,&pixmap,&mask,&armedPixmap,&armedMask);
|
||||
|
||||
Arg av[4];
|
||||
Cardinal ac = 0;
|
||||
|
||||
XtSetArg(av[ac],XmNlabelPixmap, pixmap); ac++;
|
||||
XtSetArg(av[ac],XmNlabelPixmapMask, mask); ac++;
|
||||
|
||||
// Only show the aremd pixmap/mask if this entry has children
|
||||
if (XfeIsAlive(XfeCascadeGetSubMenu(item)))
|
||||
{
|
||||
XtSetArg(av[ac],XmNarmPixmap, armedPixmap); ac++;
|
||||
XtSetArg(av[ac],XmNarmPixmapMask, armedMask); ac++;
|
||||
}
|
||||
|
||||
XtSetValues(item,av,ac);
|
||||
}
|
||||
|
||||
XtSetValues(item,av,ac);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/* virtual */ void
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "RDFToolbar.h"
|
||||
#include "Logo.h"
|
||||
|
||||
#include "prefapi.h"
|
||||
|
||||
#include <Xfe/ToolItem.h>
|
||||
#include <Xfe/ToolBar.h>
|
||||
|
||||
|
@ -35,7 +37,6 @@
|
|||
#define MIN_TOOLBAR_HEIGHT 26
|
||||
#define MAX_CHILD_WIDTH 100
|
||||
#define LOGO_NAME "logo"
|
||||
#define TOOLBAR_NAME "toolbar"
|
||||
|
||||
XFE_RDFToolbar::XFE_RDFToolbar(XFE_Frame * frame,
|
||||
XFE_Toolbox * toolbox,
|
||||
|
@ -49,7 +50,6 @@ XFE_RDFToolbar::XFE_RDFToolbar(XFE_Frame * frame,
|
|||
toolbox->getBaseWidget(),
|
||||
XmNuserData, this,
|
||||
NULL);
|
||||
|
||||
// Create the toolbar
|
||||
_toolbar = XtVaCreateManagedWidget(HT_GetViewName(view),
|
||||
xfeToolBarWidgetClass,
|
||||
|
@ -63,7 +63,7 @@ XFE_RDFToolbar::XFE_RDFToolbar(XFE_Frame * frame,
|
|||
NULL);
|
||||
|
||||
// Create the logo
|
||||
m_logo = new XFE_Logo(getFrame(),m_widget,LOGO_NAME);
|
||||
m_logo = new XFE_Logo(frame,m_widget,LOGO_NAME);
|
||||
|
||||
m_logo->setSize(XFE_ANIMATION_SMALL);
|
||||
|
||||
|
@ -292,7 +292,14 @@ XFE_RDFToolbar::updateRoot()
|
|||
/* virtual */ void
|
||||
XFE_RDFToolbar::configureXfeButton(Widget item,HT_Resource entry)
|
||||
{
|
||||
if (fe_globalPrefs.toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
int32 toolbar_style;
|
||||
int result = PREF_GetIntPref("browser.chrome.toolbar_style",
|
||||
&toolbar_style);
|
||||
|
||||
D(printf("XFE_RDFToolbar::configureXfeButton: toolbar_style = %d\n",
|
||||
toolbar_style););
|
||||
|
||||
if (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNpixmap, XmUNSPECIFIED_PIXMAP,
|
||||
|
@ -308,22 +315,28 @@ XFE_RDFToolbar::configureXfeButton(Widget item,HT_Resource entry)
|
|||
|
||||
getPixmapsForEntry(entry,&pixmap,&pixmapMask,NULL,NULL);
|
||||
|
||||
unsigned char layout;
|
||||
|
||||
if (ht_IsFECommand(entry))
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNpixmap, pixmap,
|
||||
XmNpixmapMask, pixmapMask,
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_BOTTOM,
|
||||
NULL);
|
||||
if (toolbar_style == BROWSER_TOOLBAR_ICONS_ONLY)
|
||||
{
|
||||
layout = XmBUTTON_PIXMAP_ONLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
layout = XmBUTTON_LABEL_ON_BOTTOM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNpixmap, pixmap,
|
||||
XmNpixmapMask, pixmapMask,
|
||||
XmNbuttonLayout, XmBUTTON_LABEL_ON_RIGHT,
|
||||
NULL);
|
||||
layout = XmBUTTON_LABEL_ON_RIGHT;
|
||||
}
|
||||
XtVaSetValues(item,
|
||||
XmNpixmap, pixmap,
|
||||
XmNpixmapMask, pixmapMask,
|
||||
XmNbuttonLayout, layout,
|
||||
NULL);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
|
@ -338,7 +351,13 @@ XFE_RDFToolbar::configureXfeButton(Widget item,HT_Resource entry)
|
|||
/* virtual */ void
|
||||
XFE_RDFToolbar::configureXfeCascade(Widget item,HT_Resource entry)
|
||||
{
|
||||
if (fe_globalPrefs.toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
D(printf("XFE_RDFToolbar::configureXfeCascade: toolbar_style = %d\n",
|
||||
toolbar_style););
|
||||
|
||||
if (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
{
|
||||
XtVaSetValues(item,
|
||||
XmNpixmap, XmUNSPECIFIED_PIXMAP,
|
||||
|
@ -347,7 +366,7 @@ XFE_RDFToolbar::configureXfeCascade(Widget item,HT_Resource entry)
|
|||
XmNarmedPixmapMask, XmUNSPECIFIED_PIXMAP,
|
||||
NULL);
|
||||
|
||||
// XtVaSetValues(item,XmNbuttonLayout,XmBUTTON_LABEL_ONLY,NULL);
|
||||
XtVaSetValues(item,XmNbuttonLayout,XmBUTTON_LABEL_ONLY,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -374,7 +393,7 @@ XFE_RDFToolbar::configureXfeCascade(Widget item,HT_Resource entry)
|
|||
|
||||
XtSetValues(item,av,ac);
|
||||
|
||||
// XtVaSetValues(item,XmNbuttonLayout,XmBUTTON_LABEL_ON_RIGHT,NULL);
|
||||
XtVaSetValues(item,XmNbuttonLayout,XmBUTTON_LABEL_ON_RIGHT,NULL);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
|
@ -389,7 +408,10 @@ XFE_RDFToolbar::configureXfeCascade(Widget item,HT_Resource entry)
|
|||
/* virtual */ void
|
||||
XFE_RDFToolbar::updateAppearance()
|
||||
{
|
||||
if (fe_globalPrefs.toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
if (toolbar_style == BROWSER_TOOLBAR_TEXT_ONLY)
|
||||
{
|
||||
XtVaSetValues(_toolbar,XmNbuttonLayout,XmBUTTON_LABEL_ONLY,NULL);
|
||||
}
|
||||
|
|
|
@ -348,7 +348,10 @@ XFE_Toolbar::updateAppearance()
|
|||
{
|
||||
unsigned char button_layout;
|
||||
|
||||
button_layout = XFE_Toolbar::styleToLayout(fe_globalPrefs.toolbar_style);
|
||||
int32 toolbar_style;
|
||||
PREF_GetIntPref("browser.chrome.toolbar_style", &toolbar_style);
|
||||
|
||||
button_layout = XFE_Toolbar::styleToLayout(toolbar_style);
|
||||
|
||||
XtVaSetValues(m_toolBar,XmNbuttonLayout,button_layout,NULL);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче