toggle -> switch

This commit is contained in:
abakkk 2020-08-06 00:04:12 +02:00
parent 1abe0b735f
commit 39ec1ba888
5 changed files with 62 additions and 62 deletions

24
area.js
View File

@ -324,7 +324,7 @@ var DrawingArea = new Lang.Class({
} }
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (button == 2) { } else if (button == 2) {
this.toggleFill(); this.switchFill();
} else if (button == 3) { } else if (button == 3) {
this._stopDrawing(); this._stopDrawing();
this.menu.open(x, y); this.menu.open(x, y);
@ -858,7 +858,7 @@ var DrawingArea = new Lang.Class({
} }
}, },
toggleColor: function() { switchColor: function() {
this.selectColor((this.currentColor == this.colors[1]) ? 2 : 1); this.selectColor((this.currentColor == this.colors[1]) ? 2 : 1);
}, },
@ -878,12 +878,12 @@ var DrawingArea = new Lang.Class({
this.updatePointerCursor(); this.updatePointerCursor();
}, },
toggleFill: function() { switchFill: function() {
this.fill = !this.fill; this.fill = !this.fill;
this.emit('show-osd', null, this.fill ? _("Fill") : _("Outline"), "", -1, false); this.emit('show-osd', null, this.fill ? _("Fill") : _("Outline"), "", -1, false);
}, },
toggleDash: function() { switchDash: function() {
this.dashedLine = !this.dashedLine; this.dashedLine = !this.dashedLine;
this.emit('show-osd', null, this.dashedLine ? _("Dashed line") : _("Full line"), "", -1, false); this.emit('show-osd', null, this.dashedLine ? _("Dashed line") : _("Full line"), "", -1, false);
}, },
@ -893,22 +893,22 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth, false); this.emit('show-osd', null, _("%d px").format(this.currentLineWidth), "", 2 * this.currentLineWidth, false);
}, },
toggleLineJoin: function() { switchLineJoin: function() {
this.currentLineJoin = this.currentLineJoin == 2 ? 0 : this.currentLineJoin + 1; this.currentLineJoin = this.currentLineJoin == 2 ? 0 : this.currentLineJoin + 1;
this.emit('show-osd', null, _(LineJoinNames[this.currentLineJoin]), "", -1, false); this.emit('show-osd', null, _(LineJoinNames[this.currentLineJoin]), "", -1, false);
}, },
toggleLineCap: function() { switchLineCap: function() {
this.currentLineCap = this.currentLineCap == 2 ? 0 : this.currentLineCap + 1; this.currentLineCap = this.currentLineCap == 2 ? 0 : this.currentLineCap + 1;
this.emit('show-osd', null, _(LineCapNames[this.currentLineCap]), "", -1, false); this.emit('show-osd', null, _(LineCapNames[this.currentLineCap]), "", -1, false);
}, },
toggleFillRule: function() { switchFillRule: function() {
this.currentFillRule = this.currentFillRule == 1 ? 0 : this.currentFillRule + 1; this.currentFillRule = this.currentFillRule == 1 ? 0 : this.currentFillRule + 1;
this.emit('show-osd', null, _(FillRuleNames[this.currentFillRule]), "", -1, false); this.emit('show-osd', null, _(FillRuleNames[this.currentFillRule]), "", -1, false);
}, },
toggleFontWeight: function() { switchFontWeight: function() {
let fontWeights = Object.keys(FontWeightNames).map(key => Number(key)); let fontWeights = Object.keys(FontWeightNames).map(key => Number(key));
let index = fontWeights.indexOf(this.currentFontWeight); let index = fontWeights.indexOf(this.currentFontWeight);
this.currentFontWeight = index == fontWeights.length - 1 ? fontWeights[0] : fontWeights[index + 1]; this.currentFontWeight = index == fontWeights.length - 1 ? fontWeights[0] : fontWeights[index + 1];
@ -920,7 +920,7 @@ var DrawingArea = new Lang.Class({
`${_(FontWeightNames[this.currentFontWeight])}</span>`, "", -1, false); `${_(FontWeightNames[this.currentFontWeight])}</span>`, "", -1, false);
}, },
toggleFontStyle: function() { switchFontStyle: function() {
this.currentFontStyle = this.currentFontStyle == 2 ? 0 : this.currentFontStyle + 1; this.currentFontStyle = this.currentFontStyle == 2 ? 0 : this.currentFontStyle + 1;
if (this.currentElement && this.currentElement.font) { if (this.currentElement && this.currentElement.font) {
this.currentElement.font.style = this.currentFontStyle; this.currentElement.font.style = this.currentFontStyle;
@ -930,7 +930,7 @@ var DrawingArea = new Lang.Class({
`${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1, false); `${_(FontStyleNames[this.currentFontStyle])}</span>`, "", -1, false);
}, },
toggleFontFamily: function() { switchFontFamily: function() {
let index = Math.max(0, this.fontFamilies.indexOf(this.currentFontFamily)); let index = Math.max(0, this.fontFamilies.indexOf(this.currentFontFamily));
this.currentFontFamily = (index == this.fontFamilies.length - 1) ? 0 : this.fontFamilies[index + 1]; this.currentFontFamily = (index == this.fontFamilies.length - 1) ? 0 : this.fontFamilies[index + 1];
if (this.currentElement && this.currentElement.font) { if (this.currentElement && this.currentElement.font) {
@ -940,7 +940,7 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, `<span font_family="${this.currentFontFamily}">${_(this.currentFontFamily)}</span>`, "", -1, false); this.emit('show-osd', null, `<span font_family="${this.currentFontFamily}">${_(this.currentFontFamily)}</span>`, "", -1, false);
}, },
toggleTextAlignment: function() { switchTextAlignment: function() {
this.currentTextRightAligned = !this.currentTextRightAligned; this.currentTextRightAligned = !this.currentTextRightAligned;
if (this.currentElement && this.currentElement.textRightAligned !== undefined) { if (this.currentElement && this.currentElement.textRightAligned !== undefined) {
this.currentElement.textRightAligned = this.currentTextRightAligned; this.currentElement.textRightAligned = this.currentTextRightAligned;
@ -949,7 +949,7 @@ var DrawingArea = new Lang.Class({
this.emit('show-osd', null, this.currentTextRightAligned ? _("Right aligned") : _("Left aligned"), "", -1, false); this.emit('show-osd', null, this.currentTextRightAligned ? _("Right aligned") : _("Left aligned"), "", -1, false);
}, },
toggleImageFile: function() { switchImageFile: function() {
let images = this.getImages(); let images = this.getImages();
if (!images.length) if (!images.length)
return; return;

View File

@ -187,12 +187,12 @@ var AreaManager = new Lang.Class({
'decrement-line-width': () => this.activeArea.incrementLineWidth(-1), 'decrement-line-width': () => this.activeArea.incrementLineWidth(-1),
'increment-line-width-more': () => this.activeArea.incrementLineWidth(5), 'increment-line-width-more': () => this.activeArea.incrementLineWidth(5),
'decrement-line-width-more': () => this.activeArea.incrementLineWidth(-5), 'decrement-line-width-more': () => this.activeArea.incrementLineWidth(-5),
'toggle-linejoin': this.activeArea.toggleLineJoin.bind(this.activeArea), 'switch-linejoin': this.activeArea.switchLineJoin.bind(this.activeArea),
'toggle-linecap': this.activeArea.toggleLineCap.bind(this.activeArea), 'switch-linecap': this.activeArea.switchLineCap.bind(this.activeArea),
'toggle-fill-rule': this.activeArea.toggleFillRule.bind(this.activeArea), 'switch-fill-rule': this.activeArea.switchFillRule.bind(this.activeArea),
'toggle-dash' : this.activeArea.toggleDash.bind(this.activeArea), 'switch-dash' : this.activeArea.switchDash.bind(this.activeArea),
'toggle-fill' : this.activeArea.toggleFill.bind(this.activeArea), 'switch-fill' : this.activeArea.switchFill.bind(this.activeArea),
'toggle-image-file' : this.activeArea.toggleImageFile.bind(this.activeArea), 'switch-image-file' : this.activeArea.switchImageFile.bind(this.activeArea),
'select-none-shape': () => this.activeArea.selectTool(Area.Tools.NONE), 'select-none-shape': () => this.activeArea.selectTool(Area.Tools.NONE),
'select-line-shape': () => this.activeArea.selectTool(Area.Tools.LINE), 'select-line-shape': () => this.activeArea.selectTool(Area.Tools.LINE),
'select-ellipse-shape': () => this.activeArea.selectTool(Area.Tools.ELLIPSE), 'select-ellipse-shape': () => this.activeArea.selectTool(Area.Tools.ELLIPSE),
@ -215,10 +215,10 @@ var AreaManager = new Lang.Class({
'toggle-background': this.activeArea.toggleBackground.bind(this.activeArea), 'toggle-background': this.activeArea.toggleBackground.bind(this.activeArea),
'toggle-grid': this.activeArea.toggleGrid.bind(this.activeArea), 'toggle-grid': this.activeArea.toggleGrid.bind(this.activeArea),
'toggle-square-area': this.activeArea.toggleSquareArea.bind(this.activeArea), 'toggle-square-area': this.activeArea.toggleSquareArea.bind(this.activeArea),
'toggle-font-family': this.activeArea.toggleFontFamily.bind(this.activeArea), 'switch-font-family': this.activeArea.switchFontFamily.bind(this.activeArea),
'toggle-font-weight': this.activeArea.toggleFontWeight.bind(this.activeArea), 'switch-font-weight': this.activeArea.switchFontWeight.bind(this.activeArea),
'toggle-font-style': this.activeArea.toggleFontStyle.bind(this.activeArea), 'switch-font-style': this.activeArea.switchFontStyle.bind(this.activeArea),
'toggle-text-alignment': this.activeArea.toggleTextAlignment.bind(this.activeArea), 'switch-text-alignment': this.activeArea.switchTextAlignment.bind(this.activeArea),
'toggle-panel-and-dock-visibility': this.togglePanelAndDockOpacity.bind(this), 'toggle-panel-and-dock-visibility': this.togglePanelAndDockOpacity.bind(this),
'toggle-help': this.activeArea.toggleHelp.bind(this.activeArea), 'toggle-help': this.activeArea.toggleHelp.bind(this.activeArea),
'open-user-stylesheet': this.openUserStyleFile.bind(this), 'open-user-stylesheet': this.openUserStyleFile.bind(this),

View File

@ -59,22 +59,22 @@ var INTERNAL_KEYBINDINGS = {
'select-resize-tool': "Select resize", 'select-resize-tool': "Select resize",
'select-mirror-tool': "Select mirror", 'select-mirror-tool': "Select mirror",
'-separator-2': '', '-separator-2': '',
'toggle-fill': "Toggle fill/outline", 'switch-fill': "Toggle fill/outline",
'toggle-fill-rule': "Toggle fill rule", 'switch-fill-rule': "Toggle fill rule",
'-separator-3': '', '-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", 'switch-linejoin': "Change linejoin",
'toggle-linecap': "Change linecap", 'switch-linecap': "Change linecap",
'toggle-dash': "Dashed line", 'switch-dash': "Dashed line",
'-separator-4': '', '-separator-4': '',
'toggle-font-family': "Change font family (generic name)", 'switch-font-family': "Change font family (generic name)",
'toggle-font-weight': "Change font weight", 'switch-font-weight': "Change font weight",
'toggle-font-style': "Change font style", 'switch-font-style': "Change font style",
'toggle-text-alignment': "Toggle text alignment", 'switch-text-alignment': "Toggle text alignment",
'toggle-image-file': "Change image file", 'switch-image-file': "Change image file",
'-separator-5': '', '-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",

Binary file not shown.

View File

@ -151,30 +151,30 @@
<summary>decrement the line width even more</summary> <summary>decrement the line width even more</summary>
<description>decrement the line width even more</description> <description>decrement the line width even more</description>
</key> </key>
<key type="as" name="toggle-linejoin"> <key type="as" name="switch-linejoin">
<default>["&lt;Primary&gt;j"]</default> <default>["&lt;Primary&gt;j"]</default>
<summary>toggle linejoin</summary> <summary>switch linejoin</summary>
<description>toggle linejoin</description> <description>switch linejoin</description>
</key> </key>
<key type="as" name="toggle-linecap"> <key type="as" name="switch-linecap">
<default>["&lt;Primary&gt;k"]</default> <default>["&lt;Primary&gt;k"]</default>
<summary>toggle linecap</summary> <summary>switch linecap</summary>
<description>toggle linecap</description> <description>switch linecap</description>
</key> </key>
<key type="as" name="toggle-fill-rule"> <key type="as" name="switch-fill-rule">
<default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default> <default><![CDATA[['<Primary>KP_Multiply','<Primary>asterisk','<Primary><Shift>asterisk']]]></default>
<summary>toggle fill rule</summary> <summary>switch fill rule</summary>
<description>toggle fill rule</description> <description>switch fill rule</description>
</key> </key>
<key type="as" name="toggle-dash"> <key type="as" name="switch-dash">
<default>["&lt;Primary&gt;period"]</default> <default>["&lt;Primary&gt;period"]</default>
<summary>toggle dash</summary> <summary>switch dash</summary>
<description>toggle dash</description> <description>switch dash</description>
</key> </key>
<key type="as" name="toggle-fill"> <key type="as" name="switch-fill">
<default>["&lt;Primary&gt;a"]</default> <default>["&lt;Primary&gt;a"]</default>
<summary>toggle fill</summary> <summary>switch fill</summary>
<description>toggle fill</description> <description>switch fill</description>
</key> </key>
<key type="as" name="select-color1"> <key type="as" name="select-color1">
<default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default> <default><![CDATA[['<Primary>KP_1','<Primary>1']]]></default>
@ -221,30 +221,30 @@
<summary>select color9</summary> <summary>select color9</summary>
<description>select color9</description> <description>select color9</description>
</key> </key>
<key type="as" name="toggle-font-family"> <key type="as" name="switch-font-family">
<default>["&lt;Primary&gt;f"]</default> <default>["&lt;Primary&gt;f"]</default>
<summary>toggle font family</summary> <summary>switch font family</summary>
<description>toggle font family</description> <description>switch font family</description>
</key> </key>
<key type="as" name="toggle-font-weight"> <key type="as" name="switch-font-weight">
<default>["&lt;Primary&gt;w"]</default> <default>["&lt;Primary&gt;w"]</default>
<summary>toggle font weight</summary> <summary>switch font weight</summary>
<description>toggle font weight</description> <description>switch font weight</description>
</key> </key>
<key type="as" name="toggle-font-style"> <key type="as" name="switch-font-style">
<default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default> <default>["&lt;Primary&gt;&lt;Shift&gt;w"]</default>
<summary>toggle font style</summary> <summary>switch font style</summary>
<description>toggle font style</description> <description>switch font style</description>
</key> </key>
<key type="as" name="toggle-text-alignment"> <key type="as" name="switch-text-alignment">
<default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default> <default>["&lt;Primary&gt;&lt;Shift&gt;a"]</default>
<summary>toggle text alignment</summary> <summary>switch text alignment</summary>
<description>toggle text alignment</description> <description>switch text alignment</description>
</key> </key>
<key type="as" name="toggle-image-file"> <key type="as" name="switch-image-file">
<default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default> <default>["&lt;Primary&gt;&lt;Shift&gt;i"]</default>
<summary>toggle image file</summary> <summary>switch image file</summary>
<description>toggle image file</description> <description>switch image file</description>
</key> </key>
<key type="as" name="open-user-stylesheet"> <key type="as" name="open-user-stylesheet">
<default>["&lt;Primary&gt;o"]</default> <default>["&lt;Primary&gt;o"]</default>