extras/source/glade/libreoffice-catalog.xml.in | 3 starmath/UIConfig_smath.mk | 1 starmath/inc/dialog.hxx | 27 +- starmath/inc/starmath.hrc | 1 starmath/source/dialog.cxx | 119 +++++------- starmath/source/smres.src | 77 -------- starmath/uiconfig/smath/ui/fontdialog.ui | 229 +++++++++++++++++++++++++ 7 files changed, 296 insertions(+), 161 deletions(-)
New commits: commit dfbbda5623c0ec92febcd6e2e714fc682e496512 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Nov 1 12:45:29 2013 +0000 convert math font dialog to .ui Change-Id: Ib7bf087664b6c8491872dfa37c750485fedabbe2 diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 0124f49..6344078 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -230,6 +230,9 @@ <glade-widget-class title="Show Math Symbol" name="smlo-SmShowSymbol" generic-name="Show Math Symbol" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> + <glade-widget-class title="Show Math Font" name="smlo-SmShowFont" + generic-name="Show Math Font" parent="GtkDrawingArea" + icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Math Symbol Selection" name="smlo-SmShowSymbolSet" generic-name="Math Symbol Selection" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk index 3683c15..2dc455a 100644 --- a/starmath/UIConfig_smath.mk +++ b/starmath/UIConfig_smath.mk @@ -26,6 +26,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/smath,\ $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\ starmath/uiconfig/smath/ui/alignmentdialog \ starmath/uiconfig/smath/ui/catalogdialog \ + starmath/uiconfig/smath/ui/fontdialog \ starmath/uiconfig/smath/ui/fontsizedialog \ starmath/uiconfig/smath/ui/fonttypedialog \ starmath/uiconfig/smath/ui/printeroptions \ diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 423ffed..8b3aae2 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -74,44 +74,39 @@ public: /**************************************************************************/ -class SmShowFont : public Control +class SmShowFont : public Window { - virtual void Paint(const Rectangle&); + virtual void Paint(const Rectangle&); public: - SmShowFont(Window *pParent, const ResId& rResId) : - Control(pParent, rResId) + SmShowFont(Window *pParent, WinBits nStyle) + : Window(pParent, nStyle) { } - + virtual Size GetOptimalSize() const; void SetFont(const Font& rFont); }; class SmFontDialog : public ModalDialog { - FixedText aFixedText1; - ComboBox aFontBox; - CheckBox aBoldCheckBox; - CheckBox aItalicCheckBox; - OKButton aOKButton1; - HelpButton aHelpButton1; - CancelButton aCancelButton1; - SmShowFont aShowFont; - FixedText aFixedText2; + ComboBox* m_pFontBox; + VclContainer* m_pAttrFrame; + CheckBox* m_pBoldCheckBox; + CheckBox* m_pItalicCheckBox; + SmShowFont* m_pShowFont; Font Face; DECL_LINK(FontSelectHdl, ComboBox *); DECL_LINK(FontModifyHdl, ComboBox *); DECL_LINK(AttrChangeHdl, CheckBox *); - DECL_LINK(HelpButtonClickHdl, Button *); void InitColor_Impl(); virtual void DataChanged( const DataChangedEvent& rDCEvt ); public: - SmFontDialog(Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes, bool bFreeRes = true); + SmFontDialog(Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes); const Font& GetFont() const { return Face; } void SetFont(const Font &rFont); diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 206e358..e053829 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -76,7 +76,6 @@ #define SID_ELEMENTSDOCKINGWINDOW (SID_SMA_START + 126) -#define RID_FONTDIALOG (RID_APP_START + 2) #define RID_SYMDEFINEDIALOG (RID_APP_START + 9) #define RID_PRINTUIOPTIONS (RID_APP_START + 11) diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 6c3d474..73d93ab 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -231,7 +231,7 @@ SfxTabPage* SmPrintOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSe void SmShowFont::Paint(const Rectangle& rRect ) { - Control::Paint( rRect ); + Window::Paint( rRect ); OUString Text (GetFont().GetName()); Size TextSize(GetTextWidth(Text), GetTextHeight()); @@ -240,6 +240,21 @@ void SmShowFont::Paint(const Rectangle& rRect ) (GetOutputSize().Height() - TextSize.Height()) / 2), Text); } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSmShowFont(Window* pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinStyle = 0; + + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + + return new SmShowFont(pParent, nWinStyle); +} + +Size SmShowFont::GetOptimalSize() const +{ + return LogicToPixel(Size(111 , 31), MapMode(MAP_APPFONT)); +} void SmShowFont::SetFont(const Font& rFont) { @@ -249,7 +264,7 @@ void SmShowFont::SetFont(const Font& rFont) Invalidate(); aFont.SetSize(Size(0, 24)); aFont.SetAlign(ALIGN_TOP); - Control::SetFont(aFont); + Window::SetFont(aFont); // keep old text color (new font may have different color) SetTextColor( aTxtColor ); @@ -259,7 +274,7 @@ void SmShowFont::SetFont(const Font& rFont) IMPL_LINK_INLINE_START( SmFontDialog, FontSelectHdl, ComboBox *, pComboBox ) { Face.SetName(pComboBox->GetText()); - aShowFont.SetFont(Face); + m_pShowFont->SetFont(Face); return 0; } IMPL_LINK_INLINE_END( SmFontDialog, FontSelectHdl, ComboBox *, pComboBox ) @@ -279,17 +294,17 @@ IMPL_LINK( SmFontDialog, FontModifyHdl, ComboBox *, pComboBox ) IMPL_LINK( SmFontDialog, AttrChangeHdl, CheckBox *, EMPTYARG /*pCheckBox*/ ) { - if (aBoldCheckBox.IsChecked()) + if (m_pBoldCheckBox->IsChecked()) Face.SetWeight(FontWeight(WEIGHT_BOLD)); else Face.SetWeight(FontWeight(WEIGHT_NORMAL)); - if (aItalicCheckBox.IsChecked()) + if (m_pItalicCheckBox->IsChecked()) Face.SetItalic(ITALIC_NORMAL); else Face.SetItalic(ITALIC_NONE); - aShowFont.SetFont(Face); + m_pShowFont->SetFont(Face); return 0; } @@ -298,40 +313,22 @@ void SmFontDialog::SetFont(const Font &rFont) { Face = rFont; - aFontBox.SetText( Face.GetName() ); - aBoldCheckBox.Check( IsBold( Face ) ); - aItalicCheckBox.Check( IsItalic( Face ) ); + m_pFontBox->SetText( Face.GetName() ); + m_pBoldCheckBox->Check( IsBold( Face ) ); + m_pItalicCheckBox->Check( IsItalic( Face ) ); - aShowFont.SetFont(Face); -} - -IMPL_LINK( SmFontDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ ) -{ - // start help system - Help* pHelp = Application::GetHelp(); - if( pHelp ) - { - pHelp->Start( OUString( "HID_SMA_FONTDIALOG" ), &aHelpButton1 ); - } - return 0; + m_pShowFont->SetFont(Face); } -SmFontDialog::SmFontDialog(Window * pParent, - OutputDevice *pFntListDevice, bool bHideCheckboxes, bool bFreeRes) - : ModalDialog(pParent,SmResId(RID_FONTDIALOG)), - aFixedText1 (this, SmResId(1)), - aFontBox (this, SmResId(1)), - aBoldCheckBox (this, SmResId(1)), - aItalicCheckBox (this, SmResId(2)), - aOKButton1 (this, SmResId(1)), - aHelpButton1 (this, SmResId(1)), - aCancelButton1 (this, SmResId(1)), - aShowFont (this, SmResId(1)), - aFixedText2 (this, SmResId(2)) +SmFontDialog::SmFontDialog(Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes) + : ModalDialog(pParent, "FontDialog", "modules/smath/ui/fontdialog.ui") { - if (bFreeRes) - FreeResource(); - aHelpButton1.SetClickHdl(LINK(this, SmFontDialog, HelpButtonClickHdl)); + get(m_pFontBox, "font"); + m_pFontBox->set_height_request(8 * m_pFontBox->GetTextHeight()); + get(m_pAttrFrame, "attrframe"); + get(m_pBoldCheckBox, "bold"); + get(m_pItalicCheckBox, "italic"); + get(m_pShowFont, "preview"); { WaitObject aWait( this ); @@ -339,8 +336,8 @@ SmFontDialog::SmFontDialog(Window * pParent, FontList aFontList( pFntListDevice ); sal_uInt16 nCount = aFontList.GetFontNameCount(); - for (sal_uInt16 i = 0; i < nCount; i++) - aFontBox.InsertEntry( aFontList.GetFontName(i).GetName() ); + for (sal_uInt16 i = 0; i < nCount; ++i) + m_pFontBox->InsertEntry( aFontList.GetFontName(i).GetName() ); Face.SetSize(Size(0, 24)); Face.SetWeight(WEIGHT_NORMAL); @@ -353,29 +350,21 @@ SmFontDialog::SmFontDialog(Window * pParent, InitColor_Impl(); // preview like controls should have a 2D look - aShowFont.SetBorderStyle( WINDOW_BORDER_MONO ); + m_pShowFont->SetBorderStyle( WINDOW_BORDER_MONO ); } - aFontBox.SetSelectHdl(LINK(this, SmFontDialog, FontSelectHdl)); - aFontBox.SetModifyHdl(LINK(this, SmFontDialog, FontModifyHdl)); - aBoldCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl)); - aItalicCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl)); + m_pFontBox->SetSelectHdl(LINK(this, SmFontDialog, FontSelectHdl)); + m_pFontBox->SetModifyHdl(LINK(this, SmFontDialog, FontModifyHdl)); + m_pBoldCheckBox->SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl)); + m_pItalicCheckBox->SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl)); if (bHideCheckboxes) { - aBoldCheckBox.Check( false ); - aBoldCheckBox.Enable( false ); - aBoldCheckBox.Show( false ); - aItalicCheckBox.Check( false ); - aItalicCheckBox.Enable( false ); - aItalicCheckBox.Show( false ); - aFixedText2.Show( false ); - - Size aSize( aFontBox.GetSizePixel() ); - long nComboBoxBottom = aFontBox.GetPosPixel().Y() + aFontBox.GetSizePixel().Height(); - long nCheckBoxBottom = aItalicCheckBox.GetPosPixel().Y() + aItalicCheckBox.GetSizePixel().Height(); - aSize.Height() += nCheckBoxBottom - nComboBoxBottom; - aFontBox.SetSizePixel( aSize ); + m_pBoldCheckBox->Check( false ); + m_pBoldCheckBox->Enable( false ); + m_pItalicCheckBox->Check( false ); + m_pItalicCheckBox->Enable( false ); + m_pAttrFrame->Show(false); } } @@ -405,8 +394,8 @@ void SmFontDialog::InitColor_Impl() Color aTmpColor( nBgCol ); Wallpaper aWall( aTmpColor ); Color aTxtColor( nTxtCol ); - aShowFont.SetBackground( aWall ); - aShowFont.SetTextColor( aTxtColor ); + m_pShowFont->SetBackground( aWall ); + m_pShowFont->SetTextColor( aTxtColor ); } void SmFontDialog::DataChanged( const DataChangedEvent& rDCEvt ) @@ -1293,17 +1282,13 @@ IMPL_LINK( SmShowSymbolSetWindow, ScrollHdl, ScrollBar*, EMPTYARG /*pScrollBar*/ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSmShowSymbol(Window *pParent, VclBuilder::stringmap &rMap) { - WinBits nWinBits = 0; + WinBits nWinStyle = 0; - VclBuilder::stringmap::iterator aFind = rMap.find(OString("border")); - if (aFind != rMap.end()) - { - if (toBool(aFind->second)) - nWinBits |= WB_BORDER; - rMap.erase(aFind); - } + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; - return new SmShowSymbol(pParent, nWinBits); + return new SmShowSymbol(pParent, nWinStyle); } void SmShowSymbol::Resize() diff --git a/starmath/source/smres.src b/starmath/source/smres.src index d03c15b..6d0d126 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -29,83 +29,6 @@ #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; } -ModalDialog RID_FONTDIALOG -{ - HelpID = "starmath:ModalDialog:RID_FONTDIALOG"; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 183 , 150 ) ; - Text [ en-US ] = "Fonts" ; - FixedText 1 - { - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Font"; - }; - ComboBox 1 - { - HelpID = "starmath:ComboBox:RID_FONTDIALOG:1"; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 111 , 60 ) ; - TabStop = TRUE ; - Sort = TRUE ; - VScroll = TRUE ; - }; - CheckBox 1 - { - HelpID = "starmath:CheckBox:RID_FONTDIALOG:1"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 60 , 84 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Bold" ; - }; - CheckBox 2 - { - HelpID = "starmath:CheckBox:RID_FONTDIALOG:2"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 60 , 97 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Italic" ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 126 , 42 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - HelpID = "starmath:HelpButton:RID_FONTDIALOG:1"; - Text [ en-US ] = "~Help" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 126 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 126 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Control 1 - { - Disable = TRUE ; - Border = TRUE; - Pos = MAP_APPFONT ( 6 , 113 ) ; - Size = MAP_APPFONT ( 111 , 31 ) ; - }; - FixedText 2 - { - Pos = MAP_APPFONT ( 6 , 85 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "Attributes" ; - }; -}; - - ModalDialog RID_SYMDEFINEDIALOG { HelpID = "starmath:ModalDialog:RID_SYMDEFINEDIALOG"; diff --git a/starmath/uiconfig/smath/ui/fontdialog.ui b/starmath/uiconfig/smath/ui/fontdialog.ui new file mode 100644 index 0000000..1a88585 --- /dev/null +++ b/starmath/uiconfig/smath/ui/fontdialog.ui @@ -0,0 +1,229 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="FontDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Fonts</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="VclComboBoxText" id="font"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_entry">True</property> + <property name="dropdown">False</property> + <child internal-child="entry"> + <object class="GtkEntry" id="ComboBoxText-entry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="formulaL"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Font</property> + <property name="use_underline">True</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="attrframe"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <property name="column_homogeneous">True</property> + <child> + <object class="GtkCheckButton" id="bold"> + <property name="label" translatable="yes">_Bold</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="italic"> + <property name="label" translatable="yes">_Italic</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="formulaL1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Attributes</property> + <property name="use_underline">True</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="smlo-SmShowFont" id="preview:border"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits