tweak custom widget to give an optimal size

+ move accessibility relations into the .ui now that we can
+ drop unused hids
+ rework the format/language positions to be less weird
+ add a custom widget stub to make easy to edit with glade

Change-Id: I9607603536f9df2b7cac0074880089adad3b9860
This commit is contained in:
Caolán McNamara
2013-09-06 11:52:31 +01:00
parent c77ec4fe42
commit ac5b44c087
5 changed files with 157 additions and 117 deletions

View File

@@ -329,6 +329,9 @@
<glade-widget-class title="Frame Preview" name="svxlo-SvxSwFrameExample"
generic-name="Frame Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Presentation Preview" name="sduilo-PresLayoutPreview"
generic-name="Presentation Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Rectangle Control" name="svxlo-SvxRectCtl"
generic-name="Rectangle Control" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>

View File

@@ -109,9 +109,6 @@
#define HID_SD_NAMEDIALOG_PAGE "SD_HID_SD_NAMEDIALOG_PAGE"
#define HID_SD_NAMEDIALOG_LINEEND "SD_HID_SD_NAMEDIALOG_LINEEND"
#define HID_SD_TABPAGE_HEADERFOOTER_SLIDE "SD_HID_SD_TABPAGE_HEADERFOOTER_SLIDE"
#define HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT "SD_HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT"
#define HID_SD_TASK_PANE "SD_HID_SD_TASK_PANE"
#define HID_SD_SLIDE_DESIGNS "SD_HID_SD_SLIDE_DESIGNS"
#define HID_SD_CURRENT_MASTERS "SD_HID_SD_CURRENT_MASTERS"

View File

@@ -28,10 +28,11 @@
#include "sdresid.hxx"
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/combobox.hxx>
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
#include "helpids.h"
#include "Outliner.hxx"
@@ -79,6 +80,7 @@ public:
~PresLayoutPreview();
virtual void Paint( const Rectangle& rRect );
virtual Size GetOptimalSize() const;
void init( SdPage* pMaster );
void update( HeaderFooterSettings& rSettings );
@@ -120,7 +122,7 @@ private:
FixedText* mpFTIncludeOn;
CheckBox* mpCBHeader;
FixedText* mpFTHeader;
VclContainer* mpHeaderBox;
Edit* mpTBHeader;
CheckBox* mpCBDateTime;
@@ -132,7 +134,7 @@ private:
SvxLanguageBox* mpCBDateTimeLanguage;
CheckBox* mpCBFooter;
FixedText* mpFTFooter;
VclContainer* mpFooterBox;
Edit* mpTBFooter;
CheckBox* mpCBSlideNumber;
@@ -182,7 +184,6 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent
mpCurrentPage( pCurrentPage ),
mpViewShell( pViewShell )
{
//FreeResource();
get(mpTabCtrl, "tabs" );
SdPage* pSlide;
@@ -207,12 +208,10 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent
}
pDoc->StopWorkStartupDelay();
// mpTabCtrl.SetHelpId( HID_XML_FILTER_TABPAGE_CTRL );
mpTabCtrl->Show();
mnSlidesId = mpTabCtrl->GetPageId("slides");
mpSlideTabPage = new HeaderFooterTabPage( this, mpTabCtrl, pDoc, pSlide, false );
//mpSlideTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_SLIDE );
mpTabCtrl->SetTabPage( mnSlidesId, mpSlideTabPage );
Size aSiz = mpSlideTabPage->GetSizePixel();
@@ -226,24 +225,14 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, ::Window* pParent
mnNotesId = mpTabCtrl->GetPageId("notes");
mpNotesHandoutsTabPage = new HeaderFooterTabPage( this, mpTabCtrl, pDoc, pNotes, true );
//mpNotesHandoutsTabPage->SetHelpId( HID_SD_TABPAGE_HEADERFOOTER_NOTESHANDOUT );
mpTabCtrl->SetTabPage( mnNotesId, mpNotesHandoutsTabPage );
get(maPBApplyToAll, "apply_all" );
get(maPBApply, "apply" );
get(maPBCancel, "cancel" );
/*aSiz = mpNotesHandoutsTabPage->GetSizePixel();
if ( aCtrlSiz.Width() < aSiz.Width() || aCtrlSiz.Height() < aSiz.Height() )
{
mpTabCtrl.SetOutputSizePixel( aSiz );
aCtrlSiz = aSiz;
}*/
ActivatePageHdl( mpTabCtrl );
AdjustLayout();
mpTabCtrl->SetActivatePageHdl( LINK( this, HeaderFooterDialog, ActivatePageHdl ) );
mpTabCtrl->SetDeactivatePageHdl( LINK( this, HeaderFooterDialog, DeactivatePageHdl ) );
@@ -446,30 +435,30 @@ HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window*
mpDialog(pDialog),
mbHandoutMode( bHandoutMode )
{
get(mpFTIncludeOn, "include_label");
get(mpCBHeader, "header_cb" );
get(mpFTHeader, "header_label" );
get(mpTBHeader, "header_text" );
get(mpCBDateTime, "datetime_cb" );
get(mpRBDateTimeFixed, "rb_fixed" );
get(mpRBDateTimeAutomatic, "rb_auto" );
get(mpTBDateTimeFixed, "datetime_value" );
get(mpCBDateTimeFormat, "datetime_format_list" );
get(mpFTDateTimeLanguage, "language_label" );
get(mpCBDateTimeLanguage, "language_list" );
get(mpFTIncludeOn, "include_label");
get(mpCBHeader, "header_cb" );
get(mpHeaderBox, "header_box" );
get(mpTBHeader, "header_text" );
get(mpCBDateTime, "datetime_cb" );
get(mpRBDateTimeFixed, "rb_fixed" );
get(mpRBDateTimeAutomatic, "rb_auto" );
get(mpTBDateTimeFixed, "datetime_value" );
get(mpCBDateTimeFormat, "datetime_format_list" );
get(mpFTDateTimeLanguage, "language_label" );
get(mpCBDateTimeLanguage, "language_list" );
get(mpCBFooter, "footer_cb" );
get(mpFTFooter, "footer_label" );
get(mpTBFooter, "footer_text" );
get(mpCBFooter, "footer_cb" );
get(mpFooterBox, "footer_box" );
get(mpTBFooter, "footer_text" );
get(mpCBSlideNumber, "slide_number" );
get(mpCBSlideNumber, "slide_number" );
get(mpCBNotOnTitle, "not_on_title" );
get(mpCBNotOnTitle, "not_on_title" );
get(mpCTPreview, "preview");
mpCTPreview->init( pActualPage ?
(pActualPage->IsMasterPage() ? pActualPage : (SdPage*)(&(pActualPage->TRG_GetMasterPage()))) :
(pDoc->GetMasterSdPage( 0, bHandoutMode ? PK_NOTES : PK_STANDARD )) );
get(mpCTPreview, "preview");
mpCTPreview->init( pActualPage ?
(pActualPage->IsMasterPage() ? pActualPage : (SdPage*)(&(pActualPage->TRG_GetMasterPage()))) :
(pDoc->GetMasterSdPage( 0, bHandoutMode ? PK_NOTES : PK_STANDARD )) );
if( mbHandoutMode )
{
@@ -481,8 +470,7 @@ HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window*
}
mpCBHeader->Show( mbHandoutMode );
mpFTHeader->Show( mbHandoutMode );
mpTBHeader->Show( mbHandoutMode );
mpHeaderBox->Show( mbHandoutMode );
mpCBNotOnTitle->Show( !mbHandoutMode );
mpCBDateTime->SetClickHdl( LINK( this, HeaderFooterTabPage, UpdateOnClickHdl ) );
@@ -500,18 +488,6 @@ HeaderFooterTabPage::HeaderFooterTabPage( HeaderFooterDialog* pDialog, ::Window*
mpCBDateTimeLanguage->SelectLanguage( meOldLanguage );
FillFormatList(SVXDATEFORMAT_A);
mpTBHeader->SetAccessibleRelationMemberOf(mpCBHeader);
mpRBDateTimeFixed->SetAccessibleRelationMemberOf(mpCBDateTime);
mpRBDateTimeAutomatic->SetAccessibleRelationMemberOf(mpCBDateTime);
mpTBDateTimeFixed->SetAccessibleName(mpRBDateTimeFixed->GetText());
mpTBDateTimeFixed->SetAccessibleRelationMemberOf(mpCBDateTime);
mpTBDateTimeFixed->SetAccessibleRelationLabeledBy(mpRBDateTimeFixed);
mpCBDateTimeFormat->SetAccessibleRelationMemberOf(mpCBDateTime);
mpCBDateTimeFormat->SetAccessibleName(mpRBDateTimeAutomatic->GetText());
mpCBDateTimeFormat->SetAccessibleRelationLabeledBy(mpRBDateTimeAutomatic);
mpCBDateTimeLanguage->SetAccessibleRelationMemberOf(mpCBDateTime);
mpTBFooter->SetAccessibleRelationMemberOf(mpCBFooter);
}
// -----------------------------------------------------------------------
@@ -626,11 +602,9 @@ void HeaderFooterTabPage::update()
mpFTDateTimeLanguage->Enable( mpCBDateTime->IsChecked() && mpRBDateTimeAutomatic->IsChecked() );
mpCBDateTimeLanguage->Enable( mpCBDateTime->IsChecked() && mpRBDateTimeAutomatic->IsChecked() );
mpFTFooter->Enable( mpCBFooter->IsChecked() );
mpTBFooter->Enable( mpCBFooter->IsChecked() );
mpFooterBox->Enable( mpCBFooter->IsChecked() );
mpFTHeader->Enable( mpCBHeader->IsChecked() );
mpTBHeader->Enable( mpCBHeader->IsChecked() );
mpHeaderBox->Enable( mpCBHeader->IsChecked() );
HeaderFooterSettings aSettings;
bool bNotOnTitle;
@@ -775,6 +749,11 @@ PresLayoutPreview::~PresLayoutPreview()
{
}
Size PresLayoutPreview::GetOptimalSize() const
{
return LogicToPixel(Size(80, 80), MAP_APPFONT);
}
// -----------------------------------------------------------------------
void PresLayoutPreview::init( SdPage *pMaster )

View File

@@ -85,6 +85,8 @@
<object class="GtkNotebook" id="tabs">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<placeholder/>
</child>

View File

@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkBox" id="HeaderFooterTab">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
@@ -39,6 +43,9 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<accessibility>
<relation type="label-for" target="header_box"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -47,17 +54,21 @@
</packing>
</child>
<child>
<object class="GtkBox" id="box4">
<object class="GtkBox" id="header_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="margin_left">12</property>
<property name="spacing">12</property>
<accessibility>
<relation type="labelled-by" target="header_cb"/>
</accessibility>
<child>
<object class="GtkLabel" id="header_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Header _text:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">header_text</property>
</object>
<packing>
<property name="expand">False</property>
@@ -93,6 +104,9 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<accessibility>
<relation type="label-for" target="datetimebox"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -101,12 +115,15 @@
</packing>
</child>
<child>
<object class="GtkBox" id="box5">
<object class="GtkBox" id="datetimebox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="margin_left">12</property>
<accessibility>
<relation type="labelled-by" target="datetime_cb"/>
</accessibility>
<child>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
@@ -122,7 +139,10 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">rb_fixed</property>
<property name="group">rb_auto</property>
<accessibility>
<relation type="label-for" target="datetime_value"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -136,6 +156,9 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
<accessibility>
<relation type="labelled-by" target="rb_fixed"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -155,7 +178,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkRadioButton" id="rb_auto">
<property name="label" translatable="yes">_Variable</property>
@@ -164,9 +186,11 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">rb_fixed</property>
<accessibility>
<relation type="labelled-by" target="variablebox"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
@@ -176,25 +200,77 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="language_label">
<object class="GtkAlignment" id="variablebox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Language</property>
<property name="use_underline">True</property>
<property name="halign">start</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>
<child>
<object class="GtkComboBox" id="datetime_format_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="left_padding">12</property>
<accessibility>
<relation type="labelled-by" target="rb_auto"/>
</accessibility>
<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>
<child>
<object class="svxcorelo-SvxLanguageBox" id="language_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="language_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Language</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">language_list</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="datetime_format_list">
<property name="visible">True</property>
<property name="can_focus">False</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>
<child>
<object class="GtkLabel" id="language_label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Format</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">datetime_format_list</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>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -203,38 +279,11 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="svxcorelo-SvxLanguageBox" id="language_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</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>
</object>
@@ -259,6 +308,9 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<accessibility>
<relation type="label-for" target="footer_box"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -267,17 +319,21 @@
</packing>
</child>
<child>
<object class="GtkBox" id="box8">
<object class="GtkBox" id="footer_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="margin_left">12</property>
<property name="spacing">12</property>
<accessibility>
<relation type="labelled-by" target="footer_cb"/>
</accessibility>
<child>
<object class="GtkLabel" id="footer_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">F_ooter text:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">footer_text</property>
</object>
<packing>
<property name="expand">False</property>
@@ -368,9 +424,10 @@
<child>
<object class="GtkLabel" id="replacement_a">
<property name="can_focus">False</property>
<property name="no_show_all">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Slide Number</property>
<property name="label" translatable="yes">_Page Number</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -381,7 +438,7 @@
<child>
<object class="GtkLabel" id="replacement_b">
<property name="can_focus">False</property>
<property name="no_show_all">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Include on page</property>
</object>
@@ -402,6 +459,8 @@
<object class="sduilo-PresLayoutPreview" id="preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>