Prefs, notifications and pot file

* Add a long timeout for some OSD notifications.
* Change some pref strings.
* "Stroke" -> "Outline"
* Clean pot file
This commit is contained in:
abakkk 2020-06-28 13:10:31 +02:00
parent f02d076ce2
commit be36fd4de2
5 changed files with 51 additions and 68 deletions

44
draw.js
View File

@ -130,7 +130,7 @@ const getJsonFiles = function() {
var DrawingArea = new Lang.Class({
Name: 'DrawOnYourScreenDrawingArea',
Extends: St.DrawingArea,
Signals: { 'show-osd': { param_types: [GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_DOUBLE] },
Signals: { 'show-osd': { param_types: [GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_DOUBLE, GObject.TYPE_BOOLEAN] },
'update-action-mode': {},
'leave-drawing-mode': {} },
@ -397,8 +397,8 @@ var DrawingArea = new Lang.Class({
event.get_key_symbol() == Clutter.KEY_KP_Enter ||
event.get_key_symbol() == Clutter.KEY_Control_L) {
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.emit('show-osd', null, _("Press <i>%s</i> to get\na fourth control point")
.format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1, true);
this.currentElement.addPoint();
this.updatePointerCursor(true);
this._redisplay();
@ -494,7 +494,7 @@ var DrawingArea = new Lang.Class({
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);
this.emit('show-osd', null, label, "", -1, true);
return;
}
}
@ -617,7 +617,8 @@ 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 <i>%s</i> to 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, true);
this.motionHandler = this.connect('motion-event', (actor, event) => {
if (this.spaceKeyPressed)
@ -676,7 +677,8 @@ var DrawingArea = new Lang.Class({
_startWriting: function() {
this.currentElement.text = '';
this.currentElement.cursorPosition = 0;
this.emit('show-osd', null, _("Type your text and 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, true);
this._updateTextCursorTimeout();
this.textHasCursor = true;
this._redisplay();
@ -873,43 +875,43 @@ var DrawingArea = new Lang.Class({
this._redisplay();
}
// Foreground color markup is not displayed since 3.36, use style instead but the transparency is lost.
this.emit('show-osd', null, this.currentColor.to_string(), this.currentColor.to_string().slice(0, 7), -1);
this.emit('show-osd', null, this.currentColor.to_string(), this.currentColor.to_string().slice(0, 7), -1, false);
},
selectTool: function(tool) {
this.currentTool = tool;
this.emit('show-osd', null, _(ToolNames[tool]), "", -1);
this.emit('show-osd', null, _(ToolNames[tool]), "", -1, false);
this.updatePointerCursor();
},
toggleFill: function() {
this.fill = !this.fill;
this.emit('show-osd', null, this.fill ? _("Fill") : _("Stroke"), "", -1);
this.emit('show-osd', null, this.fill ? _("Fill") : _("Outline"), "", -1, false);
},
toggleDash: function() {
this.dashedLine = !this.dashedLine;
this.emit('show-osd', null, this.dashedLine ? _("Dashed line") : _("Full line"), "", -1);
this.emit('show-osd', null, this.dashedLine ? _("Dashed line") : _("Full line"), "", -1, false);
},
incrementLineWidth: function(increment) {
this.currentLineWidth = Math.max(this.currentLineWidth + increment, 0);
this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth);
this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth, false);
},
toggleLineJoin: function() {
this.currentLineJoin = this.currentLineJoin == 2 ? 0 : this.currentLineJoin + 1;
this.emit('show-osd', null, _(LineJoinNames[this.currentLineJoin]), "", -1);
this.emit('show-osd', null, _(LineJoinNames[this.currentLineJoin]), "", -1, false);
},
toggleLineCap: function() {
this.currentLineCap = this.currentLineCap == 2 ? 0 : this.currentLineCap + 1;
this.emit('show-osd', null, _(LineCapNames[this.currentLineCap]), "", -1);
this.emit('show-osd', null, _(LineCapNames[this.currentLineCap]), "", -1, false);
},
toggleFillRule: function() {
this.currentFillRule = this.currentFillRule == 1 ? 0 : this.currentFillRule + 1;
this.emit('show-osd', null, _(FillRuleNames[this.currentFillRule]), "", -1);
this.emit('show-osd', null, _(FillRuleNames[this.currentFillRule]), "", -1, false);
},
toggleFontWeight: function() {
@ -920,7 +922,8 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.weight = this.currentFontWeight;
this._redisplay();
}
this.emit('show-osd', null, `<span font_weight="${this.currentFontWeight}">${_(FontWeightNames[this.currentFontWeight])}</span>`, "", -1);
this.emit('show-osd', null, `<span font_weight="${this.currentFontWeight}">` +
`${_(FontWeightNames[this.currentFontWeight])}</span>`, "", -1, false);
},
toggleFontStyle: function() {
@ -929,7 +932,8 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.style = this.currentFontStyle;
this._redisplay();
}
this.emit('show-osd', null, `<span font_style="${FontStyleNames[this.currentFontStyle].toLowerCase()}">${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1);
this.emit('show-osd', null, `<span font_style="${FontStyleNames[this.currentFontStyle].toLowerCase()}">` +
`${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1, false);
},
toggleFontFamily: function() {
@ -939,7 +943,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.family = currentFontFamily;
this._redisplay();
}
this.emit('show-osd', null, `<span font_family="${currentFontFamily}">${_(currentFontFamily)}</span>`, "", -1);
this.emit('show-osd', null, `<span font_family="${currentFontFamily}">${_(currentFontFamily)}</span>`, "", -1, false);
},
toggleTextAlignment: function() {
@ -948,7 +952,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.textRightAligned = this.currentTextRightAligned;
this._redisplay();
}
this.emit('show-osd', null, this.currentTextRightAligned ? _("Right aligned") : _("Left aligned"), "", -1);
this.emit('show-osd', null, this.currentTextRightAligned ? _("Right aligned") : _("Left aligned"), "", -1, false);
},
toggleHelp: function() {
@ -1119,7 +1123,7 @@ var DrawingArea = new Lang.Class({
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
GLib.file_set_contents(path, contents);
if (notify)
this.emit('show-osd', 'document-save-symbolic', name, "", -1);
this.emit('show-osd', 'document-save-symbolic', name, "", -1, false);
if (name != Me.metadata['persistent-file-name']) {
this.jsonName = name;
this.lastJsonContents = contents;
@ -1171,7 +1175,7 @@ var DrawingArea = new Lang.Class({
this.elements.push(...JSON.parse(contents).map(object => new DrawingElement(object)));
if (notify)
this.emit('show-osd', 'document-open-symbolic', name, "", -1);
this.emit('show-osd', 'document-open-symbolic', name, "", -1, false);
if (name != Me.metadata['persistent-file-name']) {
this.jsonName = name;
this.lastJsonContents = contents;

View File

@ -81,18 +81,18 @@ var AreaManager = new Lang.Class({
Shell.ActionMode.ALL,
this.toggleDrawing.bind(this));
Main.wm.addKeybinding('erase-drawing',
this.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.eraseDrawing.bind(this));
Main.wm.addKeybinding('toggle-modal',
this.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.toggleModal.bind(this));
Main.wm.addKeybinding('erase-drawing',
this.settings,
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.ALL,
this.eraseDrawing.bind(this));
this.updateAreas();
this.monitorChangedHandler = Main.layoutManager.connect('monitors-changed', this.updateAreas.bind(this));
@ -536,8 +536,8 @@ var AreaManager = new Lang.Class({
if (this.activeArea)
this.toggleDrawing();
Main.wm.removeKeybinding('toggle-drawing');
Main.wm.removeKeybinding('erase-drawing');
Main.wm.removeKeybinding('toggle-modal');
Main.wm.removeKeybinding('erase-drawing');
this.removeAreas();
if (this.indicator)
this.indicator.disable();

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Draw On Your Screen VERSION\n"
"Report-Msgid-Bugs-To: https://framagit.org/abakkk/DrawOnYourScreen/issues\n"
"POT-Creation-Date: 2020-01-03 08:00+0100\n"
"POT-Creation-Date: 2019-03-04 16:40+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -74,7 +74,9 @@ msgstr ""
msgid "Mirror"
msgstr ""
msgid "Press <i>%s</i> to get a fourth control point"
msgid ""
"Press <i>%s</i> to get\n"
"a fourth control point"
msgstr ""
msgid "Mark a point of symmetry"
@ -115,7 +117,6 @@ msgid "Left aligned"
msgstr ""
#: helper
msgid "Screenshot"
msgstr ""
@ -132,7 +133,6 @@ msgid "System"
msgstr ""
#: menu
msgid "Undo"
msgstr ""
@ -162,7 +162,6 @@ msgid "Save drawing"
msgstr ""
#: prefs.js
msgid "Preferences"
msgstr ""
@ -170,18 +169,16 @@ msgid "About"
msgstr ""
#: GLOBAL_KEYBINDINGS
msgid "Enter/leave drawing mode"
msgstr ""
msgid "Erase all drawings"
msgstr ""
msgid "Toggle modeless/modal"
msgstr ""
#: INTERNAL_KEYBINDINGS
msgid "Erase all drawings"
msgstr ""
#: INTERNAL_KEYBINDINGS
msgid "Undo last brushstroke"
msgstr ""
@ -194,9 +191,6 @@ msgstr ""
msgid "Smooth last brushstroke"
msgstr ""
msgid "Free drawing"
msgstr ""
msgid "Select line"
msgstr ""
@ -248,10 +242,6 @@ msgstr ""
msgid "Toggle fill rule"
msgstr ""
#: already in draw.js
#:msgid "Dashed line"
#:msgstr ""
msgid "Change font family (generic name)"
msgstr ""
@ -282,10 +272,6 @@ msgstr ""
msgid "Open next drawing"
msgstr ""
#: already in draw.js
#:msgid "Save drawing"
#:msgstr ""
msgid "Save drawing as a SVG file"
msgstr ""
@ -299,7 +285,6 @@ msgid "Show help"
msgstr ""
#: OTHER_SHORTCUTS
msgid "Draw"
msgstr ""
@ -341,15 +326,12 @@ msgstr ""
msgid "Select eraser <span alpha=\"50%\">(while starting drawing)</span>"
msgstr ""
msgid "Duplicate <span alpha=\"50%\">(while starting moving, resizing or mirroring)</span>"
msgid "Duplicate <span alpha=\"50%\">(while starting handling)</span>"
msgstr ""
msgid "Rotate rectangle, polygon, polyline"
msgstr ""
msgid "Translate text area"
msgstr ""
msgid "Extend circle to ellipse"
msgstr ""
@ -369,7 +351,6 @@ msgid "Inverse <span alpha=\"50%\">(while mirroring)</span>"
msgstr ""
#: About page
# You are free to translate the extension name, that is displayed in About page, or not.
msgid "Draw On You Screen"
msgstr ""
@ -381,7 +362,6 @@ msgid "Start drawing with Super+Alt+D and save your beautiful work by taking a s
msgstr ""
#: Prefs page
msgid "Global"
msgstr ""
@ -415,7 +395,7 @@ msgid ""
msgstr ""
msgid ""
"<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file, "
"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."
msgstr ""

View File

@ -37,8 +37,8 @@ const MARGIN = 10;
var GLOBAL_KEYBINDINGS = {
'toggle-drawing': "Enter/leave drawing mode",
'erase-drawing': "Erase all drawings",
'toggle-modal': "Toggle modeless/modal"
'toggle-modal': "Toggle modeless/modal",
'erase-drawing': "Erase all drawings"
};
var INTERNAL_KEYBINDINGS = {
@ -58,7 +58,7 @@ var INTERNAL_KEYBINDINGS = {
'select-resize-tool': "Select resize",
'select-mirror-tool': "Select mirror",
'-separator-2': '',
'toggle-fill': "Toggle fill/stroke",
'toggle-fill': "Toggle fill/outline",
'toggle-fill-rule': "Toggle fill rule",
'-separator-3': '',
'increment-line-width': "Increment line width",
@ -99,16 +99,15 @@ function getKeyLabel(accel) {
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: "Toggle fill/outline", get shortcut() { return _("Center click"); } },
{ 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: "Ignore pointer movement", get shortcut() { return _("%s held").format(getKeyLabel('space')); } },
{ desc: "Leave", shortcut: getKeyLabel('Escape') },
{ desc: "-separator-1", shortcut: "" },
{ desc: "Select eraser <span alpha=\"50%\">(while starting drawing)</span>", shortcut: getKeyLabel('<Shift>') },
{ desc: "Duplicate <span alpha=\"50%\">(while starting moving, resizing or mirroring)</span>", shortcut: getKeyLabel('<Shift>') },
{ desc: "Duplicate <span alpha=\"50%\">(while starting handling)</span>", shortcut: getKeyLabel('<Shift>') },
{ desc: "Rotate rectangle, polygon, polyline", shortcut: getKeyLabel('<Primary>') },
{ desc: "Translate 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>') },
@ -326,7 +325,7 @@ const PrefsPage = new GObject.Class({
wrap: true,
xalign: 0,
use_markup: true,
label: _("<u>Note</u>: When you save elements made with <b>eraser</b> in a <b>SVG</b> file, " +
label: _("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"))
});

View File

@ -26,16 +26,16 @@
<summary>toggle drawing</summary>
<description>enter or leave drawing mode</description>
</key>
<key type="as" name="erase-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>erase drawing</summary>
<description>erase drawing</description>
</key>
<key type="as" name="toggle-modal">
<default>["&lt;Primary&gt;&lt;Alt&gt;&lt;Super&gt;d"]</default>
<summary>toggle modeless/modal</summary>
<description>toggle modeless/modal</description>
</key>
<key type="as" name="erase-drawing">
<default>["&lt;Alt&gt;&lt;Super&gt;e"]</default>
<summary>erase drawing</summary>
<description>erase drawing</description>
</key>
<key type="as" name="undo">
<default>["&lt;Primary&gt;z"]</default>
<summary>undo</summary>