Rework of pref and osd texts

This commit is contained in:
abakkk 2020-06-20 11:17:56 +02:00
parent ca943ddd9e
commit 9c351b5724
3 changed files with 71 additions and 36 deletions

14
draw.js
View File

@ -371,6 +371,9 @@ var DrawingArea = new Lang.Class({
} else if (this.currentElement && this.currentElement.shape == Shapes.LINE) { } 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) { if (event.get_key_symbol() == Clutter.KEY_Return || event.get_key_symbol() == 65421 || event.get_key_symbol() == 65507) {
// 65507 is 'Ctrl' key alone // 65507 is 'Ctrl' key alone
if (this.currentElement.points.length == 2)
this.emit('show-osd', null, _("Press <i>%s</i> to get a fourth control point")
.format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1);
this.currentElement.addPoint(); this.currentElement.addPoint();
this.updatePointerCursor(true); this.updatePointerCursor(true);
this._redisplay(); this._redisplay();
@ -462,6 +465,8 @@ var DrawingArea = new Lang.Class({
this.grabbedElementLocked = !this.grabbedElementLocked; this.grabbedElementLocked = !this.grabbedElementLocked;
if (this.grabbedElementLocked) { if (this.grabbedElementLocked) {
this.updatePointerCursor(); this.updatePointerCursor();
let label = controlPressed ? _("Mark a point of symmetry") : _("Draw a line of symmetry");
this.emit('show-osd', null, label, "", -1);
return; return;
} }
} }
@ -580,7 +585,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.startDrawing(startX, startY); this.currentElement.startDrawing(startX, startY);
if (this.currentTool == Shapes.POLYGON || this.currentTool == Shapes.POLYLINE) if (this.currentTool == Shapes.POLYGON || this.currentTool == Shapes.POLYLINE)
this.emit('show-osd', null, _("Press <i>%s</i>\nto mark vertices").format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1); this.emit('show-osd', null, _("Press <i>%s</i> to mark vertices").format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1);
this.motionHandler = this.connect('motion-event', (actor, event) => { this.motionHandler = this.connect('motion-event', (actor, event) => {
if (this.spaceKeyPressed) if (this.spaceKeyPressed)
@ -627,7 +632,7 @@ var DrawingArea = new Lang.Class({
// start writing // start writing
this.currentElement.textState = TextStates.WRITING; this.currentElement.textState = TextStates.WRITING;
this.currentElement.text = ''; this.currentElement.text = '';
this.emit('show-osd', null, _("Type your text\nand press <i>%s</i>").format(Gtk.accelerator_get_label(Clutter.KEY_Escape, 0)), "", -1); this.emit('show-osd', null, _("Type your text and press <i>%s</i>").format(Gtk.accelerator_get_label(Clutter.KEY_Escape, 0)), "", -1);
this._updateTextCursorTimeout(); this._updateTextCursorTimeout();
this.textHasCursor = true; this.textHasCursor = true;
this._redisplay(); this._redisplay();
@ -804,7 +809,7 @@ var DrawingArea = new Lang.Class({
incrementLineWidth: function(increment) { incrementLineWidth: function(increment) {
this.currentLineWidth = Math.max(this.currentLineWidth + increment, 0); 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() { toggleLineJoin: function() {
@ -1823,6 +1828,7 @@ var DrawingHelper = new Lang.Class({
let hbox = new St.BoxLayout({ vertical: false }); 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].desc) }));
hbox.add_child(new St.Label({ text: Prefs.OTHER_SHORTCUTS[i].shortcut, x_expand: true })); 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); this.vbox.add_child(hbox);
} }
@ -2089,7 +2095,7 @@ const DrawingMenu = new Lang.Class({
_addSliderItem: function(menu, target, targetProperty) { _addSliderItem: function(menu, target, targetProperty) {
let item = new PopupMenu.PopupBaseMenuItem({ activate: false }); 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); let slider = new Slider.Slider(target[targetProperty] / 50);
if (GS_VERSION < '3.33.0') { if (GS_VERSION < '3.33.0') {

View File

@ -86,16 +86,26 @@ msgstr ""
msgid "Full line" msgid "Full line"
msgstr "" msgstr ""
# %s is a key label msgid "%d px"
msgid "" msgstr ""
"Press <i>%s</i>\n"
"to mark vertices" msgid "Press <i>%s</i> to get a fourth control point"
msgstr ""
msgid "Mark a point of symmetry"
msgstr ""
msgid "Draw a line of symmetry"
msgstr "" msgstr ""
# %s is a key label # %s is a key label
msgid "" msgid ""
"Type your text\n" "Press <i>%s</i> to mark vertices"
"and press <i>%s</i>" msgstr ""
# %s is a key label
msgid ""
"Type your text and press <i>%s</i>"
msgstr "" msgstr ""
msgid "Screenshot" msgid "Screenshot"
@ -285,12 +295,6 @@ msgstr ""
msgid "Center click" msgid "Center click"
msgstr "" msgstr ""
msgid "Transform shape (when drawing)"
msgstr ""
msgid "Rotate drawing (when moving)"
msgstr ""
msgid "Increment/decrement line width" msgid "Increment/decrement line width"
msgstr "" msgstr ""
@ -304,20 +308,41 @@ msgstr ""
msgid "%s … %s" msgid "%s … %s"
msgstr "" msgstr ""
msgid "Select eraser (when starting drawing)" msgid "Ignore pointer movement"
msgstr ""
msgid "Duplicate drawing (when starting moving)"
msgstr "" msgstr ""
# %s is a key label # %s is a key label
msgid "%s held" msgid "%s held"
msgstr "" msgstr ""
msgid "Ignore pointer movement" msgid "Leave"
msgstr "" 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 "" msgstr ""
#: About page #: About page
@ -432,6 +457,3 @@ msgstr ""
#msgid "Fantasy" #msgid "Fantasy"
#msgstr "" #msgstr ""
#msgid "px"
#msgstr ""

View File

@ -56,26 +56,27 @@ var INTERNAL_KEYBINDINGS = {
'select-move-tool': "Select move", 'select-move-tool': "Select move",
'select-resize-tool': "Select resize", 'select-resize-tool': "Select resize",
'select-mirror-tool': "Select mirror", 'select-mirror-tool': "Select mirror",
'toggle-fill': "Toggle fill/stroke",
'-separator-2': '', '-separator-2': '',
'toggle-fill': "Toggle fill/stroke",
'toggle-fill-rule': "Change fill rule",
'-separator-3': '',
'increment-line-width': "Increment line width", 'increment-line-width': "Increment line width",
'decrement-line-width': "Decrement line width", 'decrement-line-width': "Decrement line width",
'increment-line-width-more': "Increment line width even more", 'increment-line-width-more': "Increment line width even more",
'decrement-line-width-more': "Decrement line width even more", 'decrement-line-width-more': "Decrement line width even more",
'toggle-linejoin': "Change linejoin", 'toggle-linejoin': "Change linejoin",
'toggle-linecap': "Change linecap", 'toggle-linecap': "Change linecap",
'toggle-fill-rule': "Change fill rule",
'toggle-dash': "Dashed line", 'toggle-dash': "Dashed line",
'-separator-3': '', '-separator-4': '',
'toggle-font-family': "Change font family (generic name)", 'toggle-font-family': "Change font family (generic name)",
'toggle-font-weight': "Change font weight", 'toggle-font-weight': "Change font weight",
'toggle-font-style': "Change font style", 'toggle-font-style': "Change font style",
'-separator-4': '', '-separator-5': '',
'toggle-panel-and-dock-visibility': "Hide panel and dock", 'toggle-panel-and-dock-visibility': "Hide panel and dock",
'toggle-background': "Add a drawing background", 'toggle-background': "Add a drawing background",
'toggle-grid': "Add a grid overlay", 'toggle-grid': "Add a grid overlay",
'toggle-square-area': "Square drawing area", 'toggle-square-area': "Square drawing area",
'-separator-5': '', '-separator-6': '',
'open-previous-json': "Open previous drawing", 'open-previous-json': "Open previous drawing",
'open-next-json': "Open next drawing", 'open-next-json': "Open next drawing",
'save-as-json': "Save drawing", 'save-as-json': "Save drawing",
@ -97,14 +98,20 @@ var OTHER_SHORTCUTS = [
{ desc: "Draw", get shortcut() { return _("Left click"); } }, { desc: "Draw", get shortcut() { return _("Left click"); } },
{ desc: "Menu", get shortcut() { return _("Right click"); } }, { desc: "Menu", get shortcut() { return _("Right click"); } },
{ desc: "Toggle fill/stroke", get shortcut() { return _("Center click"); } }, { desc: "Toggle fill/stroke", get shortcut() { return _("Center click"); } },
{ desc: "Transform shape (when drawing)", shortcut: getKeyLabel('<Primary>') },
{ desc: "Rotate drawing (when moving)", shortcut: getKeyLabel('<Primary>') },
{ desc: "Increment/decrement line width", get shortcut() { return _("Scroll"); } }, { desc: "Increment/decrement line width", get shortcut() { return _("Scroll"); } },
{ desc: "Select color", get shortcut() { return _("%s … %s").format(getKeyLabel('<Primary>1'), getKeyLabel('<Primary>9')); } }, { desc: "Select color", get shortcut() { return _("%s … %s").format(getKeyLabel('<Primary>1'), getKeyLabel('<Primary>9')); } },
{ desc: "Select eraser (when starting drawing)", get shortcut() { return _("%s held").format(getKeyLabel('<Shift>')); } },
{ desc: "Duplicate drawing (when starting moving)", get shortcut() { return _("%s held").format(getKeyLabel('<Shift>')); } },
{ desc: "Ignore pointer movement", get shortcut() { return _("%s held").format(getKeyLabel('space')); } }, { 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 <span alpha=\"50%\">(while starting a drawing)</span>", shortcut: "%s".format(getKeyLabel('<Shift>')) },
{ desc: "Duplicate <span alpha=\"50%\">(while starting a transformation)</span>", shortcut: "%s".format(getKeyLabel('<Shift>')) },
{ desc: "Rotate rectangle, polygon, polyline, text area", shortcut: getKeyLabel('<Primary>') },
{ desc: "Extend circle to ellipse", shortcut: getKeyLabel('<Primary>') },
{ desc: "Curve line", shortcut: getKeyLabel('<Primary>') },
{ desc: "Smooth free drawing stroke", shortcut: getKeyLabel('<Primary>') },
{ desc: "Rotate <span alpha=\"50%\">(while moving)</span>", shortcut: getKeyLabel('<Primary>') },
{ desc: "Stretch <span alpha=\"50%\">(while resizing)</span>", shortcut: getKeyLabel('<Primary>') },
{ desc: "Inverse <span alpha=\"50%\">(while mirroring)</span>", shortcut: getKeyLabel('<Primary>') }
]; ];
function init() { function init() {
@ -286,7 +293,7 @@ const PrefsPage = new GObject.Class({
continue; continue;
} }
let otherBox = new Gtk.Box({ margin_left: MARGIN, margin_right: MARGIN }); 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); otherLabel.set_halign(1);
let otherLabel2 = new Gtk.Label({ label: OTHER_SHORTCUTS[i].shortcut }); let otherLabel2 = new Gtk.Label({ label: OTHER_SHORTCUTS[i].shortcut });
otherBox.pack_start(otherLabel, true, true, 4); otherBox.pack_start(otherLabel, true, true, 4);