[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - vcl/inc vcl/source vcl/uiconfig

Daniel Silva danielfaleirosilva at gmail.com
Wed Jun 27 14:29:28 UTC 2018


 vcl/inc/printdlg.hxx           |    1 
 vcl/source/window/printdlg.cxx |   31 +++++-
 vcl/uiconfig/ui/printdialog.ui |  182 +++++++++++++++++++++++++++++------------
 3 files changed, 159 insertions(+), 55 deletions(-)

New commits:
commit 18acebfc14fac1e2645218ee929b9c63c7320e35
Author: Daniel Silva <danielfaleirosilva at gmail.com>
Date:   Mon Jun 18 14:52:16 2018 -0300

    Sets pages per sheet and brochure in print dialog
    
    Change-Id: Iee6fea72cee02d9ffd00b81511382992aad72e61
    Reviewed-on: https://gerrit.libreoffice.org/56057
    Tested-by: Jenkins
    Reviewed-by: Daniel Silva <danielfaleirosilva at gmail.com>

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 2baa21dc53d3..5264fa506034 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -164,6 +164,7 @@ namespace vcl
         VclPtr<ListBox>                         mpNupOrientationBox;
 
         // page order ("left to right, then down")
+        VclPtr<FixedText>                       mpNupOrderTxt;
         VclPtr<ListBox>                         mpNupOrderBox;
         VclPtr<ShowNupOrderWindow>              mpNupOrderWin;
         /// border around each page
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 967b88335b09..97c3bca84689 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -518,6 +518,7 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
     get(mpNupOrderWin, "orderpreview");
     get(mpNupPagesBox, "pagespersheetbox");
     get(mpNupOrientationBox, "pageorientationbox");
+    get(mpNupOrderTxt, "labelorder");
     get(mpNupOrderBox, "orderbox");
     get(mpPagesBtn, "pagespersheetbtn");
     get(mpBrochureBtn, "brochure");
@@ -639,6 +640,8 @@ PrintDialog::PrintDialog(vcl::Window* i_pWindow, const std::shared_ptr<PrinterCo
     mpCopyCountField->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
     mpNupColEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
     mpNupRowsEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+    mpPageMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
+    mpSheetMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
 
     preparePreview( true, true );
 }
@@ -690,6 +693,7 @@ void PrintDialog::dispose()
     mpNupOrientationBox.clear();
     mpNupOrderBox.clear();
     mpNupOrderWin.clear();
+    mpNupOrderTxt.clear();
     mpBorderCB.clear();
     ModalDialog::dispose();
 }
@@ -1024,10 +1028,28 @@ void PrintDialog::updateNupFromPages()
     mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( nSheetMargin ), FUNIT_100TH_MM );
 
     showAdvancedControls( bCustom );
-
     updateNup();
 }
 
+void PrintDialog::enableNupControls( bool bEnable )
+{
+    mpNupPagesBox->Enable( bEnable );
+    mpNupNumPagesTxt->Enable( bEnable );
+    mpNupColEdt->Enable( bEnable );
+    mpNupTimesTxt->Enable( bEnable );
+    mpNupRowsEdt->Enable( bEnable );
+    mpPageMarginTxt1->Enable( bEnable );
+    mpPageMarginEdt->Enable( bEnable );
+    mpPageMarginTxt2->Enable( bEnable );
+    mpSheetMarginTxt1->Enable( bEnable );
+    mpSheetMarginEdt->Enable( bEnable );
+    mpSheetMarginTxt2->Enable( bEnable );
+    mpNupOrderTxt->Enable( bEnable );
+    mpNupOrderBox->Enable( bEnable );
+    mpNupOrderWin->Enable( bEnable );
+    mpBorderCB->Enable( bEnable );
+}
+
 void PrintDialog::showAdvancedControls( bool i_bShow )
 {
     mpNupNumPagesTxt->Show( i_bShow );
@@ -1232,8 +1254,7 @@ void PrintDialog::setupOptionalUI()
         else if( aCtrlType == "Bool" && aGroupingHint == "LayoutPage" && aPropertyName == "PrintProspect" )
         {
             mpBrochureBtn->SetText( aText );
-            // FIXME: Brochure button is still not working, so it is hidden for now
-            // mpBrochureBtn->Show();
+            mpBrochureBtn->Show();
 
             bool bVal = false;
             PropertyValue* pVal = maPController->getValue( aPropertyName );
@@ -1582,12 +1603,12 @@ IMPL_LINK ( PrintDialog, ClickHdl, Button*, pButton, void )
             mpNupPagesBox->SelectEntryPos( 0 );
             updateNupFromPages();
             showAdvancedControls( false );
-            //enableNupControls( false );
+            enableNupControls( false );
         }
     }
     else if( pButton == mpPagesBtn )
     {
-        //enableNupControls( true );
+        enableNupControls( true );
         updateNupFromPages();
     }
     else if( pButton == mpCollateBox )
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index f7b7de2db876..4775d131fab5 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="vcl">
   <requires lib="gtk+" version="3.18"/>
   <requires lib="LibreOffice" version="1.0"/>
@@ -29,6 +29,64 @@
     <property name="stock">gtk-media-next</property>
     <property name="icon_size">1</property>
   </object>
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+      <!-- column-name gint -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" context="printdialog|liststore1">1</col>
+        <col id="1">1</col>
+      </row>
+      <row>
+        <col id="0" context="printdialog|liststore1">2</col>
+        <col id="1">2</col>
+      </row>
+      <row>
+        <col id="0" context="printdialog|liststore1">4</col>
+        <col id="1">4</col>
+      </row>
+      <row>
+        <col id="0" context="printdialog|liststore1">6</col>
+        <col id="1">6</col>
+      </row>
+      <row>
+        <col id="0" context="printdialog|liststore1">9</col>
+        <col id="1">9</col>
+      </row>
+      <row>
+        <col id="0" context="printdialog|liststore1">16</col>
+        <col id="1">16</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="printdialog|liststore1">Custom</col>
+        <col id="1">65535</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="liststore2">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes" context="printdialog|liststore2">left to right, then down</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="printdialog|liststore2">top to bottom, then right</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="printdialog|liststore2">top to bottom, then left</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="printdialog|liststore2">right to left, then down</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkDialog" id="PrintDialog">
     <property name="can_focus">False</property>
     <property name="type_hint">dialog</property>
@@ -125,14 +183,14 @@
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkBox">
+                      <object class="GtkBox" id="box13">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="orientation">vertical</property>
                         <child>
                           <object class="vcllo-PrintPreviewWindow" id="preview">
-                            <property name="width_request">427</property>
-                            <property name="height_request">600</property>
+                            <property name="width_request">463</property>
+                            <property name="height_request">650</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                           </object>
@@ -144,7 +202,7 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
+                        <property name="expand">True</property>
                         <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
@@ -354,13 +412,12 @@
                   <object class="GtkNotebook" id="tabcontrol">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="vexpand">True</property>
                     <child>
                       <object class="GtkBox" id="box11">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="orientation">vertical</property>
-                        <property name="spacing">10</property>
+                        <property name="spacing">6</property>
                         <child>
                           <object class="GtkFrame" id="frame1">
                             <property name="visible">True</property>
@@ -573,7 +630,6 @@
                                         </child>
                                         <child>
                                           <object class="GtkComboBox" id="printpagesbox">
-                                            <property name="visible">False</property>
                                             <property name="can_focus">False</property>
                                           </object>
                                           <packing>
@@ -592,7 +648,6 @@
                                             <property name="column_spacing">3</property>
                                             <child>
                                               <object class="GtkLabel" id="printrange">
-                                                <property name="visible">False</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="halign">center</property>
                                                 <property name="label" translatable="yes" context="printdialog|labelpages">Pages:</property>
@@ -604,7 +659,6 @@
                                             </child>
                                             <child>
                                               <object class="GtkEntry" id="pagerange">
-                                                <property name="visible">False</property>
                                                 <property name="can_focus">True</property>
                                                 <property name="placeholder_text" translatable="yes" context="printdialog|pagerange">e.g.: 1, 3-5, 7, 9</property>
                                               </object>
@@ -774,6 +828,7 @@
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="hexpand">True</property>
+                                            <property name="model">liststore2</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">1</property>
@@ -782,23 +837,11 @@
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkComboBox" id="pagespersheetbox">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="hexpand">True</property>
-                                          </object>
-                                          <packing>
-                                            <property name="left_attach">1</property>
-                                            <property name="top_attach">2</property>
-                                            <property name="width">3</property>
-                                          </packing>
-                                        </child>
-                                        <child>
                                           <object class="vcllo-ShowNupOrderWindow" id="orderpreview">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="hexpand">True</property>
-                                            <property name="stock">gtk-missing-image</property>
+                                            <property name="halign">center</property>
+                                            <property name="valign">start</property>
                                           </object>
                                           <packing>
                                             <property name="left_attach">4</property>
@@ -891,32 +934,6 @@
                                           </packing>
                                         </child>
                                         <child>
-                                          <object class="GtkRadioButton" id="pagespersheetbtn">
-                                            <property name="label" translatable="yes" context="printdialog|pagespersheetbtn">Pages per sheet</property>
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">True</property>
-                                            <property name="receives_default">False</property>
-                                            <property name="active">True</property>
-                                            <property name="draw_indicator">True</property>
-                                            <property name="group">brochure</property>
-                                          </object>
-                                          <packing>
-                                            <property name="left_attach">0</property>
-                                            <property name="top_attach">2</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkLabel" id="pagespersheettxt">
-                                            <property name="can_focus">False</property>
-                                            <property name="label" translatable="yes" context="printdialog|pagespersheettxt">Pages</property>
-                                            <property name="mnemonic_widget">pagerows</property>
-                                          </object>
-                                          <packing>
-                                            <property name="left_attach">0</property>
-                                            <property name="top_attach">3</property>
-                                          </packing>
-                                        </child>
-                                        <child>
                                           <object class="GtkRadioButton" id="brochure">
                                             <property name="label" translatable="yes" context="printdialog|brochure">Brochure</property>
                                             <property name="visible">True</property>
@@ -977,6 +994,68 @@
                                             <property name="width">4</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <object class="GtkBox" id="box12">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">3</property>
+                                            <child>
+                                              <object class="GtkRadioButton" id="pagespersheetbtn">
+                                                <property name="label" translatable="yes" context="printdialog|pagespersheetbtn">Pages per sheet</property>
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="receives_default">False</property>
+                                                <property name="active">True</property>
+                                                <property name="draw_indicator">True</property>
+                                                <property name="group">brochure</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="pagespersheettxt">
+                                                <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">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">2</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="pagestxt">
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes" context="printdialog|pagespersheettxt">Pages</property>
+                                            <property name="mnemonic_widget">pagerows</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">3</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkComboBox" id="pagespersheetbox">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="hexpand">True</property>
+                                            <property name="model">liststore1</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="top_attach">2</property>
+                                            <property name="width">3</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                     </child>
                                     <child type="label">
@@ -1066,5 +1145,8 @@
         </child>
       </object>
     </child>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list