small rework of prefs.js

This commit is contained in:
abakkk 2020-01-07 22:15:18 +01:00
parent 662f229a64
commit 4cc28cf100
2 changed files with 59 additions and 56 deletions

View File

@ -285,18 +285,18 @@ msgstr ""
msgid "Global" msgid "Global"
msgstr "" msgstr ""
msgid "Drawing on the desktop"
msgstr ""
msgid "<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>"
msgstr ""
msgid "Persistent" msgid "Persistent"
msgstr "" msgstr ""
msgid "Persistent drawing through session restart" msgid "Persistent drawing through session restart"
msgstr "" msgstr ""
msgid "Drawing on the desktop"
msgstr ""
msgid "<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>"
msgstr ""
msgid "Disable on-screen notifications" msgid "Disable on-screen notifications"
msgstr "" msgstr ""
@ -314,18 +314,18 @@ msgid ""
" . rotate a rectangle or a text area\n" " . rotate a rectangle or a text area\n"
" . extend and rotate an ellipse\n" " . extend and rotate an ellipse\n"
" . curve a line (cubic Bezier curve)\n" " . curve a line (cubic Bezier curve)\n"
" . smooth a free drawing stroke (you may prefer to smooth the stroke afterward, see <i>%s</i>)" " . smooth a free drawing stroke (you may prefer to smooth the stroke afterward, see <i>%s</i>)"
msgstr "" msgstr ""
msgid "" msgid ""
"Default drawing attributes (colors, font, line, dash) are defined in an editable css file.\n" "<b>Default</b> drawing attributes (color palette, font, line, dash) are defined in an editable <b>css</b> file.\n"
"See <i>“%s”</i>." "See <i>“%s”</i>."
msgstr "" msgstr ""
msgid "" msgid ""
"<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file,\n" "<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file, "
"they are colored with background color, transparent if it is disabled.\n" "they are colored with background color, transparent if it is disabled.\n"
"(See “%s” or edit the SVG file afterwards)" "See <i>“%s”</i> or edit the SVG file afterwards."
msgstr "" msgstr ""

View File

@ -179,82 +179,85 @@ var PrefsPage = new GObject.Class({
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 }); let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, margin: MARGIN*3 });
this.add(box); this.add(box);
let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true }); let globalFrame = new Gtk.Frame({ label_yalign: 1.0 });
box.add(listBox); globalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Global") + "</big></b>" }));
box.add(globalFrame);
let listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN/2, margin_bottom: MARGIN/2 });
globalFrame.add(listBox);
let styleContext = listBox.get_style_context(); let styleContext = listBox.get_style_context();
styleContext.add_class('background'); styleContext.add_class('background');
let globalTitleBox = new Gtk.Box({ margin: MARGIN });
let globalTitleLabel = new Gtk.Label({ use_markup: true, label: "<b><big>" + _("Global") + " :</big></b>" });
globalTitleLabel.set_halign(1);
globalTitleBox.pack_start(globalTitleLabel, true, true, 4);
listBox.add(globalTitleBox);
let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, this.settings); let globalKeybindingsWidget = new KeybindingsWidget(GLOBAL_KEYBINDINGS, this.settings);
globalKeybindingsWidget.margin = MARGIN; globalKeybindingsWidget.margin = MARGIN;
listBox.add(globalKeybindingsWidget); listBox.add(globalKeybindingsWidget);
let persistentBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); let persistentBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let persistentLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let persistentLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let persistentLabel1 = new Gtk.Label({label: _("Persistent")}); let persistentLabel1 = new Gtk.Label({label: _("Persistent")});
let persistentLabel2 = new Gtk.Label({ use_markup: true, halign: 1, label: "<small>" + _("Persistent drawing through session restart") + "</small>" }); let persistentLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "<small>" + _("Persistent drawing through session restart") + "</small>" });
persistentLabel1.set_halign(1); persistentLabel1.set_halign(1);
persistentLabel2.get_style_context().add_class("dim-label"); persistentLabel2.get_style_context().add_class('dim-label');
persistentLabelBox.pack_start(persistentLabel1, true, true, 0); persistentLabelBox.pack_start(persistentLabel1, true, true, 0);
persistentLabelBox.pack_start(persistentLabel2, true, true, 0); persistentLabelBox.pack_start(persistentLabel2, true, true, 0);
let persistentSwitch = new Gtk.Switch({valign: 3}); let persistentSwitch = new Gtk.Switch({valign: 3});
this.settings.bind("persistent-drawing", persistentSwitch, "active", 0); this.settings.bind('persistent-drawing', persistentSwitch, 'active', 0);
persistentBox.pack_start(persistentLabelBox, true, true, 4); persistentBox.pack_start(persistentLabelBox, true, true, 4);
persistentBox.pack_start(persistentSwitch, false, false, 4); persistentBox.pack_start(persistentSwitch, false, false, 4);
listBox.add(persistentBox); listBox.add(persistentBox);
let desktopBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); let desktopBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let desktopLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let desktopLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let desktopLabel1 = new Gtk.Label({label: _("Drawing on the desktop")}); let desktopLabel1 = new Gtk.Label({label: _("Drawing on the desktop")});
let desktopLabel2 = new Gtk.Label({ use_markup: true, halign: 1, label: "<small>" + _("<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>") + "</small>" }); let desktopLabel2 = new Gtk.Label({ use_markup: true, halign: 1, wrap: true, xalign: 0, label: "<small>" + _("<i>Draw On Your Screen</i> becomes <i>Draw On Your Desktop</i>") + "</small>" });
desktopLabel1.set_halign(1); desktopLabel1.set_halign(1);
desktopLabel2.get_style_context().add_class("dim-label"); desktopLabel2.get_style_context().add_class('dim-label');
desktopLabelBox.pack_start(desktopLabel1, true, true, 0); desktopLabelBox.pack_start(desktopLabel1, true, true, 0);
desktopLabelBox.pack_start(desktopLabel2, true, true, 0); desktopLabelBox.pack_start(desktopLabel2, true, true, 0);
let desktopSwitch = new Gtk.Switch({valign: 3}); let desktopSwitch = new Gtk.Switch({valign: 3});
this.settings.bind("drawing-on-desktop", desktopSwitch, "active", 0); this.settings.bind('drawing-on-desktop', desktopSwitch, 'active', 0);
desktopBox.pack_start(desktopLabelBox, true, true, 4); desktopBox.pack_start(desktopLabelBox, true, true, 4);
desktopBox.pack_start(desktopSwitch, false, false, 4); desktopBox.pack_start(desktopSwitch, false, false, 4);
listBox.add(desktopBox); listBox.add(desktopBox);
let osdBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); let osdBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let osdLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let osdLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let osdLabel1 = new Gtk.Label({label: _("Disable on-screen notifications")}); let osdLabel1 = new Gtk.Label({label: _("Disable on-screen notifications")});
osdLabel1.set_halign(1); osdLabel1.set_halign(1);
osdLabelBox.pack_start(osdLabel1, true, true, 0); osdLabelBox.pack_start(osdLabel1, true, true, 0);
let osdSwitch = new Gtk.Switch({valign: 3}); let osdSwitch = new Gtk.Switch({valign: 3});
this.settings.bind("osd-disabled", osdSwitch, "active", 0); this.settings.bind('osd-disabled', osdSwitch, 'active', 0);
osdBox.pack_start(osdLabelBox, true, true, 4); osdBox.pack_start(osdLabelBox, true, true, 4);
osdBox.pack_start(osdSwitch, false, false, 4); osdBox.pack_start(osdSwitch, false, false, 4);
listBox.add(osdBox); listBox.add(osdBox);
let indicatorBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); let indicatorBox = new Gtk.Box({ margin_top: MARGIN/2, margin_bottom: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN });
let indicatorLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }); let indicatorLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let indicatorLabel1 = new Gtk.Label({label: _("Disable panel indicator")}); let indicatorLabel1 = new Gtk.Label({label: _("Disable panel indicator")});
indicatorLabel1.set_halign(1); indicatorLabel1.set_halign(1);
indicatorLabelBox.pack_start(indicatorLabel1, true, true, 0); indicatorLabelBox.pack_start(indicatorLabel1, true, true, 0);
let indicatorSwitch = new Gtk.Switch({valign: 3}); let indicatorSwitch = new Gtk.Switch({valign: 3});
this.settings.bind("indicator-disabled", indicatorSwitch, "active", 0); this.settings.bind('indicator-disabled', indicatorSwitch, 'active', 0);
indicatorBox.pack_start(indicatorLabelBox, true, true, 4); indicatorBox.pack_start(indicatorLabelBox, true, true, 4);
indicatorBox.pack_start(indicatorSwitch, false, false, 4); indicatorBox.pack_start(indicatorSwitch, false, false, 4);
listBox.add(indicatorBox); listBox.add(indicatorBox);
listBox.add(new Gtk.Box({ margin_bottom: MARGIN, margin_left: MARGIN, margin_right: MARGIN })); let children = listBox.get_children();
this.addSeparator(listBox); for (let i = 0; i < children.length; i++) {
if (children[i].activatable)
children[i].set_activatable(false);
}
let internalTitleBox = new Gtk.Box({ margin: MARGIN }); let internalFrame = new Gtk.Frame({ margin_top: 3*MARGIN, label_yalign: 1.0 });
let internalTitleLabel = new Gtk.Label({ use_markup: true, label: "<b><big>" + _("Internal") + " </big></b>" + _("(in drawing mode)") + " <b><big>:</big></b>" }); internalFrame.set_label_widget(new Gtk.Label({ margin_bottom: MARGIN/2, use_markup: true, label: "<b><big>" + _("Internal") + " </big></b>" + _("(in drawing mode)") }));
internalTitleLabel.set_halign(1); box.add(internalFrame);
internalTitleBox.pack_start(internalTitleLabel, true, true, 4);
listBox.add(internalTitleBox);
listBox.add(new Gtk.Box({ margin_top: MARGIN/2, margin_left: MARGIN, margin_right: MARGIN })); listBox = new Gtk.ListBox({ selection_mode: 0, hexpand: true, margin_top: MARGIN });
internalFrame.add(listBox);
styleContext = listBox.get_style_context();
styleContext.add_class('background');
for (let i = 0; i < OTHER_SHORTCUTS.length; i++) { for (let i = 0; i < OTHER_SHORTCUTS.length; i++) {
if (OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) { if (OTHER_SHORTCUTS[i].desc.indexOf('-separator-') != -1) {
@ -270,19 +273,19 @@ var PrefsPage = new GObject.Class({
listBox.add(otherBox); listBox.add(otherBox);
} }
listBox.add(new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN })); let controlBox = new Gtk.Box({ margin: MARGIN, margin_top: 2*MARGIN });
let controlBox = new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN, margin_bottom:MARGIN });
let controlLabel = new Gtk.Label({ let controlLabel = new Gtk.Label({
wrap: true,
xalign: 0,
use_markup: true, use_markup: true,
label: _("By pressing <b>Ctrl</b> key <b>during</b> the drawing process, you can:\n" + label: _("By pressing <b>Ctrl</b> key <b>during</b> the drawing process, you can:\n" +
" . rotate a rectangle or a text area\n" + " . rotate a rectangle or a text area\n" +
" . extend and rotate an ellipse\n" + " . extend and rotate an ellipse\n" +
" . curve a line (cubic Bezier curve)\n" + " . curve a line (cubic Bezier curve)\n" +
" . smooth a free drawing stroke (you may prefer to smooth the stroke afterward, see <i>%s</i>)").format(_("Smooth last brushstroke")) " . smooth a free drawing stroke (you may prefer to smooth the stroke afterward, see <i>%s</i>)").format(_("Smooth last brushstroke"))
}); });
controlLabel.set_halign(1); controlLabel.set_halign(1);
controlLabel.get_style_context().add_class("dim-label"); controlLabel.get_style_context().add_class('dim-label');
controlBox.pack_start(controlLabel, true, true, 4); controlBox.pack_start(controlLabel, true, true, 4);
listBox.add(controlBox); listBox.add(controlBox);
@ -290,38 +293,38 @@ var PrefsPage = new GObject.Class({
internalKeybindingsWidget.margin = MARGIN; internalKeybindingsWidget.margin = MARGIN;
listBox.add(internalKeybindingsWidget); listBox.add(internalKeybindingsWidget);
let styleBox = new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN, margin_bottom:MARGIN }); let styleBox = new Gtk.Box({ margin: MARGIN });
let styleLabel = new Gtk.Label({ let styleLabel = new Gtk.Label({
wrap: true,
xalign: 0,
use_markup: true, use_markup: true,
label: _("<b>Default</b> drawing attributes (color palette, font, line, dash) are defined in an editable <b>css</b> file.\n" + label: _("<b>Default</b> drawing attributes (color palette, font, line, dash) are defined in an editable <b>css</b> file.\n" +
"See <i>“%s”</i>.").format(_("Open user.css")) "See <i>“%s”</i>.").format(_("Open user.css"))
}); });
styleLabel.set_halign(1); styleLabel.set_halign(1);
styleLabel.get_style_context().add_class("dim-label"); styleLabel.get_style_context().add_class('dim-label');
styleBox.pack_start(styleLabel, true, true, 4); styleBox.pack_start(styleLabel, true, true, 4);
listBox.add(styleBox); listBox.add(styleBox);
let noteBox = new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN, margin_bottom:MARGIN }); let noteBox = new Gtk.Box({ margin: MARGIN });
let noteLabel = new Gtk.Label({ let noteLabel = new Gtk.Label({
wrap: true,
xalign: 0,
use_markup: true, use_markup: true,
label: _("<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file,\nthey are colored with background color, transparent if it is disabled.\n(See “%s” or edit the SVG file afterwards)").format(_("Add a drawing background")) label: _("<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file, " +
"they are colored with background color, transparent if it is disabled.\n" +
"See <i>“%s”</i> or edit the SVG file afterwards.").format(_("Add a drawing background"))
}); });
noteLabel.set_halign(1); noteLabel.set_halign(1);
noteLabel.get_style_context().add_class("dim-label"); noteLabel.get_style_context().add_class('dim-label');
noteBox.pack_start(noteLabel, true, true, 4); noteBox.pack_start(noteLabel, true, true, 4);
listBox.add(noteBox); listBox.add(noteBox);
let children = listBox.get_children(); children = listBox.get_children();
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
if (children[i].activatable) if (children[i].activatable)
children[i].set_activatable(false); children[i].set_activatable(false);
} }
},
addSeparator: function(container) {
let separatorRow = new Gtk.ListBoxRow({sensitive: false});
separatorRow.add(new Gtk.Separator({ margin: MARGIN }));
container.add(separatorRow);
} }
}); });