replace 'smoothed-stroke' pref with 'Ctrl' key modifier

This commit is contained in:
abakkk 2020-01-05 13:42:05 +01:00
parent 5b1816d29a
commit 8f3fbe7aa9
5 changed files with 8 additions and 31 deletions

View File

@ -311,8 +311,6 @@ var DrawingArea = new Lang.Class({
this._stopDrawing(); this._stopDrawing();
}); });
this.smoothedStroke = this.settings.get_boolean('smoothed-stroke');
this.currentElement = new DrawingElement ({ this.currentElement = new DrawingElement ({
shape: this.currentShape, shape: this.currentShape,
color: this.currentColor.to_string(), color: this.currentColor.to_string(),
@ -383,7 +381,7 @@ var DrawingArea = new Lang.Class({
if (!this.currentElement) if (!this.currentElement)
return; return;
if (this.currentElement.shape == Shapes.NONE) if (this.currentElement.shape == Shapes.NONE)
this.currentElement.addPoint(x, y, this.smoothedStroke); this.currentElement.addPoint(x, y, controlPressed);
else if ((this.currentElement.shape == Shapes.RECTANGLE || this.currentElement.shape == Shapes.TEXT) && (controlPressed || this.currentElement.transform.active)) else if ((this.currentElement.shape == Shapes.RECTANGLE || this.currentElement.shape == Shapes.TEXT) && (controlPressed || this.currentElement.transform.active))
this.currentElement.transformRectangle(x, y); this.currentElement.transformRectangle(x, y);
else if (this.currentElement.shape == Shapes.ELLIPSE && (controlPressed || this.currentElement.transform.active)) else if (this.currentElement.shape == Shapes.ELLIPSE && (controlPressed || this.currentElement.transform.active))

View File

@ -313,15 +313,9 @@ msgid ""
"By pressing <b>Ctrl</b> key <b>during</b> the drawing process, you can:\n" "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)" " . curve a line (cubic Bezier curve)\n"
msgstr "" " . smooth a free drawing stroke (you may prefer to smooth the stroke afterward, see “<i>%s</i>”)"
msgid "Smooth stroke during the drawing process"
msgstr ""
msgid ""
"You can also smooth the stroke afterward\n"
"See “%s”"
msgstr "" msgstr ""
msgid "Change the style" msgid "Change the style"

View File

@ -274,27 +274,17 @@ var PrefsPage = new GObject.Class({
let controlBox = new Gtk.Box({ margin_top: MARGIN, margin_left: MARGIN, margin_right: MARGIN, margin_bottom: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({
use_markup: true, use_markup: true,
label: _("By pressing <b>Ctrl</b> key <b>during</b> the drawing process, you can:\n . rotate a rectangle or a text area\n . extend and rotate an ellipse\n . curve a line (cubic Bezier curve)") label: _("By pressing <b>Ctrl</b> key <b>during</b> the drawing process, you can:\n" +
" . rotate a rectangle or a text area\n" +
" . extend and rotate an ellipse\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"))
}); });
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);
let smoothBox = new Gtk.Box({ margin: MARGIN });
let smoothLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
let smoothLabel1 = new Gtk.Label({label: _("Smooth stroke during the drawing process")});
let smoothLabel2 = new Gtk.Label({ use_markup: true, halign: 1, label: "<small>" + _("You can also smooth the stroke afterward\nSee “%s”").format(_("Smooth last brushstroke")) + "</small>" });
smoothLabel1.set_halign(1);
smoothLabel2.get_style_context().add_class("dim-label");
smoothLabelBox.pack_start(smoothLabel1, true, true, 0);
smoothLabelBox.pack_start(smoothLabel2, true, true, 0);
let smoothSwitch = new Gtk.Switch({valign: 3});
this.settings.bind("smoothed-stroke", smoothSwitch, "active", 0);
smoothBox.pack_start(smoothLabelBox, true, true, 4);
smoothBox.pack_start(smoothSwitch, false, false, 4);
listBox.add(smoothBox);
let internalKeybindingsWidget = new KeybindingsWidget(INTERNAL_KEYBINDINGS, this.settings); let internalKeybindingsWidget = new KeybindingsWidget(INTERNAL_KEYBINDINGS, this.settings);
internalKeybindingsWidget.margin = MARGIN; internalKeybindingsWidget.margin = MARGIN;
listBox.add(internalKeybindingsWidget); listBox.add(internalKeybindingsWidget);

Binary file not shown.

View File

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gnome-shell-extensions"> <schemalist gettext-domain="gnome-shell-extensions">
<schema path="/org/gnome/shell/extensions/draw-on-your-screen/" id="org.gnome.shell.extensions.draw-on-your-screen"> <schema path="/org/gnome/shell/extensions/draw-on-your-screen/" id="org.gnome.shell.extensions.draw-on-your-screen">
<key type="b" name="smoothed-stroke">
<default>false</default>
<summary>smoothed stroke</summary>
<description>smoothed stroke</description>
</key>
<key type="b" name="drawing-on-desktop"> <key type="b" name="drawing-on-desktop">
<default>false</default> <default>false</default>
<summary>move drawing on desktop</summary> <summary>move drawing on desktop</summary>