printing: Add printing support
Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/165>
This commit is contained in:
parent
e96b9ccac9
commit
ae5ca76176
22 changed files with 936 additions and 49 deletions
192
data/gtk/print.ui
Normal file
192
data/gtk/print.ui
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="LpPrint" parent="AdwWindow">
|
||||
<property name="title" translatable="yes">Layout Image</property>
|
||||
<property name="default-width">350</property>
|
||||
<signal name="notify::orientation" handler="orientation_changed" swapped="yes" />
|
||||
<property name="content">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkShortcutController">
|
||||
<property name="scope">managed</property>
|
||||
<child>
|
||||
<object class="GtkShortcut">
|
||||
<property name="trigger">Escape|<Ctrl>w</property>
|
||||
<property name="action">action(window.close)</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwHeaderBar">
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">go-previous-symbolic</property>
|
||||
<property name="action-name">print.back</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="spacing">24</property>
|
||||
<property name="margin-top">18</property>
|
||||
<property name="margin-end">18</property>
|
||||
<property name="margin-bottom">18</property>
|
||||
<property name="margin-start">18</property>
|
||||
<child>
|
||||
<object class="LpPrintPreview" id="preview">
|
||||
<property name="css-name">lpprintpreview</property>
|
||||
<binding name="print">
|
||||
<constant>LpPrint</constant>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="spacing">36</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleButton">
|
||||
<property name="icon-name">page-orientation-portrait-symbolic</property>
|
||||
<property name="action-name">print.orientation</property>
|
||||
<property name="action-target">"portrait"</property>
|
||||
<property name="tooltip-text" translatable="yes">Portrait page orientation</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton">
|
||||
<property name="icon-name">page-orientation-landscape-symbolic</property>
|
||||
<property name="action-name">print.orientation</property>
|
||||
<property name="action-target">"landscape"</property>
|
||||
<property name="tooltip-text" translatable="yes">Landscape page orientation</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">center-on-page-horizontal-symbolic</property>
|
||||
<property name="action-name">print.center-horizontally</property>
|
||||
<property name="tooltip-text" translatable="yes">Center image horizontally</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">center-on-page-vertical-symbolic</property>
|
||||
<property name="action-name">print.center-vertically</property>
|
||||
<property name="tooltip-text" translatable="yes">Center image vertically</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Image Width</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="width">
|
||||
<property name="valign">center</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<signal name="value-changed" handler="width_changed" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Image Scale</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="scale">
|
||||
<style>
|
||||
<class name="dim-label" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Left Margin</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="margin_left">
|
||||
<property name="valign">center</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<signal name="value-changed" handler="margin_left_changed" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes">Top Margin</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="margin_top">
|
||||
<property name="valign">center</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<signal name="value-changed" handler="margin_top_changed" swapped="yes" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwComboRow" id="unit">
|
||||
<property name="title" translatable="yes">Length Unit</property>
|
||||
<signal name="notify::selected-item" handler="unit_selected" swapped="yes" />
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item>cm</item>
|
||||
<item>in</item>
|
||||
<item>px</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="boxed-list" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Print</property>
|
||||
<property name="action-name">print.print</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="width-request">160</property>
|
||||
<style>
|
||||
<class name="suggested-action" />
|
||||
<class name="pill" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gnome/Loupe">
|
||||
<file compressed="true" preprocess="xml-stripblanks">gtk/help_overlay.ui</file>
|
||||
<file>style.css</file>
|
||||
<file>style-hc.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
|
@ -38,29 +38,8 @@ appstream_file = i18n.merge_file(
|
|||
install_dir: iv_datadir / 'metainfo'
|
||||
)
|
||||
|
||||
# appstream_util = find_program('appstream-util', required: false)
|
||||
# if appstream_util.found()
|
||||
# test('Validate appstream file', appstream_util,
|
||||
# args: ['validate', appstream_file]
|
||||
# )
|
||||
# endif
|
||||
|
||||
install_data('org.gnome.Loupe.gschema.xml',
|
||||
install_dir: iv_datadir / 'glib-2.0' / 'schemas'
|
||||
)
|
||||
|
||||
compile_schemas = find_program('glib-compile-schemas', required: false)
|
||||
if compile_schemas.found()
|
||||
test('Validate schema file', compile_schemas,
|
||||
args: ['--strict', '--dry-run', meson.current_source_dir()]
|
||||
)
|
||||
endif
|
||||
|
||||
gnome.compile_resources('loupe',
|
||||
'loupe.gresource.xml',
|
||||
gresource_bundle: true,
|
||||
install: true,
|
||||
install_dir: iv_pkgdatadir,
|
||||
)
|
||||
|
||||
subdir('icons')
|
||||
|
||||
# Post install
|
||||
|
||||
gnome.post_install()
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="loupe">
|
||||
<schema id="org.gnome.Loupe" path="/org/gnome/Loupe/">
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m 3 0 c -1.644531 0 -3 1.355469 -3 3 v 10.003906 c 0 1.644532 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355468 3 -3 v -8.503906 c 0 -0.265625 -0.105469 -0.519531 -0.292969 -0.707031 l -3.5 -3.5 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 z m 0 2 h 8 v 1.5 c 0 1 0.5 1.5 1.5 1.5 h 1.5 v 8.003906 c 0 0.574219 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.425781 -1 -1 v -10.003906 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/>
|
||||
<path d="m 7 6 h 2 v -2 h -2 z m 0 0"/>
|
||||
<path d="m 7 9 h 2 v -2 h -2 z m 0 0"/>
|
||||
<path d="m 7 12 h 2 v -2 h -2 z m 0 0"/>
|
||||
<g fill-opacity="0.34902">
|
||||
<path d="m 10 12 h 2 v -2 h -2 z m 0 0"/>
|
||||
<path d="m 4 12 h 2 v -2 h -2 z m 0 0"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 848 B |
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m 3 0 c -1.644531 0 -3 1.355469 -3 3 v 10.003906 c 0 1.644532 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355468 3 -3 v -8.503906 c 0 -0.265625 -0.105469 -0.519531 -0.292969 -0.707031 l -3.5 -3.5 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 z m 0 2 h 8 v 1.5 c 0 1 0.5 1.5 1.5 1.5 h 1.5 v 8.003906 c 0 0.574219 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.425781 -1 -1 v -10.003906 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/>
|
||||
<path d="m 10 7 v 2 h 2 v -2 z m 0 0"/>
|
||||
<path d="m 7 7 v 2 h 2 v -2 z m 0 0"/>
|
||||
<path d="m 4 7 v 2 h 2 v -2 z m 0 0"/>
|
||||
<g fill-opacity="0.34902">
|
||||
<path d="m 4 10 v 2 h 2 v -2 z m 0 0"/>
|
||||
<path d="m 4 4 v 2 h 2 v -2 z m 0 0"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 841 B |
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m 15 11 c 0 1.644531 -1.355469 3 -3 3 h -9 c -1.644531 0 -3 -1.355469 -3 -3 v -6 c 0 -1.644531 1.355469 -3 3 -3 h 7.5 c 0.265625 0 0.519531 0.105469 0.707031 0.292969 l 3.5 3.5 c 0.1875 0.1875 0.292969 0.441406 0.292969 0.707031 z m -2 0 v -4 h -1.5 c -1 0 -1.5 -0.5 -1.5 -1.5 v -1.5 h -7 c -0.570312 0 -1 0.429688 -1 1 v 6 c 0 0.570312 0.429688 1 1 1 h 9 c 0.570312 0 1 -0.429688 1 -1 z m -8.5 -6.035156 c -0.824219 0 -1.5 0.675781 -1.5 1.5 c 0 0.820312 0.675781 1.5 1.5 1.5 s 1.5 -0.679688 1.5 -1.5 c 0 -0.824219 -0.675781 -1.5 -1.5 -1.5 z m 0 1 c 0.28125 0 0.5 0.21875 0.5 0.5 s -0.21875 0.5 -0.5 0.5 s -0.5 -0.21875 -0.5 -0.5 s 0.21875 -0.5 0.5 -0.5 z m 0 0"/>
|
||||
<path d="m 13.460938 10 h -2.417969 c -0.558594 0 -1.09375 -0.195312 -1.523438 -0.550781 l -1.128906 -0.941407 c -0.804687 -0.671874 -1.972656 -0.675781 -2.78125 -0.003906 l -1.09375 0.898438 c -0.449219 0.375 -1.015625 0.578125 -1.597656 0.578125 h -1.339844 c -0.277344 0 -0.5 0.222656 -0.5 0.5 c 0 0.273437 0.222656 0.5 0.5 0.5 h 1.339844 c 0.816406 0 1.605469 -0.285157 2.234375 -0.804688 l 1.09375 -0.902343 c 0.4375 -0.363282 1.070312 -0.359376 1.503906 0.003906 l 1.128906 0.941406 c 0.609375 0.503906 1.371094 0.78125 2.164063 0.78125 h 2.417969 c 0.277343 0 0.5 -0.222656 0.5 -0.5 s -0.222657 -0.5 -0.5 -0.5 z m 0 0"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m 5 1 c -1.644531 0 -3 1.355469 -3 3 v 9 c 0 1.644531 1.355469 3 3 3 h 6 c 1.644531 0 3 -1.355469 3 -3 v -7.5 c 0 -0.265625 -0.105469 -0.519531 -0.292969 -0.707031 l -3.5 -3.5 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 z m 0 2 h 4 v 1.5 c 0 1 0.5 1.5 1.5 1.5 h 1.5 v 7 c 0 0.570312 -0.429688 1 -1 1 h -6 c -0.570312 0 -1 -0.429688 -1 -1 v -9 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/>
|
||||
<path d="m 8 6 c -1.097656 0 -2 0.902344 -2 2 c 0 0.53125 0.210938 1.015625 0.550781 1.375 c -0.015625 0.011719 -0.03125 0.015625 -0.050781 0.027344 c -0.925781 0.535156 -1.5 1.527344 -1.5 2.597656 c 0 0.542969 0.441406 0.980469 0.980469 0.980469 h 4.039062 c 0.539063 0 0.980469 -0.4375 0.980469 -0.980469 c 0 -1.070312 -0.574219 -2.0625 -1.5 -2.597656 c -0.015625 -0.011719 -0.035156 -0.019532 -0.054688 -0.027344 c 0.34375 -0.359375 0.554688 -0.84375 0.554688 -1.375 c 0 -1.097656 -0.902344 -2 -2 -2 z m 0 1 c 0.558594 0 1 0.441406 1 1 s -0.441406 1 -1 1 s -1 -0.441406 -1 -1 s 0.441406 -1 1 -1 z m 0 3 c 0.34375 0 0.691406 0.089844 1 0.269531 c 0.566406 0.324219 0.933594 0.902344 0.992188 1.542969 c 0.007812 0.105469 -0.074219 0.1875 -0.179688 0.1875 h -3.605469 c -0.113281 0 -0.207031 -0.09375 -0.195312 -0.207031 c 0.0625 -0.632813 0.429687 -1.203125 0.988281 -1.523438 c 0.308594 -0.179687 0.65625 -0.269531 1 -0.269531 z m 0 0" fill-rule="evenodd"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -22,5 +22,11 @@ row.property label.subtitle {
|
|||
margin: 16px;
|
||||
border-radius: 5px;
|
||||
outline: 2px solid white;
|
||||
box-shadow: 0 0 10px rgba(0.4, 0.4, 0.4, 0.8);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 200);
|
||||
}
|
||||
|
||||
lpprintpreview {
|
||||
background-color: rgb(240, 240, 240);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 14px 1px black;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue