From 9c351b5724bab3d0e18974145374a2dae7c2bee9 Mon Sep 17 00:00:00 2001 From: abakkk Date: Sat, 20 Jun 2020 11:17:56 +0200 Subject: [PATCH] Rework of pref and osd texts --- draw.js | 14 +++++--- locale/draw-on-your-screen.pot | 64 +++++++++++++++++++++++----------- prefs.js | 29 +++++++++------ 3 files changed, 71 insertions(+), 36 deletions(-) diff --git a/draw.js b/draw.js index d291a27..5a6cfe7 100644 --- a/draw.js +++ b/draw.js @@ -371,6 +371,9 @@ var DrawingArea = new Lang.Class({ } else if (this.currentElement && this.currentElement.shape == Shapes.LINE) { if (event.get_key_symbol() == Clutter.KEY_Return || event.get_key_symbol() == 65421 || event.get_key_symbol() == 65507) { // 65507 is 'Ctrl' key alone + if (this.currentElement.points.length == 2) + this.emit('show-osd', null, _("Press %s to get a fourth control point") + .format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1); this.currentElement.addPoint(); this.updatePointerCursor(true); this._redisplay(); @@ -462,6 +465,8 @@ var DrawingArea = new Lang.Class({ this.grabbedElementLocked = !this.grabbedElementLocked; if (this.grabbedElementLocked) { this.updatePointerCursor(); + let label = controlPressed ? _("Mark a point of symmetry") : _("Draw a line of symmetry"); + this.emit('show-osd', null, label, "", -1); return; } } @@ -580,7 +585,7 @@ var DrawingArea = new Lang.Class({ this.currentElement.startDrawing(startX, startY); if (this.currentTool == Shapes.POLYGON || this.currentTool == Shapes.POLYLINE) - this.emit('show-osd', null, _("Press %s\nto mark vertices").format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1); + this.emit('show-osd', null, _("Press %s to mark vertices").format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1); this.motionHandler = this.connect('motion-event', (actor, event) => { if (this.spaceKeyPressed) @@ -627,7 +632,7 @@ var DrawingArea = new Lang.Class({ // start writing this.currentElement.textState = TextStates.WRITING; this.currentElement.text = ''; - this.emit('show-osd', null, _("Type your text\nand press %s").format(Gtk.accelerator_get_label(Clutter.KEY_Escape, 0)), "", -1); + this.emit('show-osd', null, _("Type your text and press %s").format(Gtk.accelerator_get_label(Clutter.KEY_Escape, 0)), "", -1); this._updateTextCursorTimeout(); this.textHasCursor = true; this._redisplay(); @@ -804,7 +809,7 @@ var DrawingArea = new Lang.Class({ incrementLineWidth: function(increment) { this.currentLineWidth = Math.max(this.currentLineWidth + increment, 0); - this.emit('show-osd', null, this.currentLineWidth + " " + _("px"), "", 2 * this.currentLineWidth); + this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth); }, toggleLineJoin: function() { @@ -1823,6 +1828,7 @@ var DrawingHelper = new Lang.Class({ let hbox = new St.BoxLayout({ vertical: false }); hbox.add_child(new St.Label({ text: _(Prefs.OTHER_SHORTCUTS[i].desc) })); hbox.add_child(new St.Label({ text: Prefs.OTHER_SHORTCUTS[i].shortcut, x_expand: true })); + hbox.get_children()[0].get_clutter_text().set_use_markup(true); this.vbox.add_child(hbox); } @@ -2089,7 +2095,7 @@ const DrawingMenu = new Lang.Class({ _addSliderItem: function(menu, target, targetProperty) { let item = new PopupMenu.PopupBaseMenuItem({ activate: false }); - let label = new St.Label({ text: target[targetProperty] + " " + _("px"), style_class: 'draw-on-your-screen-menu-slider-label' }); + let label = new St.Label({ text: _("%d px").format(target[targetProperty]), style_class: 'draw-on-your-screen-menu-slider-label' }); let slider = new Slider.Slider(target[targetProperty] / 50); if (GS_VERSION < '3.33.0') { diff --git a/locale/draw-on-your-screen.pot b/locale/draw-on-your-screen.pot index c8d3bd4..e96e603 100644 --- a/locale/draw-on-your-screen.pot +++ b/locale/draw-on-your-screen.pot @@ -86,16 +86,26 @@ msgstr "" msgid "Full line" msgstr "" -# %s is a key label -msgid "" -"Press %s\n" -"to mark vertices" +msgid "%d px" +msgstr "" + +msgid "Press %s to get a fourth control point" +msgstr "" + +msgid "Mark a point of symmetry" +msgstr "" + +msgid "Draw a line of symmetry" msgstr "" # %s is a key label msgid "" -"Type your text\n" -"and press %s" +"Press %s to mark vertices" +msgstr "" + +# %s is a key label +msgid "" +"Type your text and press %s" msgstr "" msgid "Screenshot" @@ -285,12 +295,6 @@ msgstr "" msgid "Center click" msgstr "" -msgid "Transform shape (when drawing)" -msgstr "" - -msgid "Rotate drawing (when moving)" -msgstr "" - msgid "Increment/decrement line width" msgstr "" @@ -304,20 +308,41 @@ msgstr "" msgid "%s … %s" msgstr "" -msgid "Select eraser (when starting drawing)" -msgstr "" - -msgid "Duplicate drawing (when starting moving)" +msgid "Ignore pointer movement" msgstr "" # %s is a key label msgid "%s held" msgstr "" -msgid "Ignore pointer movement" +msgid "Leave" msgstr "" -msgid "Leave" +msgid "Select eraser (when starting a drawing)" +msgstr "" + +msgid "Duplicate (when starting a transformation)" +msgstr "" + +msgid "Rotate rectangle, polygon, polyline, text area" +msgstr "" + +msgid "Extend circle to ellipse" +msgstr "" + +msgid "Curve line" +msgstr "" + +msgid "Smooth free drawing stroke" +msgstr "" + +msgid "Rotate (when moving)" +msgstr "" + +msgid "Stretch (when resizing)" +msgstr "" + +msgid "Inverse (when mirroring)" msgstr "" #: About page @@ -432,6 +457,3 @@ msgstr "" #msgid "Fantasy" #msgstr "" -#msgid "px" -#msgstr "" - diff --git a/prefs.js b/prefs.js index b342cc2..5e5c947 100644 --- a/prefs.js +++ b/prefs.js @@ -56,26 +56,27 @@ var INTERNAL_KEYBINDINGS = { 'select-move-tool': "Select move", 'select-resize-tool': "Select resize", 'select-mirror-tool': "Select mirror", - 'toggle-fill': "Toggle fill/stroke", '-separator-2': '', + 'toggle-fill': "Toggle fill/stroke", + 'toggle-fill-rule': "Change fill rule", + '-separator-3': '', 'increment-line-width': "Increment line width", 'decrement-line-width': "Decrement line width", 'increment-line-width-more': "Increment line width even more", 'decrement-line-width-more': "Decrement line width even more", 'toggle-linejoin': "Change linejoin", 'toggle-linecap': "Change linecap", - 'toggle-fill-rule': "Change fill rule", 'toggle-dash': "Dashed line", - '-separator-3': '', + '-separator-4': '', 'toggle-font-family': "Change font family (generic name)", 'toggle-font-weight': "Change font weight", 'toggle-font-style': "Change font style", - '-separator-4': '', + '-separator-5': '', 'toggle-panel-and-dock-visibility': "Hide panel and dock", 'toggle-background': "Add a drawing background", 'toggle-grid': "Add a grid overlay", 'toggle-square-area': "Square drawing area", - '-separator-5': '', + '-separator-6': '', 'open-previous-json': "Open previous drawing", 'open-next-json': "Open next drawing", 'save-as-json': "Save drawing", @@ -97,14 +98,20 @@ var OTHER_SHORTCUTS = [ { desc: "Draw", get shortcut() { return _("Left click"); } }, { desc: "Menu", get shortcut() { return _("Right click"); } }, { desc: "Toggle fill/stroke", get shortcut() { return _("Center click"); } }, - { desc: "Transform shape (when drawing)", shortcut: getKeyLabel('') }, - { desc: "Rotate drawing (when moving)", shortcut: getKeyLabel('') }, { desc: "Increment/decrement line width", get shortcut() { return _("Scroll"); } }, { desc: "Select color", get shortcut() { return _("%s … %s").format(getKeyLabel('1'), getKeyLabel('9')); } }, - { desc: "Select eraser (when starting drawing)", get shortcut() { return _("%s held").format(getKeyLabel('')); } }, - { desc: "Duplicate drawing (when starting moving)", get shortcut() { return _("%s held").format(getKeyLabel('')); } }, { desc: "Ignore pointer movement", get shortcut() { return _("%s held").format(getKeyLabel('space')); } }, - { desc: "Leave", shortcut: getKeyLabel('Escape') } + { desc: "Leave", shortcut: getKeyLabel('Escape') }, + { desc: "-separator-1", shortcut: "" }, + { desc: "Select eraser (while starting a drawing)", shortcut: "%s".format(getKeyLabel('')) }, + { desc: "Duplicate (while starting a transformation)", shortcut: "%s".format(getKeyLabel('')) }, + { desc: "Rotate rectangle, polygon, polyline, text area", shortcut: getKeyLabel('') }, + { desc: "Extend circle to ellipse", shortcut: getKeyLabel('') }, + { desc: "Curve line", shortcut: getKeyLabel('') }, + { desc: "Smooth free drawing stroke", shortcut: getKeyLabel('') }, + { desc: "Rotate (while moving)", shortcut: getKeyLabel('') }, + { desc: "Stretch (while resizing)", shortcut: getKeyLabel('') }, + { desc: "Inverse (while mirroring)", shortcut: getKeyLabel('') } ]; function init() { @@ -286,7 +293,7 @@ const PrefsPage = new GObject.Class({ continue; } let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); - let otherLabel = new Gtk.Label({ label: _(OTHER_SHORTCUTS[i].desc) }); + let otherLabel = new Gtk.Label({ label: _(OTHER_SHORTCUTS[i].desc), use_markup: true }); otherLabel.set_halign(1); let otherLabel2 = new Gtk.Label({ label: OTHER_SHORTCUTS[i].shortcut }); otherBox.pack_start(otherLabel, true, true, 4);