scp2/source/ooo/file_ooo.scp | 11 ++ scp2/source/ooo/module_hidden_ooo.scp | 1 vcl/inc/vcl/layout.hxx | 20 +++-- vcl/qa/cppunit/builder/demo.ui | 125 +++++++++++++++++++--------------- vcl/source/window/builder.cxx | 15 ++++ vcl/source/window/layout.cxx | 91 +++++++++++++++++------- 6 files changed, 175 insertions(+), 88 deletions(-)
New commits: commit 0d705463411ed1a5139a1f609cd276a353d1a9de Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 11 11:45:33 2012 +0100 add a GtkFrame to the demo diff --git a/vcl/qa/cppunit/builder/demo.ui b/vcl/qa/cppunit/builder/demo.ui index ed75074..c8dc618 100644 --- a/vcl/qa/cppunit/builder/demo.ui +++ b/vcl/qa/cppunit/builder/demo.ui @@ -51,69 +51,92 @@ </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <property name="homogeneous">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> <child> - <object class="GtkLabel" id="label1"> + <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">left</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">left</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">right</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">center</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="entry1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">â</property> + <property name="text" translatable="yes">an edit control</property> + <property name="invisible_char_set">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> </child> - <child> - <object class="GtkLabel" id="label2"> + <child type="label"> + <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">right</property> + <property name="label" translatable="yes">Frame Label</property> + <property name="use_markup">True</property> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">center</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="entry1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">â</property> - <property name="text" translatable="yes">an edit control</property> - <property name="invisible_char_set">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> <child> @@ -309,12 +332,6 @@ <child> <placeholder/> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="expand">True</property> commit 5c3a8d8fb299d106332cb925d462aaae08586a11 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 11 11:41:54 2012 +0100 implement a basic VclFrame factor out common VclContainer pieces diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index fc7e0a1..cff021f 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -36,6 +36,9 @@ class VCL_DLLPUBLIC VclContainer : public Window { public: VclContainer(Window *pParent) : Window(pParent) {} + virtual Size GetOptimalSize(WindowSizeType eType) const; + using Window::SetPosSizePixel; + virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); protected: virtual Size calculateRequisition() const = 0; virtual void setAllocation(const Size &rAllocation) = 0; @@ -60,10 +63,6 @@ public: { Show(); } -public: - virtual Size GetOptimalSize(WindowSizeType eType) const; - using Window::SetPosSizePixel; - virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); protected: virtual Size calculateRequisition() const; virtual void setAllocation(const Size &rAllocation); @@ -313,15 +312,20 @@ public: { return m_nColumnSpacing; } -public: - virtual Size GetOptimalSize(WindowSizeType eType) const; - using Window::SetPosSizePixel; - virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); }; VCL_DLLPUBLIC void setGridAttach(Window &rWidget, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nWidth = 1, sal_Int32 nHeight = 1); +class VCL_DLLPUBLIC VclFrame : public VclContainer +{ +public: + VclFrame(Window *pParent) : VclContainer(pParent) {} +protected: + virtual Size calculateRequisition() const; + virtual void setAllocation(const Size &rAllocation); +}; + // retro-fitting utilities // //Get a Size which is large enough to contain all children with diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 98581bc..40ba994 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -71,6 +71,11 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, bool b } else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkBox"))) { + // <property name="visible">True</property> + // <property name="can_focus">False</property> + // <property name="orientation">vertical</property> + // <property name="spacing">6</property> + // <property name="homogeneous">True</property> if (bVertical) pWindow = new VclVBox(pParent); else @@ -85,8 +90,18 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, bool b } else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkGrid"))) { + // <property name="row_spacing">4</property> + // <property name="column_spacing">2</property> + // <property name="row_homogeneous">True</property> + // <property name="column_homogeneous">True</property> pWindow = new VclGrid(pParent); } + else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkFrame"))) + { + // <property name="label_xalign">0</property> + // <property name="shadow_type">none</property> + pWindow = new VclFrame(pParent); + } else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkButton"))) { pWindow = new PushButton(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 9d2f2be..0764a8c 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -27,6 +27,20 @@ */ #include <vcl/layout.hxx> +#include "window.h" + +Size VclContainer::GetOptimalSize(WindowSizeType eType) const +{ + if (eType == WINDOWSIZE_MAXIMUM) + return Window::GetOptimalSize(eType); + return calculateRequisition(); +} + +void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) +{ + Window::SetPosSizePixel(rAllocPos, rAllocation); + setAllocation(rAllocation); +} Size VclBox::calculateRequisition() const { @@ -76,13 +90,6 @@ Size VclBox::calculateRequisition() const return aSize; } -Size VclBox::GetOptimalSize(WindowSizeType eType) const -{ - if (eType == WINDOWSIZE_MAXIMUM) - return Window::GetOptimalSize(eType); - return calculateRequisition(); -} - void VclBox::setAllocation(const Size &rAllocation) { sal_uInt16 nChildren = GetChildCount(); @@ -205,12 +212,6 @@ void VclBox::setAllocation(const Size &rAllocation) } } -void VclBox::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) -{ - Window::SetPosSizePixel(rAllocPos, rAllocation); - setAllocation(rAllocation); -} - #define DEFAULT_CHILD_INTERNAL_PAD_X 4 #define DEFAULT_CHILD_INTERNAL_PAD_Y 0 #define DEFAULT_CHILD_MIN_WIDTH 85 @@ -397,13 +398,6 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<long> &rWidths, std::vec } } -Size VclGrid::GetOptimalSize(WindowSizeType eType) const -{ - if (eType == WINDOWSIZE_MAXIMUM) - return Window::GetOptimalSize(eType); - return calculateRequisition(); -} - Size VclGrid::calculateRequisition() const { array_type A = assembleGrid(); @@ -444,12 +438,6 @@ Size VclGrid::calculateRequisition() const return Size(nTotalWidth, nTotalHeight); } -void VclGrid::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) -{ - Window::SetPosSizePixel(rAllocPos, rAllocation); - setAllocation(rAllocation); -} - void VclGrid::setAllocation(const Size& rAllocation) { array_type A = assembleGrid(); @@ -523,6 +511,57 @@ void setGridAttach(Window &rWidget, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 n rWidget.setChildProperty<sal_Int32>(sHeight, nHeight); } +//To-Do, hook a DecorationView into VclFrame ? + +Size VclFrame::calculateRequisition() const +{ + Size aRet(0, 0); + + WindowImpl* pWindowImpl = ImplGetWindowImpl(); + + Window *pChild = pWindowImpl->mpLastChild; + Window *pLabel = pChild != pWindowImpl->mpFirstChild ? pWindowImpl->mpFirstChild : NULL; + + if (pChild && pChild->IsVisible()) + aRet = pChild->GetOptimalSize(WINDOWSIZE_PREFERRED); + + //To-Do, padding, borders, from style/theme + if (pLabel && pLabel->IsVisible()) + { + Size aLabelSize = pLabel->GetOptimalSize(WINDOWSIZE_PREFERRED); + aRet.Height() += aLabelSize.Height(); + aRet.Width() = std::max(aLabelSize.Width(), aRet.Width()); + } + + return aRet; +} + +void VclFrame::setAllocation(const Size &rAllocation) +{ + Size aAllocation(rAllocation); + Point aChildPos(0, 0); + + WindowImpl* pWindowImpl = ImplGetWindowImpl(); + + //The label widget is the last (of two) children + Window *pChild = pWindowImpl->mpLastChild; + Window *pLabel = pChild != pWindowImpl->mpFirstChild ? pWindowImpl->mpFirstChild : NULL; + + if (pLabel && pLabel->IsVisible()) + { + //To-Do, borders etc. + Size aLabelSize = pLabel->GetOptimalSize(WINDOWSIZE_PREFERRED); + aLabelSize.Height() = std::min(aLabelSize.Height(), aAllocation.Height()); + aLabelSize.Width() = std::min(aLabelSize.Width(), aAllocation.Width()); + pLabel->SetPosSizePixel(aChildPos, aLabelSize); + aAllocation.Height() -= aLabelSize.Height(); + aChildPos.Y() += aLabelSize.Height(); + } + + if (pChild && pChild->IsVisible()) + pChild->SetPosSizePixel(aChildPos, aAllocation); +} + Size getLegacyBestSizeForChildren(const Window &rWindow) { Rectangle aBounds; commit 6a2ed30cb3369520f69be9ec2fb0a70b2ba477e2 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 11 11:33:09 2012 +0100 install ui-previewer diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index 3327978..13cc69d 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -135,6 +135,17 @@ File gid_File_Bin_Gengal #endif End +File gid_File_Bin_UIPreviewer + BIN_FILE_BODY; + Dir = gid_Brand_Dir_Program; + Styles = (PACKED); + #ifdef UNX + Name = "ui-previewer"; + #else + Name = "ui-previewer.exe"; + #endif +End + #ifdef UNX File gid_File_Script_Gengal diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 438dcde..62a8808 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -93,6 +93,7 @@ Module gid_Module_Root_Files_2 gid_File_Profile_Gengal, gid_File_Bin_Spadmin_Bin, gid_File_Bin_Uri_Encode, + gid_File_Bin_UIPreviewer, gid_File_Exe_Nsplugin, gid_File_Lib_Npsoplugin, gid_File_Lib_Soffice,
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits